Title: [207961] releases/WebKitGTK/webkit-2.14
Revision
207961
Author
[email protected]
Date
2016-10-27 01:54:04 -0700 (Thu, 27 Oct 2016)

Log Message

Merge r207372 - 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.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.14/LayoutTests/ChangeLog (207960 => 207961)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/ChangeLog	2016-10-27 08:49:27 UTC (rev 207960)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/ChangeLog	2016-10-27 08:54:04 UTC (rev 207961)
@@ -1,3 +1,14 @@
+2016-10-14  Antti Koivisto  <[email protected]>
+
+        100% CPU on homedepot.com page
+        https://bugs.webkit.org/show_bug.cgi?id=163452
+        <rdar://problem/28730708>
+
+        Reviewed by Simon Fraser.
+
+        * fast/animation/animation-style-update-size-expected.txt: Added.
+        * fast/animation/animation-style-update-size.html: Added.
+
 2016-10-07  Ryosuke Niwa  <[email protected]>
 
         REGRESSION(r165103): labels list doesn't get invalidated when other lists are invalidated at document level

Added: releases/WebKitGTK/webkit-2.14/LayoutTests/fast/animation/animation-style-update-size-expected.txt (0 => 207961)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/fast/animation/animation-style-update-size-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/fast/animation/animation-style-update-size-expected.txt	2016-10-27 08:54:04 UTC (rev 207961)
@@ -0,0 +1,2 @@
+Test that animation on an element doesn't invalidate the entire subtree for style resolution.
+Animation frame resolved style for 1 element(s)

Added: releases/WebKitGTK/webkit-2.14/LayoutTests/fast/animation/animation-style-update-size.html (0 => 207961)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/fast/animation/animation-style-update-size.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/fast/animation/animation-style-update-size.html	2016-10-27 08:54:04 UTC (rev 207961)
@@ -0,0 +1,25 @@
+<script>
+testRunner.dumpAsText();
+testRunner.waitUntilDone();
+</script>
+<style>
+body {
+    animation: testframes infinite 1s;
+}
+
+@keyframes testframes {
+    from { padding: 0 }
+    to { padding: 120px }
+}
+</style>
+<body>
+<div>Test that animation on an element doesn't invalidate the entire subtree for style resolution.</div>
+<log></log>
+<script>
+
+document.body.addEventListener("animationiteration", () => {
+    document.querySelector("log").textContent = "Animation frame resolved style for " + internals.lastStyleUpdateSize + " element(s)";
+    testRunner.notifyDone();
+});
+
+</script>

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog (207960 => 207961)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog	2016-10-27 08:49:27 UTC (rev 207960)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog	2016-10-27 08:54:04 UTC (rev 207961)
@@ -1,3 +1,39 @@
+2016-10-14  Antti Koivisto  <[email protected]>
+
+        100% CPU on homedepot.com page
+        https://bugs.webkit.org/show_bug.cgi?id=163452
+        <rdar://problem/28730708>
+
+        Reviewed by Simon Fraser.
+
+        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:
+
 2016-10-13  Carlos Garcia Campos  <[email protected]>
 
         WebView and WebPage URLs not updated after URL is modified by InjectedBundlePageResourceLoadClient::willSendRequestForFrame

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/dom/Document.cpp (207960 => 207961)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/dom/Document.cpp	2016-10-27 08:49:27 UTC (rev 207960)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/dom/Document.cpp	2016-10-27 08:54:04 UTC (rev 207961)
@@ -1921,6 +1921,8 @@
         Style::TreeResolver resolver(*this);
         auto styleUpdate = resolver.resolve(change);
 
+        m_lastStyleUpdateSizeForTesting = styleUpdate ? styleUpdate->size() : 0;
+
         clearNeedsStyleRecalc();
         clearChildNeedsStyleRecalc();
         unscheduleStyleRecalc();

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/dom/Document.h (207960 => 207961)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/dom/Document.h	2016-10-27 08:49:27 UTC (rev 207960)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/dom/Document.h	2016-10-27 08:54:04 UTC (rev 207961)
@@ -562,6 +562,7 @@
     void recalcStyle(Style::Change = Style::NoChange);
     WEBCORE_EXPORT void updateStyleIfNeeded();
     bool needsStyleRecalc() const { return !inPageCache() && (m_pendingStyleRecalcShouldForce || childNeedsStyleRecalc() || m_optimizedStyleSheetUpdateTimer.isActive()); }
+    unsigned lastStyleUpdateSizeForTesting() const { return m_lastStyleUpdateSizeForTesting; }
 
     WEBCORE_EXPORT void updateLayout();
     
@@ -1519,6 +1520,7 @@
     bool m_inStyleRecalc;
     bool m_closeAfterStyleRecalc;
     bool m_inRenderTreeUpdate { false };
+    unsigned m_lastStyleUpdateSizeForTesting { 0 };
 
     bool m_gotoAnchorNeededAfterStylesheetsLoad;
     bool m_isDNSPrefetchEnabled;

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/style/StyleTreeResolver.cpp (207960 => 207961)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/style/StyleTreeResolver.cpp	2016-10-27 08:49:27 UTC (rev 207960)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/style/StyleTreeResolver.cpp	2016-10-27 08:54:04 UTC (rev 207961)
@@ -234,7 +234,7 @@
             update.change = Detach;
     }
 
-    if (update.change != Detach && (parent().change == Force || element.styleChangeType() >= FullStyleChange))
+    if (update.change != Detach && (parent().change == Force || element.styleChangeType() == FullStyleChange))
         update.change = Force;
 
     return update;

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/style/StyleUpdate.h (207960 => 207961)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/style/StyleUpdate.h	2016-10-27 08:49:27 UTC (rev 207960)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/style/StyleUpdate.h	2016-10-27 08:54:04 UTC (rev 207961)
@@ -68,6 +68,8 @@
 
     const Document& document() const { return m_document; }
 
+    unsigned size() const { return m_elements.size() + m_texts.size(); }
+
     void addElement(Element&, Element* parent, ElementUpdate&&);
     void addText(Text&, Element* parent);
     void addText(Text&);

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/testing/Internals.cpp (207960 => 207961)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/testing/Internals.cpp	2016-10-27 08:49:27 UTC (rev 207960)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/testing/Internals.cpp	2016-10-27 08:54:04 UTC (rev 207961)
@@ -2366,6 +2366,14 @@
     return document->styleRecalcCount();
 }
 
+unsigned Internals::lastStyleUpdateSize() const
+{
+    Document* document = contextDocument();
+    if (!document)
+        return 0;
+    return document->lastStyleUpdateSizeForTesting();
+}
+
 void Internals::startTrackingCompositingUpdates(ExceptionCode& ec)
 {
     Document* document = contextDocument();

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/testing/Internals.h (207960 => 207961)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/testing/Internals.h	2016-10-27 08:49:27 UTC (rev 207960)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/testing/Internals.h	2016-10-27 08:54:04 UTC (rev 207961)
@@ -328,6 +328,7 @@
     
     void startTrackingStyleRecalcs(ExceptionCode&);
     unsigned styleRecalcCount(ExceptionCode&);
+    unsigned lastStyleUpdateSize() const;
 
     void startTrackingCompositingUpdates(ExceptionCode&);
     unsigned compositingUpdateCount(ExceptionCode&);

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/testing/Internals.idl (207960 => 207961)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/testing/Internals.idl	2016-10-27 08:49:27 UTC (rev 207960)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/testing/Internals.idl	2016-10-27 08:54:04 UTC (rev 207961)
@@ -331,6 +331,7 @@
 
     [RaisesException] void startTrackingStyleRecalcs();
     [RaisesException] unsigned long styleRecalcCount();
+    readonly attribute unsigned long lastStyleUpdateSize;
 
     [RaisesException] void startTrackingCompositingUpdates();
     [RaisesException] unsigned long compositingUpdateCount();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to