Dear all,

The following pair of patches get rid of the setPosCache and setDimCache methods that have been added over the years all over the inset and mathed code. The idea is that these code are not needed, since the only callers of draw and metrics are either * the drawing/metrics code in MathRow (for math) TextMetrics/RowPainter (for text)
* the metrics/draw methods of child classes of given inset.

The idea is that the cache should be set by the real caller of these methods, which is already done in today's code.

Is there something I am missing, or should I just push the code to master and fix the fallout (which should be small at worst, IIUC what is going on)?

JMarc
From c6bd7c1008cddc6cc9c729db57ac3a5524ed8133 Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date: Mon, 5 Dec 2016 11:51:18 +0100
Subject: [PATCH 1/2] Get rid of Inset::setPosCache

This helper method is used to set the inset position cache at drawing
time. However this is already done by the drawing code itself
(MathRow::draw, RowPainter::paintInset), so that there is no need to
do this same work again in a different place.

This commit comes with a mild risk (it might be that some of these calls were
useful after all!), but all of this is fixable.
---
 src/insets/Inset.cpp               |    9 ---------
 src/insets/Inset.h                 |    2 --
 src/insets/InsetIPA.cpp            |    1 -
 src/insets/InsetPreview.cpp        |    1 -
 src/mathed/CommandInset.cpp        |    1 -
 src/mathed/InsetMathArray.cpp      |    1 -
 src/mathed/InsetMathBig.cpp        |    1 -
 src/mathed/InsetMathBox.cpp        |    2 --
 src/mathed/InsetMathCases.cpp      |    1 -
 src/mathed/InsetMathColor.cpp      |    1 -
 src/mathed/InsetMathDecoration.cpp |    1 -
 src/mathed/InsetMathDelim.cpp      |    1 -
 src/mathed/InsetMathDiagram.cpp    |    1 -
 src/mathed/InsetMathDots.cpp       |    1 -
 src/mathed/InsetMathFont.cpp       |    1 -
 src/mathed/InsetMathFrac.cpp       |    1 -
 src/mathed/InsetMathHull.cpp       |    2 --
 src/mathed/InsetMathNest.cpp       |    1 -
 src/mathed/InsetMathSplit.cpp      |    1 -
 src/mathed/InsetMathXYMatrix.cpp   |    1 -
 src/mathed/MathMacro.cpp           |    1 -
 src/mathed/MathMacroArgument.cpp   |    1 -
 src/mathed/MathMacroTemplate.cpp   |    1 -
 23 files changed, 34 deletions(-)

diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp
index 6e2e4a0..9c385b1 100644
--- a/src/insets/Inset.cpp
+++ b/src/insets/Inset.cpp
@@ -543,7 +543,6 @@ void Inset::drawMarkers(PainterInfo & pi, int x, int y) const
 	pi.pain.line(t, d - 3, t, d, pen_color);
 	pi.pain.line(x, d, x + 3, d, pen_color);
 	pi.pain.line(t - 3, d, t, d, pen_color);
-	setPosCache(pi, x, y);
 }
 
 
@@ -560,7 +559,6 @@ void Inset::drawMarkers2(PainterInfo & pi, int x, int y) const
 	pi.pain.line(t, a + 3, t, a, pen_color);
 	pi.pain.line(x, a, x + 3, a, pen_color);
 	pi.pain.line(t - 3, a, t, a, pen_color);
-	setPosCache(pi, x, y);
 }
 
 
@@ -621,13 +619,6 @@ ColorCode Inset::labelColor() const
 }
 
 
-void Inset::setPosCache(PainterInfo const & pi, int x, int y) const
-{
-	//LYXERR("Inset: set position cache to " << x << " " << y);
-	pi.base.bv->coordCache().insets().add(this, x, y);
-}
-
-
 void Inset::setDimCache(MetricsInfo const & mi, Dimension const & dim) const
 {
 	mi.base.bv->coordCache().insets().add(this, dim);
diff --git a/src/insets/Inset.h b/src/insets/Inset.h
index 48ad7be..e9937dc 100644
--- a/src/insets/Inset.h
+++ b/src/insets/Inset.h
@@ -211,8 +211,6 @@ public:
 	int xo(BufferView const & bv) const;
 	/// last drawn position for 'important' insets
 	int yo(BufferView const & bv) const;
-	/// set x/y drawing position cache if available
-	virtual void setPosCache(PainterInfo const &, int, int) const;
 	///
 	void setDimCache(MetricsInfo const &, Dimension const &) const;
 	/// do we cover screen position x/y?
diff --git a/src/insets/InsetIPA.cpp b/src/insets/InsetIPA.cpp
index 1c20866..a574da8 100644
--- a/src/insets/InsetIPA.cpp
+++ b/src/insets/InsetIPA.cpp
@@ -152,7 +152,6 @@ void InsetIPA::draw(PainterInfo & pi, int x, int y) const
 {
 	if (previewState(pi.base.bv)) {
 		preview_->draw(pi, x, y);
-		setPosCache(pi, x, y);
 		return;
 	}
 	InsetText::draw(pi, x, y);
diff --git a/src/insets/InsetPreview.cpp b/src/insets/InsetPreview.cpp
index 37aec63..739322b 100644
--- a/src/insets/InsetPreview.cpp
+++ b/src/insets/InsetPreview.cpp
@@ -139,7 +139,6 @@ void InsetPreview::draw(PainterInfo & pi, int x, int y) const
 	if (previewState(pi.base.bv)) {
 		// one pixel gap in front
 		preview_->draw(pi, x + 1, y);
-		setPosCache(pi, x, y);
 	} else
 		InsetText::draw(pi, x, y);
 }
diff --git a/src/mathed/CommandInset.cpp b/src/mathed/CommandInset.cpp
index 0cf041c..6b94664 100644
--- a/src/mathed/CommandInset.cpp
+++ b/src/mathed/CommandInset.cpp
@@ -58,7 +58,6 @@ Inset * CommandInset::editXY(Cursor & cur, int /*x*/, int /*y*/)
 void CommandInset::draw(PainterInfo & pi, int x, int y) const
 {
 	button_.draw(pi, x, y);
-	setPosCache(pi, x, y);
 }
 
 
diff --git a/src/mathed/InsetMathArray.cpp b/src/mathed/InsetMathArray.cpp
index eb8676d..eeea831 100644
--- a/src/mathed/InsetMathArray.cpp
+++ b/src/mathed/InsetMathArray.cpp
@@ -82,7 +82,6 @@ void InsetMathArray::metrics(MetricsInfo & mi, Dimension & dim) const
 
 void InsetMathArray::draw(PainterInfo & pi, int x, int y) const
 {
-	setPosCache(pi, x, y);
 	Changer dummy2 = pi.base.changeEnsureMath();
 	Changer dummy = pi.base.changeArray();
 	InsetMathGrid::draw(pi, x, y);
diff --git a/src/mathed/InsetMathBig.cpp b/src/mathed/InsetMathBig.cpp
index ff3765a..76efc57 100644
--- a/src/mathed/InsetMathBig.cpp
+++ b/src/mathed/InsetMathBig.cpp
@@ -90,7 +90,6 @@ void InsetMathBig::draw(PainterInfo & pi, int x, int y) const
 		(delim_ == "\\\\") ? from_ascii("\\") : support::ltrim(delim_, "\\");
 	mathed_draw_deco(pi, x + 1, y - dim.ascent(), 4, dim.height(),
 			 delim);
-	setPosCache(pi, x, y);
 }
 
 
diff --git a/src/mathed/InsetMathBox.cpp b/src/mathed/InsetMathBox.cpp
index d0ac82f..aff3fb6 100644
--- a/src/mathed/InsetMathBox.cpp
+++ b/src/mathed/InsetMathBox.cpp
@@ -146,7 +146,6 @@ void InsetMathFBox::draw(PainterInfo & pi, int x, int y) const
 		dim.width() - 2, dim.height() - 2, Color_foreground);
 	Changer dummy = pi.base.changeFontSet("textnormal");
 	cell(0).draw(pi, x + 3, y);
-	setPosCache(pi, x, y);
 }
 
 
@@ -370,7 +369,6 @@ void InsetMathBoxed::draw(PainterInfo & pi, int x, int y) const
 	pi.pain.rectangle(x + 1, y - dim.ascent() + 1,
 		dim.width() - 2, dim.height() - 2, Color_foreground);
 	cell(0).draw(pi, x + 3, y);
-	setPosCache(pi, x, y);
 }
 
 
diff --git a/src/mathed/InsetMathCases.cpp b/src/mathed/InsetMathCases.cpp
index 4a7b151..0a5fa33 100644
--- a/src/mathed/InsetMathCases.cpp
+++ b/src/mathed/InsetMathCases.cpp
@@ -56,7 +56,6 @@ void InsetMathCases::draw(PainterInfo & pi, int x, int y) const
 	Dimension const dim = dimension(*pi.base.bv);
 	mathed_draw_deco(pi, x + 1, y - dim.ascent(), 6, dim.height(), from_ascii("{"));
 	InsetMathGrid::draw(pi, x, y);
-	setPosCache(pi, x, y);
 }
 
 
diff --git a/src/mathed/InsetMathColor.cpp b/src/mathed/InsetMathColor.cpp
index 966fe5e..ea4f4ef 100644
--- a/src/mathed/InsetMathColor.cpp
+++ b/src/mathed/InsetMathColor.cpp
@@ -60,7 +60,6 @@ void InsetMathColor::draw(PainterInfo & pi, int x, int y) const
 	cell(0).draw(pi, x + 1, y);
 	pi.base.font.setColor(origcol);
 	drawMarkers(pi, x, y);
-	setPosCache(pi, x, y);
 }
 
 
diff --git a/src/mathed/InsetMathDecoration.cpp b/src/mathed/InsetMathDecoration.cpp
index 7a0cfb0..f7fd6ea 100644
--- a/src/mathed/InsetMathDecoration.cpp
+++ b/src/mathed/InsetMathDecoration.cpp
@@ -142,7 +142,6 @@ void InsetMathDecoration::draw(PainterInfo & pi, int x, int y) const
 		mathed_draw_deco(pi, x + 1 + (dim0.wid - dw_) / 2,
 			y + dy_, dw_, dh_, key_->name);
 	drawMarkers(pi, x, y);
-	setPosCache(pi, x, y);
 }
 
 
diff --git a/src/mathed/InsetMathDelim.cpp b/src/mathed/InsetMathDelim.cpp
index d2b284f..e039e64 100644
--- a/src/mathed/InsetMathDelim.cpp
+++ b/src/mathed/InsetMathDelim.cpp
@@ -131,7 +131,6 @@ void InsetMathDelim::draw(PainterInfo & pi, int x, int y) const
 	mathed_draw_deco(pi, x, b, dw_, dim.height(), left_);
 	mathed_draw_deco(pi, x + dim.width() - dw_,
 		b, dw_, dim.height(), right_);
-	setPosCache(pi, x, y);
 }
 
 
diff --git a/src/mathed/InsetMathDiagram.cpp b/src/mathed/InsetMathDiagram.cpp
index 6b12949..c2019d4 100644
--- a/src/mathed/InsetMathDiagram.cpp
+++ b/src/mathed/InsetMathDiagram.cpp
@@ -58,7 +58,6 @@ void InsetMathDiagram::metrics(MetricsInfo & mi, Dimension & dim) const
 
 void InsetMathDiagram::draw(PainterInfo & pi, int x, int y) const
 {
-	setPosCache(pi, x, y);
 	Changer dummy2 = pi.base.changeEnsureMath();
 	FontInfo & f = pi.base.font;
 	Changer dummy = (f.style() == LM_ST_DISPLAY) ? f.changeStyle(LM_ST_TEXT)
diff --git a/src/mathed/InsetMathDots.cpp b/src/mathed/InsetMathDots.cpp
index b579964..8c4bd83 100644
--- a/src/mathed/InsetMathDots.cpp
+++ b/src/mathed/InsetMathDots.cpp
@@ -69,7 +69,6 @@ void InsetMathDots::draw(PainterInfo & pi, int x, int y) const
 		--y;
 	mathed_draw_deco(pi, x + 2, y - dh_, dim.width() - 2, dim.ascent(),
 		key_->name);
-	setPosCache(pi, x, y);
 }
 
 
diff --git a/src/mathed/InsetMathFont.cpp b/src/mathed/InsetMathFont.cpp
index 825cf33..05f9e66 100644
--- a/src/mathed/InsetMathFont.cpp
+++ b/src/mathed/InsetMathFont.cpp
@@ -95,7 +95,6 @@ void InsetMathFont::draw(PainterInfo & pi, int x, int y) const
 	Changer dummy = pi.base.changeFontSet(font());
 	cell(0).draw(pi, x + 1, y);
 	drawMarkers(pi, x, y);
-	setPosCache(pi, x, y);
 }
 
 
diff --git a/src/mathed/InsetMathFrac.cpp b/src/mathed/InsetMathFrac.cpp
index 2362495..ad999a2 100644
--- a/src/mathed/InsetMathFrac.cpp
+++ b/src/mathed/InsetMathFrac.cpp
@@ -275,7 +275,6 @@ void InsetMathFrac::metrics(MetricsInfo & mi, Dimension & dim) const
 
 void InsetMathFrac::draw(PainterInfo & pi, int x, int y) const
 {
-	setPosCache(pi, x, y);
 	Changer dummy3 = pi.base.changeEnsureMath();
 	Dimension const dim = dimension(*pi.base.bv);
 	Dimension const dim0 = cell(0).dimension(*pi.base.bv);
diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index 52442b2..4027707 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -609,7 +609,6 @@ void InsetMathHull::draw(PainterInfo & pi, int x, int y) const
 			// one pixel gap in front
 			preview_->draw(pi, x + 1, y);
 		}
-		setPosCache(pi, x, y);
 		return;
 	}
 
@@ -637,7 +636,6 @@ void InsetMathHull::draw(PainterInfo & pi, int x, int y) const
 	if (canPaintChange(*bv))
 		pi.change_.paintCue(pi, x + 1, y + 1 - dim.asc,
 		                    x + dim.wid, y + dim.des);
-	setPosCache(pi, x, y);
 }
 
 
diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp
index 3794a58..e0bbe51 100644
--- a/src/mathed/InsetMathNest.cpp
+++ b/src/mathed/InsetMathNest.cpp
@@ -272,7 +272,6 @@ void InsetMathNest::draw(PainterInfo & pi, int x, int y) const
 		pi.pain.fillRectangle(x, y - ascent(), width(), height(),
 					Color_mathlockbg);
 #endif
-	setPosCache(pi, x, y);
 }
 
 
diff --git a/src/mathed/InsetMathSplit.cpp b/src/mathed/InsetMathSplit.cpp
index 5008a8d..c260e2e 100644
--- a/src/mathed/InsetMathSplit.cpp
+++ b/src/mathed/InsetMathSplit.cpp
@@ -106,7 +106,6 @@ void InsetMathSplit::draw(PainterInfo & pi, int x, int y) const
 {
 	Changer dummy = pi.base.changeEnsureMath();
 	InsetMathGrid::draw(pi, x, y);
-	setPosCache(pi, x, y);
 }
 
 
diff --git a/src/mathed/InsetMathXYMatrix.cpp b/src/mathed/InsetMathXYMatrix.cpp
index ab5cb83..0994914 100644
--- a/src/mathed/InsetMathXYMatrix.cpp
+++ b/src/mathed/InsetMathXYMatrix.cpp
@@ -57,7 +57,6 @@ void InsetMathXYMatrix::metrics(MetricsInfo & mi, Dimension & dim) const
 
 void InsetMathXYMatrix::draw(PainterInfo & pi, int x, int y) const
 {
-	setPosCache(pi, x, y);
 	Changer dummy2 = pi.base.changeEnsureMath();
 	Changer dummy = pi.base.changeArray();
 	InsetMathGrid::draw(pi, x, y);
diff --git a/src/mathed/MathMacro.cpp b/src/mathed/MathMacro.cpp
index 71654b4..6a5c904 100644
--- a/src/mathed/MathMacro.cpp
+++ b/src/mathed/MathMacro.cpp
@@ -624,7 +624,6 @@ void MathMacro::draw(PainterInfo & pi, int x, int y) const
 {
 	Dimension const dim = dimension(*pi.base.bv);
 
-	setPosCache(pi, x, y);
 	int expx = x;
 	int expy = y;
 
diff --git a/src/mathed/MathMacroArgument.cpp b/src/mathed/MathMacroArgument.cpp
index 2e6b0e2..76b43f3 100644
--- a/src/mathed/MathMacroArgument.cpp
+++ b/src/mathed/MathMacroArgument.cpp
@@ -69,7 +69,6 @@ void MathMacroArgument::metrics(MetricsInfo & mi, Dimension & dim) const
 void MathMacroArgument::draw(PainterInfo & pi, int x, int y) const
 {
 	drawStrRed(pi, x, y, str_);
-	setPosCache(pi, x, y);
 }
 
 
diff --git a/src/mathed/MathMacroTemplate.cpp b/src/mathed/MathMacroTemplate.cpp
index 42d8177..2a7dc77 100644
--- a/src/mathed/MathMacroTemplate.cpp
+++ b/src/mathed/MathMacroTemplate.cpp
@@ -590,7 +590,6 @@ void MathMacroTemplate::draw(PainterInfo & pi, int x, int y) const
 	Changer dummy1 = pi.base.changeFontSet("mathnormal");
 	Changer dummy2 = pi.base.font.changeStyle(LM_ST_TEXT);
 
-	setPosCache(pi, x, y);
 	Dimension const dim = dimension(*pi.base.bv);
 
 	// draw outer frame
-- 
1.7.9.5

From 73001d719d946f12c443bcb459f14ce9bc54821f Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date: Mon, 5 Dec 2016 17:37:51 +0100
Subject: [PATCH 2/2] Get rid of Inset::setDimCache

This helper method is used to set the inset dimension cache at metrics
time. However this is already done by the metrics code itself
(MathRow::metrics, TextMetrics::redoParagraph), so that there is no
need to do this same work again in a different place.

This commit comes with a mild risk (it might be that some of these
calls were useful after all!), but all of this is fixable.
---
 src/insets/Inset.cpp             |    6 ------
 src/insets/Inset.h               |    2 --
 src/insets/InsetIPA.cpp          |    2 --
 src/insets/InsetIPAMacro.cpp     |    4 ----
 src/insets/InsetLine.cpp         |    3 ---
 src/insets/InsetNewpage.cpp      |    2 --
 src/insets/InsetPhantom.cpp      |    9 ---------
 src/insets/InsetPhantom.h        |    2 --
 src/insets/InsetPreview.cpp      |    2 --
 src/insets/InsetSpace.cpp        |    2 --
 src/insets/InsetSpecialChar.cpp  |    2 --
 src/insets/InsetVSpace.cpp       |    2 --
 src/mathed/CommandInset.cpp      |    2 --
 src/mathed/InsetMathGrid.cpp     |    2 --
 src/mathed/InsetMathHull.cpp     |    5 -----
 src/mathed/MathMacroTemplate.cpp |    2 --
 16 files changed, 49 deletions(-)

diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp
index 9c385b1..54bf2d6 100644
--- a/src/insets/Inset.cpp
+++ b/src/insets/Inset.cpp
@@ -619,12 +619,6 @@ ColorCode Inset::labelColor() const
 }
 
 
-void Inset::setDimCache(MetricsInfo const & mi, Dimension const & dim) const
-{
-	mi.base.bv->coordCache().insets().add(this, dim);
-}
-
-
 Buffer const * Inset::updateFrontend() const
 {
 	//FIXME (Abdel 03/12/10): see bugs #6814 and #6949
diff --git a/src/insets/Inset.h b/src/insets/Inset.h
index e9937dc..cf0b399 100644
--- a/src/insets/Inset.h
+++ b/src/insets/Inset.h
@@ -211,8 +211,6 @@ public:
 	int xo(BufferView const & bv) const;
 	/// last drawn position for 'important' insets
 	int yo(BufferView const & bv) const;
-	///
-	void setDimCache(MetricsInfo const &, Dimension const &) const;
 	/// do we cover screen position x/y?
 	virtual bool covers(BufferView const & bv, int x, int y) const;
 	/// get the screen positions of the cursor (see note in Cursor.cpp)
diff --git a/src/insets/InsetIPA.cpp b/src/insets/InsetIPA.cpp
index a574da8..29ed000 100644
--- a/src/insets/InsetIPA.cpp
+++ b/src/insets/InsetIPA.cpp
@@ -188,8 +188,6 @@ void InsetIPA::metrics(MetricsInfo & mi, Dimension & dim) const
 		dim.des += TEXT_TO_INSET_OFFSET;
 		// insert a one pixel gap
 		dim.wid += 1;
-		// Cache the inset dimension.
-		setDimCache(mi, dim);
 		Dimension dim_dummy;
 		MetricsInfo mi_dummy = mi;
 		InsetText::metrics(mi_dummy, dim_dummy);
diff --git a/src/insets/InsetIPAMacro.cpp b/src/insets/InsetIPAMacro.cpp
index 0d7a41b..3c78dec 100644
--- a/src/insets/InsetIPAMacro.cpp
+++ b/src/insets/InsetIPAMacro.cpp
@@ -173,9 +173,6 @@ void InsetIPADeco::metrics(MetricsInfo & mi, Dimension & dim) const
 		theFontMetrics(font).rectText(label, w, a, d);
 		dim.des += int(d * 1.5);
 	}
-
-	// cache the inset dimension
-	setDimCache(mi, dim);
 }
 
 
@@ -413,7 +410,6 @@ void InsetIPAChar::metrics(MetricsInfo & mi, Dimension & dim) const
 	}
 	docstring ds(s.begin(), s.end());
 	dim.wid = fm.width(ds);
-	setDimCache(mi, dim);
 }
 
 
diff --git a/src/insets/InsetLine.cpp b/src/insets/InsetLine.cpp
index 73ce540..5f699f1 100644
--- a/src/insets/InsetLine.cpp
+++ b/src/insets/InsetLine.cpp
@@ -132,9 +132,6 @@ void InsetLine::metrics(MetricsInfo & mi, Dimension & dim) const
 
 	dim.asc = max(fm.maxAscent(), offset_ + height_);
 	dim.des = max(fm.maxDescent(), - offset_);
-
-	// Cache the inset dimension
-	setDimCache(mi, dim);
 }
 
 
diff --git a/src/insets/InsetNewpage.cpp b/src/insets/InsetNewpage.cpp
index b369ce1..e83f56d 100644
--- a/src/insets/InsetNewpage.cpp
+++ b/src/insets/InsetNewpage.cpp
@@ -103,8 +103,6 @@ void InsetNewpage::metrics(MetricsInfo & mi, Dimension & dim) const
 	dim.asc = defaultRowHeight();
 	dim.des = defaultRowHeight();
 	dim.wid = mi.base.textwidth;
-	// Cache the inset dimension. 
-	setDimCache(mi, dim);
 }
 
 
diff --git a/src/insets/InsetPhantom.cpp b/src/insets/InsetPhantom.cpp
index 8fb9d94..c24524e 100644
--- a/src/insets/InsetPhantom.cpp
+++ b/src/insets/InsetPhantom.cpp
@@ -135,15 +135,6 @@ docstring InsetPhantom::layoutName() const
 }
 
 
-void InsetPhantom::metrics(MetricsInfo & mi, Dimension & dim) const
-{
-	InsetCollapsable::metrics(mi, dim);
-
-	// cache the inset dimension
-	setDimCache(mi, dim);
-}
-
-
 void InsetPhantom::draw(PainterInfo & pi, int x, int y) const
 {
 	// draw the text
diff --git a/src/insets/InsetPhantom.h b/src/insets/InsetPhantom.h
index fad5063..42c3da1 100644
--- a/src/insets/InsetPhantom.h
+++ b/src/insets/InsetPhantom.h
@@ -62,8 +62,6 @@ private:
 	///
 	docstring layoutName() const;
 	///
-	void metrics(MetricsInfo &, Dimension &) const;
-	///
 	void draw(PainterInfo & pi, int x, int y) const;
 	///
 	void write(std::ostream &) const;
diff --git a/src/insets/InsetPreview.cpp b/src/insets/InsetPreview.cpp
index 739322b..c306ae9 100644
--- a/src/insets/InsetPreview.cpp
+++ b/src/insets/InsetPreview.cpp
@@ -174,8 +174,6 @@ void InsetPreview::metrics(MetricsInfo & mi, Dimension & dim) const
 		dim.des += TEXT_TO_INSET_OFFSET;
 		// insert a one pixel gap
 		dim.wid += 1;
-		// Cache the inset dimension.
-		setDimCache(mi, dim);
 		Dimension dim_dummy;
 		MetricsInfo mi_dummy = mi;
 		InsetText::metrics(mi_dummy, dim_dummy);
diff --git a/src/insets/InsetSpace.cpp b/src/insets/InsetSpace.cpp
index 7d76f3f..6593d04 100644
--- a/src/insets/InsetSpace.cpp
+++ b/src/insets/InsetSpace.cpp
@@ -260,8 +260,6 @@ void InsetSpace::metrics(MetricsInfo & mi, Dimension & dim) const
 			// shut up compiler
 			break;
 	}
-	// Cache the inset dimension.
-	setDimCache(mi, dim);
 }
 
 
diff --git a/src/insets/InsetSpecialChar.cpp b/src/insets/InsetSpecialChar.cpp
index b6bcb47..4626205 100644
--- a/src/insets/InsetSpecialChar.cpp
+++ b/src/insets/InsetSpecialChar.cpp
@@ -129,8 +129,6 @@ void InsetSpecialChar::metrics(MetricsInfo & mi, Dimension & dim) const
 	}
 	if (dim.wid == 0)
 		dim.wid = fm.width(s);
-
-	setDimCache(mi, dim);
 }
 
 
diff --git a/src/insets/InsetVSpace.cpp b/src/insets/InsetVSpace.cpp
index 461933c..d4e1aaf 100644
--- a/src/insets/InsetVSpace.cpp
+++ b/src/insets/InsetVSpace.cpp
@@ -150,8 +150,6 @@ void InsetVSpace::metrics(MetricsInfo & mi, Dimension & dim) const
 	dim.asc = height / 2 + (a - d) / 2; // align cursor with the
 	dim.des = height - dim.asc;         // label text
 	dim.wid = ADD_TO_VSPACE_WIDTH + 2 * vspace_arrow_size + 5 + w;
-	// Cache the inset dimension. 
-	setDimCache(mi, dim);
 }
 
 
diff --git a/src/mathed/CommandInset.cpp b/src/mathed/CommandInset.cpp
index 6b94664..0c9e585 100644
--- a/src/mathed/CommandInset.cpp
+++ b/src/mathed/CommandInset.cpp
@@ -43,8 +43,6 @@ void CommandInset::metrics(MetricsInfo & mi, Dimension & dim) const
 		button_.update(screenLabel(), true);
 	}
 	button_.metrics(mi, dim);
-	// Cache the inset dimension. 
-	setDimCache(mi, dim);
 }
 
 
diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp
index fca8f38..72adce7 100644
--- a/src/mathed/InsetMathGrid.cpp
+++ b/src/mathed/InsetMathGrid.cpp
@@ -589,8 +589,6 @@ void InsetMathGrid::metrics(MetricsInfo & mi, Dimension & dim) const
 */
 	dim.wid += leftMargin() + rightMargin();
 	metricsMarkers2(mi, dim);
-	// Cache the inset dimension.
-	setDimCache(mi, dim);
 }
 
 
diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index 4027707..807475e 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -515,8 +515,6 @@ void InsetMathHull::metrics(MetricsInfo & mi, Dimension & dim) const
 			if (display())
 				dim.des += displayMargin();
 		}
-		// Cache the inset dimension.
-		setDimCache(mi, dim);
 		return;
 	}
 
@@ -550,9 +548,6 @@ void InsetMathHull::metrics(MetricsInfo & mi, Dimension & dim) const
 	math_font_max_dim(mi.base.font, asc, des);
 	dim.asc = max(dim.asc, asc);
 	dim.des = max(dim.des, des);
-	// Cache the inset dimension.
-	// FIXME: This will overwrite InsetMathGrid dimension, is that OK?
-	setDimCache(mi, dim);
 }
 
 
diff --git a/src/mathed/MathMacroTemplate.cpp b/src/mathed/MathMacroTemplate.cpp
index 2a7dc77..2ac8703 100644
--- a/src/mathed/MathMacroTemplate.cpp
+++ b/src/mathed/MathMacroTemplate.cpp
@@ -578,8 +578,6 @@ void MathMacroTemplate::metrics(MetricsInfo & mi, Dimension & dim) const
 	dim.wid += 6;
 	dim.des += 2;
 	dim.asc += 2;
-
-	setDimCache(mi, dim);
 }
 
 
-- 
1.7.9.5

Reply via email to