Changeset 254582 in webkit
- Timestamp:
- Jan 15, 2020 11:14:26 AM (4 years ago)
- Location:
- branches/safari-609-branch
- Files:
-
- 2 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-609-branch/LayoutTests/ChangeLog
r254475 r254582 1 2020-01-14 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r254054. rdar://problem/58549108 4 5 REGRESSION (r252724): Unable to tap on play button on google video 'See the top search trends of 2019' 6 https://bugs.webkit.org/show_bug.cgi?id=205694 7 <rdar://problem/58062987> 8 9 Reviewed by Zalan Bujtas. 10 11 Source/WebCore: 12 13 After r252724, which separated 'used' from 'specified' z-index in style, we need to copy 14 the specified to the used z-index in animated styles, while preserving the existing 'forceStackingContext' 15 behavior which set the used z-index to 0. 16 17 Do so by creating Adjuster::adjustAnimatedStyle(), which is called from TreeResolver::createAnimatedElementUpdate() 18 if any animations could have affected the style. We need to pass back information about whether the animation should 19 force stacking context. 20 21 Test: animations/z-index-in-keyframe.html 22 23 * animation/KeyframeEffect.cpp: 24 (WebCore::KeyframeEffect::apply): 25 * animation/KeyframeEffect.h: 26 (WebCore::KeyframeEffect::triggersStackingContext const): 27 * dom/Element.cpp: 28 (WebCore::Element::applyKeyframeEffects): 29 * dom/Element.h: 30 * page/animation/CSSAnimationController.h: 31 (): Deleted. 32 * page/animation/CompositeAnimation.cpp: 33 (WebCore::CompositeAnimation::animate): 34 * style/StyleAdjuster.cpp: 35 (WebCore::Style::Adjuster::adjustAnimatedStyle): 36 * style/StyleAdjuster.h: 37 * style/StyleTreeResolver.cpp: 38 (WebCore::Style::TreeResolver::createAnimatedElementUpdate): 39 40 LayoutTests: 41 42 * animations/z-index-in-keyframe-expected.html: Added. 43 * animations/z-index-in-keyframe.html: Added. 44 45 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254054 268f45cc-cd09-0410-ab3c-d52691b4dbfc 46 47 2020-01-05 Simon Fraser <simon.fraser@apple.com> 48 49 REGRESSION (r252724): Unable to tap on play button on google video 'See the top search trends of 2019' 50 https://bugs.webkit.org/show_bug.cgi?id=205694 51 <rdar://problem/58062987> 52 53 Reviewed by Zalan Bujtas. 54 55 * animations/z-index-in-keyframe-expected.html: Added. 56 * animations/z-index-in-keyframe.html: Added. 57 1 58 2020-01-13 Alan Coon <alancoon@apple.com> 2 59 -
branches/safari-609-branch/Source/WebCore/ChangeLog
r254475 r254582 1 2020-01-14 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r254054. rdar://problem/58549108 4 5 REGRESSION (r252724): Unable to tap on play button on google video 'See the top search trends of 2019' 6 https://bugs.webkit.org/show_bug.cgi?id=205694 7 <rdar://problem/58062987> 8 9 Reviewed by Zalan Bujtas. 10 11 Source/WebCore: 12 13 After r252724, which separated 'used' from 'specified' z-index in style, we need to copy 14 the specified to the used z-index in animated styles, while preserving the existing 'forceStackingContext' 15 behavior which set the used z-index to 0. 16 17 Do so by creating Adjuster::adjustAnimatedStyle(), which is called from TreeResolver::createAnimatedElementUpdate() 18 if any animations could have affected the style. We need to pass back information about whether the animation should 19 force stacking context. 20 21 Test: animations/z-index-in-keyframe.html 22 23 * animation/KeyframeEffect.cpp: 24 (WebCore::KeyframeEffect::apply): 25 * animation/KeyframeEffect.h: 26 (WebCore::KeyframeEffect::triggersStackingContext const): 27 * dom/Element.cpp: 28 (WebCore::Element::applyKeyframeEffects): 29 * dom/Element.h: 30 * page/animation/CSSAnimationController.h: 31 (): Deleted. 32 * page/animation/CompositeAnimation.cpp: 33 (WebCore::CompositeAnimation::animate): 34 * style/StyleAdjuster.cpp: 35 (WebCore::Style::Adjuster::adjustAnimatedStyle): 36 * style/StyleAdjuster.h: 37 * style/StyleTreeResolver.cpp: 38 (WebCore::Style::TreeResolver::createAnimatedElementUpdate): 39 40 LayoutTests: 41 42 * animations/z-index-in-keyframe-expected.html: Added. 43 * animations/z-index-in-keyframe.html: Added. 44 45 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254054 268f45cc-cd09-0410-ab3c-d52691b4dbfc 46 47 2020-01-05 Simon Fraser <simon.fraser@apple.com> 48 49 REGRESSION (r252724): Unable to tap on play button on google video 'See the top search trends of 2019' 50 https://bugs.webkit.org/show_bug.cgi?id=205694 51 <rdar://problem/58062987> 52 53 Reviewed by Zalan Bujtas. 54 55 After r252724, which separated 'used' from 'specified' z-index in style, we need to copy 56 the specified to the used z-index in animated styles, while preserving the existing 'forceStackingContext' 57 behavior which set the used z-index to 0. 58 59 Do so by creating Adjuster::adjustAnimatedStyle(), which is called from TreeResolver::createAnimatedElementUpdate() 60 if any animations could have affected the style. We need to pass back information about whether the animation should 61 force stacking context. 62 63 Test: animations/z-index-in-keyframe.html 64 65 * animation/KeyframeEffect.cpp: 66 (WebCore::KeyframeEffect::apply): 67 * animation/KeyframeEffect.h: 68 (WebCore::KeyframeEffect::triggersStackingContext const): 69 * dom/Element.cpp: 70 (WebCore::Element::applyKeyframeEffects): 71 * dom/Element.h: 72 * page/animation/CSSAnimationController.h: 73 (): Deleted. 74 * page/animation/CompositeAnimation.cpp: 75 (WebCore::CompositeAnimation::animate): 76 * style/StyleAdjuster.cpp: 77 (WebCore::Style::Adjuster::adjustAnimatedStyle): 78 * style/StyleAdjuster.h: 79 * style/StyleTreeResolver.cpp: 80 (WebCore::Style::TreeResolver::createAnimatedElementUpdate): 81 1 82 2020-01-13 Alan Coon <alancoon@apple.com> 2 83 -
branches/safari-609-branch/Source/WebCore/animation/KeyframeEffect.cpp
r253728 r254582 51 51 #include "RenderStyle.h" 52 52 #include "RuntimeEnabledFeatures.h" 53 #include "StyleAdjuster.h" 53 54 #include "StylePendingResources.h" 54 55 #include "StyleResolver.h" … … 1091 1092 1092 1093 setAnimatedPropertiesInStyle(targetStyle, computedTiming.progress.value()); 1093 1094 // https://w3c.github.io/web-animations/#side-effects-section1095 // For every property targeted by at least one animation effect that is current or in effect, the user agent1096 // must act as if the will-change property ([css-will-change-1]) on the target element includes the property.1097 if (m_triggersStackingContext && targetStyle.hasAutoUsedZIndex())1098 targetStyle.setUsedZIndex(0);1099 1094 } 1100 1095 -
branches/safari-609-branch/Source/WebCore/animation/KeyframeEffect.h
r253728 r254582 127 127 const RenderStyle& currentStyle() const override; 128 128 bool isAccelerated() const { return m_shouldRunAccelerated; } 129 bool triggersStackingContext() const { return m_triggersStackingContext; } 129 130 bool filterFunctionListsMatch() const override { return m_filterFunctionListsMatch; } 130 131 bool transformFunctionListsMatch() const override { return m_transformFunctionListsMatch; } -
branches/safari-609-branch/Source/WebCore/dom/Element.cpp
r253923 r254582 3725 3725 } 3726 3726 3727 boolElement::applyKeyframeEffects(RenderStyle& targetStyle)3728 { 3729 bool hasNonAcceleratedAnimationProperty = false;3727 OptionSet<AnimationImpact> Element::applyKeyframeEffects(RenderStyle& targetStyle) 3728 { 3729 OptionSet<AnimationImpact> impact; 3730 3730 3731 3731 for (const auto& effect : ensureKeyframeEffectStack().sortedEffects()) { … … 3733 3733 effect->animation()->resolve(targetStyle); 3734 3734 3735 if (!hasNonAcceleratedAnimationProperty && !effect->isAccelerated()) 3736 hasNonAcceleratedAnimationProperty = true; 3737 } 3738 3739 return !hasNonAcceleratedAnimationProperty; 3735 if (effect->isAccelerated()) 3736 impact.add(AnimationImpact::RequiresRecomposite); 3737 3738 if (effect->triggersStackingContext()) 3739 impact.add(AnimationImpact::ForcesStackingContext); 3740 } 3741 3742 return impact; 3740 3743 } 3741 3744 -
branches/safari-609-branch/Source/WebCore/dom/Element.h
r253923 r254582 74 74 } 75 75 76 enum class AnimationImpact; 77 76 78 class Element : public ContainerNode { 77 79 WTF_MAKE_ISO_ALLOCATED(Element); … … 481 483 KeyframeEffectStack& ensureKeyframeEffectStack(); 482 484 bool hasKeyframeEffects() const; 483 boolapplyKeyframeEffects(RenderStyle&);485 OptionSet<AnimationImpact> applyKeyframeEffects(RenderStyle&); 484 486 485 487 #if ENABLE(FULLSCREEN_API) -
branches/safari-609-branch/Source/WebCore/page/animation/AnimationBase.h
r252554 r254582 50 50 }; 51 51 52 enum class AnimationImpact { 53 RequiresRecomposite = 1 << 0, 54 ForcesStackingContext = 1 << 1 55 }; 56 52 57 class AnimationBase : public RefCounted<AnimationBase> 53 58 , public CSSPropertyBlendingClient { -
branches/safari-609-branch/Source/WebCore/page/animation/CSSAnimationController.h
r246490 r254582 31 31 #include "AnimationBase.h" 32 32 #include "CSSPropertyNames.h" 33 #include "Element.h" 33 34 #include "RenderStyle.h" 34 35 #include <wtf/Forward.h> … … 38 39 class CSSAnimationControllerPrivate; 39 40 class Document; 40 class Element;41 41 class Frame; 42 42 class LayoutRect; … … 45 45 struct AnimationUpdate { 46 46 std::unique_ptr<RenderStyle> style; 47 bool animationChangeRequiresRecomposite { false }; 47 OptionSet<AnimationImpact> impact; 48 48 49 }; 49 50 -
branches/safari-609-branch/Source/WebCore/page/animation/CompositeAnimation.cpp
r252724 r254582 38 38 #include "RenderElement.h" 39 39 #include "RenderStyle.h" 40 #include "StyleAdjuster.h" 40 41 #include <wtf/NeverDestroyed.h> 41 42 #include <wtf/text/CString.h> … … 287 288 m_keyframeAnimations.checkConsistency(); 288 289 289 bool animationChangeRequiresRecomposite = false; 290 bool forceStackingContext = false; 290 OptionSet<AnimationImpact> imapct; 291 291 292 292 std::unique_ptr<RenderStyle> animatedStyle; … … 301 301 checkForStackingContext |= WillChangeData::propertyCreatesStackingContext(transition->animatingProperty()); 302 302 303 animationChangeRequiresRecomposite = changes.contains(AnimateChange::RunningStateChange) && transition->affectsAcceleratedProperty(); 303 if (changes.contains(AnimateChange::RunningStateChange) && transition->affectsAcceleratedProperty()) 304 imapct.add(AnimationImpact::RequiresRecomposite); 304 305 } 305 306 … … 317 318 #endif 318 319 ) 319 forceStackingContext = true;320 imapct.add(AnimationImpact::ForcesStackingContext); 320 321 } 321 322 } … … 327 328 if (keyframeAnim) { 328 329 auto changes = keyframeAnim->animate(*this, targetStyle, animatedStyle); 329 animationChangeRequiresRecomposite = changes.contains(AnimateChange::RunningStateChange) && keyframeAnim->affectsAcceleratedProperty(); 330 forceStackingContext |= changes.contains(AnimateChange::StyleBlended) && keyframeAnim->triggersStackingContext(); 330 if (changes.contains(AnimateChange::RunningStateChange) && keyframeAnim->affectsAcceleratedProperty()) 331 imapct.add(AnimationImpact::RequiresRecomposite); 332 333 if (changes.contains(AnimateChange::StyleBlended) && keyframeAnim->triggersStackingContext()) 334 imapct.add(AnimationImpact::ForcesStackingContext); 335 331 336 m_hasAnimationThatDependsOnLayout |= keyframeAnim->dependsOnLayout(); 332 337 } 333 338 } 334 339 335 // https://drafts.csswg.org/css-animations-1/ 336 // While an animation is applied but has not finished, or has finished but has an animation-fill-mode of forwards or both, 337 // the user agent must act as if the will-change property ([css-will-change-1]) on the element additionally 338 // includes all the properties animated by the animation. 339 if (forceStackingContext && animatedStyle) { 340 if (animatedStyle->hasAutoUsedZIndex()) 341 animatedStyle->setUsedZIndex(0); 342 } 343 344 return { WTFMove(animatedStyle), animationChangeRequiresRecomposite }; 340 return { WTFMove(animatedStyle), imapct }; 345 341 } 346 342 -
branches/safari-609-branch/Source/WebCore/style/StyleAdjuster.cpp
r253917 r254582 31 31 #include "StyleAdjuster.h" 32 32 33 #include "AnimationBase.h" 33 34 #include "CSSFontSelector.h" 34 35 #include "Element.h" … … 43 44 #include "Page.h" 44 45 #include "Quirks.h" 46 #include "RenderBox.h" 45 47 #include "RenderStyle.h" 46 48 #include "RenderTheme.h" … … 525 527 } 526 528 529 void Adjuster::adjustAnimatedStyle(RenderStyle& style, const RenderStyle* parentBoxStyle, OptionSet<AnimationImpact> impact) 530 { 531 // Set an explicit used z-index in two cases: 532 // 1. When the element respects z-index, and the style has an explicit z-index set (for example, the animation 533 // itself may animate z-index). 534 // 2. When we want the stacking context side-effets of explicit z-index, via forceStackingContext. 535 // It's important to not clobber an existing used z-index, since an earlier animation may have set it, but we 536 // may still need to update the used z-index value from the specified value. 537 bool elementRespectsZIndex = style.position() != PositionType::Static || (parentBoxStyle && parentBoxStyle->isDisplayFlexibleOrGridBox()); 538 539 if (elementRespectsZIndex && !style.hasAutoSpecifiedZIndex()) 540 style.setUsedZIndex(style.specifiedZIndex()); 541 else if (impact.contains(AnimationImpact::ForcesStackingContext)) 542 style.setUsedZIndex(0); 543 } 544 527 545 void Adjuster::adjustForSiteSpecificQuirks(RenderStyle& style) const 528 546 { -
branches/safari-609-branch/Source/WebCore/style/StyleAdjuster.h
r252599 r254582 43 43 44 44 static void adjustSVGElementStyle(RenderStyle&, const SVGElement&); 45 static void adjustAnimatedStyle(RenderStyle&, const RenderStyle* parentBoxStyle, OptionSet<AnimationImpact>); 46 45 47 #if ENABLE(TEXT_AUTOSIZING) 46 48 static bool adjustForTextAutosizing(RenderStyle&, const Element&); -
branches/safari-609-branch/Source/WebCore/style/StyleTreeResolver.cpp
r253987 r254582 50 50 #include "Settings.h" 51 51 #include "ShadowRoot.h" 52 #include "StyleAdjuster.h" 52 53 #include "StyleFontSizeFunctions.h" 53 54 #include "StyleResolver.h" … … 303 304 { 304 305 auto* oldStyle = element.renderOrDisplayContentsStyle(); 305 306 bool shouldRecompositeLayer = false;306 307 OptionSet<AnimationImpact> animationImpact; 307 308 308 309 // New code path for CSS Animations and CSS Transitions. … … 324 325 if (element.hasKeyframeEffects()) { 325 326 auto animatedStyle = RenderStyle::clonePtr(*newStyle); 326 shouldRecompositeLayer= element.applyKeyframeEffects(*animatedStyle);327 animationImpact = element.applyKeyframeEffects(*animatedStyle); 327 328 newStyle = WTFMove(animatedStyle); 328 329 } … … 333 334 334 335 auto animationUpdate = animationController.updateAnimations(element, *newStyle, oldStyle); 335 shouldRecompositeLayer = animationUpdate.animationChangeRequiresRecomposite;336 animationImpact.add(animationUpdate.impact); 336 337 337 338 if (animationUpdate.style) 338 339 newStyle = WTFMove(animationUpdate.style); 339 340 } 341 342 if (animationImpact) 343 Adjuster::adjustAnimatedStyle(*newStyle, parentBoxStyle(), animationImpact); 340 344 341 345 auto change = oldStyle ? determineChange(*oldStyle, *newStyle) : Detach; … … 345 349 change = Detach; 346 350 347 shouldRecompositeLayer |= element.styleResolutionShouldRecompositeLayer(); 348 351 bool shouldRecompositeLayer = animationImpact.contains(AnimationImpact::RequiresRecomposite) || element.styleResolutionShouldRecompositeLayer(); 349 352 return { WTFMove(newStyle), change, shouldRecompositeLayer }; 350 353 }
Note: See TracChangeset
for help on using the changeset viewer.