Title: [238279] trunk
Revision
238279
Author
[email protected]
Date
2018-11-16 06:51:36 -0800 (Fri, 16 Nov 2018)

Log Message

[LFC][IFC] Add support for out-of-flow positioned boxes
https://bugs.webkit.org/show_bug.cgi?id=191726

Reviewed by Antti Koivisto.

Source/WebCore:

While laying out formatting context roots (inline-block, floats) in an inline formatting context, we need to make sure
that their out-of-flow descendants get laid out as well.

Test: fast/inline/simple-inline-with-out-of-flow-descendant.html

* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
* layout/layouttree/LayoutTreeBuilder.cpp: This was returning the wrong context root when the container was also a context root.
(WebCore::Layout::TreeBuilder::createSubTree):

Tools:

* LayoutReloaded/misc/LFC-passing-tests.txt:

LayoutTests:

* fast/inline/simple-inline-with-out-of-flow-descendant-expected.txt: Added.
* fast/inline/simple-inline-with-out-of-flow-descendant.html: Added.
* platform/ios/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (238278 => 238279)


--- trunk/LayoutTests/ChangeLog	2018-11-16 14:09:39 UTC (rev 238278)
+++ trunk/LayoutTests/ChangeLog	2018-11-16 14:51:36 UTC (rev 238279)
@@ -1,3 +1,14 @@
+2018-11-16  Zalan Bujtas  <[email protected]>
+
+        [LFC][IFC] Add support for out-of-flow positioned boxes
+        https://bugs.webkit.org/show_bug.cgi?id=191726
+
+        Reviewed by Antti Koivisto.
+
+        * fast/inline/simple-inline-with-out-of-flow-descendant-expected.txt: Added.
+        * fast/inline/simple-inline-with-out-of-flow-descendant.html: Added.
+        * platform/ios/TestExpectations:
+
 2018-11-16  Thibault Saunier  <[email protected]>
 
         [GStreamer][MediaStream] Handle track addition and removal

Added: trunk/LayoutTests/fast/inline/simple-inline-with-out-of-flow-descendant-expected.txt (0 => 238279)


--- trunk/LayoutTests/fast/inline/simple-inline-with-out-of-flow-descendant-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/simple-inline-with-out-of-flow-descendant-expected.txt	2018-11-16 14:51:36 UTC (rev 238279)
@@ -0,0 +1,17 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+layer at (8,8) size 202x202 clip at (9,9) size 200x200
+  RenderBlock {DIV} at (0,0) size 202x202 [border: (1px solid #008000)]
+    RenderText {#text} at (1,1) size 37x18
+      text run at (1,1) width 37: "inline"
+    RenderText {#text} at (37,1) size 48x18
+      text run at (37,1) width 48: "content"
+layer at (95,73) size 69x56
+  RenderBlock (positioned) {SPAN} at (50,50) size 69x56 [border: (1px solid #0000FF)]
+    RenderText {#text} at (1,1) size 67x54
+      text run at (1,1) width 54: "absolute"
+      text run at (1,19) width 67: "positioned"
+      text run at (1,37) width 48: "content"

Added: trunk/LayoutTests/fast/inline/simple-inline-with-out-of-flow-descendant.html (0 => 238279)


--- trunk/LayoutTests/fast/inline/simple-inline-with-out-of-flow-descendant.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/simple-inline-with-out-of-flow-descendant.html	2018-11-16 14:51:36 UTC (rev 238279)
@@ -0,0 +1,22 @@
+<style>
+.inlineContextRoot {
+	border: 1px solid green;
+	width: 200px;
+	height: 200px;
+	overflow: hidden;
+}
+
+.blockContextRoot {
+	position: absolute;
+	left: 50px;
+	top: 50px;
+	border: 1px solid blue;
+}
+
+.inlineBlock {
+	display: inline-block;
+	position: relative;
+}
+</style>
+
+<div class=inlineContextRoot>inline<span class=inlineBlock><span class=blockContextRoot>absolute positioned content</span></span>content</div>

Modified: trunk/LayoutTests/platform/ios/TestExpectations (238278 => 238279)


--- trunk/LayoutTests/platform/ios/TestExpectations	2018-11-16 14:09:39 UTC (rev 238278)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2018-11-16 14:51:36 UTC (rev 238279)
@@ -3109,6 +3109,7 @@
 fast/inline/simple-inline-block.html [ Failure ]
 fast/inline/simple-shrink-to-fit-inline-block.html [ Failure ]
 fast/inline/simple-inline-inflow-positioned.html [ Failure ]
+fast/inline/simple-inline-with-out-of-flow-descendant.html [ Failure ]
 fast/block/basic/height-percentage-simple.html [ Failure ]
 fast/block/basic/child-block-level-box-with-height-percent.html [ Failure ]
 fast/block/basic/quirk-mode-percent-height.html [ Failure ]

Modified: trunk/Source/WebCore/ChangeLog (238278 => 238279)


--- trunk/Source/WebCore/ChangeLog	2018-11-16 14:09:39 UTC (rev 238278)
+++ trunk/Source/WebCore/ChangeLog	2018-11-16 14:51:36 UTC (rev 238279)
@@ -1,3 +1,20 @@
+2018-11-16  Zalan Bujtas  <[email protected]>
+
+        [LFC][IFC] Add support for out-of-flow positioned boxes
+        https://bugs.webkit.org/show_bug.cgi?id=191726
+
+        Reviewed by Antti Koivisto.
+
+        While laying out formatting context roots (inline-block, floats) in an inline formatting context, we need to make sure
+        that their out-of-flow descendants get laid out as well.
+
+        Test: fast/inline/simple-inline-with-out-of-flow-descendant.html
+
+        * layout/inlineformatting/InlineFormattingContext.cpp:
+        (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
+        * layout/layouttree/LayoutTreeBuilder.cpp: This was returning the wrong context root when the container was also a context root.
+        (WebCore::Layout::TreeBuilder::createSubTree):
+
 2018-11-16  Thibault Saunier  <[email protected]>
 
         [GStreamer][WebRTC] Add API to enable/disable device mocks

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (238278 => 238279)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2018-11-16 14:09:39 UTC (rev 238278)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2018-11-16 14:51:36 UTC (rev 238279)
@@ -383,18 +383,19 @@
     displayBox.setVerticalMargin(heightAndMargin.collapsedMargin.value_or(heightAndMargin.margin));
 }
 
-void InlineFormattingContext::layoutFormattingContextRoot(const Box& layoutBox) const
+void InlineFormattingContext::layoutFormattingContextRoot(const Box& root) const
 {
-    ASSERT(layoutBox.isFloatingPositioned() || layoutBox.isInlineBlockBox());
+    ASSERT(root.isFloatingPositioned() || root.isInlineBlockBox());
 
-    auto& layoutState = this->layoutState();
-    auto& formattingState = layoutState.createFormattingStateForFormattingRootIfNeeded(layoutBox);
-    computeBorderAndPadding(layoutBox);
-    computeWidthAndMargin(layoutBox);
+    computeBorderAndPadding(root);
+    computeWidthAndMargin(root);
     // Swich over to the new formatting context (the one that the root creates).
-    formattingState.formattingContext(layoutBox)->layout();
+    auto formattingContext = layoutState().createFormattingStateForFormattingRootIfNeeded(root).formattingContext(root);
+    formattingContext->layout();
     // Come back and finalize the root's height and margin.
-    computeHeightAndMargin(layoutBox);
+    computeHeightAndMargin(root);
+    // Now that we computed the root's height, we can go back and layout the out-of-flow descedants (if any).
+    formattingContext->layoutOutOfFlowDescendants(root);
 }
 
 void InlineFormattingContext::computeWidthAndHeightForReplacedInlineBox(const Box& layoutBox) const

Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp (238278 => 238279)


--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2018-11-16 14:09:39 UTC (rev 238278)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2018-11-16 14:51:36 UTC (rev 238279)
@@ -125,9 +125,8 @@
 
         if (box->isOutOfFlowPositioned()) {
             // Not efficient, but this is temporary anyway.
-            // Collect the out-of-flow descendants at the formatting root lever (as opposed to at the containing block level, though they might be the same).
-            auto& containingBlockFormattingContextRoot = box->containingBlock()->formattingContextRoot();
-            const_cast<Container&>(containingBlockFormattingContextRoot).addOutOfFlowDescendant(*box);
+            // Collect the out-of-flow descendants at the formatting root level (as opposed to at the containing block level, though they might be the same).
+            const_cast<Container&>(box->formattingContextRoot()).addOutOfFlowDescendant(*box);
         }
         if (is<Container>(*box))
             createSubTree(downcast<RenderElement>(child), downcast<Container>(*box));

Modified: trunk/Tools/ChangeLog (238278 => 238279)


--- trunk/Tools/ChangeLog	2018-11-16 14:09:39 UTC (rev 238278)
+++ trunk/Tools/ChangeLog	2018-11-16 14:51:36 UTC (rev 238279)
@@ -1,3 +1,12 @@
+2018-11-16  Zalan Bujtas  <[email protected]>
+
+        [LFC][IFC] Add support for out-of-flow positioned boxes
+        https://bugs.webkit.org/show_bug.cgi?id=191726
+
+        Reviewed by Antti Koivisto.
+
+        * LayoutReloaded/misc/LFC-passing-tests.txt:
+
 2018-11-15  Myles C. Maxfield  <[email protected]>
 
         WKPreferencesSetFontSmoothingLevel doesn't actually do anything

Modified: trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt (238278 => 238279)


--- trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2018-11-16 14:09:39 UTC (rev 238278)
+++ trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2018-11-16 14:51:36 UTC (rev 238279)
@@ -70,6 +70,7 @@
 fast/inline/simple-inline-block.html
 fast/inline/simple-shrink-to-fit-inline-block.html
 fast/inline/simple-inline-inflow-positioned.html
+fast/inline/simple-inline-with-out-of-flow-descendant.html
 fast/block/basic/height-percentage-simple.html
 fast/block/basic/child-block-level-box-with-height-percent.html
 fast/block/basic/quirk-mode-percent-height.html
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to