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) {
Element* target1 = document->getElementById("target1");
const ComputedStyle* style1 = target1->GetLayoutObject()->Style();
EXPECT_FALSE(style1->HasTransformAnimationWithForwardsOrBothFillMode());
EXPECT_FALSE(style1->HasTransformRelatedProperty());
// HasOpacity is true;
EXPECT_TRUE(style1->IsStackingContext());
EXPECT_FALSE(style1->CanContainFixedPositionObjects(false));
Element* target2 = document->getElementById("target2");
const ComputedStyle* style2 = target2->GetLayoutObject()->Style();
EXPECT_TRUE(style2->HasTransformAnimationWithForwardsOrBothFillMode());
EXPECT_TRUE(style2->HasTransformRelatedProperty());
EXPECT_TRUE(style2->IsStackingContext());
EXPECT_TRUE(style2->CanContainFixedPositionObjects(false));
Element* target3 = document->getElementById("target3");
const ComputedStyle* style3 = target3->GetLayoutObject()->Style();
EXPECT_TRUE(style3->HasTransformAnimationWithForwardsOrBothFillMode());
EXPECT_TRUE(style3->HasTransformRelatedProperty());
EXPECT_TRUE(style3->IsStackingContext());
EXPECT_TRUE(style3->CanContainFixedPositionObjects(false));
Element* target4 = document->getElementById("target4");
const ComputedStyle* style4 = target4->GetLayoutObject()->Style();
EXPECT_FALSE(style4->HasTransformAnimationWithForwardsOrBothFillMode());
EXPECT_FALSE(style4->HasTransformRelatedProperty());
EXPECT_TRUE(style4->IsStackingContext());
EXPECT_FALSE(style4->CanContainFixedPositionObjects(false));
}
TEST_F(AnimationCompositorAnimationsTest, HasWebAnimationsWithFillMode) {
......@@ -1958,27 +1953,22 @@ TEST_F(AnimationCompositorAnimationsTest, HasWebAnimationsWithFillMode) {
Element* target1 = document->getElementById("target1");
const ComputedStyle* style1 = target1->GetLayoutObject()->Style();
EXPECT_FALSE(style1->HasTransformAnimationWithForwardsOrBothFillMode());
EXPECT_FALSE(style1->HasTransformRelatedProperty());
// HasOpacity is true;
EXPECT_TRUE(style1->IsStackingContext());
EXPECT_FALSE(style1->CanContainFixedPositionObjects(false));
Element* target2 = document->getElementById("target2");
const ComputedStyle* style2 = target2->GetLayoutObject()->Style();
EXPECT_TRUE(style2->HasTransformAnimationWithForwardsOrBothFillMode());
EXPECT_TRUE(style2->HasTransformRelatedProperty());
EXPECT_TRUE(style2->IsStackingContext());
EXPECT_TRUE(style2->CanContainFixedPositionObjects(false));
Element* target3 = document->getElementById("target3");
const ComputedStyle* style3 = target3->GetLayoutObject()->Style();
EXPECT_TRUE(style3->HasTransformAnimationWithForwardsOrBothFillMode());
EXPECT_TRUE(style3->HasTransformRelatedProperty());
EXPECT_TRUE(style3->IsStackingContext());
EXPECT_TRUE(style3->CanContainFixedPositionObjects(false));
Element* target4 = document->getElementById("target4");
const ComputedStyle* style4 = target4->GetLayoutObject()->Style();
EXPECT_FALSE(style4->HasTransformAnimationWithForwardsOrBothFillMode());
EXPECT_FALSE(style4->HasTransformRelatedProperty());
EXPECT_TRUE(style4->IsStackingContext());
EXPECT_FALSE(style4->CanContainFixedPositionObjects(false));
}
} // namespace blink
......@@ -2074,10 +2074,9 @@ class ComputedStyle : public ComputedStyleBase,
// will-change:transform should result in the same rendering behavior as
// having a transform, including the creation of a containing block for fixed
// position descendants.
CORE_EXPORT bool HasTransformRelatedProperty() const {
bool HasTransformRelatedProperty() const {
return HasTransform() || Preserves3D() || HasPerspective() ||
HasWillChangeTransformHint() ||
HasTransformAnimationWithForwardsOrBothFillMode();
HasWillChangeTransformHint();
}
// Paint utility functions.
......@@ -2124,6 +2123,7 @@ class ComputedStyle : public ComputedStyleBase,
}
bool CanContainFixedPositionObjects(bool is_document_element) const {
return HasTransformRelatedProperty() ||
HasTransformAnimationWithForwardsOrBothFillMode() ||
// Filter establishes containing block for non-document elements:
// https://drafts.fxtf.org/filter-effects-1/#FilterProperty
(!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