Bug 1225018 part 1 - Trigger reflow on some text emphasis changes for line height calculation. r=dbaron
authorXidorn Quan <quanxunzhen@gmail.com>
Tue, 08 Dec 2015 12:55:01 -0500
changeset 310049 3d3c819671be0cea51b05f1dd48dd406c141e125
parent 310048 03c28b711e1f99d4db97fd333e18050cd0d77015
child 310050 3b472ae8fc261bdebf2d4a62b7b462d1d3ac12f7
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1225018
milestone45.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1225018 part 1 - Trigger reflow on some text emphasis changes for line height calculation. r=dbaron
layout/style/nsStyleStruct.cpp
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -3627,24 +3627,31 @@ nsChangeHint nsStyleText::CalcDifference
       (mTextSizeAdjust != aOther.mTextSizeAdjust) ||
       (mLetterSpacing != aOther.mLetterSpacing) ||
       (mLineHeight != aOther.mLineHeight) ||
       (mTextIndent != aOther.mTextIndent) ||
       (mWordSpacing != aOther.mWordSpacing) ||
       (mTabSize != aOther.mTabSize))
     return NS_STYLE_HINT_REFLOW;
 
+  if (HasTextEmphasis() != aOther.HasTextEmphasis() ||
+      (HasTextEmphasis() &&
+       mTextEmphasisPosition != aOther.mTextEmphasisPosition)) {
+    // Text emphasis position change could affect line height calculation.
+    return nsChangeHint_AllReflowHints |
+           nsChangeHint_RepaintFrame;
+  }
+
   if (!AreShadowArraysEqual(mTextShadow, aOther.mTextShadow)) {
     return nsChangeHint_UpdateSubtreeOverflow |
            nsChangeHint_SchedulePaint |
            nsChangeHint_RepaintFrame;
   }
 
-  if (mTextEmphasisPosition != aOther.mTextEmphasisPosition ||
-      mTextEmphasisStyle != aOther.mTextEmphasisStyle ||
+  if (mTextEmphasisStyle != aOther.mTextEmphasisStyle ||
       mTextEmphasisStyleString != aOther.mTextEmphasisStyleString) {
     return nsChangeHint_UpdateOverflow |
            nsChangeHint_SchedulePaint |
            nsChangeHint_RepaintFrame;
   }
 
   MOZ_ASSERT(!mTextEmphasisColorForeground ||
              !aOther.mTextEmphasisColorForeground ||
@@ -3652,16 +3659,20 @@ nsChangeHint nsStyleText::CalcDifference
              "If the text-emphasis-color are both foreground color, "
              "mTextEmphasisColor should also be identical");
   if (mTextEmphasisColorForeground != aOther.mTextEmphasisColorForeground ||
       mTextEmphasisColor != aOther.mTextEmphasisColor) {
     return nsChangeHint_SchedulePaint |
            nsChangeHint_RepaintFrame;
   }
 
+  if (mTextEmphasisPosition != aOther.mTextEmphasisPosition) {
+    return nsChangeHint_NeutralChange;
+  }
+
   return NS_STYLE_HINT_NONE;
 }
 
 LogicalSide
 nsStyleText::TextEmphasisSide(WritingMode aWM) const
 {
   MOZ_ASSERT(
     (!(mTextEmphasisPosition & NS_STYLE_TEXT_EMPHASIS_POSITION_LEFT) !=