Diff
Modified: branches/safari-611-branch/LayoutTests/ChangeLog (273176 => 273177)
--- branches/safari-611-branch/LayoutTests/ChangeLog 2021-02-19 23:37:58 UTC (rev 273176)
+++ branches/safari-611-branch/LayoutTests/ChangeLog 2021-02-19 23:38:02 UTC (rev 273177)
@@ -1,5 +1,53 @@
2021-02-19 Alan Coon <alanc...@apple.com>
+ Cherry-pick r273003. rdar://problem/74500696
+
+ Animated keyframe style needs to go through full style adjuster
+ https://bugs.webkit.org/show_bug.cgi?id=222036
+ rdar://72421747
+
+ Reviewed by Zalan Bujtas.
+
+ Source/WebCore:
+
+ We can create unadjusted styles via keyframe animations and those may cause problems in rendering.
+
+ Test: fast/animation/animation-position-crash.html
+
+ * style/StyleAdjuster.cpp:
+ (WebCore::Style::Adjuster::adjustAnimatedStyle):
+
+ Make this a member function and invoke Adjuster::adjust.
+ Simplify the z-index adjustment since it is mostly handled by adjust.
+
+ * style/StyleAdjuster.h:
+ * style/StyleTreeResolver.cpp:
+
+ Always use style adjuster for keyframe animation.
+
+ (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
+
+ LayoutTests:
+
+ * fast/animation/animation-position-crash-expected.html: Added.
+ * fast/animation/animation-position-crash.html: Added.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273003 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-02-17 Antti Koivisto <an...@apple.com>
+
+ Animated keyframe style needs to go through full style adjuster
+ https://bugs.webkit.org/show_bug.cgi?id=222036
+ rdar://72421747
+
+ Reviewed by Zalan Bujtas.
+
+ * fast/animation/animation-position-crash-expected.html: Added.
+ * fast/animation/animation-position-crash.html: Added.
+
+2021-02-19 Alan Coon <alanc...@apple.com>
+
Cherry-pick r272927. rdar://problem/74500651
REGRESSION(r271515): ::marker fired at wrong time
Added: branches/safari-611-branch/LayoutTests/fast/animation/animation-position-crash-expected.html (0 => 273177)
--- branches/safari-611-branch/LayoutTests/fast/animation/animation-position-crash-expected.html (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/animation/animation-position-crash-expected.html 2021-02-19 23:38:02 UTC (rev 273177)
@@ -0,0 +1,4 @@
+<style>
+#target { width:100px; height:100px; left:100px; top:100px; background-color:green; position:absolute }
+</style>
+<span id=target></span>
Added: branches/safari-611-branch/LayoutTests/fast/animation/animation-position-crash.html (0 => 273177)
--- branches/safari-611-branch/LayoutTests/fast/animation/animation-position-crash.html (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/animation/animation-position-crash.html 2021-02-19 23:38:02 UTC (rev 273177)
@@ -0,0 +1,25 @@
+<style>
+#target { width:100px; height:100px; left:100px; top:100px; background-color:green }
+</style>
+<span id=target></span>
+<script>
+async function test() {
+ if (window.testRunner)
+ testRunner.waitUntilDone();
+
+ var positionAnimation = [
+ { position: 'static' },
+ { position: 'absolute' },
+ ];
+ var positionTiming = {
+ duration: 16,
+ fill: 'forwards'
+ };
+ const animation = target.animate(positionAnimation, positionTiming);
+ await animation.finished;
+
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+test();
+</script>
Modified: branches/safari-611-branch/Source/WebCore/ChangeLog (273176 => 273177)
--- branches/safari-611-branch/Source/WebCore/ChangeLog 2021-02-19 23:37:58 UTC (rev 273176)
+++ branches/safari-611-branch/Source/WebCore/ChangeLog 2021-02-19 23:38:02 UTC (rev 273177)
@@ -1,5 +1,67 @@
2021-02-19 Alan Coon <alanc...@apple.com>
+ Cherry-pick r273003. rdar://problem/74500696
+
+ Animated keyframe style needs to go through full style adjuster
+ https://bugs.webkit.org/show_bug.cgi?id=222036
+ rdar://72421747
+
+ Reviewed by Zalan Bujtas.
+
+ Source/WebCore:
+
+ We can create unadjusted styles via keyframe animations and those may cause problems in rendering.
+
+ Test: fast/animation/animation-position-crash.html
+
+ * style/StyleAdjuster.cpp:
+ (WebCore::Style::Adjuster::adjustAnimatedStyle):
+
+ Make this a member function and invoke Adjuster::adjust.
+ Simplify the z-index adjustment since it is mostly handled by adjust.
+
+ * style/StyleAdjuster.h:
+ * style/StyleTreeResolver.cpp:
+
+ Always use style adjuster for keyframe animation.
+
+ (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
+
+ LayoutTests:
+
+ * fast/animation/animation-position-crash-expected.html: Added.
+ * fast/animation/animation-position-crash.html: Added.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273003 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-02-17 Antti Koivisto <an...@apple.com>
+
+ Animated keyframe style needs to go through full style adjuster
+ https://bugs.webkit.org/show_bug.cgi?id=222036
+ rdar://72421747
+
+ Reviewed by Zalan Bujtas.
+
+ We can create unadjusted styles via keyframe animations and those may cause problems in rendering.
+
+ Test: fast/animation/animation-position-crash.html
+
+ * style/StyleAdjuster.cpp:
+ (WebCore::Style::Adjuster::adjustAnimatedStyle):
+
+ Make this a member function and invoke Adjuster::adjust.
+ Simplify the z-index adjustment since it is mostly handled by adjust.
+
+ * style/StyleAdjuster.h:
+ * style/StyleTreeResolver.cpp:
+
+ Always use style adjuster for keyframe animation.
+
+ (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
+
+2021-02-19 Alan Coon <alanc...@apple.com>
+
Cherry-pick r272931. rdar://problem/74500616
RenderElement::containingBlockForAbsolutePosition may call RenderObject::containingBlock recursively
Modified: branches/safari-611-branch/Source/WebCore/style/StyleAdjuster.cpp (273176 => 273177)
--- branches/safari-611-branch/Source/WebCore/style/StyleAdjuster.cpp 2021-02-19 23:37:58 UTC (rev 273176)
+++ branches/safari-611-branch/Source/WebCore/style/StyleAdjuster.cpp 2021-02-19 23:38:02 UTC (rev 273177)
@@ -573,8 +573,10 @@
style.setDisplay(DisplayType::Block);
}
-void Adjuster::adjustAnimatedStyle(RenderStyle& style, const RenderStyle* parentBoxStyle, OptionSet<AnimationImpact> impact)
+void Adjuster::adjustAnimatedStyle(RenderStyle& style, OptionSet<AnimationImpact> impact) const
{
+ adjust(style, nullptr);
+
// Set an explicit used z-index in two cases:
// 1. When the element respects z-index, and the style has an explicit z-index set (for example, the animation
// itself may animate z-index).
@@ -581,11 +583,8 @@
// 2. When we want the stacking context side-effets of explicit z-index, via forceStackingContext.
// It's important to not clobber an existing used z-index, since an earlier animation may have set it, but we
// may still need to update the used z-index value from the specified value.
- bool elementRespectsZIndex = style.position() != PositionType::Static || (parentBoxStyle && parentBoxStyle->isDisplayFlexibleOrGridBox());
-
- if (elementRespectsZIndex && !style.hasAutoSpecifiedZIndex())
- style.setUsedZIndex(style.specifiedZIndex());
- else if (impact.contains(AnimationImpact::ForcesStackingContext))
+
+ if (style.hasAutoUsedZIndex() && impact.contains(AnimationImpact::ForcesStackingContext))
style.setUsedZIndex(0);
}
Modified: branches/safari-611-branch/Source/WebCore/style/StyleAdjuster.h (273176 => 273177)
--- branches/safari-611-branch/Source/WebCore/style/StyleAdjuster.h 2021-02-19 23:37:58 UTC (rev 273176)
+++ branches/safari-611-branch/Source/WebCore/style/StyleAdjuster.h 2021-02-19 23:38:02 UTC (rev 273177)
@@ -46,10 +46,9 @@
Adjuster(const Document&, const RenderStyle& parentStyle, const RenderStyle* parentBoxStyle, const Element*);
void adjust(RenderStyle&, const RenderStyle* userAgentAppearanceStyle) const;
+ void adjustAnimatedStyle(RenderStyle&, OptionSet<AnimationImpact>) const;
static void adjustSVGElementStyle(RenderStyle&, const SVGElement&);
- static void adjustAnimatedStyle(RenderStyle&, const RenderStyle* parentBoxStyle, OptionSet<AnimationImpact>);
-
static void adjustEventListenerRegionTypesForRootStyle(RenderStyle&, const Document&);
#if ENABLE(TEXT_AUTOSIZING)
Modified: branches/safari-611-branch/Source/WebCore/style/StyleTreeResolver.cpp (273176 => 273177)
--- branches/safari-611-branch/Source/WebCore/style/StyleTreeResolver.cpp 2021-02-19 23:37:58 UTC (rev 273176)
+++ branches/safari-611-branch/Source/WebCore/style/StyleTreeResolver.cpp 2021-02-19 23:38:02 UTC (rev 273177)
@@ -352,12 +352,12 @@
auto animatedStyle = RenderStyle::clonePtr(*newStyle);
animationImpact = styleable.applyKeyframeEffects(*animatedStyle, *previousLastStyleChangeEventStyle);
newStyle = WTFMove(animatedStyle);
+
+ Adjuster adjuster(m_document, parent().style, parentBoxStyle(), styleable.pseudoId == PseudoId::None ? &element : nullptr);
+ adjuster.adjustAnimatedStyle(*newStyle, animationImpact);
} else
styleable.setLastStyleChangeEventStyle(nullptr);
- if (animationImpact)
- Adjuster::adjustAnimatedStyle(*newStyle, parentBoxStyle(), animationImpact);
-
// Deduplication speeds up equality comparisons as the properties inherit to descendants.
// FIXME: There should be a more general mechanism for this.
if (oldStyle)