Diff
Modified: trunk/LayoutTests/ChangeLog (207371 => 207372)
--- trunk/LayoutTests/ChangeLog 2016-10-15 07:22:03 UTC (rev 207371)
+++ trunk/LayoutTests/ChangeLog 2016-10-15 08:27:19 UTC (rev 207372)
@@ -1,3 +1,14 @@
+2016-10-14 Antti Koivisto <an...@apple.com>
+
+ 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-14 Chris Dumez <cdu...@apple.com>
Unreviewed, rolling out r207319.
Added: trunk/LayoutTests/fast/animation/animation-style-update-size-expected.txt (0 => 207372)
--- trunk/LayoutTests/fast/animation/animation-style-update-size-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/animation/animation-style-update-size-expected.txt 2016-10-15 08:27:19 UTC (rev 207372)
@@ -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: trunk/LayoutTests/fast/animation/animation-style-update-size.html (0 => 207372)
--- trunk/LayoutTests/fast/animation/animation-style-update-size.html (rev 0)
+++ trunk/LayoutTests/fast/animation/animation-style-update-size.html 2016-10-15 08:27:19 UTC (rev 207372)
@@ -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: trunk/Source/WebCore/ChangeLog (207371 => 207372)
--- trunk/Source/WebCore/ChangeLog 2016-10-15 07:22:03 UTC (rev 207371)
+++ trunk/Source/WebCore/ChangeLog 2016-10-15 08:27:19 UTC (rev 207372)
@@ -1,3 +1,39 @@
+2016-10-14 Antti Koivisto <an...@apple.com>
+
+ 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-14 Chris Dumez <cdu...@apple.com>
Setting HTMLMediaElement.muted to the same value should not fire a volume change event
Modified: trunk/Source/WebCore/dom/Document.cpp (207371 => 207372)
--- trunk/Source/WebCore/dom/Document.cpp 2016-10-15 07:22:03 UTC (rev 207371)
+++ trunk/Source/WebCore/dom/Document.cpp 2016-10-15 08:27:19 UTC (rev 207372)
@@ -1851,6 +1851,8 @@
Style::TreeResolver resolver(*this);
auto styleUpdate = resolver.resolve(change);
+ m_lastStyleUpdateSizeForTesting = styleUpdate ? styleUpdate->size() : 0;
+
clearNeedsStyleRecalc();
clearChildNeedsStyleRecalc();
unscheduleStyleRecalc();
Modified: trunk/Source/WebCore/dom/Document.h (207371 => 207372)
--- trunk/Source/WebCore/dom/Document.h 2016-10-15 07:22:03 UTC (rev 207371)
+++ trunk/Source/WebCore/dom/Document.h 2016-10-15 08:27:19 UTC (rev 207372)
@@ -535,6 +535,7 @@
void recalcStyle(Style::Change = Style::NoChange);
WEBCORE_EXPORT void updateStyleIfNeeded();
bool needsStyleRecalc() const;
+ unsigned lastStyleUpdateSizeForTesting() const { return m_lastStyleUpdateSizeForTesting; }
WEBCORE_EXPORT void updateLayout();
@@ -1488,6 +1489,7 @@
bool m_inStyleRecalc;
bool m_closeAfterStyleRecalc;
bool m_inRenderTreeUpdate { false };
+ unsigned m_lastStyleUpdateSizeForTesting { 0 };
bool m_gotoAnchorNeededAfterStylesheetsLoad;
bool m_isDNSPrefetchEnabled;
Modified: trunk/Source/WebCore/style/StyleTreeResolver.cpp (207371 => 207372)
--- trunk/Source/WebCore/style/StyleTreeResolver.cpp 2016-10-15 07:22:03 UTC (rev 207371)
+++ trunk/Source/WebCore/style/StyleTreeResolver.cpp 2016-10-15 08:27:19 UTC (rev 207372)
@@ -233,7 +233,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: trunk/Source/WebCore/style/StyleUpdate.h (207371 => 207372)
--- trunk/Source/WebCore/style/StyleUpdate.h 2016-10-15 07:22:03 UTC (rev 207371)
+++ trunk/Source/WebCore/style/StyleUpdate.h 2016-10-15 08:27:19 UTC (rev 207372)
@@ -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: trunk/Source/WebCore/testing/Internals.cpp (207371 => 207372)
--- trunk/Source/WebCore/testing/Internals.cpp 2016-10-15 07:22:03 UTC (rev 207371)
+++ trunk/Source/WebCore/testing/Internals.cpp 2016-10-15 08:27:19 UTC (rev 207372)
@@ -2385,6 +2385,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: trunk/Source/WebCore/testing/Internals.h (207371 => 207372)
--- trunk/Source/WebCore/testing/Internals.h 2016-10-15 07:22:03 UTC (rev 207371)
+++ trunk/Source/WebCore/testing/Internals.h 2016-10-15 08:27:19 UTC (rev 207372)
@@ -329,6 +329,7 @@
void startTrackingStyleRecalcs(ExceptionCode&);
unsigned styleRecalcCount(ExceptionCode&);
+ unsigned lastStyleUpdateSize() const;
void startTrackingCompositingUpdates(ExceptionCode&);
unsigned compositingUpdateCount(ExceptionCode&);
Modified: trunk/Source/WebCore/testing/Internals.idl (207371 => 207372)
--- trunk/Source/WebCore/testing/Internals.idl 2016-10-15 07:22:03 UTC (rev 207371)
+++ trunk/Source/WebCore/testing/Internals.idl 2016-10-15 08:27:19 UTC (rev 207372)
@@ -327,6 +327,7 @@
[MayThrowLegacyException] void startTrackingStyleRecalcs();
[MayThrowLegacyException] unsigned long styleRecalcCount();
+ readonly attribute unsigned long lastStyleUpdateSize;
[MayThrowLegacyException] void startTrackingCompositingUpdates();
[MayThrowLegacyException] unsigned long compositingUpdateCount();