Bug 1359834 Part 2: Define a new nsChangeHint_ReflowHintsForFloatAreaChange hint and use it for float changes. r=dholbert
authorBrad Werth <bwerth@mozilla.com>
Fri, 14 Jul 2017 17:20:35 -0700
changeset 369223 12e9e29939648820d67d43621c72aafdc19ffacb
parent 369222 bd2693278ba15fa51414ccbaea7604bf822a6ec0
child 369224 45b3e5e97dc782e6b7d288240bffe7c8834d3600
push id46613
push userbwerth@mozilla.com
push dateMon, 17 Jul 2017 21:04:13 +0000
treeherderautoland@b90b259fdfa8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1359834
milestone56.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 1359834 Part 2: Define a new nsChangeHint_ReflowHintsForFloatAreaChange hint and use it for float changes. r=dholbert MozReview-Commit-ID: 692GBiRUTab
layout/base/nsChangeHint.h
layout/style/nsStyleStruct.cpp
--- a/layout/base/nsChangeHint.h
+++ b/layout/base/nsChangeHint.h
@@ -422,16 +422,27 @@ static_assert(!(nsChangeHint_Hints_Alway
 // nsChangeHint_ClearAncestorIntrinsics (which is inline-axis specific), but we
 // do need to send it, to clear cached results from CSS Flex measuring reflows.
 #define nsChangeHint_ReflowHintsForBSizeChange            \
   nsChangeHint((nsChangeHint_AllReflowHints |             \
                 nsChangeHint_UpdateComputedBSize) &       \
                ~(nsChangeHint_ClearDescendantIntrinsics | \
                  nsChangeHint_NeedDirtyReflow))
 
+// * For changes to the float area of an already-floated element, we need all
+// reflow hints, but not the ones that apply to descendants.
+// 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.
+#define nsChangeHint_ReflowHintsForFloatAreaChange            \
+  nsChangeHint(nsChangeHint_AllReflowHints &              \
+               ~(nsChangeHint_ClearDescendantIntrinsics | \
+                 nsChangeHint_NeedDirtyReflow))
+
 #define NS_STYLE_HINT_REFLOW \
   nsChangeHint(NS_STYLE_HINT_VISUAL | nsChangeHint_AllReflowHints)
 
 #define nsChangeHint_Hints_CanIgnoreIfNotVisible   \
   nsChangeHint(NS_STYLE_HINT_VISUAL |              \
                nsChangeHint_NeutralChange |        \
                nsChangeHint_UpdateOpacityLayer |   \
                nsChangeHint_UpdateTransformLayer | \
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -3522,20 +3522,18 @@ nsStyleDisplay::CalcDifference(const nsS
    * nsChangeHint_ReconstructFrame, PropagateScrollToViewport will be called.
    *
    * The scroll-behavior css property is not expected to change often (the
    * CSSOM-View DOM methods are likely to be used in those cases); however,
    * if this does become common perhaps a faster-path might be worth while.
    */
 
   if (mFloat != aNewData.mFloat) {
-    // Changing which side we float on doesn't affect descendants directly
-    hint |= nsChangeHint_AllReflowHints &
-            ~(nsChangeHint_ClearDescendantIntrinsics |
-              nsChangeHint_NeedDirtyReflow);
+    // Changing which side we're floating on (float:none was handled above).
+    hint |= nsChangeHint_ReflowHintsForFloatAreaChange;
   }
 
   if (mVerticalAlign != aNewData.mVerticalAlign) {
     // XXX Can this just be AllReflowHints + RepaintFrame, and be included in
     // the block below?
     hint |= NS_STYLE_HINT_REFLOW;
   }