Bug 719177 - Changes to '-moz-text-blink' and some 'text-decoration-style' values only need to update the overflow areas and repaint, not reflow. r=roc
authorMats Palmgren <matspal@gmail.com>
Sat, 28 Jan 2012 04:35:58 +0100
changeset 85638 0246973f2513b7d7d93b1d3e8bf03bcebb34fff6
parent 85637 f222fbece9833a7a500bfb1408f0a346a898c567
child 85639 13739446fc8e01c8dd7db32645e4a341b2ea1099
push id21940
push userjdrew@mozilla.com
push dateSun, 29 Jan 2012 02:43:03 +0000
treeherdermozilla-central@ec666b4c8d84 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs719177
milestone12.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 719177 - Changes to '-moz-text-blink' and some 'text-decoration-style' values only need to update the overflow areas and repaint, not reflow. r=roc
layout/style/nsStyleStruct.cpp
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -2734,55 +2734,57 @@ nsStyleTextReset::nsStyleTextReset(const
 
 nsStyleTextReset::~nsStyleTextReset(void)
 {
   MOZ_COUNT_DTOR(nsStyleTextReset);
 }
 
 nsChangeHint nsStyleTextReset::CalcDifference(const nsStyleTextReset& aOther) const
 {
-  if (mVerticalAlign == aOther.mVerticalAlign
-      && mUnicodeBidi == aOther.mUnicodeBidi) {
-    // Reflow for blink changes
-    if (mTextBlink != aOther.mTextBlink) {
-      return NS_STYLE_HINT_REFLOW;
+  if (mVerticalAlign != aOther.mVerticalAlign ||
+      mUnicodeBidi != aOther.mUnicodeBidi) {
+    return NS_STYLE_HINT_REFLOW;
+  }
+    
+  const nsChangeHint kUpdateOverflowAndRepaintHint =
+    NS_CombineHint(nsChangeHint_UpdateOverflow, nsChangeHint_RepaintFrame);
+  if (mTextBlink != aOther.mTextBlink) {
+    return kUpdateOverflowAndRepaintHint;
+  }
+
+  PRUint8 lineStyle = GetDecorationStyle();
+  PRUint8 otherLineStyle = aOther.GetDecorationStyle();
+  if (mTextDecorationLine != aOther.mTextDecorationLine ||
+      lineStyle != otherLineStyle) {
+    // UpdateOverflow for decoration line style changes only to or from double
+    // or wave because that may cause overflow area changes.
+    if (lineStyle == NS_STYLE_TEXT_DECORATION_STYLE_DOUBLE ||
+        lineStyle == NS_STYLE_TEXT_DECORATION_STYLE_WAVY ||
+        otherLineStyle == NS_STYLE_TEXT_DECORATION_STYLE_DOUBLE ||
+        otherLineStyle == NS_STYLE_TEXT_DECORATION_STYLE_WAVY) {
+      return kUpdateOverflowAndRepaintHint;
     }
-
-    PRUint8 lineStyle = GetDecorationStyle();
-    PRUint8 otherLineStyle = aOther.GetDecorationStyle();
-    if (mTextDecorationLine != aOther.mTextDecorationLine ||
-        lineStyle != otherLineStyle) {
-      // Reflow for decoration line style changes only to or from double or
-      // wave because that may cause overflow area changes
-      if (lineStyle == NS_STYLE_TEXT_DECORATION_STYLE_DOUBLE ||
-          lineStyle == NS_STYLE_TEXT_DECORATION_STYLE_WAVY ||
-          otherLineStyle == NS_STYLE_TEXT_DECORATION_STYLE_DOUBLE ||
-          otherLineStyle == NS_STYLE_TEXT_DECORATION_STYLE_WAVY) {
-        return NS_STYLE_HINT_REFLOW;
-      }
-      // Repaint for other style decoration lines because they must be in
-      // default overflow rect
-      return nsChangeHint_RepaintFrame;
-    }
-
-    // Repaint for decoration color changes
-    nscolor decColor, otherDecColor;
-    bool isFG, otherIsFG;
-    GetDecorationColor(decColor, isFG);
-    aOther.GetDecorationColor(otherDecColor, otherIsFG);
-    if (isFG != otherIsFG || (!isFG && decColor != otherDecColor)) {
-      return nsChangeHint_RepaintFrame;
-    }
-
-    if (mTextOverflow != aOther.mTextOverflow) {
-      return nsChangeHint_RepaintFrame;
-    }
-    return NS_STYLE_HINT_NONE;
+    // Repaint for other style decoration lines because they must be in the
+    // default overflow rect.
+    return nsChangeHint_RepaintFrame;
   }
-  return NS_STYLE_HINT_REFLOW;
+
+  // Repaint for decoration color changes.
+  nscolor decColor, otherDecColor;
+  bool isFG, otherIsFG;
+  GetDecorationColor(decColor, isFG);
+  aOther.GetDecorationColor(otherDecColor, otherIsFG);
+  if (isFG != otherIsFG || (!isFG && decColor != otherDecColor)) {
+    return nsChangeHint_RepaintFrame;
+  }
+
+  if (mTextOverflow != aOther.mTextOverflow) {
+    return nsChangeHint_RepaintFrame;
+  }
+  return NS_STYLE_HINT_NONE;
 }
 
 #ifdef DEBUG
 /* static */
 nsChangeHint nsStyleTextReset::MaxDifference()
 {
   return NS_STYLE_HINT_REFLOW;
 }