Title: [273415] trunk/Source/WebCore
Revision
273415
Author
an...@apple.com
Date
2021-02-24 11:43:35 -0800 (Wed, 24 Feb 2021)

Log Message

Move PostResolutionCallbackDisabler to resolveComputedStyle
https://bugs.webkit.org/show_bug.cgi?id=222350

Reviewed by Ryosuke Niwa.

It can be constructed and deleted repeatedly in styleForElementIgnoringPendingStylesheets when
resolveComputedStyle calls it in a loop.

* dom/Document.cpp:
(WebCore::Document::styleForElementIgnoringPendingStylesheets):
* dom/Element.cpp:
(WebCore::Element::resolveComputedStyle):
(WebCore::Element::resolvePseudoElementStyle):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (273414 => 273415)


--- trunk/Source/WebCore/ChangeLog	2021-02-24 19:41:52 UTC (rev 273414)
+++ trunk/Source/WebCore/ChangeLog	2021-02-24 19:43:35 UTC (rev 273415)
@@ -1,3 +1,19 @@
+2021-02-24  Antti Koivisto  <an...@apple.com>
+
+        Move PostResolutionCallbackDisabler to resolveComputedStyle
+        https://bugs.webkit.org/show_bug.cgi?id=222350
+
+        Reviewed by Ryosuke Niwa.
+
+        It can be constructed and deleted repeatedly in styleForElementIgnoringPendingStylesheets when
+        resolveComputedStyle calls it in a loop.
+
+        * dom/Document.cpp:
+        (WebCore::Document::styleForElementIgnoringPendingStylesheets):
+        * dom/Element.cpp:
+        (WebCore::Element::resolveComputedStyle):
+        (WebCore::Element::resolvePseudoElementStyle):
+
 2021-02-24  Said Abou-Hallawa  <s...@apple.com>
 
         [GPU Process] In process DisplayList display should have a higher precedence than GPUP display

Modified: trunk/Source/WebCore/dom/Document.cpp (273414 => 273415)


--- trunk/Source/WebCore/dom/Document.cpp	2021-02-24 19:41:52 UTC (rev 273414)
+++ trunk/Source/WebCore/dom/Document.cpp	2021-02-24 19:43:35 UTC (rev 273415)
@@ -2207,10 +2207,8 @@
     ASSERT(&element.document() == this);
     ASSERT(!element.isPseudoElement() || pseudoElementSpecifier == PseudoId::None);
     ASSERT(pseudoElementSpecifier == PseudoId::None || parentStyle);
+    ASSERT(Style::postResolutionCallbacksAreSuspended());
 
-    // On iOS request delegates called during styleForElement may result in re-entering WebKit and killing the style resolver.
-    Style::PostResolutionCallbackDisabler disabler(*this, Style::PostResolutionCallbackDisabler::DrainCallbacks::No);
-
     SetForScope<bool> change(m_ignorePendingStylesheets, true);
     auto& resolver = element.styleResolver();
 

Modified: trunk/Source/WebCore/dom/Element.cpp (273414 => 273415)


--- trunk/Source/WebCore/dom/Element.cpp	2021-02-24 19:41:52 UTC (rev 273414)
+++ trunk/Source/WebCore/dom/Element.cpp	2021-02-24 19:43:35 UTC (rev 273415)
@@ -3355,6 +3355,9 @@
         elementsRequiringComputedStyle.prepend(&ancestor);
     }
 
+    // On iOS request delegates called during styleForElement may result in re-entering WebKit and killing the style resolver.
+    Style::PostResolutionCallbackDisabler disabler(document(), Style::PostResolutionCallbackDisabler::DrainCallbacks::No);
+
     // Resolve and cache styles starting from the most distant ancestor.
     for (auto& element : elementsRequiringComputedStyle) {
         auto style = document().styleForElementIgnoringPendingStylesheets(*element, computedStyle);
@@ -3425,6 +3428,8 @@
     ASSERT(parentStyle);
     ASSERT(!parentStyle->getCachedPseudoStyle(pseudoElementSpecifier));
 
+    Style::PostResolutionCallbackDisabler disabler(document(), Style::PostResolutionCallbackDisabler::DrainCallbacks::No);
+
     auto style = document().styleForElementIgnoringPendingStylesheets(*this, parentStyle, pseudoElementSpecifier);
     if (!style) {
         style = RenderStyle::createPtr();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to