Title: [254104] trunk/Source/WebCore
Revision
254104
Author
za...@apple.com
Date
2020-01-06 19:15:36 -0800 (Mon, 06 Jan 2020)

Log Message

[LFC] FormattingContext::layoutInFlowContent should take UsedHorizontalValues::Constraints
https://bugs.webkit.org/show_bug.cgi?id=205809
<rdar://problem/58345856>

Reviewed by Antti Koivisto.

This patch is in preparation for using the incoming horizontal constraint instead of
accessing the formatting context root's geometry.
(e.g. <div style="width: 100px;">text content</div>. The IFC should not need to query the div's display box
for the horizontal available space (100px))

* layout/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::layoutOutOfFlowContent):
* layout/FormattingContext.h:
* layout/LayoutContext.cpp:
(WebCore::Layout::LayoutContext::layoutFormattingContextSubtree):
* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::layoutInFlowContent):
(WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot):
* layout/blockformatting/BlockFormattingContext.h:
* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::layoutInFlowContent):
(WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot):
* layout/inlineformatting/InlineFormattingContext.h:
* layout/tableformatting/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::layoutInFlowContent):
(WebCore::Layout::TableFormattingContext::layoutTableCellBox):
* layout/tableformatting/TableFormattingContext.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (254103 => 254104)


--- trunk/Source/WebCore/ChangeLog	2020-01-07 02:52:26 UTC (rev 254103)
+++ trunk/Source/WebCore/ChangeLog	2020-01-07 03:15:36 UTC (rev 254104)
@@ -1,3 +1,34 @@
+2020-01-06  Zalan Bujtas  <za...@apple.com>
+
+        [LFC] FormattingContext::layoutInFlowContent should take UsedHorizontalValues::Constraints
+        https://bugs.webkit.org/show_bug.cgi?id=205809
+        <rdar://problem/58345856>
+
+        Reviewed by Antti Koivisto.
+
+        This patch is in preparation for using the incoming horizontal constraint instead of
+        accessing the formatting context root's geometry.
+        (e.g. <div style="width: 100px;">text content</div>. The IFC should not need to query the div's display box
+        for the horizontal available space (100px))
+
+        * layout/FormattingContext.cpp:
+        (WebCore::Layout::FormattingContext::layoutOutOfFlowContent):
+        * layout/FormattingContext.h:
+        * layout/LayoutContext.cpp:
+        (WebCore::Layout::LayoutContext::layoutFormattingContextSubtree):
+        * layout/blockformatting/BlockFormattingContext.cpp:
+        (WebCore::Layout::BlockFormattingContext::layoutInFlowContent):
+        (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot):
+        * layout/blockformatting/BlockFormattingContext.h:
+        * layout/inlineformatting/InlineFormattingContext.cpp:
+        (WebCore::Layout::InlineFormattingContext::layoutInFlowContent):
+        (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot):
+        * layout/inlineformatting/InlineFormattingContext.h:
+        * layout/tableformatting/TableFormattingContext.cpp:
+        (WebCore::Layout::TableFormattingContext::layoutInFlowContent):
+        (WebCore::Layout::TableFormattingContext::layoutTableCellBox):
+        * layout/tableformatting/TableFormattingContext.h:
+
 2020-01-06  Don Olmstead  <don.olmst...@sony.com>
 
         Rename GraphicsContext3D to GraphicsContextGL

Modified: trunk/Source/WebCore/layout/FormattingContext.cpp (254103 => 254104)


--- trunk/Source/WebCore/layout/FormattingContext.cpp	2020-01-07 02:52:26 UTC (rev 254103)
+++ trunk/Source/WebCore/layout/FormattingContext.cpp	2020-01-07 03:15:36 UTC (rev 254104)
@@ -155,8 +155,9 @@
         computeOutOfFlowHorizontalGeometry(*outOfFlowBox);
         if (is<Container>(*outOfFlowBox)) {
             auto& outOfFlowRootContainer = downcast<Container>(*outOfFlowBox);
+            auto& outOfFlowRootDisplayBox = geometryForBox(outOfFlowRootContainer);
             auto formattingContext = LayoutContext::createFormattingContext(outOfFlowRootContainer, layoutState());
-            formattingContext->layoutInFlowContent(invalidationState);
+            formattingContext->layoutInFlowContent(invalidationState, Geometry::inFlowHorizontalConstraints(outOfFlowRootDisplayBox));
             computeOutOfFlowVerticalGeometry(outOfFlowRootContainer);
             formattingContext->layoutOutOfFlowContent(invalidationState);
         } else

Modified: trunk/Source/WebCore/layout/FormattingContext.h (254103 => 254104)


--- trunk/Source/WebCore/layout/FormattingContext.h	2020-01-07 02:52:26 UTC (rev 254103)
+++ trunk/Source/WebCore/layout/FormattingContext.h	2020-01-07 03:15:36 UTC (rev 254104)
@@ -64,7 +64,7 @@
     FormattingContext(const Container& formattingContextRoot, FormattingState&);
     virtual ~FormattingContext();
 
-    virtual void layoutInFlowContent(InvalidationState&) = 0;
+    virtual void layoutInFlowContent(InvalidationState&, const UsedHorizontalValues::Constraints&) = 0;
     void layoutOutOfFlowContent(InvalidationState&);
 
     struct IntrinsicWidthConstraints {

Modified: trunk/Source/WebCore/layout/LayoutContext.cpp (254103 => 254104)


--- trunk/Source/WebCore/layout/LayoutContext.cpp	2020-01-07 02:52:26 UTC (rev 254103)
+++ trunk/Source/WebCore/layout/LayoutContext.cpp	2020-01-07 03:15:36 UTC (rev 254104)
@@ -93,7 +93,9 @@
 {
     RELEASE_ASSERT(formattingContextRoot.establishesFormattingContext());
     auto formattingContext = createFormattingContext(formattingContextRoot, layoutState());
-    formattingContext->layoutInFlowContent(invalidationState);
+    auto& displayBoxForFormattingContextRoot = layoutState().displayBoxForLayoutBox(formattingContextRoot);
+    auto constraints = UsedHorizontalValues::Constraints { displayBoxForFormattingContextRoot.contentBoxLeft(), displayBoxForFormattingContextRoot.contentBoxWidth() };
+    formattingContext->layoutInFlowContent(invalidationState, constraints);
     formattingContext->layoutOutOfFlowContent(invalidationState);
 }
 

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp (254103 => 254104)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp	2020-01-07 02:52:26 UTC (rev 254103)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp	2020-01-07 03:15:36 UTC (rev 254104)
@@ -52,7 +52,7 @@
 }
 
 enum class LayoutDirection { Child, Sibling };
-void BlockFormattingContext::layoutInFlowContent(InvalidationState& invalidationState)
+void BlockFormattingContext::layoutInFlowContent(InvalidationState& invalidationState, const UsedHorizontalValues::Constraints&)
 {
     // 9.4.1 Block formatting contexts
     // In a block formatting context, boxes are laid out one after the other, vertically, beginning at the top of a containing block.
@@ -187,8 +187,9 @@
     if (is<Container>(layoutBox)) {
         // Swich over to the new formatting context (the one that the root creates).
         auto& rootContainer = downcast<Container>(layoutBox);
+        auto& rootContainerDisplayBox = geometryForBox(rootContainer);
         auto formattingContext = LayoutContext::createFormattingContext(rootContainer, layoutState());
-        formattingContext->layoutInFlowContent(invalidationState);
+        formattingContext->layoutInFlowContent(invalidationState, Geometry::inFlowHorizontalConstraints(rootContainerDisplayBox));
         // Come back and finalize the root's geometry.
         computeHeightAndMargin(rootContainer);
         // Now that we computed the root's height, we can go back and layout the out-of-flow content.

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h (254103 => 254104)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h	2020-01-07 02:52:26 UTC (rev 254103)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h	2020-01-07 03:15:36 UTC (rev 254104)
@@ -48,7 +48,7 @@
 public:
     BlockFormattingContext(const Container& formattingContextRoot, BlockFormattingState&);
 
-    void layoutInFlowContent(InvalidationState&) override;
+    void layoutInFlowContent(InvalidationState&, const UsedHorizontalValues::Constraints&) override;
 
 private:
     void layoutFormattingContextRoot(FloatingContext&, const Box&, InvalidationState&);

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (254103 => 254104)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2020-01-07 02:52:26 UTC (rev 254103)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2020-01-07 03:15:36 UTC (rev 254104)
@@ -64,7 +64,7 @@
     return nullptr;
 }
 
-void InlineFormattingContext::layoutInFlowContent(InvalidationState& invalidationState)
+void InlineFormattingContext::layoutInFlowContent(InvalidationState& invalidationState, const UsedHorizontalValues::Constraints&)
 {
     if (!root().hasInFlowOrFloatingChild())
         return;
@@ -140,7 +140,7 @@
     if (is<Container>(formattingContextRoot)) {
         auto& rootContainer = downcast<Container>(formattingContextRoot);
         auto formattingContext = LayoutContext::createFormattingContext(rootContainer, layoutState());
-        formattingContext->layoutInFlowContent(invalidationState);
+        formattingContext->layoutInFlowContent(invalidationState, usedHorizontalValues.constraints);
         // Come back and finalize the root's height and margin.
         computeHeightAndMargin(rootContainer, usedHorizontalValues, usedVerticalValues);
         // Now that we computed the root's height, we can go back and layout the out-of-flow content.

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h (254103 => 254104)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h	2020-01-07 02:52:26 UTC (rev 254103)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h	2020-01-07 03:15:36 UTC (rev 254104)
@@ -43,7 +43,7 @@
     WTF_MAKE_ISO_ALLOCATED(InlineFormattingContext);
 public:
     InlineFormattingContext(const Container& formattingContextRoot, InlineFormattingState&);
-    void layoutInFlowContent(InvalidationState&) override;
+    void layoutInFlowContent(InvalidationState&, const UsedHorizontalValues::Constraints&) override;
 
 private:
     IntrinsicWidthConstraints computedIntrinsicWidthConstraints() override;

Modified: trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp (254103 => 254104)


--- trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp	2020-01-07 02:52:26 UTC (rev 254103)
+++ trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp	2020-01-07 03:15:36 UTC (rev 254104)
@@ -58,7 +58,7 @@
 {
 }
 
-void TableFormattingContext::layoutInFlowContent(InvalidationState& invalidationState)
+void TableFormattingContext::layoutInFlowContent(InvalidationState& invalidationState, const UsedHorizontalValues::Constraints&)
 {
     auto& grid = formattingState().tableGrid();
     auto& columnsContext = grid.columnsContext();
@@ -110,7 +110,7 @@
 
     ASSERT(cellLayoutBox.establishesBlockFormattingContext());
     if (is<Container>(cellLayoutBox))
-        LayoutContext::createFormattingContext(downcast<Container>(cellLayoutBox), layoutState())->layoutInFlowContent(invalidationState);
+        LayoutContext::createFormattingContext(downcast<Container>(cellLayoutBox), layoutState())->layoutInFlowContent(invalidationState, Geometry::inFlowHorizontalConstraints(cellDisplayBox));
     cellDisplayBox.setVerticalMargin({ { }, { } });
     cellDisplayBox.setContentBoxHeight(geometry().tableCellHeightAndMargin(cellLayoutBox).contentHeight);
     // FIXME: Check what to do with out-of-flow content.

Modified: trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.h (254103 => 254104)


--- trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.h	2020-01-07 02:52:26 UTC (rev 254103)
+++ trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.h	2020-01-07 03:15:36 UTC (rev 254104)
@@ -42,7 +42,7 @@
     WTF_MAKE_ISO_ALLOCATED(TableFormattingContext);
 public:
     TableFormattingContext(const Container& formattingContextRoot, TableFormattingState&);
-    void layoutInFlowContent(InvalidationState&) override;
+    void layoutInFlowContent(InvalidationState&, const UsedHorizontalValues::Constraints&) override;
 
 private:
     class Geometry : public FormattingContext::Geometry {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to