Changeset 276140 in webkit
- Timestamp:
- Apr 16, 2021, 9:50:28 AM (5 years ago)
- Location:
- branches/safari-611-branch/Source/WebCore
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
style/StyleTreeResolver.cpp (modified) (7 diffs)
-
style/StyleTreeResolver.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-611-branch/Source/WebCore/ChangeLog
r276132 r276140 1 2021-04-16 Russell Epstein <repstein@apple.com> 2 3 Apply patch. rdar://problem/76375504 4 5 2021-04-16 Antti Koivisto <antti@apple.com> 6 7 Animated pseudo element style resolved against wrong parent style 8 https://bugs.webkit.org/show_bug.cgi?id=223990 9 rdar://74997361 10 11 In createAnimatedElementUpdate we get the parent and parent box styles from the parent stack. 12 This is wrong for pseudo elements. Their parent style should the host style which is not pushed to the stack. 13 14 This matters in style adjuster which may apply wrong adjustments as a result. 15 16 Test: fast/animation/pseudo-element-style-adjuster.html 17 18 * style/StyleTreeResolver.cpp: 19 (WebCore::Style::TreeResolver::resolveElement): 20 (WebCore::Style::TreeResolver::resolvePseudoStyle): 21 (WebCore::Style::TreeResolver::createAnimatedElementUpdate): 22 23 Make static and provide the parent and parent box styles as parameters. 24 25 * style/StyleTreeResolver.h: 26 1 27 2021-04-15 Russell Epstein <repstein@apple.com> 2 28 -
branches/safari-611-branch/Source/WebCore/style/StyleTreeResolver.cpp
r276132 r276140 222 222 } 223 223 224 auto update = createAnimatedElementUpdate(WTFMove(newStyle), styleable, parent().change );224 auto update = createAnimatedElementUpdate(WTFMove(newStyle), styleable, parent().change, parent().style, parentBoxStyle()); 225 225 auto descendantsToResolve = computeDescendantsToResolve(update.change, element.styleValidity(), parent().descendantsToResolve); 226 226 … … 278 278 if (!elementUpdate.style->hasPseudoStyle(pseudoId)) 279 279 return { }; 280 281 auto pseudoStyle = scope().resolver.pseudoStyleForElement(element, { pseudoId }, *elementUpdate.style, parentBoxStyleForPseudo(elementUpdate), &scope().selectorFilter); 280 281 auto& parentStyle = *elementUpdate.style; 282 auto* parentBoxStyle = parentBoxStyleForPseudo(elementUpdate); 283 284 auto pseudoStyle = scope().resolver.pseudoStyleForElement(element, { pseudoId }, parentStyle, parentBoxStyle, &scope().selectorFilter); 282 285 if (!pseudoStyle) 283 286 return { }; … … 287 290 return { }; 288 291 289 return createAnimatedElementUpdate(WTFMove(pseudoStyle), { element, pseudoId }, elementUpdate.change );292 return createAnimatedElementUpdate(WTFMove(pseudoStyle), { element, pseudoId }, elementUpdate.change, parentStyle, parentBoxStyle); 290 293 } 291 294 … … 316 319 } 317 320 318 ElementUpdate TreeResolver::createAnimatedElementUpdate(std::unique_ptr<RenderStyle> newStyle, const Styleable& styleable, Change parentChange )321 ElementUpdate TreeResolver::createAnimatedElementUpdate(std::unique_ptr<RenderStyle> newStyle, const Styleable& styleable, Change parentChange, const RenderStyle& parentStyle, const RenderStyle* parentBoxStyle) 319 322 { 320 323 auto& element = styleable.element; 324 auto& document = element.document(); 321 325 auto* oldStyle = element.renderOrDisplayContentsStyle(styleable.pseudoId); 322 326 … … 326 330 // on the document timeline. Note that we get timeline() on the Document here because we need a timeline created 327 331 // in case no Web Animations have been created through the JS API. 328 if ( element.document().backForwardCacheState() == Document::NotInBackForwardCache && !element.document().renderView()->printing()) {332 if (document.backForwardCacheState() == Document::NotInBackForwardCache && !document.renderView()->printing()) { 329 333 if (oldStyle && (oldStyle->hasTransitions() || newStyle->hasTransitions())) 330 m_document.timeline().updateCSSTransitionsForStyleable(styleable, *oldStyle, *newStyle);334 document.timeline().updateCSSTransitionsForStyleable(styleable, *oldStyle, *newStyle); 331 335 332 336 // The order in which CSS Transitions and CSS Animations are updated matters since CSS Transitions define the after-change style … … 335 339 if ((oldStyle && oldStyle->hasAnimations()) || newStyle->hasAnimations()) { 336 340 // FIXME: Remove this hack and pass the parent style via updateCSSAnimationsForStyleable. 337 scope().resolver.setParentElementStyleForKeyframes(&parent ().style);338 339 m_document.timeline().updateCSSAnimationsForStyleable(styleable, oldStyle, *newStyle);341 scope().resolver.setParentElementStyleForKeyframes(&parentStyle); 342 343 document.timeline().updateCSSAnimationsForStyleable(styleable, oldStyle, *newStyle); 340 344 341 345 scope().resolver.setParentElementStyleForKeyframes(nullptr); … … 354 358 newStyle = WTFMove(animatedStyle); 355 359 356 Adjuster adjuster( m_document, parent().style, parentBoxStyle(), styleable.pseudoId == PseudoId::None ? &element : nullptr);360 Adjuster adjuster(document, parentStyle, parentBoxStyle, styleable.pseudoId == PseudoId::None ? &element : nullptr); 357 361 adjuster.adjustAnimatedStyle(*newStyle, animationImpact); 358 362 } else -
branches/safari-611-branch/Source/WebCore/style/StyleTreeResolver.h
r276132 r276140 62 62 ElementUpdates resolveElement(Element&); 63 63 64 ElementUpdate createAnimatedElementUpdate(std::unique_ptr<RenderStyle>, const Styleable&, Change );64 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.