Commit 00b9558e authored by Xida Chen's avatar Xida Chen Committed by Commit Bot

Manually revert 602554 and 607336

602554 was created to fix a containing block issue, stated in
crbug.com/764783.

Once 602554 is landed, we found that it breaks inbox, as stated in
crbug.com/899759, so we landed 607336.

Now with 607336 landed, the callsites of "ContainerForAbsolutePosition"
are making an assumption that the container will always have a PaintLayer.
Apparently, that is no longer true.

So this CL reverts both CLs, we should fix chrome's stacking context
behavior as stated in crbug.com/903946

Bug: 905914
Change-Id: I15df9041f7b34b525e5bc0875443a46213c2de03
Reviewed-on: https://chromium-review.googlesource.com/c/1344813Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Commit-Queue: Xida Chen <xidachen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609906}
parent e1451d6c
...@@ -1908,52 +1908,4 @@ TEST_F(AnimationCompositorAnimationsTest, ...@@ -1908,52 +1908,4 @@ TEST_F(AnimationCompositorAnimationsTest,
EXPECT_EQ(host->GetCompositedAnimationsCountForTesting(), 0u); EXPECT_EQ(host->GetCompositedAnimationsCountForTesting(), 0u);
} }
TEST_F(AnimationCompositorAnimationsTest, HasCSSAnimationsWithFillMode) {
LoadTestData("css-animation-with-fill-mode.html");
Document* document = GetFrame()->GetDocument();
Element* target1 = document->getElementById("target1");
const ComputedStyle* style1 = target1->GetLayoutObject()->Style();
EXPECT_FALSE(style1->HasTransformAnimationWithForwardsOrBothFillMode());
EXPECT_FALSE(style1->CanContainFixedPositionObjects(false));
Element* target2 = document->getElementById("target2");
const ComputedStyle* style2 = target2->GetLayoutObject()->Style();
EXPECT_TRUE(style2->HasTransformAnimationWithForwardsOrBothFillMode());
EXPECT_TRUE(style2->CanContainFixedPositionObjects(false));
Element* target3 = document->getElementById("target3");
const ComputedStyle* style3 = target3->GetLayoutObject()->Style();
EXPECT_TRUE(style3->HasTransformAnimationWithForwardsOrBothFillMode());
EXPECT_TRUE(style3->CanContainFixedPositionObjects(false));
Element* target4 = document->getElementById("target4");
const ComputedStyle* style4 = target4->GetLayoutObject()->Style();
EXPECT_FALSE(style4->HasTransformAnimationWithForwardsOrBothFillMode());
EXPECT_FALSE(style4->CanContainFixedPositionObjects(false));
}
TEST_F(AnimationCompositorAnimationsTest, HasWebAnimationsWithFillMode) {
LoadTestData("web-animation-with-fill-mode.html");
Document* document = GetFrame()->GetDocument();
Element* target1 = document->getElementById("target1");
const ComputedStyle* style1 = target1->GetLayoutObject()->Style();
EXPECT_FALSE(style1->HasTransformAnimationWithForwardsOrBothFillMode());
EXPECT_FALSE(style1->CanContainFixedPositionObjects(false));
Element* target2 = document->getElementById("target2");
const ComputedStyle* style2 = target2->GetLayoutObject()->Style();
EXPECT_TRUE(style2->HasTransformAnimationWithForwardsOrBothFillMode());
EXPECT_TRUE(style2->CanContainFixedPositionObjects(false));
Element* target3 = document->getElementById("target3");
const ComputedStyle* style3 = target3->GetLayoutObject()->Style();
EXPECT_TRUE(style3->HasTransformAnimationWithForwardsOrBothFillMode());
EXPECT_TRUE(style3->CanContainFixedPositionObjects(false));
Element* target4 = document->getElementById("target4");
const ComputedStyle* style4 = target4->GetLayoutObject()->Style();
EXPECT_FALSE(style4->HasTransformAnimationWithForwardsOrBothFillMode());
EXPECT_FALSE(style4->CanContainFixedPositionObjects(false));
}
} // namespace blink } // namespace blink
...@@ -38,18 +38,14 @@ namespace blink { ...@@ -38,18 +38,14 @@ namespace blink {
namespace { namespace {
bool AffectsTransformRelatedProperty(const KeyframeEffect& effect) {
return effect.Affects(PropertyHandle(GetCSSPropertyTransform())) ||
effect.Affects(PropertyHandle(GetCSSPropertyRotate())) ||
effect.Affects(PropertyHandle(GetCSSPropertyScale())) ||
effect.Affects(PropertyHandle(GetCSSPropertyTranslate()));
}
void UpdateAnimationFlagsForEffect(const KeyframeEffect& effect, void UpdateAnimationFlagsForEffect(const KeyframeEffect& effect,
ComputedStyle& style) { ComputedStyle& style) {
if (effect.Affects(PropertyHandle(GetCSSPropertyOpacity()))) if (effect.Affects(PropertyHandle(GetCSSPropertyOpacity())))
style.SetHasCurrentOpacityAnimation(true); style.SetHasCurrentOpacityAnimation(true);
if (AffectsTransformRelatedProperty(effect)) if (effect.Affects(PropertyHandle(GetCSSPropertyTransform())) ||
effect.Affects(PropertyHandle(GetCSSPropertyRotate())) ||
effect.Affects(PropertyHandle(GetCSSPropertyScale())) ||
effect.Affects(PropertyHandle(GetCSSPropertyTranslate())))
style.SetHasCurrentTransformAnimation(true); style.SetHasCurrentTransformAnimation(true);
if (effect.Affects(PropertyHandle(GetCSSPropertyFilter()))) if (effect.Affects(PropertyHandle(GetCSSPropertyFilter())))
style.SetHasCurrentFilterAnimation(true); style.SetHasCurrentFilterAnimation(true);
...@@ -93,13 +89,6 @@ void ElementAnimations::UpdateAnimationFlags(ComputedStyle& style) { ...@@ -93,13 +89,6 @@ void ElementAnimations::UpdateAnimationFlags(ComputedStyle& style) {
// FIXME: Needs to consider AnimationGroup once added. // FIXME: Needs to consider AnimationGroup once added.
DCHECK(animation.effect()->IsKeyframeEffect()); DCHECK(animation.effect()->IsKeyframeEffect());
const KeyframeEffect& effect = *ToKeyframeEffect(animation.effect()); const KeyframeEffect& effect = *ToKeyframeEffect(animation.effect());
if (AffectsTransformRelatedProperty(effect)) {
CompositorKeyframeModel::FillMode mode =
animation.effect()->SpecifiedTiming().fill_mode;
if (mode == CompositorKeyframeModel::FillMode::FORWARDS ||
mode == CompositorKeyframeModel::FillMode::BOTH)
style.SetHasTransformAnimationWithForwardsOrBothFillMode(true);
}
if (!effect.IsCurrent()) if (!effect.IsCurrent())
continue; continue;
UpdateAnimationFlagsForEffect(effect, style); UpdateAnimationFlagsForEffect(effect, style);
......
<!DOCTYPE html>
<html>
<style>
@keyframes spin {
0% { transform: rotate(20deg); }
100% { transform: none; }
}
@keyframes opac {
0% { opacity: 1.0; }
100% { opacity: 0.2; }
}
.animate1 {
animation: opac 0s;
animation-fill-mode: both;
}
.animate2 {
animation: spin 0s;
animation-fill-mode: both;
}
.animate3 {
animation: spin 0s, opac 0s;
animation-fill-mode: both, none;
}
.animate4 {
animation: spin 0s, opac 0s;
animation-fill-mode: none, both;
}
.target {
width: 10px;
height: 10px;
background: red;
}
.positioned {
position: absolute;
top: 0;
left: 0;
height: 10px;
width: 10px;
background: lime;
}
</style>
<div id="target1" class="animate1 target">
<div class="positioned"></div>
</div>
<div id="target2" class="animate2 target">
<div class="positioned"></div>
</div>
<div id="target3" class="animate3 target">
<div class="positioned"></div>
</div>
<div id="target4" class="animate4 target">
<div class="positioned"></div>
</div>
</html>
<!DOCTYPE html>
<html>
<style>
.target {
width: 10px;
height: 10px;
background: red;
}
.positioned {
position: absolute;
top: 0;
left: 0;
height: 10px;
width: 10px;
background: lime;
}
</style>
<div id="target1" class="target">
<div class="positioned"></div>
</div>
<div id="target2" class="target">
<div class="positioned"></div>
</div>
<div id="target3" class="target">
<div class="positioned"></div>
</div>
<div id="target4" class="target">
<div class="positioned"></div>
</div>
<script>
var keyframe1 = {opacity: [1, 0.2]};
var keyframe2 = {transform: ['rotate(20deg)', 'none']};
var option1 = {fill: 'both', duration: 0};
var option2 = {fill: 'none', duration: 0};
var target1 = document.getElementById('target1');
target1.animate(keyframe1, option1);
var target2 = document.getElementById('target2');
target2.animate(keyframe2, option1);
var target3 = document.getElementById('target3');
target3.animate(keyframe2, option1);
target3.animate(keyframe1, option2);
var target4 = document.getElementById('target4');
target4.animate(keyframe2, option2);
target4.animate(keyframe1, option1);
</script>
</html>
...@@ -1343,7 +1343,7 @@ class ComputedStyle : public ComputedStyleBase, ...@@ -1343,7 +1343,7 @@ class ComputedStyle : public ComputedStyleBase,
bool HasWillChangeOpacityHint() const { bool HasWillChangeOpacityHint() const {
return WillChangeProperties().Contains(CSSPropertyOpacity); return WillChangeProperties().Contains(CSSPropertyOpacity);
} }
CORE_EXPORT bool HasWillChangeTransformHint() const; bool HasWillChangeTransformHint() const;
// Hyphen utility functions. // Hyphen utility functions.
Hyphenation* GetHyphenation() const; Hyphenation* GetHyphenation() const;
...@@ -2123,7 +2123,6 @@ class ComputedStyle : public ComputedStyleBase, ...@@ -2123,7 +2123,6 @@ 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());
......
...@@ -764,13 +764,6 @@ ...@@ -764,13 +764,6 @@
field_group: "*", field_group: "*",
default_value: "false", default_value: "false",
}, },
{
name: "HasTransformAnimationWithForwardsOrBothFillMode",
field_template: "primitive",
type_name: "bool",
field_group: "*",
default_value: "false",
},
{ {
name: "HasCurrentFilterAnimation", name: "HasCurrentFilterAnimation",
field_template: "primitive", field_template: "primitive",
......
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