Title: [252483] trunk/Source/WebCore
Revision
252483
Author
[email protected]
Date
2019-11-15 07:41:25 -0800 (Fri, 15 Nov 2019)

Log Message

[LFC][Invalidation] Introduce LayoutBox::updateStyle
https://bugs.webkit.org/show_bug.cgi?id=204224
<rdar://problem/57226354>

Reviewed by Antti Koivisto.

This is in preparation for being able to do incremental layouts on partial style change (currently we re-build the tree on each layout frame).

* layout/LayoutState.h:
(WebCore::Layout::LayoutState::layoutBoxForRenderer const):
* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::updateStyle):
* layout/layouttree/LayoutBox.h:
* rendering/updating/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::updateRendererStyle):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (252482 => 252483)


--- trunk/Source/WebCore/ChangeLog	2019-11-15 14:26:06 UTC (rev 252482)
+++ trunk/Source/WebCore/ChangeLog	2019-11-15 15:41:25 UTC (rev 252483)
@@ -1,5 +1,23 @@
 2019-11-15  Zalan Bujtas  <[email protected]>
 
+        [LFC][Invalidation] Introduce LayoutBox::updateStyle
+        https://bugs.webkit.org/show_bug.cgi?id=204224
+        <rdar://problem/57226354>
+
+        Reviewed by Antti Koivisto.
+
+        This is in preparation for being able to do incremental layouts on partial style change (currently we re-build the tree on each layout frame).
+
+        * layout/LayoutState.h:
+        (WebCore::Layout::LayoutState::layoutBoxForRenderer const):
+        * layout/layouttree/LayoutBox.cpp:
+        (WebCore::Layout::Box::updateStyle):
+        * layout/layouttree/LayoutBox.h:
+        * rendering/updating/RenderTreeUpdater.cpp:
+        (WebCore::RenderTreeUpdater::updateRendererStyle):
+
+2019-11-15  Zalan Bujtas  <[email protected]>
+
         [LFC][Invalidation] Add a temporary RenderObject to Layout::Box map
         https://bugs.webkit.org/show_bug.cgi?id=204218
         <rdar://problem/57215201>

Modified: trunk/Source/WebCore/layout/LayoutState.h (252482 => 252483)


--- trunk/Source/WebCore/layout/LayoutState.h	2019-11-15 14:26:06 UTC (rev 252482)
+++ trunk/Source/WebCore/layout/LayoutState.h	2019-11-15 15:41:25 UTC (rev 252483)
@@ -74,6 +74,8 @@
 
     const Container& root() const { return *m_layoutTreeContent.rootLayoutBox; }
 
+    Box* layoutBoxForRenderer(const RenderObject& renderer) const { return m_layoutTreeContent.renderObjectToLayoutBox.get(&renderer); }
+
 private:
     HashMap<const Container*, std::unique_ptr<FormattingState>> m_formattingStates;
 #ifndef NDEBUG

Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp (252482 => 252483)


--- trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp	2019-11-15 14:26:06 UTC (rev 252482)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp	2019-11-15 15:41:25 UTC (rev 252483)
@@ -65,6 +65,11 @@
     removeRareData();
 }
 
+void Box::updateStyle(const RenderStyle& newStyle)
+{
+    m_style = RenderStyle::clone(newStyle);
+}
+
 bool Box::establishesFormattingContext() const
 {
     // We need the final tree structure to tell whether a box establishes a certain formatting context. 

Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.h (252482 => 252483)


--- trunk/Source/WebCore/layout/layouttree/LayoutBox.h	2019-11-15 14:26:06 UTC (rev 252482)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.h	2019-11-15 15:41:25 UTC (rev 252483)
@@ -136,6 +136,7 @@
     bool isPaddingApplicable() const;
     bool isOverflowVisible() const;
 
+    void updateStyle(const RenderStyle& newStyle);
     const RenderStyle& style() const { return m_style; }
 
     const Replaced* replaced() const;

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp (252482 => 252483)


--- trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp	2019-11-15 14:26:06 UTC (rev 252482)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp	2019-11-15 15:41:25 UTC (rev 252483)
@@ -45,10 +45,17 @@
 #include "RenderMultiColumnFlow.h"
 #include "RenderMultiColumnSet.h"
 #include "RenderTreeUpdaterGeneratedContent.h"
+#include "RuntimeEnabledFeatures.h"
 #include "StyleResolver.h"
 #include "StyleTreeResolver.h"
 #include <wtf/SystemTracing.h>
 
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+#include "FrameView.h"
+#include "FrameViewLayoutContext.h"
+#include "LayoutState.h"
+#endif
+
 #if PLATFORM(IOS_FAMILY)
 #include "ContentChangeObserver.h"
 #endif
@@ -288,6 +295,14 @@
     auto oldStyle = RenderStyle::clone(renderer.style());
     renderer.setStyle(WTFMove(newStyle), minimalStyleDifference);
     m_builder.normalizeTreeAfterStyleChange(renderer, oldStyle);
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+    if (RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextEnabled()) {
+        if (!m_document.view() || m_document.view()->layoutContext().initialLayoutState())
+            return;
+        if (auto* layoutBox = m_document.view()->layoutContext().initialLayoutState()->layoutBoxForRenderer(renderer))
+            layoutBox->updateStyle(newStyle);
+    }
+#endif
 }
 
 void RenderTreeUpdater::updateElementRenderer(Element& element, const Style::ElementUpdate& update)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to