Title: [272300] trunk/Source/WebCore
Revision
272300
Author
[email protected]
Date
2021-02-02 23:35:00 -0800 (Tue, 02 Feb 2021)

Log Message

Remove the Timer from Style::Scope
https://bugs.webkit.org/show_bug.cgi?id=221221

Reviewed by Sam Weinig.

Just request a rendering update instead. It already flushes any pending style scope updates.

* style/StyleScope.cpp:
(WebCore::Style::Scope::Scope):
(WebCore::Style::Scope::clearPendingUpdate):
(WebCore::Style::Scope::scheduleUpdate):
(WebCore::Style::Scope::pendingUpdateTimerFired): Deleted.
* style/StyleScope.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (272299 => 272300)


--- trunk/Source/WebCore/ChangeLog	2021-02-03 07:14:23 UTC (rev 272299)
+++ trunk/Source/WebCore/ChangeLog	2021-02-03 07:35:00 UTC (rev 272300)
@@ -1,3 +1,19 @@
+2021-02-02  Antti Koivisto  <[email protected]>
+
+        Remove the Timer from Style::Scope
+        https://bugs.webkit.org/show_bug.cgi?id=221221
+
+        Reviewed by Sam Weinig.
+
+        Just request a rendering update instead. It already flushes any pending style scope updates.
+
+        * style/StyleScope.cpp:
+        (WebCore::Style::Scope::Scope):
+        (WebCore::Style::Scope::clearPendingUpdate):
+        (WebCore::Style::Scope::scheduleUpdate):
+        (WebCore::Style::Scope::pendingUpdateTimerFired): Deleted.
+        * style/StyleScope.h:
+
 2021-02-02  Simon Fraser  <[email protected]>
 
         Avoid a virtual function call in HTMLFormControlElement::isDisabledOrReadOnly()

Modified: trunk/Source/WebCore/dom/Element.cpp (272299 => 272300)


--- trunk/Source/WebCore/dom/Element.cpp	2021-02-03 07:14:23 UTC (rev 272299)
+++ trunk/Source/WebCore/dom/Element.cpp	2021-02-03 07:35:00 UTC (rev 272300)
@@ -3386,6 +3386,8 @@
 
 bool Element::isVisibleWithoutResolvingFullStyle() const
 {
+    document().styleScope().flushPendingUpdate();
+
     if (renderStyle() || hasValidStyle())
         return renderStyle() && renderStyle()->visibility() == Visibility::Visible;
 

Modified: trunk/Source/WebCore/style/StyleScope.cpp (272299 => 272300)


--- trunk/Source/WebCore/style/StyleScope.cpp	2021-02-03 07:14:23 UTC (rev 272299)
+++ trunk/Source/WebCore/style/StyleScope.cpp	2021-02-03 07:35:00 UTC (rev 272300)
@@ -60,7 +60,6 @@
 
 Scope::Scope(Document& document)
     : m_document(document)
-    , m_pendingUpdateTimer(*this, &Scope::pendingUpdateTimerFired)
 {
 }
 
@@ -67,7 +66,6 @@
 Scope::Scope(ShadowRoot& shadowRoot)
     : m_document(shadowRoot.documentScope())
     , m_shadowRoot(&shadowRoot)
-    , m_pendingUpdateTimer(*this, &Scope::pendingUpdateTimerFired)
 {
 }
 
@@ -553,8 +551,8 @@
     ASSERT(m_pendingUpdate);
 
     auto updateType = *m_pendingUpdate;
-
-    clearPendingUpdate();
+    m_pendingUpdate = { };
+    
     updateActiveStyleSheets(updateType);
 }
 
@@ -567,12 +565,6 @@
     m_hasDescendantWithPendingUpdate = false;
 }
 
-void Scope::clearPendingUpdate()
-{
-    m_pendingUpdateTimer.stop();
-    m_pendingUpdate = { };
-}
-
 void Scope::scheduleUpdate(UpdateType update)
 {
     if (update == UpdateType::ContentsOrInterpretation) {
@@ -592,9 +584,7 @@
             m_document.styleScope().m_hasDescendantWithPendingUpdate = true;
     }
 
-    if (m_pendingUpdateTimer.isActive())
-        return;
-    m_pendingUpdateTimer.startOneShot(0_s);
+    m_document.scheduleRenderingUpdate({ });
 }
 
 void Scope::evaluateMediaQueriesForViewportChange()
@@ -680,12 +670,6 @@
         resolver->invalidateMatchedDeclarationsCache();
 }
 
-
-void Scope::pendingUpdateTimerFired()
-{
-    flushPendingUpdate();
-}
-
 const Vector<RefPtr<StyleSheet>>& Scope::styleSheetsForStyleSheetList()
 {
     // FIXME: StyleSheetList content should be updated separately from style resolver updates.

Modified: trunk/Source/WebCore/style/StyleScope.h (272299 => 272300)


--- trunk/Source/WebCore/style/StyleScope.h	2021-02-03 07:14:23 UTC (rev 272299)
+++ trunk/Source/WebCore/style/StyleScope.h	2021-02-03 07:35:00 UTC (rev 272300)
@@ -160,9 +160,6 @@
 
     void updateResolver(Vector<RefPtr<CSSStyleSheet>>&, ResolverUpdateType);
 
-    void pendingUpdateTimerFired();
-    void clearPendingUpdate();
-
     Document& m_document;
     ShadowRoot* m_shadowRoot { nullptr };
 
@@ -171,8 +168,6 @@
     Vector<RefPtr<StyleSheet>> m_styleSheetsForStyleSheetList;
     Vector<RefPtr<CSSStyleSheet>> m_activeStyleSheets;
 
-    Timer m_pendingUpdateTimer;
-
     mutable std::unique_ptr<HashSet<const CSSStyleSheet*>> m_weakCopyOfActiveStyleSheetListForFastLookup;
 
     // Track the currently loading top-level stylesheets needed for rendering.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to