Commit 86dea917 authored by Xida Chen's avatar Xida Chen Committed by Commit Bot

Do not enable stacking context with transform animation + some fill mode

In our previous CL:
https://chromium-review.googlesource.com/c/chromium/src/+/1066630
We make an element containing block and enable its stacking context when
this element has transform animation with forwards or both fill-mode.
This change is breaking the stacking context behavior where inbox
depends on.

This CL keeps the containing block behavior but reverts the stacking
context. Unit tests are updated.

Bug: 899759
Change-Id: I1f519c3383df9a89bcd0c2ec9f15e1c9b8ca1dc0
Reviewed-on: https://chromium-review.googlesource.com/c/1330282Reviewed-by: default avatarStephen McGruer <smcgruer@chromium.org>
Reviewed-by: default avatarAnders Ruud <andruud@chromium.org>
Commit-Queue: Xida Chen <xidachen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607336}
parent 547edc4d
...@@ -1929,27 +1929,22 @@ TEST_F(AnimationCompositorAnimationsTest, HasCSSAnimationsWithFillMode) { ...@@ -1929,27 +1929,22 @@ TEST_F(AnimationCompositorAnimationsTest, HasCSSAnimationsWithFillMode) {
Element* target1 = document->getElementById("target1"); Element* target1 = document->getElementById("target1");
const ComputedStyle* style1 = target1->GetLayoutObject()->Style(); const ComputedStyle* style1 = target1->GetLayoutObject()->Style();
EXPECT_FALSE(style1->HasTransformAnimationWithForwardsOrBothFillMode()); EXPECT_FALSE(style1->HasTransformAnimationWithForwardsOrBothFillMode());
EXPECT_FALSE(style1->HasTransformRelatedProperty()); EXPECT_FALSE(style1->CanContainFixedPositionObjects(false));
// HasOpacity is true;
EXPECT_TRUE(style1->IsStackingContext());
Element* target2 = document->getElementById("target2"); Element* target2 = document->getElementById("target2");
const ComputedStyle* style2 = target2->GetLayoutObject()->Style(); const ComputedStyle* style2 = target2->GetLayoutObject()->Style();
EXPECT_TRUE(style2->HasTransformAnimationWithForwardsOrBothFillMode()); EXPECT_TRUE(style2->HasTransformAnimationWithForwardsOrBothFillMode());
EXPECT_TRUE(style2->HasTransformRelatedProperty()); EXPECT_TRUE(style2->CanContainFixedPositionObjects(false));
EXPECT_TRUE(style2->IsStackingContext());
Element* target3 = document->getElementById("target3"); Element* target3 = document->getElementById("target3");
const ComputedStyle* style3 = target3->GetLayoutObject()->Style(); const ComputedStyle* style3 = target3->GetLayoutObject()->Style();
EXPECT_TRUE(style3->HasTransformAnimationWithForwardsOrBothFillMode()); EXPECT_TRUE(style3->HasTransformAnimationWithForwardsOrBothFillMode());
EXPECT_TRUE(style3->HasTransformRelatedProperty()); EXPECT_TRUE(style3->CanContainFixedPositionObjects(false));
EXPECT_TRUE(style3->IsStackingContext());
Element* target4 = document->getElementById("target4"); Element* target4 = document->getElementById("target4");
const ComputedStyle* style4 = target4->GetLayoutObject()->Style(); const ComputedStyle* style4 = target4->GetLayoutObject()->Style();
EXPECT_FALSE(style4->HasTransformAnimationWithForwardsOrBothFillMode()); EXPECT_FALSE(style4->HasTransformAnimationWithForwardsOrBothFillMode());
EXPECT_FALSE(style4->HasTransformRelatedProperty()); EXPECT_FALSE(style4->CanContainFixedPositionObjects(false));
EXPECT_TRUE(style4->IsStackingContext());
} }
TEST_F(AnimationCompositorAnimationsTest, HasWebAnimationsWithFillMode) { TEST_F(AnimationCompositorAnimationsTest, HasWebAnimationsWithFillMode) {
...@@ -1958,27 +1953,22 @@ TEST_F(AnimationCompositorAnimationsTest, HasWebAnimationsWithFillMode) { ...@@ -1958,27 +1953,22 @@ TEST_F(AnimationCompositorAnimationsTest, HasWebAnimationsWithFillMode) {
Element* target1 = document->getElementById("target1"); Element* target1 = document->getElementById("target1");
const ComputedStyle* style1 = target1->GetLayoutObject()->Style(); const ComputedStyle* style1 = target1->GetLayoutObject()->Style();
EXPECT_FALSE(style1->HasTransformAnimationWithForwardsOrBothFillMode()); EXPECT_FALSE(style1->HasTransformAnimationWithForwardsOrBothFillMode());
EXPECT_FALSE(style1->HasTransformRelatedProperty()); EXPECT_FALSE(style1->CanContainFixedPositionObjects(false));
// HasOpacity is true;
EXPECT_TRUE(style1->IsStackingContext());
Element* target2 = document->getElementById("target2"); Element* target2 = document->getElementById("target2");
const ComputedStyle* style2 = target2->GetLayoutObject()->Style(); const ComputedStyle* style2 = target2->GetLayoutObject()->Style();
EXPECT_TRUE(style2->HasTransformAnimationWithForwardsOrBothFillMode()); EXPECT_TRUE(style2->HasTransformAnimationWithForwardsOrBothFillMode());
EXPECT_TRUE(style2->HasTransformRelatedProperty()); EXPECT_TRUE(style2->CanContainFixedPositionObjects(false));
EXPECT_TRUE(style2->IsStackingContext());
Element* target3 = document->getElementById("target3"); Element* target3 = document->getElementById("target3");
const ComputedStyle* style3 = target3->GetLayoutObject()->Style(); const ComputedStyle* style3 = target3->GetLayoutObject()->Style();
EXPECT_TRUE(style3->HasTransformAnimationWithForwardsOrBothFillMode()); EXPECT_TRUE(style3->HasTransformAnimationWithForwardsOrBothFillMode());
EXPECT_TRUE(style3->HasTransformRelatedProperty()); EXPECT_TRUE(style3->CanContainFixedPositionObjects(false));
EXPECT_TRUE(style3->IsStackingContext());
Element* target4 = document->getElementById("target4"); Element* target4 = document->getElementById("target4");
const ComputedStyle* style4 = target4->GetLayoutObject()->Style(); const ComputedStyle* style4 = target4->GetLayoutObject()->Style();
EXPECT_FALSE(style4->HasTransformAnimationWithForwardsOrBothFillMode()); EXPECT_FALSE(style4->HasTransformAnimationWithForwardsOrBothFillMode());
EXPECT_FALSE(style4->HasTransformRelatedProperty()); EXPECT_FALSE(style4->CanContainFixedPositionObjects(false));
EXPECT_TRUE(style4->IsStackingContext());
} }
} // namespace blink } // namespace blink
...@@ -2074,10 +2074,9 @@ class ComputedStyle : public ComputedStyleBase, ...@@ -2074,10 +2074,9 @@ class ComputedStyle : public ComputedStyleBase,
// will-change:transform should result in the same rendering behavior as // will-change:transform should result in the same rendering behavior as
// having a transform, including the creation of a containing block for fixed // having a transform, including the creation of a containing block for fixed
// position descendants. // position descendants.
CORE_EXPORT bool HasTransformRelatedProperty() const { bool HasTransformRelatedProperty() const {
return HasTransform() || Preserves3D() || HasPerspective() || return HasTransform() || Preserves3D() || HasPerspective() ||
HasWillChangeTransformHint() || HasWillChangeTransformHint();
HasTransformAnimationWithForwardsOrBothFillMode();
} }
// Paint utility functions. // Paint utility functions.
...@@ -2124,6 +2123,7 @@ class ComputedStyle : public ComputedStyleBase, ...@@ -2124,6 +2123,7 @@ class ComputedStyle : public ComputedStyleBase,
} }
bool CanContainFixedPositionObjects(bool is_document_element) const { bool CanContainFixedPositionObjects(bool is_document_element) const {
return HasTransformRelatedProperty() || return HasTransformRelatedProperty() ||
HasTransformAnimationWithForwardsOrBothFillMode() ||
// Filter establishes containing block for non-document elements: // Filter establishes containing block for non-document elements:
// https://drafts.fxtf.org/filter-effects-1/#FilterProperty // https://drafts.fxtf.org/filter-effects-1/#FilterProperty
(!is_document_element && HasFilter()); (!is_document_element && HasFilter());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment