Title: [256829] trunk
Revision
256829
Author
za...@apple.com
Date
2020-02-18 08:02:49 -0800 (Tue, 18 Feb 2020)

Log Message

[LFC][IFC] Add missing float check in inline line layout
https://bugs.webkit.org/show_bug.cgi?id=207878
<rdar://problem/59537467>

Reviewed by Antti Koivisto.

Source/WebCore:

Test: fast/layoutformattingcontext/float-in-inline-context-simple.html

Make sure float content gets laid out as well.

* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::layoutInFlowContent):
* layout/inlineformatting/LineLayoutContext.cpp:
(WebCore::Layout::isAtSoftWrapOpportunity):
(WebCore::Layout::nextWrapOpportunity):

LayoutTests:

* fast/layoutformattingcontext/float-in-inline-context-simple-expected.html: Added.
* fast/layoutformattingcontext/float-in-inline-context-simple.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (256828 => 256829)


--- trunk/LayoutTests/ChangeLog	2020-02-18 15:55:39 UTC (rev 256828)
+++ trunk/LayoutTests/ChangeLog	2020-02-18 16:02:49 UTC (rev 256829)
@@ -1,5 +1,16 @@
 2020-02-18  Zalan Bujtas  <za...@apple.com>
 
+        [LFC][IFC] Add missing float check in inline line layout
+        https://bugs.webkit.org/show_bug.cgi?id=207878
+        <rdar://problem/59537467>
+
+        Reviewed by Antti Koivisto.
+
+        * fast/layoutformattingcontext/float-in-inline-context-simple-expected.html: Added.
+        * fast/layoutformattingcontext/float-in-inline-context-simple.html: Added.
+
+2020-02-18  Zalan Bujtas  <za...@apple.com>
+
         [LFC][TreeBuilding] Take createLineBreakBox's return value
         https://bugs.webkit.org/show_bug.cgi?id=207879
         <rdar://problem/59537585>

Added: trunk/LayoutTests/fast/layoutformattingcontext/float-in-inline-context-simple-expected.html (0 => 256829)


--- trunk/LayoutTests/fast/layoutformattingcontext/float-in-inline-context-simple-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/float-in-inline-context-simple-expected.html	2020-02-18 16:02:49 UTC (rev 256829)
@@ -0,0 +1,4 @@
+<!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<div style="height: 100px; border: 1px solid green;">
+<div style="width: 20px; height: 20px; border: 1px solid blue"></div>
+</div>

Added: trunk/LayoutTests/fast/layoutformattingcontext/float-in-inline-context-simple.html (0 => 256829)


--- trunk/LayoutTests/fast/layoutformattingcontext/float-in-inline-context-simple.html	                        (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/float-in-inline-context-simple.html	2020-02-18 16:02:49 UTC (rev 256829)
@@ -0,0 +1,4 @@
+<!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<div style="color: white; height: 100px; border: 1px solid green;">
+text before<div style="float: left; width: 20px; height: 20px; border: 1px solid blue"></div>after
+</div>

Modified: trunk/Source/WebCore/ChangeLog (256828 => 256829)


--- trunk/Source/WebCore/ChangeLog	2020-02-18 15:55:39 UTC (rev 256828)
+++ trunk/Source/WebCore/ChangeLog	2020-02-18 16:02:49 UTC (rev 256829)
@@ -1,3 +1,21 @@
+2020-02-18  Zalan Bujtas  <za...@apple.com>
+
+        [LFC][IFC] Add missing float check in inline line layout
+        https://bugs.webkit.org/show_bug.cgi?id=207878
+        <rdar://problem/59537467>
+
+        Reviewed by Antti Koivisto.
+
+        Test: fast/layoutformattingcontext/float-in-inline-context-simple.html
+
+        Make sure float content gets laid out as well. 
+
+        * layout/inlineformatting/InlineFormattingContext.cpp:
+        (WebCore::Layout::InlineFormattingContext::layoutInFlowContent):
+        * layout/inlineformatting/LineLayoutContext.cpp:
+        (WebCore::Layout::isAtSoftWrapOpportunity):
+        (WebCore::Layout::nextWrapOpportunity):
+
 2020-02-18  Jacob Uphoff  <jacob_uph...@apple.com>
 
         Unreviewed, rolling out r256804.

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (256828 => 256829)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2020-02-18 15:55:39 UTC (rev 256828)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2020-02-18 16:02:49 UTC (rev 256829)
@@ -85,13 +85,13 @@
     // 1. Visit each inline box and partially compute their geometry (margins, paddings and borders).
     // 2. Collect the inline items (flatten the the layout tree) and place them on lines in bidirectional order. 
     while (layoutBox) {
-        ASSERT(layoutBox->isInlineLevelBox());
+        ASSERT(layoutBox->isInlineLevelBox() || layoutBox->isFloatingPositioned());
 
-        if (layoutBox->isAtomicInlineLevelBox()) {
+        if (layoutBox->isAtomicInlineLevelBox() || layoutBox->isFloatingPositioned()) {
             // Inline-blocks, inline-tables and replaced elements (img, video) can be sized but not yet positioned.
             if (layoutBox->establishesFormattingContext()) {
                 ASSERT(is<ContainerBox>(*layoutBox));
-                ASSERT(layoutBox->isInlineBlockBox() || layoutBox->isInlineTableBox());
+                ASSERT(layoutBox->isInlineBlockBox() || layoutBox->isInlineTableBox() || layoutBox->isFloatingPositioned());
                 auto& containerBox = downcast<ContainerBox>(*layoutBox);
                 computeBorderAndPadding(containerBox, horizontalConstraints);
                 computeWidthAndMargin(containerBox, horizontalConstraints);

Modified: trunk/Source/WebCore/layout/inlineformatting/LineLayoutContext.cpp (256828 => 256829)


--- trunk/Source/WebCore/layout/inlineformatting/LineLayoutContext.cpp	2020-02-18 15:55:39 UTC (rev 256828)
+++ trunk/Source/WebCore/layout/inlineformatting/LineLayoutContext.cpp	2020-02-18 16:02:49 UTC (rev 256829)
@@ -72,8 +72,8 @@
     // e.g. [container start][prior_continuous_content][container end] (<span>prior_continuous_content</span>)
     // An incoming <img> box would enable us to commit the "<span>prior_continuous_content</span>" content
     // but an incoming text content would not necessarily.
-    ASSERT(current.isText() || current.isBox());
-    ASSERT(next.isText() || next.isBox());
+    ASSERT(current.isText() || current.isBox() || current.isFloat());
+    ASSERT(next.isText() || next.isBox() || next.isFloat());
     if (current.isText() && next.isText()) {
         auto& currentInlineTextItem = downcast<InlineTextItem>(current);
         auto& nextInlineTextItem = downcast<InlineTextItem>(next);
@@ -101,6 +101,11 @@
         // The line breaking behavior of a replaced element or other atomic inline is equivalent to an ideographic character.
         return true;
     }
+    if (current.isFloat() || next.isFloat()) {
+        // While floats are not part of the inline content, let's just handle them as if they were inline boxes for now and pretend
+        // there's a soft wrapping opportunity here (text before<div style="float: left"></div>and after).
+        return true;
+    }
     ASSERT_NOT_REACHED();
     return true;
 }
@@ -121,7 +126,7 @@
         // Break at the first text/box/line break inline item.
         for (; index < layoutRange.end; ++index) {
             auto& inlineItem = inlineContent[index];
-            if (inlineItem.isText() || inlineItem.isBox())
+            if (inlineItem.isText() || inlineItem.isBox() || inlineItem.isFloat())
                 return index;
             if (inlineItem.isLineBreak()) {
                 isAtLineBreak = true;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to