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 610054 f9999b665370b42d63ccd54ecfa117d71c78c070
parent 610053 14de01c074fcb1b7915ca110ba1230c836835c4a
child 610055 017a228130800948a070c59001b8bc6e59bb5dde
push id68774
push userbwerth@mozilla.com
push dateMon, 17 Jul 2017 21:02:16 +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
@@ -3526,16 +3526,37 @@ nsStyleDisplay::CalcDifference(const nsS
    * if this does become common perhaps a faster-path might be worth while.
    */
 
   if (mFloat != aNewData.mFloat) {
     // Changing which side we're floating on (float:none was handled above).
     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.
@@ -3685,18 +3706,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