Changeset 207372 in webkit


Ignore:
Timestamp:
Oct 15, 2016 1:27:19 AM (8 years ago)
Author:
Antti Koivisto
Message:

100% CPU on homedepot.com page
https://bugs.webkit.org/show_bug.cgi?id=163452
<rdar://problem/28730708>

Reviewed by Simon Fraser.

Source/WebCore:

The site has a keyframe animation on body. Currently this causes the animation to invalidate the
style of the entire document.

Animations use SyntheticStyleChange to invalidate elements when animation progresses and currently
that causes full subtree invalidation. However animation only ever affect individual elements and
the normal style resolution mechanism should be able to deal with things like inheritance as needed.

Test: fast/animation/animation-style-update-size.html

  • dom/Document.cpp:

(WebCore::Document::recalcStyle):

  • dom/Document.h:

(WebCore::Document::lastStyleUpdateSizeForTesting):

Testing support.

  • style/StyleTreeResolver.cpp:

(WebCore::Style::TreeResolver::resolveElement):

Don't force subtree style resolution for SyntheticStyleChange.

  • style/StyleUpdate.h:

(WebCore::Style::Update::size):

  • testing/Internals.cpp:

(WebCore::Internals::lastStyleUpdateSize):

  • testing/Internals.h:
  • testing/Internals.idl:

LayoutTests:

  • fast/animation/animation-style-update-size-expected.txt: Added.
  • fast/animation/animation-style-update-size.html: Added.
Location:
trunk
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r207355 r207372  
     12016-10-14  Antti Koivisto  <antti@apple.com>
     2
     3        100% CPU on homedepot.com page
     4        https://bugs.webkit.org/show_bug.cgi?id=163452
     5        <rdar://problem/28730708>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * fast/animation/animation-style-update-size-expected.txt: Added.
     10        * fast/animation/animation-style-update-size.html: Added.
     11
    1122016-10-14  Chris Dumez  <cdumez@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r207368 r207372  
     12016-10-14  Antti Koivisto  <antti@apple.com>
     2
     3        100% CPU on homedepot.com page
     4        https://bugs.webkit.org/show_bug.cgi?id=163452
     5        <rdar://problem/28730708>
     6
     7        Reviewed by Simon Fraser.
     8
     9        The site has a keyframe animation on body. Currently this causes the animation to invalidate the
     10        style of the entire document.
     11
     12        Animations use SyntheticStyleChange to invalidate elements when animation progresses and currently
     13        that causes full subtree invalidation. However animation only ever affect individual elements and
     14        the normal style resolution mechanism should be able to deal with things like inheritance as needed.
     15
     16        Test: fast/animation/animation-style-update-size.html
     17
     18        * dom/Document.cpp:
     19        (WebCore::Document::recalcStyle):
     20        * dom/Document.h:
     21        (WebCore::Document::lastStyleUpdateSizeForTesting):
     22
     23            Testing support.
     24
     25        * style/StyleTreeResolver.cpp:
     26        (WebCore::Style::TreeResolver::resolveElement):
     27
     28            Don't force subtree style resolution for SyntheticStyleChange.
     29
     30        * style/StyleUpdate.h:
     31        (WebCore::Style::Update::size):
     32        * testing/Internals.cpp:
     33        (WebCore::Internals::lastStyleUpdateSize):
     34        * testing/Internals.h:
     35        * testing/Internals.idl:
     36
    1372016-10-14  Chris Dumez  <cdumez@apple.com>
    238
  • trunk/Source/WebCore/dom/Document.cpp

    r207234 r207372  
    18521852        auto styleUpdate = resolver.resolve(change);
    18531853
     1854        m_lastStyleUpdateSizeForTesting = styleUpdate ? styleUpdate->size() : 0;
     1855
    18541856        clearNeedsStyleRecalc();
    18551857        clearChildNeedsStyleRecalc();
  • trunk/Source/WebCore/dom/Document.h

    r207155 r207372  
    536536    WEBCORE_EXPORT void updateStyleIfNeeded();
    537537    bool needsStyleRecalc() const;
     538    unsigned lastStyleUpdateSizeForTesting() const { return m_lastStyleUpdateSizeForTesting; }
    538539
    539540    WEBCORE_EXPORT void updateLayout();
     
    14891490    bool m_closeAfterStyleRecalc;
    14901491    bool m_inRenderTreeUpdate { false };
     1492    unsigned m_lastStyleUpdateSizeForTesting { 0 };
    14911493
    14921494    bool m_gotoAnchorNeededAfterStylesheetsLoad;
  • trunk/Source/WebCore/style/StyleTreeResolver.cpp

    r206951 r207372  
    234234    }
    235235
    236     if (update.change != Detach && (parent().change == Force || element.styleChangeType() >= FullStyleChange))
     236    if (update.change != Detach && (parent().change == Force || element.styleChangeType() == FullStyleChange))
    237237        update.change = Force;
    238238
  • trunk/Source/WebCore/style/StyleUpdate.h

    r200098 r207372  
    6969    const Document& document() const { return m_document; }
    7070
     71    unsigned size() const { return m_elements.size() + m_texts.size(); }
     72
    7173    void addElement(Element&, Element* parent, ElementUpdate&&);
    7274    void addText(Text&, Element* parent);
  • trunk/Source/WebCore/testing/Internals.cpp

    r207173 r207372  
    23862386}
    23872387
     2388unsigned Internals::lastStyleUpdateSize() const
     2389{
     2390    Document* document = contextDocument();
     2391    if (!document)
     2392        return 0;
     2393    return document->lastStyleUpdateSizeForTesting();
     2394}
     2395
    23882396void Internals::startTrackingCompositingUpdates(ExceptionCode& ec)
    23892397{
  • trunk/Source/WebCore/testing/Internals.h

    r207173 r207372  
    330330    void startTrackingStyleRecalcs(ExceptionCode&);
    331331    unsigned styleRecalcCount(ExceptionCode&);
     332    unsigned lastStyleUpdateSize() const;
    332333
    333334    void startTrackingCompositingUpdates(ExceptionCode&);
  • trunk/Source/WebCore/testing/Internals.idl

    r207173 r207372  
    328328    [MayThrowLegacyException] void startTrackingStyleRecalcs();
    329329    [MayThrowLegacyException] unsigned long styleRecalcCount();
     330    readonly attribute unsigned long lastStyleUpdateSize;
    330331
    331332    [MayThrowLegacyException] void startTrackingCompositingUpdates();
Note: See TracChangeset for help on using the changeset viewer.