Title: [254378] trunk
Revision
254378
Author
[email protected]
Date
2020-01-10 16:13:12 -0800 (Fri, 10 Jan 2020)

Log Message

[LFC][Integration] Update style for layout boxes
https://bugs.webkit.org/show_bug.cgi?id=206074

Reviewed by Zalan Bujtas.

Source/WebCore:

Test: fast/css/simple-color-change.html

For simple style changes we may keep the existing layout boxes. In this case we need to update the style.

* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::updateStyle):

Update style in layout boxes.

(WebCore::LayoutIntegration::LineLayout::rootLayoutBox):
* layout/integration/LayoutIntegrationLineLayout.h:

Make root non-const.

* layout/layouttree/LayoutBox.h:
(WebCore::Layout::Box::nextSibling):
* layout/layouttree/LayoutContainer.h:

Expose non-const accessors.

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::styleDidChange):

Invoke LineLayout::updateStyle

LayoutTests:

* fast/css/simple-color-change-expected.html: Added.
* fast/css/simple-color-change.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (254377 => 254378)


--- trunk/LayoutTests/ChangeLog	2020-01-11 00:01:47 UTC (rev 254377)
+++ trunk/LayoutTests/ChangeLog	2020-01-11 00:13:12 UTC (rev 254378)
@@ -1,3 +1,13 @@
+2020-01-10  Antti Koivisto  <[email protected]>
+
+        [LFC][Integration] Update style for layout boxes
+        https://bugs.webkit.org/show_bug.cgi?id=206074
+
+        Reviewed by Zalan Bujtas.
+
+        * fast/css/simple-color-change-expected.html: Added.
+        * fast/css/simple-color-change.html: Added.
+
 2020-01-10  Brent Fulgham  <[email protected]>
 
         [iOS] Remove 'com.apple.awdd' from the WebContent process sandbox

Added: trunk/LayoutTests/fast/css/simple-color-change-expected.html (0 => 254378)


--- trunk/LayoutTests/fast/css/simple-color-change-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/simple-color-change-expected.html	2020-01-11 00:13:12 UTC (rev 254378)
@@ -0,0 +1,4 @@
+<style>
+.green { color: green; }
+</style>
+<div class=green>Green</div>

Added: trunk/LayoutTests/fast/css/simple-color-change.html (0 => 254378)


--- trunk/LayoutTests/fast/css/simple-color-change.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/simple-color-change.html	2020-01-11 00:13:12 UTC (rev 254378)
@@ -0,0 +1,16 @@
+<style>
+div { color: red; }
+.green { color: green; }
+</style>
+<div id=test>Green</div>
+<script>
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+setTimeout(() => {
+    test.classList.add("green");
+
+    if (window.testRunner)
+        testRunner.notifyDone();
+}, 20);
+</script>

Modified: trunk/Source/WebCore/ChangeLog (254377 => 254378)


--- trunk/Source/WebCore/ChangeLog	2020-01-11 00:01:47 UTC (rev 254377)
+++ trunk/Source/WebCore/ChangeLog	2020-01-11 00:13:12 UTC (rev 254378)
@@ -1,3 +1,35 @@
+2020-01-10  Antti Koivisto  <[email protected]>
+
+        [LFC][Integration] Update style for layout boxes
+        https://bugs.webkit.org/show_bug.cgi?id=206074
+
+        Reviewed by Zalan Bujtas.
+
+        Test: fast/css/simple-color-change.html
+
+        For simple style changes we may keep the existing layout boxes. In this case we need to update the style.
+
+        * layout/integration/LayoutIntegrationLineLayout.cpp:
+        (WebCore::LayoutIntegration::LineLayout::updateStyle):
+
+        Update style in layout boxes.
+
+        (WebCore::LayoutIntegration::LineLayout::rootLayoutBox):
+        * layout/integration/LayoutIntegrationLineLayout.h:
+
+        Make root non-const.
+
+        * layout/layouttree/LayoutBox.h:
+        (WebCore::Layout::Box::nextSibling):
+        * layout/layouttree/LayoutContainer.h:
+
+        Expose non-const accessors.
+
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::styleDidChange):
+
+        Invoke LineLayout::updateStyle
+
 2020-01-10  John Wilander  <[email protected]>
 
         Resource Load Statistics: Align WebCore::NetworkStorageSession's m_thirdPartyCookieBlockingMode init value with r254239

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (254377 => 254378)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2020-01-11 00:01:47 UTC (rev 254377)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2020-01-11 00:13:12 UTC (rev 254378)
@@ -76,6 +76,19 @@
     return true;
 }
 
+void LineLayout::updateStyle()
+{
+    auto& root = rootLayoutBox();
+
+    // FIXME: Encapsulate style updates better.
+    root.updateStyle(m_flow.style());
+
+    for (auto* child = root.firstChild(); child; child = child->nextSibling()) {
+        if (child->isAnonymous())
+            child->updateStyle(RenderStyle::createAnonymousStyleWithDisplay(root.style(), DisplayType::Inline));
+    }
+}
+
 void LineLayout::layout()
 {
     if (!m_layoutState)
@@ -199,6 +212,11 @@
     return m_treeContent->rootLayoutBox();
 }
 
+Layout::Container& LineLayout::rootLayoutBox()
+{
+    return m_treeContent->rootLayoutBox();
+}
+
 void LineLayout::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
 {
     if (!displayInlineContent())

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h (254377 => 254378)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h	2020-01-11 00:01:47 UTC (rev 254377)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h	2020-01-11 00:13:12 UTC (rev 254378)
@@ -60,6 +60,7 @@
 
     static bool canUseFor(const RenderBlockFlow&);
 
+    void updateStyle();
     void layout();
 
     LayoutUnit contentLogicalHeight() const { return m_contentLogicalHeight; }
@@ -80,11 +81,12 @@
 
 private:
     const Layout::Container& rootLayoutBox() const;
+    Layout::Container& rootLayoutBox();
     void prepareRootGeometryForLayout();
     ShadowData* debugTextShadow();
 
     const RenderBlockFlow& m_flow;
-    std::unique_ptr<const Layout::LayoutTreeContent> m_treeContent;
+    std::unique_ptr<Layout::LayoutTreeContent> m_treeContent;
     std::unique_ptr<Layout::LayoutState> m_layoutState;
     LayoutUnit m_contentLogicalHeight;
 };

Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.h (254377 => 254378)


--- trunk/Source/WebCore/layout/layouttree/LayoutBox.h	2020-01-11 00:01:47 UTC (rev 254377)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.h	2020-01-11 00:13:12 UTC (rev 254378)
@@ -130,6 +130,9 @@
     const Box* previousInFlowSibling() const;
     const Box* previousInFlowOrFloatingSibling() const;
 
+    // FIXME: This is currently needed for style updates.
+    Box* nextSibling() { return m_nextSibling; }
+
     bool isContainer() const { return m_baseTypeFlags & ContainerFlag; }
     bool isBlockContainer() const { return isBlockLevelBox() && isContainer(); }
     bool isInlineContainer() const { return isInlineLevelBox() && isContainer(); }

Modified: trunk/Source/WebCore/layout/layouttree/LayoutContainer.h (254377 => 254378)


--- trunk/Source/WebCore/layout/layouttree/LayoutContainer.h	2020-01-11 00:01:47 UTC (rev 254377)
+++ trunk/Source/WebCore/layout/layouttree/LayoutContainer.h	2020-01-11 00:13:12 UTC (rev 254378)
@@ -48,6 +48,9 @@
     const Box* lastInFlowChild() const;
     const Box* lastInFlowOrFloatingChild() const;
 
+    // FIXME: This is currently needed for style updates.
+    Box* firstChild() { return m_firstChild; }
+
     bool hasChild() const { return firstChild(); }
     bool hasInFlowChild() const { return firstInFlowChild(); }
     bool hasInFlowOrFloatingChild() const { return firstInFlowOrFloatingChild(); }

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (254377 => 254378)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2020-01-11 00:01:47 UTC (rev 254377)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2020-01-11 00:13:12 UTC (rev 254378)
@@ -2104,6 +2104,11 @@
 
     if (multiColumnFlow())
         updateStylesForColumnChildren();
+
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+    if (layoutFormattingContextLineLayout())
+        layoutFormattingContextLineLayout()->updateStyle();
+#endif
 }
 
 void RenderBlockFlow::updateStylesForColumnChildren()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to