Bug 719177 - Introduce NS_STYLE_HINT_UPDATE_OVERFLOW as a short-hand for nsChangeHint(nsChangeHint_RepaintFrame | nsChangeHint_UpdateOverflow). r=roc
authorMats Palmgren <matspal@gmail.com>
Sat, 28 Jan 2012 04:35:59 +0100
changeset 85639 13739446fc8e01c8dd7db32645e4a341b2ea1099
parent 85638 0246973f2513b7d7d93b1d3e8bf03bcebb34fff6
child 85640 07bd73451aa40ee4d59ecce7cddbd57cb5811651
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 - Introduce NS_STYLE_HINT_UPDATE_OVERFLOW as a short-hand for nsChangeHint(nsChangeHint_RepaintFrame | nsChangeHint_UpdateOverflow). r=roc
layout/base/nsChangeHint.h
layout/style/nsStyleContext.cpp
layout/style/nsStyleStruct.cpp
--- a/layout/base/nsChangeHint.h
+++ b/layout/base/nsChangeHint.h
@@ -139,16 +139,18 @@ inline bool NS_IsHintSubset(nsChangeHint
   nsChangeHint(0)
 #define nsChangeHint_ReflowFrame                        \
   nsChangeHint(nsChangeHint_NeedReflow |                \
                nsChangeHint_ClearAncestorIntrinsics |   \
                nsChangeHint_ClearDescendantIntrinsics | \
                nsChangeHint_NeedDirtyReflow)
 #define NS_STYLE_HINT_REFLOW \
   nsChangeHint(nsChangeHint_RepaintFrame | nsChangeHint_ReflowFrame)
+#define NS_STYLE_HINT_UPDATE_OVERFLOW \
+  nsChangeHint(nsChangeHint_RepaintFrame | nsChangeHint_UpdateOverflow)
 #define NS_STYLE_HINT_FRAMECHANGE \
   nsChangeHint(NS_STYLE_HINT_REFLOW | nsChangeHint_ReconstructFrame)
 
 /**
  * |nsRestyleHint| is a bitfield for the result of
  * |HasStateDependentStyle| and |HasAttributeDependentStyle|.  When no
  * restyling is necessary, use |nsRestyleHint(0)|.
  */
--- a/layout/style/nsStyleContext.cpp
+++ b/layout/style/nsStyleContext.cpp
@@ -433,26 +433,26 @@ nsStyleContext::CalcStyleDifference(nsSt
   PR_END_MACRO
 
   // We begin by examining those style structs that are capable of
   // causing the maximal difference, a FRAMECHANGE.
   // FRAMECHANGE Structs: Display, XUL, Content, UserInterface,
   // Visibility, Outline, TableBorder, Table, Text, UIReset, Quotes
   nsChangeHint maxHint = nsChangeHint(NS_STYLE_HINT_FRAMECHANGE |
       nsChangeHint_UpdateTransformLayer | nsChangeHint_UpdateOpacityLayer |
-      nsChangeHint_UpdateOverflow);
+      NS_STYLE_HINT_UPDATE_OVERFLOW);
   DO_STRUCT_DIFFERENCE(Display);
 
   // Changes to 'visibility' cause SyncFrameView.
   maxHint = nsChangeHint(NS_STYLE_HINT_FRAMECHANGE |
       nsChangeHint_SyncFrameView);
   DO_STRUCT_DIFFERENCE(Visibility);
 
   maxHint = nsChangeHint(NS_STYLE_HINT_FRAMECHANGE |
-      nsChangeHint_UpdateOverflow | nsChangeHint_UpdateCursor);
+      NS_STYLE_HINT_UPDATE_OVERFLOW | nsChangeHint_UpdateCursor);
   DO_STRUCT_DIFFERENCE(XUL);
   DO_STRUCT_DIFFERENCE(Column);
   DO_STRUCT_DIFFERENCE(Content);
   DO_STRUCT_DIFFERENCE(UserInterface);
   DO_STRUCT_DIFFERENCE(TableBorder);
   DO_STRUCT_DIFFERENCE(Table);
   DO_STRUCT_DIFFERENCE(UIReset);
   DO_STRUCT_DIFFERENCE(Text);
@@ -460,17 +460,17 @@ nsStyleContext::CalcStyleDifference(nsSt
   // If the quotes implementation is ever going to change we might not need
   // a framechange here and a reflow should be sufficient.  See bug 35768.
   DO_STRUCT_DIFFERENCE(Quotes);
 
   maxHint = nsChangeHint(NS_STYLE_HINT_REFLOW | nsChangeHint_UpdateEffects);
   DO_STRUCT_DIFFERENCE(SVGReset);
   DO_STRUCT_DIFFERENCE(SVG);
 
-  maxHint = nsChangeHint(NS_STYLE_HINT_REFLOW | nsChangeHint_UpdateOverflow);
+  maxHint = nsChangeHint(NS_STYLE_HINT_REFLOW | NS_STYLE_HINT_UPDATE_OVERFLOW);
   DO_STRUCT_DIFFERENCE(Border);
       
   // Changes to 'z-index' cause SyncFrameView.
   maxHint = nsChangeHint(NS_STYLE_HINT_REFLOW | nsChangeHint_SyncFrameView);
   DO_STRUCT_DIFFERENCE(Position);
 
   // At this point, we know that the worst kind of damage we could do is
   // a reflow.
@@ -480,17 +480,17 @@ nsStyleContext::CalcStyleDifference(nsSt
   // to occur.  REFLOW Structs: Font, Margin, Padding, List, Position,
   // TextReset
   DO_STRUCT_DIFFERENCE(Font);
   DO_STRUCT_DIFFERENCE(Margin);
   DO_STRUCT_DIFFERENCE(Padding);
   DO_STRUCT_DIFFERENCE(TextReset);
 
   // Outline needs to update the overflow and repaint.
-  maxHint = nsChangeHint(nsChangeHint_RepaintFrame | nsChangeHint_UpdateOverflow);
+  maxHint = NS_STYLE_HINT_UPDATE_OVERFLOW;
   DO_STRUCT_DIFFERENCE(Outline);
 
   // Most backgrounds only require a repaint, but backgrounds using -moz-element
   // need to reset SVG effects, too.
   maxHint = nsChangeHint(nsChangeHint_RepaintFrame | nsChangeHint_UpdateEffects);
   DO_STRUCT_DIFFERENCE(Background);
 
   // Color only needs a repaint.
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -592,18 +592,17 @@ nsChangeHint nsStyleBorder::CalcDifferen
 
   return NS_STYLE_HINT_NONE;
 }
 
 #ifdef DEBUG
 /* static */
 nsChangeHint nsStyleBorder::MaxDifference()
 {
-  return NS_CombineHint(nsChangeHint_UpdateOverflow,
-                        NS_STYLE_HINT_REFLOW);
+  return NS_CombineHint(NS_STYLE_HINT_UPDATE_OVERFLOW, NS_STYLE_HINT_REFLOW);
 }
 #endif
 
 void
 nsStyleBorder::TrackImage(nsPresContext* aContext)
 {
   // Sanity
   NS_ABORT_IF_FALSE(!mImageTracked, "Already tracking image!");
@@ -685,31 +684,31 @@ nsChangeHint nsStyleOutline::CalcDiffere
   bool outlineWasVisible =
     mCachedOutlineWidth > 0 && mOutlineStyle != NS_STYLE_BORDER_STYLE_NONE;
   bool outlineIsVisible = 
     aOther.mCachedOutlineWidth > 0 && aOther.mOutlineStyle != NS_STYLE_BORDER_STYLE_NONE;
   if (outlineWasVisible != outlineIsVisible ||
       (outlineIsVisible && (mOutlineOffset != aOther.mOutlineOffset ||
                             mOutlineWidth != aOther.mOutlineWidth ||
                             mTwipsPerPixel != aOther.mTwipsPerPixel))) {
-    return NS_CombineHint(nsChangeHint_UpdateOverflow, nsChangeHint_RepaintFrame);
+    return NS_STYLE_HINT_UPDATE_OVERFLOW;
   }
   if ((mOutlineStyle != aOther.mOutlineStyle) ||
       (mOutlineColor != aOther.mOutlineColor) ||
       (mOutlineRadius != aOther.mOutlineRadius)) {
     return nsChangeHint_RepaintFrame;
   }
   return NS_STYLE_HINT_NONE;
 }
 
 #ifdef DEBUG
 /* static */
 nsChangeHint nsStyleOutline::MaxDifference()
 {
-  return NS_CombineHint(nsChangeHint_UpdateOverflow, nsChangeHint_RepaintFrame);
+  return NS_STYLE_HINT_UPDATE_OVERFLOW;
 }
 #endif
 
 // --------------------
 // nsStyleList
 //
 nsStyleList::nsStyleList() 
   : mListStyleType(NS_STYLE_LIST_STYLE_DISC),
@@ -2265,33 +2264,31 @@ nsChangeHint nsStyleDisplay::CalcDiffere
      */
     if (!mSpecifiedTransform != !aOther.mSpecifiedTransform ||
         (mSpecifiedTransform &&
          *mSpecifiedTransform != *aOther.mSpecifiedTransform)) {
       NS_UpdateHint(hint, NS_CombineHint(nsChangeHint_UpdateOverflow,
                                          nsChangeHint_UpdateTransformLayer));
     }
 
-    const nsChangeHint kUpdateOverflowAndRepaintHint =
-      NS_CombineHint(nsChangeHint_UpdateOverflow, nsChangeHint_RepaintFrame);
     for (PRUint8 index = 0; index < 3; ++index)
       if (mTransformOrigin[index] != aOther.mTransformOrigin[index]) {
-        NS_UpdateHint(hint, kUpdateOverflowAndRepaintHint);
+        NS_UpdateHint(hint, NS_STYLE_HINT_UPDATE_OVERFLOW);
         break;
       }
     
     for (PRUint8 index = 0; index < 2; ++index)
       if (mPerspectiveOrigin[index] != aOther.mPerspectiveOrigin[index]) {
-        NS_UpdateHint(hint, kUpdateOverflowAndRepaintHint);
+        NS_UpdateHint(hint, NS_STYLE_HINT_UPDATE_OVERFLOW);
         break;
       }
 
     if (mChildPerspective != aOther.mChildPerspective ||
         mTransformStyle != aOther.mTransformStyle)
-      NS_UpdateHint(hint, kUpdateOverflowAndRepaintHint);
+      NS_UpdateHint(hint, NS_STYLE_HINT_UPDATE_OVERFLOW);
 
     if (mBackfaceVisibility != aOther.mBackfaceVisibility)
       NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
   }
 
   // Note:  Our current behavior for handling changes to the
   // transition-duration, transition-delay, and transition-timing-function
   // properties is to do nothing.  In other words, the transition
@@ -2739,33 +2736,31 @@ nsStyleTextReset::~nsStyleTextReset(void
 
 nsChangeHint nsStyleTextReset::CalcDifference(const nsStyleTextReset& aOther) const
 {
   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;
+    return NS_STYLE_HINT_UPDATE_OVERFLOW;
   }
 
   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;
+      return NS_STYLE_HINT_UPDATE_OVERFLOW;
     }
     // Repaint for other style decoration lines because they must be in the
     // default overflow rect.
     return nsChangeHint_RepaintFrame;
   }
 
   // Repaint for decoration color changes.
   nscolor decColor, otherDecColor;
@@ -2792,24 +2787,22 @@ nsChangeHint nsStyleTextReset::MaxDiffer
 
 static nsChangeHint
 CalcShadowDifference(nsCSSShadowArray* lhs,
                      nsCSSShadowArray* rhs)
 {
   if (lhs == rhs)
     return NS_STYLE_HINT_NONE;
 
-  const nsChangeHint kUpdateOverflowAndRepaintHint =
-    NS_CombineHint(nsChangeHint_UpdateOverflow, nsChangeHint_RepaintFrame);
   if (!lhs || !rhs || lhs->Length() != rhs->Length())
-    return kUpdateOverflowAndRepaintHint;
+    return NS_STYLE_HINT_UPDATE_OVERFLOW;
 
   for (PRUint32 i = 0; i < lhs->Length(); ++i) {
     if (*lhs->ShadowAt(i) != *rhs->ShadowAt(i))
-      return kUpdateOverflowAndRepaintHint;
+      return NS_STYLE_HINT_UPDATE_OVERFLOW;
   }
   return NS_STYLE_HINT_NONE;
 }
 
 // --------------------
 // nsStyleText
 //
 
@@ -2879,18 +2872,17 @@ nsChangeHint nsStyleText::CalcDifference
 
   return CalcShadowDifference(mTextShadow, aOther.mTextShadow);
 }
 
 #ifdef DEBUG
 /* static */
 nsChangeHint nsStyleText::MaxDifference()
 {
-  return NS_CombineHint(nsChangeHint_UpdateOverflow,
-                        NS_STYLE_HINT_FRAMECHANGE);
+  return NS_CombineHint(NS_STYLE_HINT_UPDATE_OVERFLOW, NS_STYLE_HINT_FRAMECHANGE);
 }
 #endif
 
 //-----------------------
 // nsStyleUserInterface
 //
 
 nsCursorImage::nsCursorImage()