Title: [207717] trunk/Source/WebCore
Revision
207717
Author
an...@apple.com
Date
2016-10-22 14:27:53 -0700 (Sat, 22 Oct 2016)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (207716 => 207717)


--- trunk/Source/WebCore/ChangeLog	2016-10-22 20:56:47 UTC (rev 207716)
+++ trunk/Source/WebCore/ChangeLog	2016-10-22 21:27:53 UTC (rev 207717)
@@ -1,3 +1,23 @@
+2016-10-22  Antti Koivisto  <an...@apple.com>
+
+        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):
+
 2016-10-22  Darin Adler  <da...@apple.com>
 
         Move SVG from ExceptionCode to Exception

Modified: trunk/Source/WebCore/style/StyleScope.cpp (207716 => 207717)


--- trunk/Source/WebCore/style/StyleScope.cpp	2016-10-22 20:56:47 UTC (rev 207716)
+++ trunk/Source/WebCore/style/StyleScope.cpp	2016-10-22 21:27:53 UTC (rev 207717)
@@ -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;

Modified: trunk/Source/WebCore/style/StyleScope.h (207716 => 207717)


--- trunk/Source/WebCore/style/StyleScope.h	2016-10-22 20:56:47 UTC (rev 207716)
+++ trunk/Source/WebCore/style/StyleScope.h	2016-10-22 21:27:53 UTC (rev 207717)
@@ -92,8 +92,8 @@
     // The change is assumed to potentially affect all author and user stylesheets including shadow roots.
     WEBCORE_EXPORT void didChangeStyleSheetEnvironment();
 
-    bool hasPendingUpdate() const { return !!m_pendingUpdate; }
-    WEBCORE_EXPORT void flushPendingUpdate();
+    bool hasPendingUpdate() const { return m_pendingUpdate || m_hasDescendantWithPendingUpdate; }
+    void flushPendingUpdate();
 
     StyleResolver& resolver();
     StyleResolver* resolverIfExists();
@@ -108,6 +108,9 @@
     void updateActiveStyleSheets(UpdateType);
     void scheduleUpdate(UpdateType);
 
+    WEBCORE_EXPORT void flushPendingSelfUpdate();
+    WEBCORE_EXPORT void flushPendingDescendantUpdates();
+
     void collectActiveStyleSheets(Vector<RefPtr<StyleSheet>>&);
 
     enum StyleResolverUpdateType {
@@ -141,6 +144,7 @@
     bool m_didUpdateActiveStyleSheets { false };
 
     Optional<UpdateType> m_pendingUpdate;
+    bool m_hasDescendantWithPendingUpdate { false };
 
     ListHashSet<Node*> m_styleSheetCandidateNodes;
 
@@ -150,5 +154,13 @@
     bool m_usesStyleBasedEditability { false };
 };
 
+inline void Scope::flushPendingUpdate()
+{
+    if (m_hasDescendantWithPendingUpdate)
+        flushPendingDescendantUpdates();
+    if (m_pendingUpdate)
+        flushPendingSelfUpdate();
 }
+
 }
+}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to