Bug 1478643 - Introduce a new change hint set for added or removed transform style. r?birtles
MozReview-Commit-ID: GfK1e5QaOu6
--- a/dom/animation/KeyframeEffect.cpp
+++ b/dom/animation/KeyframeEffect.cpp
@@ -1604,22 +1604,20 @@ KeyframeEffect::CalculateCumulativeChang
return;
}
// We try a little harder to optimize transform animations simply
// because they are so common (the second-most commonly animated
// property at the time of writing). So if we encounter a transform
// segment that needs composing with the underlying value, we just add
// all the change hints a transform animation is known to be able to
// generate.
- mCumulativeChangeHint |= nsChangeHint_AddOrRemoveTransform |
- nsChangeHint_RepaintFrame |
- nsChangeHint_UpdateContainingBlock |
- nsChangeHint_UpdateOverflow |
- nsChangeHint_UpdatePostTransformOverflow |
- nsChangeHint_UpdateTransformLayer;
+ mCumulativeChangeHint |=
+ nsChangeHint_ComprehensiveAddOrRemoveTransform |
+ nsChangeHint_UpdatePostTransformOverflow |
+ nsChangeHint_UpdateTransformLayer;
continue;
}
RefPtr<ComputedStyle> fromContext =
CreateComputedStyleForAnimationValue(property.mProperty,
segment.mFromValue,
presContext,
aComputedStyle);
--- a/layout/base/nsChangeHint.h
+++ b/layout/base/nsChangeHint.h
@@ -463,16 +463,31 @@ static_assert(!(nsChangeHint_Hints_Alway
nsChangeHint_AddOrRemoveTransform | \
nsChangeHint_UpdateContainingBlock | \
nsChangeHint_UpdateOverflow | \
nsChangeHint_UpdatePostTransformOverflow | \
nsChangeHint_UpdateTransformLayer | \
nsChangeHint_UpdateUsesOpacity | \
nsChangeHint_VisibilityChange)
+// Change hints for added or removed transform style.
+//
+// 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.
+//
+// We do not need to apply nsChangeHint_UpdateTransformLayer since
+// nsChangeHint_RepaintFrame will forcibly invalidate the frame area and
+// ensure layers are rebuilt (or removed).
+#define nsChangeHint_ComprehensiveAddOrRemoveTransform \
+ nsChangeHint(nsChangeHint_UpdateContainingBlock | \
+ nsChangeHint_AddOrRemoveTransform | \
+ nsChangeHint_UpdateOverflow | \
+ nsChangeHint_RepaintFrame)
+
// NB: Once we drop support for the old style system, this logic should be
// inlined in the Servo style system to eliminate the FFI call.
inline nsChangeHint NS_HintsNotHandledForDescendantsIn(nsChangeHint aChangeHint) {
nsChangeHint result =
aChangeHint & nsChangeHint_Hints_NeverHandledForDescendants;
if (!NS_IsHintSubset(nsChangeHint_NeedDirtyReflow, aChangeHint)) {
if (NS_IsHintSubset(nsChangeHint_NeedReflow, aChangeHint)) {
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -3806,27 +3806,17 @@ nsStyleDisplay::CalcDifference(const nsS
if (mIsolation != aNewData.mIsolation) {
hint |= nsChangeHint_RepaintFrame;
}
/* 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 (HasTransformStyle() != aNewData.HasTransformStyle()) {
- // We do not need to apply nsChangeHint_UpdateTransformLayer since
- // nsChangeHint_RepaintFrame will forcibly invalidate the frame area and
- // ensure layers are rebuilt (or removed).
- //
- // Note: If we add a new change hint for transform changes here or in
- // CompareTransformValues(), we have to modify
- // KeyframeEffect::CalculateCumulativeChangeHint too!
- hint |= nsChangeHint_UpdateContainingBlock |
- nsChangeHint_AddOrRemoveTransform |
- nsChangeHint_UpdateOverflow |
- nsChangeHint_RepaintFrame;
+ hint |= nsChangeHint_ComprehensiveAddOrRemoveTransform;
} else {
/* 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 the property isn't present in either style struct, we still do the