Title: [231318] trunk/Source/WebCore
Revision
231318
Author
za...@apple.com
Date
2018-05-03 11:39:44 -0700 (Thu, 03 May 2018)

Log Message

[LFC] Enable multiple layout roots for incremental layout.
https://bugs.webkit.org/show_bug.cgi?id=185185

Reviewed by Antti Koivisto.

With certain type of style changes, we can stop the box invalidation at the formatting context boundary.
When multiple boxes need updating in different formatting contexts, instead of marking the parent containing block chain all
the way up to a common ancestor, we could just work with a list of layout entry points per layout frame.

* layout/FormattingState.h:
* layout/LayoutContext.cpp:
(WebCore::Layout::LayoutContext::updateLayout):
(WebCore::Layout::LayoutContext::addLayoutEntryPoint):
* layout/LayoutContext.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (231317 => 231318)


--- trunk/Source/WebCore/ChangeLog	2018-05-03 18:39:13 UTC (rev 231317)
+++ trunk/Source/WebCore/ChangeLog	2018-05-03 18:39:44 UTC (rev 231318)
@@ -1,5 +1,22 @@
 2018-05-03  Zalan Bujtas  <za...@apple.com>
 
+        [LFC] Enable multiple layout roots for incremental layout.
+        https://bugs.webkit.org/show_bug.cgi?id=185185
+
+        Reviewed by Antti Koivisto.
+
+        With certain type of style changes, we can stop the box invalidation at the formatting context boundary.
+        When multiple boxes need updating in different formatting contexts, instead of marking the parent containing block chain all
+        the way up to a common ancestor, we could just work with a list of layout entry points per layout frame.
+
+        * layout/FormattingState.h:
+        * layout/LayoutContext.cpp:
+        (WebCore::Layout::LayoutContext::updateLayout):
+        (WebCore::Layout::LayoutContext::addLayoutEntryPoint):
+        * layout/LayoutContext.h:
+
+2018-05-03  Zalan Bujtas  <za...@apple.com>
+
         [LFC] Box invalidation logic should go to dedicated classes.
         https://bugs.webkit.org/show_bug.cgi?id=185249
 

Modified: trunk/Source/WebCore/layout/LayoutContext.cpp (231317 => 231318)


--- trunk/Source/WebCore/layout/LayoutContext.cpp	2018-05-03 18:39:13 UTC (rev 231317)
+++ trunk/Source/WebCore/layout/LayoutContext.cpp	2018-05-03 18:39:44 UTC (rev 231318)
@@ -51,9 +51,15 @@
 
 void LayoutContext::updateLayout()
 {
-    auto context = formattingContext(*m_root);
-    auto& state = establishedFormattingState(*m_root, *context);
-    context->layout(*this, state);
+    ASSERT(!m_formattingContextRootListForLayout.isEmpty());
+    for (auto layoutRoot : m_formattingContextRootListForLayout) {
+        RELEASE_ASSERT(layoutRoot.get());
+        RELEASE_ASSERT(layoutRoot->establishesFormattingContext());
+        auto context = formattingContext(*layoutRoot);
+        auto& state = establishedFormattingState(*layoutRoot, *context);
+        context->layout(*this, state);
+    }
+    m_formattingContextRootListForLayout.clear();
 }
 
 Display::Box& LayoutContext::createDisplayBox(const Box& layoutBox)

Modified: trunk/Source/WebCore/layout/LayoutContext.h (231317 => 231318)


--- trunk/Source/WebCore/layout/LayoutContext.h	2018-05-03 18:39:13 UTC (rev 231317)
+++ trunk/Source/WebCore/layout/LayoutContext.h	2018-05-03 18:39:44 UTC (rev 231318)
@@ -46,7 +46,8 @@
 // LayoutContext is the entry point for layout. It takes a (formatting root)container which acts as the root of the layout context.
 // LayoutContext::layout() generates the display tree for the root container's subtree (it does not run layout on the root though).
 // Note, while the root container is suppposed to be the entry point for the initial layout, it does not necessarily need to be the entry point of any
-// subsequent layouts (subtree layout).
+// subsequent layouts (subtree layout). A non-initial, subtree layout could be initiated on multiple formatting contexts.
+// Each formatting context has an entry point for layout, which potenitally means multiple entry points per layout frame.
 // LayoutContext also holds the formatting states. They cache formatting context specific data to enable performant incremental layouts.
 class LayoutContext {
     WTF_MAKE_ISO_ALLOCATED(LayoutContext);
@@ -75,6 +76,7 @@
 
 private:
     WeakPtr<Box> m_root;
+    Vector<WeakPtr<Box>> m_formattingContextRootListForLayout;
     HashMap<const Box*, std::unique_ptr<FormattingState>> m_formattingStates;
     HashMap<const Box*, std::unique_ptr<Display::Box>> m_layoutToDisplayBox;
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to