REGRESSION(r207669): Dromaeo/jslib-style-jquery.html regressed >20%
https://bugs.webkit.org/show_bug.cgi?id=163851
Reviewed by Darin Adler.
The test calls Scope::flushPendingUpdate a lot and nothing ever happens there.
Add a separate invalidity bit for descendant scopes and inline the fast path.
* style/StyleScope.cpp:
(WebCore::Style::Scope::flushPendingSelfUpdate):
(WebCore::Style::Scope::flushPendingDescendantUpdates):
(WebCore::Style::Scope::scheduleUpdate):
(WebCore::Style::Scope::flushPendingUpdate): Deleted.
* style/StyleScope.h:
(WebCore::Style::Scope::hasPendingUpdate):
(WebCore::Style::Scope::flushPendingUpdate):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@207717 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/style/StyleScope.cpp b/Source/WebCore/style/StyleScope.cpp
index 2b43b04..4cd8693 100644
--- a/Source/WebCore/style/StyleScope.cpp
+++ b/Source/WebCore/style/StyleScope.cpp
@@ -467,21 +467,25 @@
return m_weakCopyOfActiveStyleSheetListForFastLookup->contains(sheet);
}
-void Scope::flushPendingUpdate()
+void Scope::flushPendingSelfUpdate()
{
- if (!m_shadowRoot) {
- for (auto* descendantShadowRoot : m_document.inDocumentShadowRoots())
- descendantShadowRoot->styleScope().flushPendingUpdate();
- }
- if (!m_pendingUpdate)
- return;
+ ASSERT(m_pendingUpdate);
+
auto updateType = *m_pendingUpdate;
clearPendingUpdate();
-
updateActiveStyleSheets(updateType);
}
+void Scope::flushPendingDescendantUpdates()
+{
+ ASSERT(m_hasDescendantWithPendingUpdate);
+ ASSERT(!m_shadowRoot);
+ for (auto* descendantShadowRoot : m_document.inDocumentShadowRoots())
+ descendantShadowRoot->styleScope().flushPendingUpdate();
+ m_hasDescendantWithPendingUpdate = false;
+}
+
void Scope::clearPendingUpdate()
{
m_pendingUpdateTimer.stop();
@@ -490,8 +494,11 @@
void Scope::scheduleUpdate(UpdateType update)
{
- if (!m_pendingUpdate || *m_pendingUpdate < update)
+ if (!m_pendingUpdate || *m_pendingUpdate < update) {
m_pendingUpdate = update;
+ if (m_shadowRoot)
+ m_document.styleScope().m_hasDescendantWithPendingUpdate = true;
+ }
if (m_pendingUpdateTimer.isActive())
return;