Title: [293039] trunk

Diff

Modified: trunk/LayoutTests/ChangeLog (293038 => 293039)


--- trunk/LayoutTests/ChangeLog	2022-04-19 21:53:42 UTC (rev 293038)
+++ trunk/LayoutTests/ChangeLog	2022-04-19 22:04:46 UTC (rev 293039)
@@ -1,3 +1,17 @@
+2022-04-19  Commit Queue  <[email protected]>
+
+        Unreviewed, reverting r292947.
+        https://bugs.webkit.org/show_bug.cgi?id=239520
+
+        Introduced new assertion failures
+
+        Reverted changeset:
+
+        "Make release assertion in Document::updateLayout more precise
+        for FrameSelection::setSelection"
+        https://bugs.webkit.org/show_bug.cgi?id=239431
+        https://commits.webkit.org/r292947
+
 2022-04-19  Ricky Mondello  <[email protected]>
 
         Update in-field icons for credential fields

Modified: trunk/LayoutTests/accessibility/mac/focus-setting-selection-syncronizing-not-clearing-expected.txt (293038 => 293039)


--- trunk/LayoutTests/accessibility/mac/focus-setting-selection-syncronizing-not-clearing-expected.txt	2022-04-19 21:53:42 UTC (rev 293038)
+++ trunk/LayoutTests/accessibility/mac/focus-setting-selection-syncronizing-not-clearing-expected.txt	2022-04-19 22:04:46 UTC (rev 293039)
@@ -7,9 +7,9 @@
 
 
 PASS addedNotification is true
+PASS axTextStateSyncOne is undefined
+PASS accessibilityController.accessibleElementById("1").isFocusable is true
 PASS accessibilityController.focusedElement.isEqual(accessibilityController.accessibleElementById("1")) is true
-PASS axTextStateSyncOne is undefined
-PASS accessibleElement1WasFocusable is true
 PASS axTextStateSyncTwo is undefined
 PASS successfullyParsed is true
 

Modified: trunk/LayoutTests/accessibility/mac/focus-setting-selection-syncronizing-not-clearing.html (293038 => 293039)


--- trunk/LayoutTests/accessibility/mac/focus-setting-selection-syncronizing-not-clearing.html	2022-04-19 21:53:42 UTC (rev 293038)
+++ trunk/LayoutTests/accessibility/mac/focus-setting-selection-syncronizing-not-clearing.html	2022-04-19 22:04:46 UTC (rev 293039)
@@ -26,7 +26,6 @@
 
     var webArea = 0;
     var axTextStateSyncOne = 0;
-    var accessibleElement1WasFocusable = false;
     var axTextStateSyncTwo = 0;
     var selectCount = 0;
     var focusCount = 0;
@@ -40,10 +39,13 @@
             selectCount++;
             if (selectCount == 1) {
                 axTextStateSyncOne = userInfo["AXTextStateSync"];
-                accessibleElement1WasFocusable = accessibilityController.accessibleElementById("1").isFocusable;
+                shouldBe("axTextStateSyncOne", "undefined");
+
+                shouldBe("accessibilityController.accessibleElementById(\"1\").isFocusable", "true");
                 accessibilityController.accessibleElementById("1").takeFocus();
             } else if (selectCount == 2) {
                 axTextStateSyncTwo = userInfo["AXTextStateSync"];
+                shouldBe("axTextStateSyncTwo", "undefined");
             }
         } else if (notification == "AXFocusChanged") {
             focusCount++;
@@ -53,12 +55,7 @@
         }
         if (selectCount == 2 && focusCount == 3) {
             webArea.removeNotificationListener();
-            setTimeout(() => {
-                shouldBe("axTextStateSyncOne", "undefined");
-                shouldBe("accessibleElement1WasFocusable", "true");
-                shouldBe("axTextStateSyncTwo", "undefined");
-                finishJSTest();
-            }, 0);
+            finishJSTest();
         }
     }
 

Modified: trunk/LayoutTests/accessibility/mac/selection-change-userinfo.html (293038 => 293039)


--- trunk/LayoutTests/accessibility/mac/selection-change-userinfo.html	2022-04-19 21:53:42 UTC (rev 293038)
+++ trunk/LayoutTests/accessibility/mac/selection-change-userinfo.html	2022-04-19 22:04:46 UTC (rev 293039)
@@ -43,12 +43,7 @@
             count++;
             if (userInfo)
                 results.push(userInfo);
-            if (count != gran.length * 4)
-                return;
-
-            webArea.removeNotificationListener();
-
-            setTimeout(() => {
+            if (count == gran.length * 4) {
                 resultIndex++;
                 shouldBe("results[resultIndex][\"AXTextStateChangeType\"]", "AXTextStateChangeTypeSelectionMove");
                 shouldBe("results[resultIndex][\"AXTextSelectionGranularity\"]", "AXTextSelectionGranularityCharacter");
@@ -184,8 +179,9 @@
                 shouldBe("results[resultIndex][\"AXTextSelectionGranularity\"]", "AXTextSelectionGranularityDocument");
                 shouldBe("results[resultIndex][\"AXTextSelectionDirection\"]", "AXTextSelectionDirectionEnd");
 
+                webArea.removeNotificationListener();
                 finishJSTest();
-            }, 0);
+            }
         }
     }
 

Modified: trunk/LayoutTests/accessibility/mac/selection-sync.html (293038 => 293039)


--- trunk/LayoutTests/accessibility/mac/selection-sync.html	2022-04-19 21:53:42 UTC (rev 293038)
+++ trunk/LayoutTests/accessibility/mac/selection-sync.html	2022-04-19 22:04:46 UTC (rev 293039)
@@ -31,12 +31,7 @@
             count++;
             if (userInfo)
                 results.push(userInfo);
-            if (count != 5)
-                return;
-
-            webArea.removeNotificationListener();
-
-            setTimeout(() => {
+            if (count == 5) {
                 shouldBe("results[resultIndex][\"AXTextStateChangeType\"]", "AXTextStateChangeTypeSelectionMove");
                 shouldBe("results[resultIndex][\"AXTextSelectionDirection\"]", "AXTextSelectionDirectionDiscontiguous");
                 shouldBe("results[resultIndex][\"AXTextStateSync\"]", "true");
@@ -61,8 +56,9 @@
                 shouldBe("results[resultIndex][\"AXTextSelectionDirection\"]", "AXTextSelectionDirectionDiscontiguous");
                 shouldBe("results[resultIndex][\"AXTextStateSync\"]", "true");
 
+                webArea.removeNotificationListener();
                 finishJSTest();
-            }, 0);
+            }
         }
     }
 

Modified: trunk/LayoutTests/accessibility/mac/selection-value-changes-for-aria-textbox.html (293038 => 293039)


--- trunk/LayoutTests/accessibility/mac/selection-value-changes-for-aria-textbox.html	2022-04-19 21:53:42 UTC (rev 293038)
+++ trunk/LayoutTests/accessibility/mac/selection-value-changes-for-aria-textbox.html	2022-04-19 22:04:46 UTC (rev 293039)
@@ -18,18 +18,14 @@
     description("This tests that ARIA removing an element from a live region sends the correct notification.");
 
     var axTextbox = 0;
-    var result = '';
     function notificationCallback(notification) {
         if (notification == "AXValueChanged") {
-           result += "Successfully received " + notification + "<br>";
+           document.getElementById("notifications").innerHTML += "Successfully received " + notification + "<br>";
            axTextbox.removeNotificationListener();
-           setTimeout(() => {
-               document.getElementById("notifications").innerHTML += result;
-              finishJSTest();
-           }, 0);
+           finishJSTest();
         }
         else if (notification == "AXSelectedTextChanged") {
-           result += "Successfully received " + notification + "<br>";
+           document.getElementById("notifications").innerHTML += "Successfully received " + notification + "<br>";
         }
     }
 

Deleted: trunk/LayoutTests/fast/forms/textarea-selection-update-during-DOMNodeRemoved-crash-expected.txt (293038 => 293039)


--- trunk/LayoutTests/fast/forms/textarea-selection-update-during-DOMNodeRemoved-crash-expected.txt	2022-04-19 21:53:42 UTC (rev 293038)
+++ trunk/LayoutTests/fast/forms/textarea-selection-update-during-DOMNodeRemoved-crash-expected.txt	2022-04-19 22:04:46 UTC (rev 293039)
@@ -1,3 +0,0 @@
-This tests updating selection within DOMNodeRemoved. WebKit should not hit any release assertions.
-
-PASS

Deleted: trunk/LayoutTests/fast/forms/textarea-selection-update-during-DOMNodeRemoved-crash.html (293038 => 293039)


--- trunk/LayoutTests/fast/forms/textarea-selection-update-during-DOMNodeRemoved-crash.html	2022-04-19 21:53:42 UTC (rev 293038)
+++ trunk/LayoutTests/fast/forms/textarea-selection-update-during-DOMNodeRemoved-crash.html	2022-04-19 22:04:46 UTC (rev 293039)
@@ -1,33 +0,0 @@
-<script>
-if (window.testRunner) {
-    testRunner.dumpAsText();
-    testRunner.waitUntilDone();
-}
-
-setTimeout(() => {
-    textarea1.selectionStart = 1;
-
-    span2.appendChild(textarea1);
-    document.documentElement.appendChild(canvas1);
-
-    textarea1.addEventListener("DOMNodeRemoved", () => {
-        other1.appendChild(span1);
-        textarea1.selectionStart = -1;
-        document.getSelection().collapse(span1);
-    });
-
-    textarea1.innerHTML = '';
-
-    document.body.innerHTML = '<p>This tests updating selection within DOMNodeRemoved. WebKit should not hit any release assertions.</p>PASS';
-
-    if (window.testRunner)
-        testRunner.notifyDone();
-}, 0);
-</script>
-<textarea id="textarea1">hello</textarea>
-<canvas id="canvas1"><other-element id="other1"></other-element></canvas>
-<span id="span1">
-    <audio controls="controls" src=""
-        <span id="span2">G&#x27;lzKsb6[Xava</span>
-    </audio>
-</span>

Modified: trunk/Source/WebCore/ChangeLog (293038 => 293039)


--- trunk/Source/WebCore/ChangeLog	2022-04-19 21:53:42 UTC (rev 293038)
+++ trunk/Source/WebCore/ChangeLog	2022-04-19 22:04:46 UTC (rev 293039)
@@ -1,3 +1,17 @@
+2022-04-19  Commit Queue  <[email protected]>
+
+        Unreviewed, reverting r292947.
+        https://bugs.webkit.org/show_bug.cgi?id=239520
+
+        Introduced new assertion failures
+
+        Reverted changeset:
+
+        "Make release assertion in Document::updateLayout more precise
+        for FrameSelection::setSelection"
+        https://bugs.webkit.org/show_bug.cgi?id=239431
+        https://commits.webkit.org/r292947
+
 2022-04-19  Ricky Mondello  <[email protected]>
 
         Update in-field icons for credential fields

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (293038 => 293039)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2022-04-19 21:53:42 UTC (rev 293038)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2022-04-19 22:04:46 UTC (rev 293039)
@@ -3281,7 +3281,6 @@
 		9B27FC60234D9ADB00394A46 /* WindowEventLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B27FC5E234D9ADA00394A46 /* WindowEventLoop.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		9B2D8A7914997CCF00ECEF3E /* UndoStep.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B2D8A7814997CCF00ECEF3E /* UndoStep.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		9B32CDA913DF7FA900F34D13 /* RenderedPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B32CDA713DF7FA900F34D13 /* RenderedPosition.h */; };
-		9B33DF8628090B5600ECFAE7 /* UpToDateLayoutScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B33DF8428090B5600ECFAE7 /* UpToDateLayoutScope.h */; };
 		9B417064125662B3006B28FC /* ApplyBlockElementCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B417062125662B3006B28FC /* ApplyBlockElementCommand.h */; };
 		9B50B1DE17CD4C0F0087F63C /* FormNamedItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B50B1DC17CD4C0F0087F63C /* FormNamedItem.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		9B532EA41BA928570038A827 /* SlotAssignment.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B532EA21BA928570038A827 /* SlotAssignment.h */; };
@@ -13467,7 +13466,6 @@
 		9B2D8A7814997CCF00ECEF3E /* UndoStep.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UndoStep.h; sourceTree = "<group>"; };
 		9B32CDA713DF7FA900F34D13 /* RenderedPosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderedPosition.h; sourceTree = "<group>"; };
 		9B32CDA813DF7FA900F34D13 /* RenderedPosition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderedPosition.cpp; sourceTree = "<group>"; };
-		9B33DF8428090B5600ECFAE7 /* UpToDateLayoutScope.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UpToDateLayoutScope.h; sourceTree = "<group>"; };
 		9B417062125662B3006B28FC /* ApplyBlockElementCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplyBlockElementCommand.h; sourceTree = "<group>"; };
 		9B417063125662B3006B28FC /* ApplyBlockElementCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ApplyBlockElementCommand.cpp; sourceTree = "<group>"; };
 		9B4376EF2117E872009D03A0 /* ThrowOnDynamicMarkupInsertionCountIncrementer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ThrowOnDynamicMarkupInsertionCountIncrementer.h; sourceTree = "<group>"; };
@@ -32431,7 +32429,6 @@
 				1C18DA57181AF6A500C4EF22 /* TextPainter.h */,
 				E4C91A0F1802343900A17F6D /* TextPaintStyle.cpp */,
 				E4C91A0D1802343100A17F6D /* TextPaintStyle.h */,
-				9B33DF8428090B5600ECFAE7 /* UpToDateLayoutScope.h */,
 				BCA257141293C010007A263D /* VerticalPositionCache.h */,
 			);
 			path = rendering;
@@ -38051,7 +38048,6 @@
 				C18CC0A42580EFB1003D75FB /* UniversalAccessZoom.h in Headers */,
 				D086FE9809D53AAB005BC74D /* UnlinkCommand.h in Headers */,
 				FD1762E0176686D900D836A8 /* UpSampler.h in Headers */,
-				9B33DF8628090B5600ECFAE7 /* UpToDateLayoutScope.h in Headers */,
 				93D437A21D57B3FE00AB85EA /* URLDecomposition.h in Headers */,
 				267726051A5DF6F2003C24DD /* URLFilterParser.h in Headers */,
 				F55B3DDE1251F12D003EF269 /* URLInputType.h in Headers */,

Modified: trunk/Source/WebCore/dom/Document.cpp (293038 => 293039)


--- trunk/Source/WebCore/dom/Document.cpp	2022-04-19 21:53:42 UTC (rev 293038)
+++ trunk/Source/WebCore/dom/Document.cpp	2022-04-19 22:04:46 UTC (rev 293039)
@@ -252,7 +252,6 @@
 #include "TransformSource.h"
 #include "TreeWalker.h"
 #include "UndoManager.h"
-#include "UpToDateLayoutScope.h"
 #include "UserGestureIndicator.h"
 #include "ValidationMessageClient.h"
 #include "VisibilityChangeClient.h"
@@ -1978,7 +1977,6 @@
     if (m_styleRecalcTimer.isActive() || backForwardCacheState() != NotInBackForwardCache)
         return;
 
-    RELEASE_ASSERT(!m_upToDateLayoutScopeCount);
     ASSERT(childNeedsStyleRecalc() || m_needsFullStyleRebuild);
 
     m_styleRecalcTimer.startOneShot(0_s);
@@ -2226,10 +2224,8 @@
         ASSERT_NOT_REACHED();
         return;
     }
+    RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(isSafeToUpdateStyleOrLayout(*this));
 
-    bool safeToUpdateStyleOrLayout = isSafeToUpdateStyleOrLayout(*this);
-    RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(safeToUpdateStyleOrLayout || (m_upToDateLayoutScopeCount && !UpToDateLayoutScope::needsLayout(*this)));
-
     RenderView::RepaintRegionAccumulator repaintRegionAccumulator(renderView());
 
     if (RefPtr owner = ownerElement())
@@ -2244,9 +2240,6 @@
     if (!frameView->layoutContext().isLayoutPending() && !renderView()->needsLayout())
         return;
 
-    // needsLayout may have changed.
-    RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(safeToUpdateStyleOrLayout);
-
     frameView->layoutContext().layout();
 
     Style::Scope::QueryContainerUpdateContext queryContainerUpdateContext;

Modified: trunk/Source/WebCore/dom/Document.h (293038 => 293039)


--- trunk/Source/WebCore/dom/Document.h	2022-04-19 21:53:42 UTC (rev 293038)
+++ trunk/Source/WebCore/dom/Document.h	2022-04-19 22:04:46 UTC (rev 293039)
@@ -621,11 +621,7 @@
     unsigned lastStyleUpdateSizeForTesting() const { return m_lastStyleUpdateSizeForTesting; }
 
     WEBCORE_EXPORT void updateLayout();
-
-    unsigned upToDateLayoutScopeCount() const { return m_upToDateLayoutScopeCount; }
-    void incrementUpToDateLayoutScopeCount() { ++m_upToDateLayoutScopeCount; }
-    void decrementUpToDateLayoutScopeCount() { ASSERT(m_upToDateLayoutScopeCount); --m_upToDateLayoutScopeCount; }
-
+    
     // updateLayoutIgnorePendingStylesheets() forces layout even if we are waiting for pending stylesheet loads,
     // so calling this may cause a flash of unstyled content (FOUC).
     enum class RunPostLayoutTasks { Asynchronously, Synchronously };
@@ -2111,8 +2107,6 @@
 
     unsigned m_writeRecursionDepth { 0 };
 
-    unsigned m_upToDateLayoutScopeCount { 0 };
-
     InheritedBool m_designMode { inherit };
     MediaProducerMediaStateFlags m_mediaState;
     bool m_userHasInteractedWithMediaElement { false };

Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (293038 => 293039)


--- trunk/Source/WebCore/editing/FrameSelection.cpp	2022-04-19 21:53:42 UTC (rev 293038)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp	2022-04-19 22:04:46 UTC (rev 293039)
@@ -73,7 +73,6 @@
 #include "StyleProperties.h"
 #include "StyleTreeResolver.h"
 #include "TypingCommand.h"
-#include "UpToDateLayoutScope.h"
 #include "VisibleUnits.h"
 #include <stdio.h>
 #include <wtf/text/CString.h>
@@ -448,10 +447,13 @@
     m_selectionRevealIntent = intent;
     m_pendingSelectionUpdate = true;
 
-    auto layoutScope = UpToDateLayoutScope::scopeIfLayoutIsUpToUpdate(*protectedDocument);
-    if (!layoutScope)
+    if (protectedDocument->hasPendingStyleRecalc())
         return;
 
+    auto frameView = protectedDocument->view();
+    if (frameView && frameView->layoutContext().isLayoutPending())
+        return;
+
     updateAndRevealSelection(intent, options.contains(SmoothScroll) ? ScrollBehavior::Smooth : ScrollBehavior::Instant, options.contains(RevealSelectionBounds) ? RevealExtentOption::DoNotRevealExtent : RevealExtentOption::RevealExtent);
 
     if (options & IsUserTriggered) {

Modified: trunk/Source/WebCore/page/FrameViewLayoutContext.cpp (293038 => 293039)


--- trunk/Source/WebCore/page/FrameViewLayoutContext.cpp	2022-04-19 21:53:42 UTC (rev 293038)
+++ trunk/Source/WebCore/page/FrameViewLayoutContext.cpp	2022-04-19 22:04:46 UTC (rev 293039)
@@ -373,8 +373,6 @@
     // too many false assertions. See <rdar://problem/7218118>.
     ASSERT(frame().view() == &view());
 
-    RELEASE_ASSERT(!frame().document()->upToDateLayoutScopeCount());
-
     if (subtreeLayoutRoot())
         convertSubtreeLayoutToFullLayout();
     if (!isLayoutSchedulingEnabled())

Modified: trunk/Source/WebCore/rendering/RenderObject.h (293038 => 293039)


--- trunk/Source/WebCore/rendering/RenderObject.h	2022-04-19 21:53:42 UTC (rev 293038)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2022-04-19 22:04:46 UTC (rev 293039)
@@ -1166,7 +1166,7 @@
 inline bool RenderObject::isSetNeedsLayoutForbidden() const
 {
 #if ASSERT_ENABLED
-    return m_setNeedsLayoutForbidden || document().upToDateLayoutScopeCount();
+    return m_setNeedsLayoutForbidden;
 #else
     return false;
 #endif

Deleted: trunk/Source/WebCore/rendering/UpToDateLayoutScope.h (293038 => 293039)


--- trunk/Source/WebCore/rendering/UpToDateLayoutScope.h	2022-04-19 21:53:42 UTC (rev 293038)
+++ trunk/Source/WebCore/rendering/UpToDateLayoutScope.h	2022-04-19 22:04:46 UTC (rev 293039)
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2022 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "Document.h"
-#include "FrameView.h"
-#include "RenderView.h"
-
-namespace WebCore {
-
-class UpToDateLayoutScope {
-    WTF_MAKE_NONCOPYABLE(UpToDateLayoutScope);
-public:
-    UpToDateLayoutScope(Document& document)
-        : m_document { &document }
-    {
-        m_document->incrementUpToDateLayoutScopeCount();
-        RELEASE_ASSERT(!needsLayout(document));
-    }
-    
-    UpToDateLayoutScope(UpToDateLayoutScope&& source)
-        : m_document { std::exchange(source.m_document, nullptr) }
-    {
-    }
-
-    ~UpToDateLayoutScope()
-    {
-        if (m_document)
-            m_document->decrementUpToDateLayoutScopeCount();
-    }
-
-    static std::optional<UpToDateLayoutScope> scopeIfLayoutIsUpToUpdate(Document& document)
-    {
-        if (needsLayout(document))
-            return std::nullopt;
-        return UpToDateLayoutScope { document };
-    }
-
-    static bool needsLayout(Document& document)
-    {
-        if (document.needsStyleRecalc())
-            return true;
-        RefPtr frameView = document.view();
-        return frameView && frameView->layoutContext().needsLayout();
-    }
-
-private:
-    RefPtr<Document> m_document;
-};
-
-}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to