Bug 1359834 Part 2: Define a new nsChangeHint_ReflowHintsForFloatAreaChange hint and use it for float changes.
MozReview-Commit-ID: 692GBiRUTab
--- 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;
}