Title: [237551] trunk
Revision
237551
Author
[email protected]
Date
2018-10-29 07:48:11 -0700 (Mon, 29 Oct 2018)

Log Message

[LFC] Add support for inflow non replaced content height when the box is an inline formatting root.
https://bugs.webkit.org/show_bug.cgi?id=191011

Reviewed by Antti Koivisto.

Source/WebCore:

// 10.6.3 Block-level non-replaced elements in normal flow when 'overflow' computes to 'visible'
// Height is the bottom edge of the last line box, if the box establishes a inline formatting context with one or more lines

This is temporary until after inline runs transition to the display tree.

Test: fast/inline/simple-intruding-floats2.html

* layout/blockformatting/BlockFormattingContextGeometry.cpp:
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
* layout/inlineformatting/InlineRun.h:
(WebCore::Layout::InlineRun::logicalLeft const):
(WebCore::Layout::InlineRun::logicalRight const):
(WebCore::Layout::InlineRun::logicalTop const):
(WebCore::Layout::InlineRun::logicalBottom const):
(WebCore::Layout::InlineRun::width const):
(WebCore::Layout::InlineRun::height const):
(WebCore::Layout::InlineRun::setWidth):
(WebCore::Layout::InlineRun::setLogicalLeft):
(WebCore::Layout::InlineRun::setLogicalRight):
(WebCore::Layout::InlineRun::moveHorizontally):
(WebCore::Layout::InlineRun::InlineRun):
* layout/inlineformatting/Line.cpp:
(WebCore::Layout::InlineFormattingContext::Line::appendContent):

Tools:

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

LayoutTests:

* fast/inline/simple-intruding-floats2-expected.txt: Added.
* fast/inline/simple-intruding-floats2.html: Added.
* platform/ios/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (237550 => 237551)


--- trunk/LayoutTests/ChangeLog	2018-10-29 14:44:53 UTC (rev 237550)
+++ trunk/LayoutTests/ChangeLog	2018-10-29 14:48:11 UTC (rev 237551)
@@ -1,5 +1,16 @@
 2018-10-29  Zalan Bujtas  <[email protected]>
 
+        [LFC] Add support for inflow non replaced content height when the box is an inline formatting root.
+        https://bugs.webkit.org/show_bug.cgi?id=191011
+
+        Reviewed by Antti Koivisto.
+
+        * fast/inline/simple-intruding-floats2-expected.txt: Added.
+        * fast/inline/simple-intruding-floats2.html: Added.
+        * platform/ios/TestExpectations:
+
+2018-10-29  Zalan Bujtas  <[email protected]>
+
         Missing from r237549
 
         Reviewed by Antti Koivisto.

Added: trunk/LayoutTests/fast/inline/simple-intruding-floats2-expected.txt (0 => 237551)


--- trunk/LayoutTests/fast/inline/simple-intruding-floats2-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/simple-intruding-floats2-expected.txt	2018-10-29 14:48:11 UTC (rev 237551)
@@ -0,0 +1,30 @@
+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
+      RenderImage {IMG} at (0,0) size 20x100
+      RenderBlock {DIV} at (0,0) size 300x54
+        RenderText {#text} at (40,0) size 34x18
+          text run at (40,0) width 34: "thisis"
+        RenderImage {IMG} at (20,0) size 20x75
+        RenderText {#text} at (73,0) size 216x36
+          text run at (73,0) width 183: "onerun, next to 2 floats. One"
+          text run at (40,18) width 138: "intruding, one in this "
+        RenderInline {SPAN} at (0,0) size 246x36
+          RenderText {#text} at (177,18) size 246x36
+            text run at (177,18) width 109: "inline formatting"
+            text run at (40,36) width 48: "context"
+        RenderText {#text} at (0,0) size 0x0
+      RenderBlock {DIV} at (0,54) size 300x54
+        RenderInline {SPAN} at (0,0) size 258x54
+          RenderImage {IMG} at (40,0) size 20x15
+          RenderText {#text} at (60,0) size 258x54
+            text run at (60,0) width 218: "this next inline formatting context"
+            text run at (40,18) width 204: "has 3 floats. 2 out of those 3 are"
+            text run at (20,36) width 59: "intruding"
+      RenderBlock (anonymous) at (0,108) size 784x18
+        RenderInline {SPAN} at (0,0) size 430x18
+          RenderText {#text} at (0,0) size 430x18
+            text run at (0,0) width 430: "and now we are back to the left edge. no intrudings at this position."
+        RenderText {#text} at (0,0) size 0x0

Added: trunk/LayoutTests/fast/inline/simple-intruding-floats2.html (0 => 237551)


--- trunk/LayoutTests/fast/inline/simple-intruding-floats2.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/simple-intruding-floats2.html	2018-10-29 14:48:11 UTC (rev 237551)
@@ -0,0 +1,5 @@
+<img style="float: left;" src="" height="100" width="20">
+<div style="text-align: left; width: 300px;">thisis<img style="float: left;" src="" height="75" width="20">onerun, next to 2 floats. One intruding, one in this
+<span>inline formatting context</span>
+</div>
+<div style="width: 300px"><span><img style="float: left;" src="" height="15" width="20">this next inline formatting context has 3 floats. 2 out of those 3 are intruding </span></div><span>and now we are back to the left edge. no intrudings at this position.</span>

Modified: trunk/LayoutTests/platform/ios/TestExpectations (237550 => 237551)


--- trunk/LayoutTests/platform/ios/TestExpectations	2018-10-29 14:44:53 UTC (rev 237550)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2018-10-29 14:48:11 UTC (rev 237551)
@@ -3110,6 +3110,7 @@
 fast/block/basic/inline-content-with-floating-image.html [ Failure ]
 fast/block/basic/inline-content-with-floating-images2.html [ Failure ]
 fast/inline/simple-intruding-float1.html [ Failure ]
+fast/inline/simple-intruding-floats2.html [ Failure ]
 
 # Datalist
 webkit.org/b/186714 fast/forms/datalist/datalist-textinput-keydown.html [ Skip ]

Modified: trunk/Source/WebCore/ChangeLog (237550 => 237551)


--- trunk/Source/WebCore/ChangeLog	2018-10-29 14:44:53 UTC (rev 237550)
+++ trunk/Source/WebCore/ChangeLog	2018-10-29 14:48:11 UTC (rev 237551)
@@ -1,5 +1,36 @@
 2018-10-29  Zalan Bujtas  <[email protected]>
 
+        [LFC] Add support for inflow non replaced content height when the box is an inline formatting root.
+        https://bugs.webkit.org/show_bug.cgi?id=191011
+
+        Reviewed by Antti Koivisto.
+
+        // 10.6.3 Block-level non-replaced elements in normal flow when 'overflow' computes to 'visible'
+        // Height is the bottom edge of the last line box, if the box establishes a inline formatting context with one or more lines
+
+        This is temporary until after inline runs transition to the display tree.
+
+        Test: fast/inline/simple-intruding-floats2.html
+
+        * layout/blockformatting/BlockFormattingContextGeometry.cpp:
+        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
+        * layout/inlineformatting/InlineRun.h:
+        (WebCore::Layout::InlineRun::logicalLeft const):
+        (WebCore::Layout::InlineRun::logicalRight const):
+        (WebCore::Layout::InlineRun::logicalTop const):
+        (WebCore::Layout::InlineRun::logicalBottom const):
+        (WebCore::Layout::InlineRun::width const):
+        (WebCore::Layout::InlineRun::height const):
+        (WebCore::Layout::InlineRun::setWidth):
+        (WebCore::Layout::InlineRun::setLogicalLeft):
+        (WebCore::Layout::InlineRun::setLogicalRight):
+        (WebCore::Layout::InlineRun::moveHorizontally):
+        (WebCore::Layout::InlineRun::InlineRun):
+        * layout/inlineformatting/Line.cpp:
+        (WebCore::Layout::InlineFormattingContext::Line::appendContent):
+
+2018-10-29  Zalan Bujtas  <[email protected]>
+
         [LFC][IFC] Add support for simple intruding floats.
         https://bugs.webkit.org/show_bug.cgi?id=190998
 

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp (237550 => 237551)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp	2018-10-29 14:44:53 UTC (rev 237550)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp	2018-10-29 14:48:11 UTC (rev 237551)
@@ -29,6 +29,7 @@
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
 
 #include "FormattingContext.h"
+#include "InlineFormattingState.h"
 #include "LayoutChildIterator.h"
 #include "Logging.h"
 #include <wtf/text/TextStream.h>
@@ -120,8 +121,9 @@
 
         // 1. the bottom edge of the last line box, if the box establishes a inline formatting context with one or more lines
         if (layoutBox.establishesInlineFormattingContext()) {
-            // height = lastLineBox().bottom();
-            return { 0, nonCollapsedMargin, collapsedMargin };
+            // This is temp and will be replaced by the correct display box once inline runs move over to the display tree.
+            auto& lastInlineRun = downcast<InlineFormattingState>(layoutContext.establishedFormattingState(layoutBox)).inlineRuns().last();
+            return { lastInlineRun.logicalBottom(), nonCollapsedMargin, collapsedMargin };
         }
 
         // 2. the bottom edge of the bottom (possibly collapsed) margin of its last in-flow child, if the child's bottom margin...

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineRun.h (237550 => 237551)


--- trunk/Source/WebCore/layout/inlineformatting/InlineRun.h	2018-10-29 14:44:53 UTC (rev 237550)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineRun.h	2018-10-29 14:48:11 UTC (rev 237551)
@@ -34,17 +34,21 @@
 namespace Layout {
 
 struct InlineRun {
-    InlineRun(LayoutUnit logcialLeft, LayoutUnit width, const InlineItem&);
+    InlineRun(Display::Box::Rect logicalRect, const InlineItem&);
 
-    LayoutUnit logicalLeft() const { return m_logicalLeft; }
-    LayoutUnit logicalRight() const { return logicalLeft() + width(); }
-    LayoutUnit width() const { return m_width; }
+    LayoutUnit logicalLeft() const { return m_logicalRect.left(); }
+    LayoutUnit logicalRight() const { return m_logicalRect.right(); }
+    LayoutUnit logicalTop() const { return m_logicalRect.top(); }
+    LayoutUnit logicalBottom() const { return m_logicalRect.bottom(); }
 
-    void setWidth(LayoutUnit width) { m_width = width; }
-    void setLogicalLeft(LayoutUnit logicalLeft) { m_logicalLeft = logicalLeft; }
-    void setLogicalRight(LayoutUnit logicalRight) { m_width -= (this->logicalRight() - logicalRight); }
-    void moveHorizontally(LayoutUnit delta) { m_logicalLeft += delta; }
+    LayoutUnit width() const { return m_logicalRect.width(); }
+    LayoutUnit height() const { return m_logicalRect.height(); }
 
+    void setWidth(LayoutUnit width) { m_logicalRect.setWidth(width); }
+    void setLogicalLeft(LayoutUnit logicalLeft) { m_logicalRect.setLeft(logicalLeft); }
+    void setLogicalRight(LayoutUnit logicalRight) { m_logicalRect.shiftRightTo(logicalRight); }
+    void moveHorizontally(LayoutUnit delta) { m_logicalRect.moveHorizontally(delta); }
+
     struct ExpansionOpportunity {
         unsigned count { 0 };
         ExpansionBehavior behavior { ForbidLeadingExpansion | ForbidTrailingExpansion };
@@ -73,8 +77,7 @@
     const InlineItem& inlineItem() const { return m_inlineItem; }
 
 private:
-    LayoutUnit m_logicalLeft;
-    LayoutUnit m_width;
+    Display::Box::Rect m_logicalRect;
     ExpansionOpportunity m_expansionOpportunity;
 
     const InlineItem& m_inlineItem;
@@ -83,9 +86,8 @@
 
 using InlineRuns = Vector<InlineRun>;
 
-inline InlineRun::InlineRun(LayoutUnit logicalLeft, LayoutUnit width, const InlineItem& inlineItem)
-    : m_logicalLeft(logicalLeft)
-    , m_width(width)
+inline InlineRun::InlineRun(Display::Box::Rect logicalRect, const InlineItem& inlineItem)
+    : m_logicalRect(logicalRect)
     , m_inlineItem(inlineItem)
 {
 }

Modified: trunk/Source/WebCore/layout/inlineformatting/Line.cpp (237550 => 237551)


--- trunk/Source/WebCore/layout/inlineformatting/Line.cpp	2018-10-29 14:44:53 UTC (rev 237550)
+++ trunk/Source/WebCore/layout/inlineformatting/Line.cpp	2018-10-29 14:48:11 UTC (rev 237551)
@@ -151,7 +151,8 @@
 
     auto requiresNewInlineRun = !hasContent() || !content.isText() || !m_lastRunCanExpand;
     if (requiresNewInlineRun) {
-        auto inlineRun = InlineRun { contentLogicalRight(), run.width, content.inlineItem() };
+        // FIXME: This needs proper baseline handling
+        auto inlineRun = InlineRun { { logicalTop(), contentLogicalRight(), run.width, logicalBottom() - logicalTop() }, content.inlineItem() };
         if (textRun)
             inlineRun.setTextContext({ textRun->start(), textRun->length() });
         m_formattingState.appendInlineRun(inlineRun);

Modified: trunk/Tools/ChangeLog (237550 => 237551)


--- trunk/Tools/ChangeLog	2018-10-29 14:44:53 UTC (rev 237550)
+++ trunk/Tools/ChangeLog	2018-10-29 14:48:11 UTC (rev 237551)
@@ -1,5 +1,14 @@
 2018-10-29  Zalan Bujtas  <[email protected]>
 
+        [LFC] Add support for inflow non replaced content height when the box is an inline formatting root.
+        https://bugs.webkit.org/show_bug.cgi?id=191011
+
+        Reviewed by Antti Koivisto.
+
+        * LayoutReloaded/misc/LFC-passing-tests.txt:
+
+2018-10-29  Zalan Bujtas  <[email protected]>
+
         Missing from r237549
 
         Reviewed by Antti Koivisto.

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


--- trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2018-10-29 14:44:53 UTC (rev 237550)
+++ trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2018-10-29 14:48:11 UTC (rev 237551)
@@ -65,3 +65,4 @@
 fast/block/basic/inline-content-with-floating-image.html
 fast/block/basic/inline-content-with-floating-images2.html
 fast/inline/simple-intruding-float1.html
+fast/inline/simple-intruding-floats2.html
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to