⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 276080 in webkit


Ignore:
Timestamp:
Apr 15, 2021, 3:44:06 PM (5 years ago)
Author:
Russell Epstein
Message:

Cherry-pick r275277. rdar://problem/76375504

Animated pseudo element style resolved against wrong parent style
https://bugs.webkit.org/show_bug.cgi?id=223990
rdar://74997361

Reviewed by Antoine Quint.
Source/WebCore:

In createAnimatedElementUpdate we get the parent and parent box styles from the parent stack.
This is wrong for pseudo elements. Their parent style should the host style which is not pushed to the stack.

This matters in style adjuster which may apply wrong adjustments as a result.

Test: fast/animation/pseudo-element-style-adjuster.html

  • style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::resolveElement): (WebCore::Style::TreeResolver::resolvePseudoStyle): (WebCore::Style::TreeResolver::createAnimatedElementUpdate):

Make static and provide the parent and parent box styles as parameters.

  • style/StyleTreeResolver.h:

LayoutTests:

  • fast/animation/pseudo-element-style-adjuster-expected.html: Added.
  • fast/animation/pseudo-element-style-adjuster.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275277 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-611-branch
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-611-branch/LayoutTests/ChangeLog

    r276067 r276080  
     12021-04-15  Russell Epstein  <repstein@apple.com>
     2
     3        Cherry-pick r275277. rdar://problem/76375504
     4
     5    Animated pseudo element style resolved against wrong parent style
     6    https://bugs.webkit.org/show_bug.cgi?id=223990
     7    rdar://74997361
     8   
     9    Reviewed by Antoine Quint.
     10    Source/WebCore:
     11   
     12    In createAnimatedElementUpdate we get the parent and parent box styles from the parent stack.
     13    This is wrong for pseudo elements. Their parent style should the host style which is not pushed to the stack.
     14   
     15    This matters in style adjuster which may apply wrong adjustments as a result.
     16   
     17    Test: fast/animation/pseudo-element-style-adjuster.html
     18   
     19    * style/StyleTreeResolver.cpp:
     20    (WebCore::Style::TreeResolver::resolveElement):
     21    (WebCore::Style::TreeResolver::resolvePseudoStyle):
     22    (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
     23   
     24    Make static and provide the parent and parent box styles as parameters.
     25   
     26    * style/StyleTreeResolver.h:
     27   
     28    LayoutTests:
     29   
     30    * fast/animation/pseudo-element-style-adjuster-expected.html: Added.
     31    * fast/animation/pseudo-element-style-adjuster.html: Added.
     32   
     33    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275277 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     34
     35    2021-03-31  Antti Koivisto  <antti@apple.com>
     36
     37            Animated pseudo element style resolved against wrong parent style
     38            https://bugs.webkit.org/show_bug.cgi?id=223990
     39            rdar://74997361
     40
     41            Reviewed by Antoine Quint.
     42
     43            * fast/animation/pseudo-element-style-adjuster-expected.html: Added.
     44            * fast/animation/pseudo-element-style-adjuster.html: Added.
     45
    1462021-04-15  Russell Epstein  <repstein@apple.com>
    247
  • branches/safari-611-branch/Source/WebCore/ChangeLog

    r276076 r276080  
     12021-04-15  Russell Epstein  <repstein@apple.com>
     2
     3        Cherry-pick r275277. rdar://problem/76375504
     4
     5    Animated pseudo element style resolved against wrong parent style
     6    https://bugs.webkit.org/show_bug.cgi?id=223990
     7    rdar://74997361
     8   
     9    Reviewed by Antoine Quint.
     10    Source/WebCore:
     11   
     12    In createAnimatedElementUpdate we get the parent and parent box styles from the parent stack.
     13    This is wrong for pseudo elements. Their parent style should the host style which is not pushed to the stack.
     14   
     15    This matters in style adjuster which may apply wrong adjustments as a result.
     16   
     17    Test: fast/animation/pseudo-element-style-adjuster.html
     18   
     19    * style/StyleTreeResolver.cpp:
     20    (WebCore::Style::TreeResolver::resolveElement):
     21    (WebCore::Style::TreeResolver::resolvePseudoStyle):
     22    (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
     23   
     24    Make static and provide the parent and parent box styles as parameters.
     25   
     26    * style/StyleTreeResolver.h:
     27   
     28    LayoutTests:
     29   
     30    * fast/animation/pseudo-element-style-adjuster-expected.html: Added.
     31    * fast/animation/pseudo-element-style-adjuster.html: Added.
     32   
     33    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275277 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     34
     35    2021-03-31  Antti Koivisto  <antti@apple.com>
     36
     37            Animated pseudo element style resolved against wrong parent style
     38            https://bugs.webkit.org/show_bug.cgi?id=223990
     39            rdar://74997361
     40
     41            Reviewed by Antoine Quint.
     42
     43            In createAnimatedElementUpdate we get the parent and parent box styles from the parent stack.
     44            This is wrong for pseudo elements. Their parent style should the host style which is not pushed to the stack.
     45
     46            This matters in style adjuster which may apply wrong adjustments as a result.
     47
     48            Test: fast/animation/pseudo-element-style-adjuster.html
     49
     50            * style/StyleTreeResolver.cpp:
     51            (WebCore::Style::TreeResolver::resolveElement):
     52            (WebCore::Style::TreeResolver::resolvePseudoStyle):
     53            (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
     54
     55            Make static and provide the parent and parent box styles as parameters.
     56
     57            * style/StyleTreeResolver.h:
     58
    1592021-04-15  Russell Epstein  <repstein@apple.com>
    260
  • branches/safari-611-branch/Source/WebCore/style/StyleTreeResolver.cpp

    r273177 r276080  
    222222    }
    223223
    224     auto update = createAnimatedElementUpdate(WTFMove(newStyle), styleable, parent().change);
     224    auto update = createAnimatedElementUpdate(WTFMove(newStyle), styleable, parent().change, parent().style, parentBoxStyle());
    225225    auto descendantsToResolve = computeDescendantsToResolve(update.change, element.styleValidity(), parent().descendantsToResolve);
    226226
     
    278278    if (!elementUpdate.style->hasPseudoStyle(pseudoId))
    279279        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);
    282285    if (!pseudoStyle)
    283286        return { };
     
    287290        return { };
    288291
    289     return createAnimatedElementUpdate(WTFMove(pseudoStyle), { element, pseudoId }, elementUpdate.change);
     292    return createAnimatedElementUpdate(WTFMove(pseudoStyle), { element, pseudoId }, elementUpdate.change, parentStyle, parentBoxStyle);
    290293}
    291294
     
    316319}
    317320
    318 ElementUpdate TreeResolver::createAnimatedElementUpdate(std::unique_ptr<RenderStyle> newStyle, const Styleable& styleable, Change parentChange)
     321ElementUpdate TreeResolver::createAnimatedElementUpdate(std::unique_ptr<RenderStyle> newStyle, const Styleable& styleable, Change parentChange, const RenderStyle& parentStyle, const RenderStyle* parentBoxStyle)
    319322{
    320323    auto& element = styleable.element;
     324    auto& document = element.document();
    321325    auto* oldStyle = element.renderOrDisplayContentsStyle(styleable.pseudoId);
    322326
     
    326330    // on the document timeline. Note that we get timeline() on the Document here because we need a timeline created
    327331    // 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()) {
    329333        if (oldStyle && (oldStyle->hasTransitions() || newStyle->hasTransitions()))
    330             m_document.timeline().updateCSSTransitionsForStyleable(styleable, *oldStyle, *newStyle);
     334            document.timeline().updateCSSTransitionsForStyleable(styleable, *oldStyle, *newStyle);
    331335
    332336        // The order in which CSS Transitions and CSS Animations are updated matters since CSS Transitions define the after-change style
     
    337341            scope().resolver.setParentElementStyleForKeyframes(&parent().style);
    338342
    339             m_document.timeline().updateCSSAnimationsForStyleable(styleable, oldStyle, *newStyle);
     343            m_document.timeline().updateCSSAnimationsForStyleable(styleable, oldStyle, *newStyle, &parentStyle);
    340344
    341345            scope().resolver.setParentElementStyleForKeyframes(nullptr);
     
    351355        // Apply all keyframe effects to the new style.
    352356        auto animatedStyle = RenderStyle::clonePtr(*newStyle);
    353         animationImpact = styleable.applyKeyframeEffects(*animatedStyle, *previousLastStyleChangeEventStyle);
     357        animationImpact = styleable.applyKeyframeEffects(*animatedStyle, *previousLastStyleChangeEventStyle, &parentStyle);
    354358        newStyle = WTFMove(animatedStyle);
    355359
    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);
    357361        adjuster.adjustAnimatedStyle(*newStyle, animationImpact);
    358362    } else
  • branches/safari-611-branch/Source/WebCore/style/StyleTreeResolver.h

    r270837 r276080  
    6262    ElementUpdates resolveElement(Element&);
    6363
    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);
    6565    Optional<ElementUpdate> resolvePseudoStyle(Element&, const ElementUpdate&, PseudoId);
    6666
Note: See TracChangeset for help on using the changeset viewer.