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

Changeset 254598 in webkit


Ignore:
Timestamp:
Jan 15, 2020, 11:15:10 AM (7 years ago)
Author:
Alan Coon
Message:

Cherry-pick r254201. rdar://problem/58552859

[Web Animations] Stop creating CSS Animations for <noscript> elements
​https://bugs.webkit.org/show_bug.cgi?id=205925
<rdar://problem/58158479>

Reviewed by Antti Koivisto.

Source/WebCore:

Test: webanimations/no-css-animation-on-noscript.html

It makes no sense to create CSS Animations for a <noscript> element and it has the side effect of potential crashes.
Indeed, AnimationTimeline::updateCSSAnimationsForElement() may be called without a currentStyle and so we never have
a list of previously-applied animations to compare to the list of animations in afterChangeStyle. So on each call we
end up creating a new CSSAnimation and the previous animation for the same name is never explicitly removed from the
effect stack and is eventually destroyed and the WeakPtr for it in the stack ends up being null, which would cause a
crash under KeyframeEffectStack::ensureEffectsAreSorted().

We now prevent elements such as <noscript> from being considered for CSS Animations in TreeResolver::resolveElement().

  • dom/Element.cpp: (WebCore::Element::rendererIsNeeded):
  • dom/Element.h: (WebCore::Element::rendererIsEverNeeded):
  • html/HTMLElement.cpp: (WebCore::HTMLElement::rendererIsEverNeeded): (WebCore::HTMLElement::rendererIsNeeded): Deleted.
  • html/HTMLElement.h:
  • style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::resolveElement):

LayoutTests:

Add a new test that checks that setting the animation property on a <noscript> element does not yield the creation of a CSSAnimation object.

  • webanimations/no-css-animation-on-noscript-expected.txt: Added.
  • webanimations/no-css-animation-on-noscript.html: Added.

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

Location:
branches/safari-609-branch
Files:
2 added
7 edited

Legend:

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

    r254595 r254598  
     12020-01-14  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r254201. rdar://problem/58552859
     4
     5    [Web Animations] Stop creating CSS Animations for <noscript> elements
     6    https://bugs.webkit.org/show_bug.cgi?id=205925
     7    <rdar://problem/58158479>
     8   
     9    Reviewed by Antti Koivisto.
     10   
     11    Source/WebCore:
     12   
     13    Test: webanimations/no-css-animation-on-noscript.html
     14   
     15    It makes no sense to create CSS Animations for a <noscript> element and it has the side effect of potential crashes.
     16    Indeed, AnimationTimeline::updateCSSAnimationsForElement() may be called without a currentStyle and so we never have
     17    a list of previously-applied animations to compare to the list of animations in afterChangeStyle. So on each call we
     18    end up creating a new CSSAnimation and the previous animation for the same name is never explicitly removed from the
     19    effect stack and is eventually destroyed and the WeakPtr for it in the stack ends up being null, which would cause a
     20    crash under KeyframeEffectStack::ensureEffectsAreSorted().
     21   
     22    We now prevent elements such as <noscript> from being considered for CSS Animations in TreeResolver::resolveElement().
     23   
     24    * dom/Element.cpp:
     25    (WebCore::Element::rendererIsNeeded):
     26    * dom/Element.h:
     27    (WebCore::Element::rendererIsEverNeeded):
     28    * html/HTMLElement.cpp:
     29    (WebCore::HTMLElement::rendererIsEverNeeded):
     30    (WebCore::HTMLElement::rendererIsNeeded): Deleted.
     31    * html/HTMLElement.h:
     32    * style/StyleTreeResolver.cpp:
     33    (WebCore::Style::TreeResolver::resolveElement):
     34   
     35    LayoutTests:
     36   
     37    Add a new test that checks that setting the `animation` property on a <noscript> element does not yield the creation of a CSSAnimation object.
     38   
     39    * webanimations/no-css-animation-on-noscript-expected.txt: Added.
     40    * webanimations/no-css-animation-on-noscript.html: Added.
     41   
     42    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254201 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     43
     44    2020-01-08  Antoine Quint  <graouts@apple.com>
     45
     46            [Web Animations] Stop creating CSS Animations for <noscript> elements
     47            https://bugs.webkit.org/show_bug.cgi?id=205925
     48            <rdar://problem/58158479>
     49
     50            Reviewed by Antti Koivisto.
     51
     52            Add a new test that checks that setting the `animation` property on a <noscript> element does not yield the creation of a CSSAnimation object.
     53
     54            * webanimations/no-css-animation-on-noscript-expected.txt: Added.
     55            * webanimations/no-css-animation-on-noscript.html: Added.
     56
    1572020-01-14  Alan Coon  <alancoon@apple.com>
    258
  • branches/safari-609-branch/Source/WebCore/ChangeLog

    r254594 r254598  
     12020-01-14  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r254201. rdar://problem/58552859
     4
     5    [Web Animations] Stop creating CSS Animations for <noscript> elements
     6    https://bugs.webkit.org/show_bug.cgi?id=205925
     7    <rdar://problem/58158479>
     8   
     9    Reviewed by Antti Koivisto.
     10   
     11    Source/WebCore:
     12   
     13    Test: webanimations/no-css-animation-on-noscript.html
     14   
     15    It makes no sense to create CSS Animations for a <noscript> element and it has the side effect of potential crashes.
     16    Indeed, AnimationTimeline::updateCSSAnimationsForElement() may be called without a currentStyle and so we never have
     17    a list of previously-applied animations to compare to the list of animations in afterChangeStyle. So on each call we
     18    end up creating a new CSSAnimation and the previous animation for the same name is never explicitly removed from the
     19    effect stack and is eventually destroyed and the WeakPtr for it in the stack ends up being null, which would cause a
     20    crash under KeyframeEffectStack::ensureEffectsAreSorted().
     21   
     22    We now prevent elements such as <noscript> from being considered for CSS Animations in TreeResolver::resolveElement().
     23   
     24    * dom/Element.cpp:
     25    (WebCore::Element::rendererIsNeeded):
     26    * dom/Element.h:
     27    (WebCore::Element::rendererIsEverNeeded):
     28    * html/HTMLElement.cpp:
     29    (WebCore::HTMLElement::rendererIsEverNeeded):
     30    (WebCore::HTMLElement::rendererIsNeeded): Deleted.
     31    * html/HTMLElement.h:
     32    * style/StyleTreeResolver.cpp:
     33    (WebCore::Style::TreeResolver::resolveElement):
     34   
     35    LayoutTests:
     36   
     37    Add a new test that checks that setting the `animation` property on a <noscript> element does not yield the creation of a CSSAnimation object.
     38   
     39    * webanimations/no-css-animation-on-noscript-expected.txt: Added.
     40    * webanimations/no-css-animation-on-noscript.html: Added.
     41   
     42    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254201 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     43
     44    2020-01-08  Antoine Quint  <graouts@apple.com>
     45
     46            [Web Animations] Stop creating CSS Animations for <noscript> elements
     47            https://bugs.webkit.org/show_bug.cgi?id=205925
     48            <rdar://problem/58158479>
     49
     50            Reviewed by Antti Koivisto.
     51
     52            Test: webanimations/no-css-animation-on-noscript.html
     53
     54            It makes no sense to create CSS Animations for a <noscript> element and it has the side effect of potential crashes.
     55            Indeed, AnimationTimeline::updateCSSAnimationsForElement() may be called without a currentStyle and so we never have
     56            a list of previously-applied animations to compare to the list of animations in afterChangeStyle. So on each call we
     57            end up creating a new CSSAnimation and the previous animation for the same name is never explicitly removed from the
     58            effect stack and is eventually destroyed and the WeakPtr for it in the stack ends up being null, which would cause a
     59            crash under KeyframeEffectStack::ensureEffectsAreSorted().
     60
     61            We now prevent elements such as <noscript> from being considered for CSS Animations in TreeResolver::resolveElement().
     62
     63            * dom/Element.cpp:
     64            (WebCore::Element::rendererIsNeeded):
     65            * dom/Element.h:
     66            (WebCore::Element::rendererIsEverNeeded):
     67            * html/HTMLElement.cpp:
     68            (WebCore::HTMLElement::rendererIsEverNeeded):
     69            (WebCore::HTMLElement::rendererIsNeeded): Deleted.
     70            * html/HTMLElement.h:
     71            * style/StyleTreeResolver.cpp:
     72            (WebCore::Style::TreeResolver::resolveElement):
     73
    1742020-01-14  Alan Coon  <alancoon@apple.com>
    275
  • branches/safari-609-branch/Source/WebCore/dom/Element.cpp

    r254582 r254598  
    21152115bool Element::rendererIsNeeded(const RenderStyle& style)
    21162116{
    2117     return style.display() != DisplayType::None && style.display() != DisplayType::Contents;
     2117    return rendererIsEverNeeded() && style.display() != DisplayType::None && style.display() != DisplayType::Contents;
    21182118}
    21192119
  • branches/safari-609-branch/Source/WebCore/dom/Element.h

    r254582 r254598  
    286286    virtual RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&);
    287287    virtual bool rendererIsNeeded(const RenderStyle&);
     288    virtual bool rendererIsEverNeeded() { return true; }
    288289
    289290    WEBCORE_EXPORT ShadowRoot* shadowRoot() const;
  • branches/safari-609-branch/Source/WebCore/html/HTMLElement.cpp

    r252392 r254598  
    734734}
    735735
    736 bool HTMLElement::rendererIsNeeded(const RenderStyle& style)
     736bool HTMLElement::rendererIsEverNeeded()
    737737{
    738738    if (hasTagName(noscriptTag)) {
    … …  
    745745            return false;
    746746    }
    747     return StyledElement::rendererIsNeeded(style);
     747    return StyledElement::rendererIsEverNeeded();
    748748}
    749749
  • branches/safari-609-branch/Source/WebCore/html/HTMLElement.h

    r251686 r254598  
    7171    void accessKeyAction(bool sendMouseEvents) override;
    7272
    73     bool rendererIsNeeded(const RenderStyle&) override;
    7473    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
     74    bool rendererIsEverNeeded() final;
    7575
    7676    WEBCORE_EXPORT virtual HTMLFormElement* form() const;
  • branches/safari-609-branch/Source/WebCore/style/StyleTreeResolver.cpp

    r254582 r254598  
    199199    }
    200200
     201    if (!element.rendererIsEverNeeded())
     202        return { };
     203
    201204    auto newStyle = styleForElement(element, parent().style);
    202205
Note: See TracChangeset for help on using the changeset viewer.