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

Changeset 273003 in webkit


Ignore:
Timestamp:
Feb 17, 2021, 9:27:21 AM (6 years ago)
Author:
Antti Koivisto
Message:

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.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r273002 r273003  
     12021-02-17  Antti Koivisto  <antti@apple.com>
     2
     3        Animated keyframe style needs to go through full style adjuster
     4        https://bugs.webkit.org/show_bug.cgi?id=222036
     5        rdar://72421747
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        * fast/animation/animation-position-crash-expected.html: Added.
     10        * fast/animation/animation-position-crash.html: Added.
     11
    1122021-02-17  Philippe Normand  <pnormand@igalia.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r273001 r273003  
     12021-02-17  Antti Koivisto  <antti@apple.com>
     2
     3        Animated keyframe style needs to go through full style adjuster
     4        https://bugs.webkit.org/show_bug.cgi?id=222036
     5        rdar://72421747
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        We can create unadjusted styles via keyframe animations and those may cause problems in rendering.
     10
     11        Test: fast/animation/animation-position-crash.html
     12
     13        * style/StyleAdjuster.cpp:
     14        (WebCore::Style::Adjuster::adjustAnimatedStyle):
     15
     16        Make this a member function and invoke Adjuster::adjust.
     17        Simplify the z-index adjustment since it is mostly handled by adjust.
     18
     19        * style/StyleAdjuster.h:
     20        * style/StyleTreeResolver.cpp:
     21
     22        Always use style adjuster for keyframe animation.
     23
     24        (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
     25
    1262021-02-17  Antoine Quint  <graouts@webkit.org>
    227
  • trunk/Source/WebCore/style/StyleAdjuster.cpp

    r272977 r273003  
    575575}
    576576
    577 void Adjuster::adjustAnimatedStyle(RenderStyle& style, const RenderStyle* parentBoxStyle, OptionSet<AnimationImpact> impact)
    578 {
     577void Adjuster::adjustAnimatedStyle(RenderStyle& style, OptionSet<AnimationImpact> impact) const
     578{
     579    adjust(style, nullptr);
     580
    579581    // Set an explicit used z-index in two cases:
    580582    // 1. When the element respects z-index, and the style has an explicit z-index set (for example, the animation
    … …  
    583585    // It's important to not clobber an existing used z-index, since an earlier animation may have set it, but we
    584586    // may still need to update the used z-index value from the specified value.
    585     bool elementRespectsZIndex = style.position() != PositionType::Static || (parentBoxStyle && parentBoxStyle->isDisplayFlexibleOrGridBox());
    586 
    587     if (elementRespectsZIndex && !style.hasAutoSpecifiedZIndex())
    588         style.setUsedZIndex(style.specifiedZIndex());
    589     else if (impact.contains(AnimationImpact::ForcesStackingContext))
     587   
     588    if (style.hasAutoUsedZIndex() && impact.contains(AnimationImpact::ForcesStackingContext))
    590589        style.setUsedZIndex(0);
    591590}
  • trunk/Source/WebCore/style/StyleAdjuster.h

    r261820 r273003  
    4747
    4848    void adjust(RenderStyle&, const RenderStyle* userAgentAppearanceStyle) const;
     49    void adjustAnimatedStyle(RenderStyle&, OptionSet<AnimationImpact>) const;
    4950
    5051    static void adjustSVGElementStyle(RenderStyle&, const SVGElement&);
    51     static void adjustAnimatedStyle(RenderStyle&, const RenderStyle* parentBoxStyle, OptionSet<AnimationImpact>);
    52    
    5352    static void adjustEventListenerRegionTypesForRootStyle(RenderStyle&, const Document&);
    5453
  • trunk/Source/WebCore/style/StyleTreeResolver.cpp

    r272927 r273003  
    347347        animationImpact = styleable.applyKeyframeEffects(*animatedStyle, *previousLastStyleChangeEventStyle, &parent().style);
    348348        newStyle = WTFMove(animatedStyle);
     349
     350        Adjuster adjuster(m_document, parent().style, parentBoxStyle(), styleable.pseudoId == PseudoId::None ? &element : nullptr);
     351        adjuster.adjustAnimatedStyle(*newStyle, animationImpact);
    349352    } else
    350353        styleable.setLastStyleChangeEventStyle(nullptr);
    351 
    352     if (animationImpact)
    353         Adjuster::adjustAnimatedStyle(*newStyle, parentBoxStyle(), animationImpact);
    354354
    355355    // Deduplication speeds up equality comparisons as the properties inherit to descendants.
Note: See TracChangeset for help on using the changeset viewer.