Title: [252735] trunk/Source/WebCore
Revision
252735
Author
[email protected]
Date
2019-11-21 08:32:09 -0800 (Thu, 21 Nov 2019)

Log Message

[LFC] Add support for LFC layout only.
https://bugs.webkit.org/show_bug.cgi?id=204441
<rdar://problem/57382929>

Reviewed by Antti Koivisto.

Clean up the render tree state when RenderView::layout is not called.

* page/FrameViewLayoutContext.cpp:
(WebCore::FrameViewLayoutContext::layoutUsingFormattingContext):
* rendering/updating/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::updateRendererStyle):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (252734 => 252735)


--- trunk/Source/WebCore/ChangeLog	2019-11-21 16:21:45 UTC (rev 252734)
+++ trunk/Source/WebCore/ChangeLog	2019-11-21 16:32:09 UTC (rev 252735)
@@ -1,3 +1,18 @@
+2019-11-21  Zalan Bujtas  <[email protected]>
+
+        [LFC] Add support for LFC layout only.
+        https://bugs.webkit.org/show_bug.cgi?id=204441
+        <rdar://problem/57382929>
+
+        Reviewed by Antti Koivisto.
+
+        Clean up the render tree state when RenderView::layout is not called.
+
+        * page/FrameViewLayoutContext.cpp:
+        (WebCore::FrameViewLayoutContext::layoutUsingFormattingContext):
+        * rendering/updating/RenderTreeUpdater.cpp:
+        (WebCore::RenderTreeUpdater::updateRendererStyle):
+
 2019-11-21  Andres Gonzalez  <[email protected]>
 
         Support boundingBoxRect and elementRect in AXIsolatedObject.

Modified: trunk/Source/WebCore/page/FrameViewLayoutContext.cpp (252734 => 252735)


--- trunk/Source/WebCore/page/FrameViewLayoutContext.cpp	2019-11-21 16:21:45 UTC (rev 252734)
+++ trunk/Source/WebCore/page/FrameViewLayoutContext.cpp	2019-11-21 16:32:09 UTC (rev 252735)
@@ -40,11 +40,13 @@
 #include "ScriptDisallowedScope.h"
 #include "Settings.h"
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+#include "DisplayBox.h"
 #include "InvalidationContext.h"
 #include "InvalidationState.h"
 #include "LayoutContext.h"
 #include "LayoutState.h"
 #include "LayoutTreeBuilder.h"
+#include "RenderDescendantIterator.h"
 #endif
 
 #include <wtf/SetForScope.h>
@@ -59,8 +61,9 @@
     if (!RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextEnabled())
         return;
 
+    auto& renderView = *this->renderView();
     if (!m_layoutTreeContent) {
-        m_layoutTreeContent = Layout::TreeBuilder::buildLayoutTree(*renderView());
+        m_layoutTreeContent = Layout::TreeBuilder::buildLayoutTree(renderView);
         // FIXME: New layout tree requires a new state for now.
         m_layoutState = nullptr;
     }
@@ -73,7 +76,19 @@
     invalidationContext.styleChanged(*m_layoutState->root().firstChild(), StyleDifference::Layout);
 
     auto layoutContext = Layout::LayoutContext { *m_layoutState };
-    layoutContext.layout(renderView()->size(), invalidationState);
+    layoutContext.layout(view().layoutSize(), invalidationState);
+
+    // Clean up the render tree state when we don't run RenderView::layout.
+    if (renderView.needsLayout()) {
+        auto contentSize = m_layoutState->displayBoxForLayoutBox(*m_layoutState->root().firstChild()).size();
+        renderView.setSize(contentSize);
+        renderView.repaintViewRectangle({ 0, 0, contentSize.width(), contentSize.height() });
+
+        for (auto& descendant : descendantsOfType<RenderObject>(renderView))
+            descendant.clearNeedsLayout();
+        renderView.clearNeedsLayout();
+    }
+
 #ifndef NDEBUG
     Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree(*m_layoutState);
 #endif

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp (252734 => 252735)


--- trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp	2019-11-21 16:21:45 UTC (rev 252734)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp	2019-11-21 16:32:09 UTC (rev 252735)
@@ -297,7 +297,7 @@
     m_builder.normalizeTreeAfterStyleChange(renderer, oldStyle);
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
     if (RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextEnabled()) {
-        if (!m_document.view() || !m_document.view()->layoutContext().layoutFormattingState())
+        if (!m_document.view() || !m_document.view()->layoutContext().layoutTreeContent())
             return;
         if (auto* layoutBox = m_document.view()->layoutContext().layoutTreeContent()->layoutBoxForRenderer(renderer))
             layoutBox->updateStyle(renderer.style());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to