Title: [238448] trunk
Revision
238448
Author
[email protected]
Date
2018-11-22 10:51:33 -0800 (Thu, 22 Nov 2018)

Log Message

[LFC][IFC] Offset formatting context root runs with horizontal margins.
https://bugs.webkit.org/show_bug.cgi?id=191900

Reviewed by Antti Koivisto.

Source/WebCore:

Inline runs generated by formatting roots (inline-block) need to be adjusted with the horizontal margins.
(The test case has padding and border as well, but they are _inside_ the formatting context.)

Test: fast/inline/inline-content-and-nested-formatting-root-with-margin-left-right.html

* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const):

Tools:

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

LayoutTests:

* fast/inline/inline-content-and-nested-formatting-root-with-margin-left-right-expected.txt: Added.
* fast/inline/inline-content-and-nested-formatting-root-with-margin-left-right.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (238447 => 238448)


--- trunk/LayoutTests/ChangeLog	2018-11-22 18:11:39 UTC (rev 238447)
+++ trunk/LayoutTests/ChangeLog	2018-11-22 18:51:33 UTC (rev 238448)
@@ -1,3 +1,13 @@
+2018-11-22  Zalan Bujtas  <[email protected]>
+
+        [LFC][IFC] Offset formatting context root runs with horizontal margins.
+        https://bugs.webkit.org/show_bug.cgi?id=191900
+
+        Reviewed by Antti Koivisto.
+
+        * fast/inline/inline-content-and-nested-formatting-root-with-margin-left-right-expected.txt: Added.
+        * fast/inline/inline-content-and-nested-formatting-root-with-margin-left-right.html: Added.
+
 2018-11-22  Simon Fraser  <[email protected]>
 
         Extremely small monospace text size when SVG is included as an img

Added: trunk/LayoutTests/fast/inline/inline-content-and-nested-formatting-root-with-margin-left-right-expected.txt (0 => 238448)


--- trunk/LayoutTests/fast/inline/inline-content-and-nested-formatting-root-with-margin-left-right-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/inline-content-and-nested-formatting-root-with-margin-left-right-expected.txt	2018-11-22 18:51:33 UTC (rev 238448)
@@ -0,0 +1,32 @@
+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 402x52 clip at (9,9) size 400x50
+  RenderBlock {DIV} at (0,0) size 402x52 [border: (1px solid #008000)]
+    RenderText {#text} at (1,1) size 6x14
+      text run at (1,1) width 6: "1"
+    RenderBlock {SPAN} at (17,1) size 17x20 [border: none (1px solid #008000)]
+      RenderText {#text} at (11,0) size 6x14
+        text run at (11,0) width 6: "2"
+    RenderText {#text} at (34,1) size 6x14
+      text run at (34,1) width 6: "3"
+layer at (8,60) size 402x52 clip at (9,61) size 400x50
+  RenderBlock {DIV} at (0,52) size 402x52 [border: (1px solid #008000)]
+    RenderText {#text} at (1,1) size 6x14
+      text run at (1,1) width 6: "1"
+    RenderBlock {SPAN} at (7,1) size 17x20 [border: none (1px solid #FF0000) none]
+      RenderText {#text} at (0,0) size 6x14
+        text run at (0,0) width 6: "2"
+    RenderText {#text} at (34,1) size 6x14
+      text run at (34,1) width 6: "3"
+layer at (8,112) size 402x52 clip at (9,113) size 400x50
+  RenderBlock {DIV} at (0,104) size 402x52 [border: (1px solid #008000)]
+    RenderText {#text} at (1,1) size 6x14
+      text run at (1,1) width 6: "1"
+    RenderBlock {SPAN} at (17,1) size 28x20 [border: none (1px solid #FF0000) none (1px solid #008000)]
+      RenderText {#text} at (11,0) size 6x14
+        text run at (11,0) width 6: "2"
+    RenderText {#text} at (55,1) size 6x14
+      text run at (55,1) width 6: "3"

Added: trunk/LayoutTests/fast/inline/inline-content-and-nested-formatting-root-with-margin-left-right.html (0 => 238448)


--- trunk/LayoutTests/fast/inline/inline-content-and-nested-formatting-root-with-margin-left-right.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/inline-content-and-nested-formatting-root-with-margin-left-right.html	2018-11-22 18:51:33 UTC (rev 238448)
@@ -0,0 +1,30 @@
+<style>
+.inlineRoot {
+	border: 1px solid green;
+	width: 400px;
+	height: 50px;
+	overflow: hidden;
+	font-size: 12px;
+}
+
+.inline-block {
+	height: 20px;
+    display: inline-block;
+}
+
+.breakStart {
+    margin-left: 10px;
+	border-left: 1px solid green;
+    padding-left: 10px;
+}
+
+.breakEnd {
+    margin-right: 10px;
+	border-right: 1px solid red	;
+    padding-right: 10px;
+}
+</style>
+
+<div class=inlineRoot>1<span class="inline-block breakStart">2</span>3</div>
+<div class=inlineRoot>1<span class="inline-block breakEnd">2</span>3</div>
+<div class=inlineRoot>1<span class="inline-block breakStart breakEnd">2</span>3</div>

Modified: trunk/Source/WebCore/ChangeLog (238447 => 238448)


--- trunk/Source/WebCore/ChangeLog	2018-11-22 18:11:39 UTC (rev 238447)
+++ trunk/Source/WebCore/ChangeLog	2018-11-22 18:51:33 UTC (rev 238448)
@@ -1,3 +1,18 @@
+2018-11-22  Zalan Bujtas  <[email protected]>
+
+        [LFC][IFC] Offset formatting context root runs with horizontal margins.
+        https://bugs.webkit.org/show_bug.cgi?id=191900
+
+        Reviewed by Antti Koivisto.
+
+        Inline runs generated by formatting roots (inline-block) need to be adjusted with the horizontal margins.
+        (The test case has padding and border as well, but they are _inside_ the formatting context.)
+
+        Test: fast/inline/inline-content-and-nested-formatting-root-with-margin-left-right.html
+
+        * layout/inlineformatting/InlineFormattingContext.cpp:
+        (WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const):
+
 2018-11-22  Simon Fraser  <[email protected]>
 
         Extremely small monospace text size when SVG is included as an img

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (238447 => 238448)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2018-11-22 18:11:39 UTC (rev 238447)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2018-11-22 18:51:33 UTC (rev 238448)
@@ -443,7 +443,12 @@
 
     if (root.establishesFormattingContext() && &root != &(this->root())) {
         createAndAppendInlineItem();
-        inlineFormattingState.inlineContent().last()->addDetachingRule({ InlineItem::DetachingRule::BreakAtStart, InlineItem::DetachingRule::BreakAtEnd });
+        auto& inlineRun = *inlineFormattingState.inlineContent().last();
+
+        auto horizontalMargins = Geometry::computedNonCollapsedHorizontalMarginValue(layoutState(), root);
+        inlineRun.addDetachingRule({ InlineItem::DetachingRule::BreakAtStart, InlineItem::DetachingRule::BreakAtEnd });
+        inlineRun.addNonBreakableStart(horizontalMargins.left);
+        inlineRun.addNonBreakableEnd(horizontalMargins.right);
         // Skip formatting root subtree. They are not part of this inline formatting context.
         return;
     }

Modified: trunk/Tools/ChangeLog (238447 => 238448)


--- trunk/Tools/ChangeLog	2018-11-22 18:11:39 UTC (rev 238447)
+++ trunk/Tools/ChangeLog	2018-11-22 18:51:33 UTC (rev 238448)
@@ -1,3 +1,12 @@
+2018-11-22  Zalan Bujtas  <[email protected]>
+
+        [LFC][IFC] Offset formatting context root runs with horizontal margins.
+        https://bugs.webkit.org/show_bug.cgi?id=191900
+
+        Reviewed by Antti Koivisto.
+
+        * LayoutReloaded/misc/LFC-passing-tests.txt:
+
 2018-11-22  Philippe Normand  <[email protected]>
 
         [GTK] Remove unmaintained bots

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


--- trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2018-11-22 18:11:39 UTC (rev 238447)
+++ trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2018-11-22 18:51:33 UTC (rev 238448)
@@ -75,6 +75,7 @@
 fast/inline/inline-content-with-padding-left-right.html
 fast/inline/inline-content-with-border-left-right.html
 fast/inline/inline-content-with-margin-left-right.html
+fast/inline/inline-content-and-nested-formatting-root-with-margin-left-right.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