Bug 1359834 Part 3: Force changes to shape-outside to trigger reflow and overflow recalculation. draft
authorBrad Werth <bwerth@mozilla.com>
Fri, 14 Jul 2017 17:26:30 -0700
changeset 609587 2119e8ca75bb7d64c0e4318c6db8a3f9dad4ca54
parent 609186 ecede811a395551f9a29d1ce11b6a81d2fef1da6
child 609588 8245eff3e35f04eb5e5aecf5ea3e335320355f6a
push id68588
push userbwerth@mozilla.com
push dateMon, 17 Jul 2017 00:28:25 +0000
bugs1359834
milestone56.0a1
Bug 1359834 Part 3: Force changes to shape-outside to trigger reflow and overflow recalculation. MozReview-Commit-ID: 7EgYZIu7aZ9
layout/style/nsStyleStruct.cpp
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -3529,16 +3529,37 @@ nsStyleDisplay::CalcDifference(const nsS
   if (mFloat != aNewData.mFloat) {
     // Our descendants aren't impacted when our float area only changes
     // placement but not size/shape. (e.g. if we change which side we float to).
     // But our ancestors/siblings are potentially impacted, so we need to send
     // the non-descendant reflow hints.
     hint |= nsChangeHint_ReflowHintsForFloatAreaChange;
   }
 
+  if (!mShapeOutside.DefinitelyEquals(aNewData.mShapeOutside)) {
+    if (aNewData.mFloat != StyleFloat::None) {
+      // If we are floating, and our shape-outside property changes, our
+      // descendants are not impacted, but our ancestor and siblings are.
+      // This is similar to a float-only change, but since the ISize of the
+      // float area changes arbitrarily along its block axis, more is required
+      // to get the siblings to adjust properly. Hinting overflow change is
+      // sufficient to trigger the correct calculation, but may be too
+      // heavyweight.
+
+      // XXX What is the minimum hint to ensure mShapeInfo is regenerated in
+      // the next reflow?
+      hint |= nsChangeHint_ReflowHintsForFloatAreaChange |
+              nsChangeHint_CSSOverflowChange;
+    } else {
+      // shape-outside changed, but we don't need to reflow because we're not
+      // floating.
+      hint |= nsChangeHint_NeutralChange;
+    }
+  }
+
   if (mVerticalAlign != aNewData.mVerticalAlign) {
     // XXX Can this just be AllReflowHints + RepaintFrame, and be included in
     // the block below?
     hint |= NS_STYLE_HINT_REFLOW;
   }
 
   // XXX the following is conservative, for now: changing float breaking shouldn't
   // necessarily require a repaint, reflow should suffice.
@@ -3688,18 +3709,17 @@ nsStyleDisplay::CalcDifference(const nsS
        mAnimationTimingFunctionCount != aNewData.mAnimationTimingFunctionCount ||
        mAnimationDurationCount != aNewData.mAnimationDurationCount ||
        mAnimationDelayCount != aNewData.mAnimationDelayCount ||
        mAnimationNameCount != aNewData.mAnimationNameCount ||
        mAnimationDirectionCount != aNewData.mAnimationDirectionCount ||
        mAnimationFillModeCount != aNewData.mAnimationFillModeCount ||
        mAnimationPlayStateCount != aNewData.mAnimationPlayStateCount ||
        mAnimationIterationCountCount != aNewData.mAnimationIterationCountCount ||
-       mScrollSnapCoordinate != aNewData.mScrollSnapCoordinate ||
-       !mShapeOutside.DefinitelyEquals(aNewData.mShapeOutside))) {
+       mScrollSnapCoordinate != aNewData.mScrollSnapCoordinate)) {
     hint |= nsChangeHint_NeutralChange;
   }
 
   return hint;
 }
 
 // --------------------
 // nsStyleVisibility