Changeset 275277 in webkit
- Timestamp:
- Mar 31, 2021 5:16:18 AM (16 months ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/animation/pseudo-element-style-adjuster-expected.html (added)
-
LayoutTests/fast/animation/pseudo-element-style-adjuster.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/style/StyleTreeResolver.cpp (modified) (7 diffs)
-
Source/WebCore/style/StyleTreeResolver.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r275276 r275277 1 2021-03-31 Antti Koivisto <antti@apple.com> 2 3 Animated pseudo element style resolved against wrong parent style 4 https://bugs.webkit.org/show_bug.cgi?id=223990 5 rdar://74997361 6 7 Reviewed by Antoine Quint. 8 9 * fast/animation/pseudo-element-style-adjuster-expected.html: Added. 10 * fast/animation/pseudo-element-style-adjuster.html: Added. 11 1 12 2021-03-31 Youenn Fablet <youenn@apple.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r275276 r275277 1 2021-03-31 Antti Koivisto <antti@apple.com> 2 3 Animated pseudo element style resolved against wrong parent style 4 https://bugs.webkit.org/show_bug.cgi?id=223990 5 rdar://74997361 6 7 Reviewed by Antoine Quint. 8 9 In createAnimatedElementUpdate we get the parent and parent box styles from the parent stack. 10 This is wrong for pseudo elements. Their parent style should the host style which is not pushed to the stack. 11 12 This matters in style adjuster which may apply wrong adjustments as a result. 13 14 Test: fast/animation/pseudo-element-style-adjuster.html 15 16 * style/StyleTreeResolver.cpp: 17 (WebCore::Style::TreeResolver::resolveElement): 18 (WebCore::Style::TreeResolver::resolvePseudoStyle): 19 (WebCore::Style::TreeResolver::createAnimatedElementUpdate): 20 21 Make static and provide the parent and parent box styles as parameters. 22 23 * style/StyleTreeResolver.h: 24 1 25 2021-03-31 Youenn Fablet <youenn@apple.com> 2 26 -
trunk/Source/WebCore/style/StyleTreeResolver.cpp
r273621 r275277 223 223 } 224 224 225 auto update = createAnimatedElementUpdate(WTFMove(newStyle), styleable, parent().change );225 auto update = createAnimatedElementUpdate(WTFMove(newStyle), styleable, parent().change, parent().style, parentBoxStyle()); 226 226 auto descendantsToResolve = computeDescendantsToResolve(update.change, element.styleValidity(), parent().descendantsToResolve); 227 227 … … 279 279 if (!elementUpdate.style->hasPseudoStyle(pseudoId)) 280 280 return { }; 281 282 auto pseudoStyle = scope().resolver.pseudoStyleForElement(element, { pseudoId }, *elementUpdate.style, parentBoxStyleForPseudo(elementUpdate), &scope().selectorFilter); 281 282 auto& parentStyle = *elementUpdate.style; 283 auto* parentBoxStyle = parentBoxStyleForPseudo(elementUpdate); 284 285 auto pseudoStyle = scope().resolver.pseudoStyleForElement(element, { pseudoId }, parentStyle, parentBoxStyle, &scope().selectorFilter); 283 286 if (!pseudoStyle) 284 287 return { }; … … 288 291 return { }; 289 292 290 return createAnimatedElementUpdate(WTFMove(pseudoStyle), { element, pseudoId }, elementUpdate.change );293 return createAnimatedElementUpdate(WTFMove(pseudoStyle), { element, pseudoId }, elementUpdate.change, parentStyle, parentBoxStyle); 291 294 } 292 295 … … 317 320 } 318 321 319 ElementUpdate TreeResolver::createAnimatedElementUpdate(std::unique_ptr<RenderStyle> newStyle, const Styleable& styleable, Change parentChange )322 ElementUpdate TreeResolver::createAnimatedElementUpdate(std::unique_ptr<RenderStyle> newStyle, const Styleable& styleable, Change parentChange, const RenderStyle& parentStyle, const RenderStyle* parentBoxStyle) 320 323 { 321 324 auto& element = styleable.element; 325 auto& document = element.document(); 322 326 auto* oldStyle = element.renderOrDisplayContentsStyle(styleable.pseudoId); 323 327 … … 327 331 // on the document timeline. Note that we get timeline() on the Document here because we need a timeline created 328 332 // in case no Web Animations have been created through the JS API. 329 if ( element.document().backForwardCacheState() == Document::NotInBackForwardCache && !element.document().renderView()->printing()) {333 if (document.backForwardCacheState() == Document::NotInBackForwardCache && !document.renderView()->printing()) { 330 334 if (oldStyle && (oldStyle->hasTransitions() || newStyle->hasTransitions())) 331 m_document.timeline().updateCSSTransitionsForStyleable(styleable, *oldStyle, *newStyle);335 document.timeline().updateCSSTransitionsForStyleable(styleable, *oldStyle, *newStyle); 332 336 333 337 // The order in which CSS Transitions and CSS Animations are updated matters since CSS Transitions define the after-change style … … 335 339 // such that when CSS Transitions are updated the CSS Animations data is the same as during the previous style change event. 336 340 if ((oldStyle && oldStyle->hasAnimations()) || newStyle->hasAnimations()) 337 m_document.timeline().updateCSSAnimationsForStyleable(styleable, oldStyle, *newStyle, &parent().style);341 document.timeline().updateCSSAnimationsForStyleable(styleable, oldStyle, *newStyle, &parentStyle); 338 342 } 339 343 … … 346 350 // Apply all keyframe effects to the new style. 347 351 auto animatedStyle = RenderStyle::clonePtr(*newStyle); 348 animationImpact = styleable.applyKeyframeEffects(*animatedStyle, *previousLastStyleChangeEventStyle, &parent ().style);352 animationImpact = styleable.applyKeyframeEffects(*animatedStyle, *previousLastStyleChangeEventStyle, &parentStyle); 349 353 newStyle = WTFMove(animatedStyle); 350 354 351 Adjuster adjuster( m_document, parent().style, parentBoxStyle(), styleable.pseudoId == PseudoId::None ? &element : nullptr);355 Adjuster adjuster(document, parentStyle, parentBoxStyle, styleable.pseudoId == PseudoId::None ? &element : nullptr); 352 356 adjuster.adjustAnimatedStyle(*newStyle, animationImpact); 353 357 } else -
trunk/Source/WebCore/style/StyleTreeResolver.h
r273621 r275277 62 62 ElementUpdates resolveElement(Element&); 63 63 64 ElementUpdate createAnimatedElementUpdate(std::unique_ptr<RenderStyle>, const Styleable&, Change);64 static ElementUpdate createAnimatedElementUpdate(std::unique_ptr<RenderStyle>, const Styleable&, Change, const RenderStyle& parentStyle, const RenderStyle* parentBoxStyle); 65 65 Optional<ElementUpdate> resolvePseudoStyle(Element&, const ElementUpdate&, PseudoId); 66 66
Note: See TracChangeset
for help on using the changeset viewer.