Bug 719177 - Changes to 'clip' only needs to update the overflow areas and repaint but does not need a reflow. r=roc
authorMats Palmgren <matspal@gmail.com>
Sat, 28 Jan 2012 04:35:59 +0100
changeset 86866 2cae7e5c62ae63554993a8f32cea553846c6e4a4
parent 86865 07bd73451aa40ee4d59ecce7cddbd57cb5811651
child 86867 bdbd188e6f5fa3c6e959e15882d171dfed611e1d
child 87187 00c7793f07703ba409dbcde1f67951e26709ca53
child 87808 43251fa50e35ee7e1fa2b050a69ab5d23c44c501
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs719177
milestone12.0a1
Bug 719177 - Changes to 'clip' only needs to update the overflow areas and repaint but does not need a reflow. r=roc
layout/style/nsStyleStruct.cpp
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -2212,56 +2212,60 @@ nsStyleDisplay::nsStyleDisplay(const nsS
   mPerspectiveOrigin[1] = aSource.mPerspectiveOrigin[1];
   mChildPerspective = aSource.mChildPerspective;
   mBackfaceVisibility = aSource.mBackfaceVisibility;
   mTransformStyle = aSource.mTransformStyle;
 }
 
 nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
 {
-  nsChangeHint hint = nsChangeHint(0);
-
   if (!EqualURIs(mBinding, aOther.mBinding)
       || mPosition != aOther.mPosition
       || mDisplay != aOther.mDisplay
       || (mFloats == NS_STYLE_FLOAT_NONE) != (aOther.mFloats == NS_STYLE_FLOAT_NONE)
       || mOverflowX != aOther.mOverflowX
       || mOverflowY != aOther.mOverflowY
-      || mResize != aOther.mResize)
-    NS_UpdateHint(hint, nsChangeHint_ReconstructFrame);
-
+      || mResize != aOther.mResize) {
+    return nsChangeHint_ReconstructFrame;
+  }
+
+  // If we've added or removed the transform property, we need to reconstruct
+  // the frame to add or remove the view object, and also to handle abs-pos
+  // and fixed-pos containers.
+  if (HasTransform() != aOther.HasTransform()) {
+    return nsChangeHint_ReconstructFrame;
+  }
+
+  nsChangeHint hint = nsChangeHint(0);
   if (mFloats != aOther.mFloats) {
     // Changing which side we float on doesn't affect descendants directly
     NS_UpdateHint(hint,
        NS_SubtractHint(nsChangeHint_ReflowFrame,
                        NS_CombineHint(nsChangeHint_ClearDescendantIntrinsics,
                                       nsChangeHint_NeedDirtyReflow)));
   }
 
   // XXX the following is conservative, for now: changing float breaking shouldn't
   // necessarily require a repaint, reflow should suffice.
   if (mBreakType != aOther.mBreakType
       || mBreakBefore != aOther.mBreakBefore
       || mBreakAfter != aOther.mBreakAfter
       || mAppearance != aOther.mAppearance
-      || mOrient != aOther.mOrient
-      || mClipFlags != aOther.mClipFlags || !mClip.IsEqualInterior(aOther.mClip))
+      || mOrient != aOther.mOrient) {
     NS_UpdateHint(hint, NS_CombineHint(nsChangeHint_ReflowFrame, nsChangeHint_RepaintFrame));
+  } else if (mClipFlags != aOther.mClipFlags
+             || !mClip.IsEqualInterior(aOther.mClip)) {
+    NS_UpdateHint(hint, NS_STYLE_HINT_UPDATE_OVERFLOW);
+  }
 
   if (mOpacity != aOther.mOpacity) {
     NS_UpdateHint(hint, nsChangeHint_UpdateOpacityLayer);
   }
 
-  /* If we've added or removed the transform property, we need to reconstruct the frame to add
-   * or remove the view object, and also to handle abs-pos and fixed-pos containers.
-   */
-  if (HasTransform() != aOther.HasTransform()) {
-    NS_UpdateHint(hint, nsChangeHint_ReconstructFrame);
-  }
-  else if (HasTransform()) {
+  if (HasTransform()) {
     /* Otherwise, if we've kept the property lying around and we already had a
      * transform, we need to see whether or not we've changed the transform.
      * If so, we need to recompute its overflow rect (which probably changed
      * if the transform changed) and to redraw within the bounds of that new
      * overflow rect.
      */
     if (!mSpecifiedTransform != !aOther.mSpecifiedTransform ||
         (mSpecifiedTransform &&