Title: [238460] trunk
Revision
238460
Author
[email protected]
Date
2018-11-23 09:05:43 -0800 (Fri, 23 Nov 2018)

Log Message

[LFC][IFC] Add support for variable height runs.
https://bugs.webkit.org/show_bug.cgi?id=191925

Reviewed by Antti Koivisto.

Source/WebCore:

https://www.w3.org/TR/CSS22/visudet.html#inline-box-height

10.8 Line height calculations: the 'line-height' and 'vertical-align' properties

The height of each inline-level box in the line box is calculated. For replaced elements, inline-block elements,
and inline-table elements, this is the height of their margin box; for inline boxes, this is their 'line-height'.

The line box height is the distance between the uppermost box top and the lowermost box bottom.

The minimum height consists of a minimum height above the baseline and a minimum depth below it,
exactly as if each line box starts with a zero-width inline box with the element's font and line height properties.
We call that imaginary box a "strut." (The name is inspired by TeX.).

Test: fast/inline/inline-content-with-image-simple.html

* layout/Verification.cpp:
(WebCore::Layout::checkForMatchingNonTextRuns):
(WebCore::Layout::checkForMatchingTextRuns):
(WebCore::Layout::outputMismatchingComplexLineInformationIfNeeded):
* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::initializeNewLine const):
(WebCore::Layout::InlineFormattingContext::splitInlineRunIfNeeded const):
(WebCore::Layout::InlineFormattingContext::createFinalRuns const):
(WebCore::Layout::InlineFormattingContext::appendContentToLine const):
(WebCore::Layout::InlineFormattingContext::layoutInlineContent const):
* layout/inlineformatting/InlineFormattingContext.h:
(WebCore::Layout::InlineFormattingContext::Line::logicalHeight const):
* layout/inlineformatting/InlineFormattingContextGeometry.cpp:
(WebCore::Layout::InlineFormattingContext::Geometry::justifyRuns):
* layout/inlineformatting/InlineRun.h:
(WebCore::Layout::InlineRun::logicalWidth const):
(WebCore::Layout::InlineRun::logicalHeight const):
(WebCore::Layout::InlineRun::setLogicalWidth):
(WebCore::Layout::InlineRun::width const): Deleted.
(WebCore::Layout::InlineRun::height const): Deleted.
(WebCore::Layout::InlineRun::setWidth): Deleted.
* layout/inlineformatting/Line.cpp:
(WebCore::Layout::InlineFormattingContext::Line::init):
(WebCore::Layout::InlineFormattingContext::Line::appendContent):
(WebCore::Layout::InlineFormattingContext::Line::close):
* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::outputInlineRuns):

Tools:

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

LayoutTests:

* fast/inline/inline-content-with-image-simple-expected.txt: Added.
* fast/inline/inline-content-with-image-simple.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (238459 => 238460)


--- trunk/LayoutTests/ChangeLog	2018-11-23 15:07:40 UTC (rev 238459)
+++ trunk/LayoutTests/ChangeLog	2018-11-23 17:05:43 UTC (rev 238460)
@@ -1,3 +1,13 @@
+2018-11-23  Zalan Bujtas  <[email protected]>
+
+        [LFC][IFC] Add support for variable height runs.
+        https://bugs.webkit.org/show_bug.cgi?id=191925
+
+        Reviewed by Antti Koivisto.
+
+        * fast/inline/inline-content-with-image-simple-expected.txt: Added.
+        * fast/inline/inline-content-with-image-simple.html: Added.
+
 2018-11-23  Javier Fernandez  <[email protected]>
 
         [css-grid] Implement Baseline Alignment for grid items

Added: trunk/LayoutTests/fast/inline/inline-content-with-image-simple-expected.txt (0 => 238460)


--- trunk/LayoutTests/fast/inline/inline-content-with-image-simple-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/inline-content-with-image-simple-expected.txt	2018-11-23 17:05:43 UTC (rev 238460)
@@ -0,0 +1,12 @@
+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 402x202 clip at (9,9) size 400x200
+  RenderBlock {DIV} at (0,0) size 402x202 [border: (1px solid #008000)]
+    RenderText {#text} at (1,83) size 11x26
+      text run at (1,83) width 11: "1"
+    RenderImage {IMG} at (12,1) size 102x102 [border: (1px solid #FF0000)]
+    RenderText {#text} at (114,83) size 11x26
+      text run at (114,83) width 11: "3"

Added: trunk/LayoutTests/fast/inline/inline-content-with-image-simple.html (0 => 238460)


--- trunk/LayoutTests/fast/inline/inline-content-with-image-simple.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/inline-content-with-image-simple.html	2018-11-23 17:05:43 UTC (rev 238460)
@@ -0,0 +1,15 @@
+<style>
+.inlineRoot {
+	border: 1px solid green;
+	width: 400px;
+	height: 200px;
+	overflow: hidden;
+	font-size: 22px;
+}
+
+.breakBoth {
+	border: 1px solid red;
+}
+</style>
+
+<div class=inlineRoot>1<img src="" height=100 width=100 class=breakBoth>3</div>

Modified: trunk/Source/WebCore/ChangeLog (238459 => 238460)


--- trunk/Source/WebCore/ChangeLog	2018-11-23 15:07:40 UTC (rev 238459)
+++ trunk/Source/WebCore/ChangeLog	2018-11-23 17:05:43 UTC (rev 238460)
@@ -1,3 +1,53 @@
+2018-11-23  Zalan Butjas  <[email protected]>
+
+        [LFC][IFC] Add support for variable height runs.
+        https://bugs.webkit.org/show_bug.cgi?id=191925
+
+        Reviewed by Antti Koivisto.
+
+        https://www.w3.org/TR/CSS22/visudet.html#inline-box-height
+
+        10.8 Line height calculations: the 'line-height' and 'vertical-align' properties
+
+        The height of each inline-level box in the line box is calculated. For replaced elements, inline-block elements,
+        and inline-table elements, this is the height of their margin box; for inline boxes, this is their 'line-height'.
+
+        The line box height is the distance between the uppermost box top and the lowermost box bottom.
+
+        The minimum height consists of a minimum height above the baseline and a minimum depth below it,
+        exactly as if each line box starts with a zero-width inline box with the element's font and line height properties.
+        We call that imaginary box a "strut." (The name is inspired by TeX.).
+
+        Test: fast/inline/inline-content-with-image-simple.html
+
+        * layout/Verification.cpp:
+        (WebCore::Layout::checkForMatchingNonTextRuns):
+        (WebCore::Layout::checkForMatchingTextRuns):
+        (WebCore::Layout::outputMismatchingComplexLineInformationIfNeeded):
+        * layout/inlineformatting/InlineFormattingContext.cpp:
+        (WebCore::Layout::InlineFormattingContext::initializeNewLine const):
+        (WebCore::Layout::InlineFormattingContext::splitInlineRunIfNeeded const):
+        (WebCore::Layout::InlineFormattingContext::createFinalRuns const):
+        (WebCore::Layout::InlineFormattingContext::appendContentToLine const):
+        (WebCore::Layout::InlineFormattingContext::layoutInlineContent const):
+        * layout/inlineformatting/InlineFormattingContext.h:
+        (WebCore::Layout::InlineFormattingContext::Line::logicalHeight const):
+        * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
+        (WebCore::Layout::InlineFormattingContext::Geometry::justifyRuns):
+        * layout/inlineformatting/InlineRun.h:
+        (WebCore::Layout::InlineRun::logicalWidth const):
+        (WebCore::Layout::InlineRun::logicalHeight const):
+        (WebCore::Layout::InlineRun::setLogicalWidth):
+        (WebCore::Layout::InlineRun::width const): Deleted.
+        (WebCore::Layout::InlineRun::height const): Deleted.
+        (WebCore::Layout::InlineRun::setWidth): Deleted.
+        * layout/inlineformatting/Line.cpp:
+        (WebCore::Layout::InlineFormattingContext::Line::init):
+        (WebCore::Layout::InlineFormattingContext::Line::appendContent):
+        (WebCore::Layout::InlineFormattingContext::Line::close):
+        * layout/layouttree/LayoutTreeBuilder.cpp:
+        (WebCore::Layout::outputInlineRuns):
+
 2018-11-23  Antti Koivisto  <[email protected]>
 
         UI side compositing doesn't paint on Mac

Modified: trunk/Source/WebCore/layout/Verification.cpp (238459 => 238460)


--- trunk/Source/WebCore/layout/Verification.cpp	2018-11-23 15:07:40 UTC (rev 238459)
+++ trunk/Source/WebCore/layout/Verification.cpp	2018-11-23 17:05:43 UTC (rev 238460)
@@ -87,12 +87,18 @@
 
 static bool checkForMatchingNonTextRuns(const InlineRun& inlineRun, const WebCore::InlineBox& inlineBox)
 {
-    return areEssentiallyEqual(inlineBox.logicalLeft(), inlineRun.logicalLeft()) && areEssentiallyEqual(inlineBox.logicalRight(), inlineRun.logicalRight());
+    return areEssentiallyEqual(inlineBox.logicalLeft(), inlineRun.logicalLeft())
+        && areEssentiallyEqual(inlineBox.logicalRight(), inlineRun.logicalRight())
+        && areEssentiallyEqual(inlineBox.logicalHeight(), inlineRun.logicalHeight());
 }
 
-static bool checkForMatchingTextRuns(const InlineRun& inlineRun, float logicalLeft, float logicalRight, unsigned start, unsigned end)
+static bool checkForMatchingTextRuns(const InlineRun& inlineRun, float logicalLeft, float logicalRight, unsigned start, unsigned end, float logicalHeight)
 {
-    return areEssentiallyEqual(logicalLeft, inlineRun.logicalLeft()) && areEssentiallyEqual(logicalRight, inlineRun.logicalRight()) && start == inlineRun.textContext()->start() && (end == (inlineRun.textContext()->start() + inlineRun.textContext()->length()));
+    return areEssentiallyEqual(logicalLeft, inlineRun.logicalLeft())
+        && areEssentiallyEqual(logicalRight, inlineRun.logicalRight())
+        && start == inlineRun.textContext()->start()
+        && (end == (inlineRun.textContext()->start() + inlineRun.textContext()->length()))
+        && areEssentiallyEqual(logicalHeight, inlineRun.logicalHeight());
 }
 
 static void collectFlowBoxSubtree(const InlineFlowBox& flowbox, Vector<WebCore::InlineBox*>& inlineBoxes)
@@ -159,7 +165,11 @@
         auto matchingRuns = false;
         if (inlineTextBox) {
             auto xOffset = resolveForRelativePositionIfNeeded(*inlineTextBox);
-            matchingRuns = checkForMatchingTextRuns(inlineRun, inlineTextBox->logicalLeft() + xOffset, inlineTextBox->logicalRight() + xOffset, inlineTextBox->start(), inlineTextBox->end() + 1);
+            matchingRuns = checkForMatchingTextRuns(inlineRun, inlineTextBox->logicalLeft() + xOffset,
+                inlineTextBox->logicalRight() + xOffset,
+                inlineTextBox->start(),
+                inlineTextBox->end() + 1,
+                inlineTextBox->logicalHeight());
 
             // <span>foobar</span>foobar generates 2 inline text boxes while we only generate one inline run.
             // also <div>foo<img style="float: left;">bar</div> too.
@@ -182,7 +192,7 @@
                     auto xOffset = resolveForRelativePositionIfNeeded(*inlineTextBox);
                     logicalRight = inlineTextBox->logicalRight() + xOffset;
                     end += (inlineTextBox->end() + 1);
-                    if (checkForMatchingTextRuns(inlineRun, logicalLeft, logicalRight, start, end)) {
+                    if (checkForMatchingTextRuns(inlineRun, logicalLeft, logicalRight, start, end, inlineTextBox->logicalHeight())) {
                         matchingRuns = true;
                         inlineBoxIndex = index;
                         break;
@@ -202,12 +212,12 @@
 
             if (inlineTextBox)
                 stream << "(" << inlineTextBox->start() << ", " << inlineTextBox->end() + 1 << ")";
-            stream << " (" << inlineBox->logicalLeft() << ", " << inlineBox->logicalRight() << ") ";
+            stream << " (" << inlineBox->logicalLeft() << ", " << inlineBox->logicalRight() << ") (" << inlineBox->logicalWidth() << "x" << inlineBox->logicalHeight() << ")";
 
             stream << "inline run ";
             if (inlineRun.textContext())
                 stream << "(" << inlineRun.textContext()->start() << ", " << inlineRun.textContext()->start() + inlineRun.textContext()->length() << ") ";
-            stream << "(" << inlineRun.logicalLeft() << ", " << inlineRun.logicalRight() << ")";
+            stream << "(" << inlineRun.logicalLeft() << ", " << inlineRun.logicalRight() << ") (" << inlineRun.logicalWidth() << "x" << inlineRun.logicalHeight() << ")";
             stream.nextLine();
             mismatched = true;
         }

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (238459 => 238460)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2018-11-23 15:07:40 UTC (rev 238459)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2018-11-23 17:05:43 UTC (rev 238460)
@@ -117,13 +117,7 @@
         }
     }
 
-    Display::Box::Rect logicalRect;
-    logicalRect.setTop(lineLogicalTop);
-    logicalRect.setLeft(lineLogicalLeft);
-    logicalRect.setWidth(availableWidth);
-    logicalRect.setHeight(formattingRoot.style().computedLineHeight());
-
-    line.init(logicalRect);
+    line.init({ lineLogicalLeft, lineLogicalTop }, availableWidth, formattingRoot.style().computedLineHeight());
 }
 
 void InlineFormattingContext::splitInlineRunIfNeeded(const InlineRun& inlineRun, InlineRuns& splitRuns) const
@@ -157,7 +151,7 @@
         contentStart += uncommitted->firstInlineItem->nonBreakableStart();
 
         auto runWidth = Geometry::runWidth(inlineContent, *uncommitted->firstInlineItem, startPosition, uncommitted->length, contentStart);
-        auto run = InlineRun { { inlineRun.logicalTop(), contentStart, runWidth, inlineRun.height() }, *uncommitted->firstInlineItem };
+        auto run = InlineRun { { inlineRun.logicalTop(), contentStart, runWidth, inlineRun.logicalHeight() }, *uncommitted->firstInlineItem };
         run.setTextContext({ startPosition, uncommitted->length });
         splitRuns.append(run);
 
@@ -235,9 +229,9 @@
                 return inlineRun;
 
             InlineRun adjustedRun = inlineRun;
-            auto width = inlineRun.width() - inlineItem.nonBreakableStart() - inlineItem.nonBreakableEnd();
+            auto width = inlineRun.logicalWidth() - inlineItem.nonBreakableStart() - inlineItem.nonBreakableEnd();
             adjustedRun.setLogicalLeft(inlineRun.logicalLeft() + inlineItem.nonBreakableStart());
-            adjustedRun.setWidth(width);
+            adjustedRun.setLogicalWidth(width);
             return adjustedRun;
         };
 
@@ -263,13 +257,13 @@
     postProcessInlineRuns(line, isLastLine);
 }
 
-void InlineFormattingContext::appendContentToLine(Line& line, const InlineLineBreaker::Run& run) const
+void InlineFormattingContext::appendContentToLine(Line& line, const InlineRunProvider::Run& run, const LayoutSize& runSize) const
 {
     auto lastRunType = line.lastRunType();
-    line.appendContent(run);
+    line.appendContent(run, runSize);
 
     if (root().style().textAlign() == TextAlignMode::Justify)
-        Geometry::computeExpansionOpportunities(line, run.content, lastRunType.value_or(InlineRunProvider::Run::Type::NonWhitespace));
+        Geometry::computeExpansionOpportunities(line, run, lastRunType.value_or(InlineRunProvider::Run::Type::NonWhitespace));
 }
 
 void InlineFormattingContext::layoutInlineContent(const InlineRunProvider& inlineRunProvider) const
@@ -318,8 +312,11 @@
             }
          }
 
-        if (generatesInlineRun)
-            appendContentToLine(line, *run);
+        if (generatesInlineRun) {
+            auto width = run->width;
+            auto height = run->content.isText() ? LayoutUnit(root().style().computedLineHeight()) : layoutState.displayBoxForLayoutBox(run->content.inlineItem().layoutBox()).height(); 
+            appendContentToLine(line, run->content, { width, height });
+        }
 
         if (isLastRun)
             closeLine(line, IsLastLine::No);

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h (238459 => 238460)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h	2018-11-23 15:07:40 UTC (rev 238459)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h	2018-11-23 17:05:43 UTC (rev 238460)
@@ -29,7 +29,6 @@
 
 #include "DisplayBox.h"
 #include "FormattingContext.h"
-#include "InlineLineBreaker.h"
 #include "InlineRun.h"
 #include <wtf/IsoMalloc.h>
 
@@ -51,10 +50,10 @@
 private:
     class Line {
     public:
-        void init(const Display::Box::Rect&);
+        void init(const LayoutPoint& topLeft, LayoutUnit availableWidth, LayoutUnit minimalHeight);
         void close();
 
-        void appendContent(const InlineLineBreaker::Run&);
+        void appendContent(const InlineRunProvider::Run&, const LayoutSize&);
 
         void adjustLogicalLeft(LayoutUnit delta);
         void adjustLogicalRight(LayoutUnit delta);
@@ -71,6 +70,7 @@
 
         LayoutUnit logicalTop() const { return m_logicalRect.top(); }
         LayoutUnit logicalBottom() const { return m_logicalRect.bottom(); }
+        LayoutUnit logicalHeight() const { return logicalBottom() - logicalTop(); }
 
     private:
         struct TrailingTrimmableContent {
@@ -105,7 +105,7 @@
     void layoutInlineContent(const InlineRunProvider&) const;
     void initializeNewLine(Line&) const;
     void closeLine(Line&, IsLastLine) const;
-    void appendContentToLine(Line&, const InlineLineBreaker::Run&) const;
+    void appendContentToLine(Line&, const InlineRunProvider::Run&, const LayoutSize&) const;
     void postProcessInlineRuns(Line&, IsLastLine) const;
     void createFinalRuns(Line&) const;
     void splitInlineRunIfNeeded(const InlineRun&, InlineRuns& splitRuns) const;

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp (238459 => 238460)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp	2018-11-23 15:07:40 UTC (rev 238459)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp	2018-11-23 17:05:43 UTC (rev 238460)
@@ -131,7 +131,7 @@
 
         inlineRun.expansionOpportunity().expansion = expansionForRun;
         inlineRun.setLogicalLeft(inlineRun.logicalLeft() + accumulatedExpansion);
-        inlineRun.setWidth(inlineRun.width() + expansionForRun);
+        inlineRun.setLogicalWidth(inlineRun.logicalWidth() + expansionForRun);
         accumulatedExpansion += expansionForRun;
     }
 }

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineRun.h (238459 => 238460)


--- trunk/Source/WebCore/layout/inlineformatting/InlineRun.h	2018-11-23 15:07:40 UTC (rev 238459)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineRun.h	2018-11-23 17:05:43 UTC (rev 238460)
@@ -41,11 +41,11 @@
     LayoutUnit logicalTop() const { return m_logicalRect.top(); }
     LayoutUnit logicalBottom() const { return m_logicalRect.bottom(); }
 
-    LayoutUnit width() const { return m_logicalRect.width(); }
-    LayoutUnit height() const { return m_logicalRect.height(); }
+    LayoutUnit logicalWidth() const { return m_logicalRect.width(); }
+    LayoutUnit logicalHeight() const { return m_logicalRect.height(); }
     bool overlapsMultipleInlineItems() const;
 
-    void setWidth(LayoutUnit width) { m_logicalRect.setWidth(width); }
+    void setLogicalWidth(LayoutUnit width) { m_logicalRect.setWidth(width); }
     void setLogicalLeft(LayoutUnit logicalLeft) { m_logicalRect.setLeft(logicalLeft); }
     void setLogicalRight(LayoutUnit logicalRight) { m_logicalRect.shiftRightTo(logicalRight); }
     void moveVertically(LayoutUnit delta) { m_logicalRect.moveVertically(delta); }

Modified: trunk/Source/WebCore/layout/inlineformatting/Line.cpp (238459 => 238460)


--- trunk/Source/WebCore/layout/inlineformatting/Line.cpp	2018-11-23 15:07:40 UTC (rev 238459)
+++ trunk/Source/WebCore/layout/inlineformatting/Line.cpp	2018-11-23 17:05:43 UTC (rev 238460)
@@ -32,10 +32,12 @@
 namespace WebCore {
 namespace Layout {
 
-void InlineFormattingContext::Line::init(const Display::Box::Rect& logicalRect)
+void InlineFormattingContext::Line::init(const LayoutPoint& topLeft, LayoutUnit availableWidth, LayoutUnit minimalHeight)
 {
-    m_logicalRect = logicalRect;
-    m_availableWidth = logicalRect.width();
+    m_logicalRect.setTopLeft(topLeft);
+    m_logicalRect.setWidth(availableWidth);
+    m_logicalRect.setHeight(minimalHeight);
+    m_availableWidth = availableWidth;
 
     m_inlineRuns.clear();
     m_lastRunType = { };
@@ -76,41 +78,41 @@
     return m_inlineRuns.last().logicalRight();
 }
 
-void InlineFormattingContext::Line::appendContent(const InlineLineBreaker::Run& run)
+void InlineFormattingContext::Line::appendContent(const InlineRunProvider::Run& run, const LayoutSize& runSize)
 {
     ASSERT(!isClosed());
 
-    auto& content = run.content;
-
     // Append this text run to the end of the last text run, if the last run is continuous.
     std::optional<InlineRun::TextContext> textRun;
-    if (content.isText()) {
-        auto textContext = content.textContext();
+    if (run.isText()) {
+        auto textContext = run.textContext();
         auto runLength = textContext->isCollapsed() ? 1 : textContext->length();
         textRun = InlineRun::TextContext { textContext->start(), runLength };
     }
 
-    auto requiresNewInlineRun = !hasContent() || !content.isText() || !m_lastRunCanExpand;
+    auto requiresNewInlineRun = !hasContent() || !run.isText() || !m_lastRunCanExpand;
     if (requiresNewInlineRun) {
         // FIXME: This needs proper baseline handling
-        auto inlineRun = InlineRun { { logicalTop(), contentLogicalRight(), run.width, logicalBottom() - logicalTop() }, content.inlineItem() };
+        auto inlineRun = InlineRun { { logicalTop(), contentLogicalRight(), runSize.width(), runSize.height() }, run.inlineItem() };
         if (textRun)
             inlineRun.setTextContext({ textRun->start(), textRun->length() });
         m_inlineRuns.append(inlineRun);
+        m_logicalRect.setHeight(std::max(runSize.height(), m_logicalRect.height()));
     } else {
         // Non-text runs always require new inline run.
         ASSERT(textRun);
         auto& inlineRun = m_inlineRuns.last();
-        inlineRun.setWidth(inlineRun.width() + run.width);
+        ASSERT(runSize.height() == inlineRun.logicalHeight());
+        inlineRun.setLogicalWidth(inlineRun.logicalWidth() + runSize.width());
         inlineRun.textContext()->setLength(inlineRun.textContext()->length() + textRun->length());
     }
 
-    m_availableWidth -= run.width;
-    m_lastRunType = content.type();
-    m_lastRunCanExpand = content.isText() && !content.textContext()->isCollapsed();
+    m_availableWidth -= runSize.width();
+    m_lastRunType = run.type();
+    m_lastRunCanExpand = run.isText() && !run.textContext()->isCollapsed();
     m_trailingTrimmableContent = { };
-    if (isTrimmableContent(content))
-        m_trailingTrimmableContent = TrailingTrimmableContent { run.width, textRun->length() };
+    if (isTrimmableContent(run))
+        m_trailingTrimmableContent = TrailingTrimmableContent { runSize.width(), textRun->length() };
 }
 
 void InlineFormattingContext::Line::close()
@@ -121,7 +123,7 @@
             return;
 
         auto& lastInlineRun = m_inlineRuns.last();
-        lastInlineRun.setWidth(lastInlineRun.width() - m_trailingTrimmableContent->width);
+        lastInlineRun.setLogicalWidth(lastInlineRun.logicalWidth() - m_trailingTrimmableContent->width);
         lastInlineRun.textContext()->setLength(lastInlineRun.textContext()->length() - m_trailingTrimmableContent->length);
 
         if (!lastInlineRun.textContext()->length())

Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp (238459 => 238460)


--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2018-11-23 15:07:40 UTC (rev 238459)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2018-11-23 17:05:43 UTC (rev 238460)
@@ -151,7 +151,7 @@
             stream << "(" << inlineRun.textContext()->start() << ", " << inlineRun.textContext()->start() + inlineRun.textContext()->length() << ") ";
         else
             stream << "(x, x) ";
-        stream << "at [" << inlineRun.logicalLeft() << ", " << inlineRun.logicalTop() << "] size [" << inlineRun.width() << " " << inlineRun.height() << "]";
+        stream << "at [" << inlineRun.logicalLeft() << ", " << inlineRun.logicalTop() << "] size [" << inlineRun.logicalWidth() << " " << inlineRun.logicalHeight() << "]";
         stream.nextLine();
     }
 }

Modified: trunk/Tools/ChangeLog (238459 => 238460)


--- trunk/Tools/ChangeLog	2018-11-23 15:07:40 UTC (rev 238459)
+++ trunk/Tools/ChangeLog	2018-11-23 17:05:43 UTC (rev 238460)
@@ -1,3 +1,12 @@
+2018-11-23  Zalan Bujtas  <[email protected]>
+
+        [LFC][IFC] Add support for variable height runs.
+        https://bugs.webkit.org/show_bug.cgi?id=191925
+
+        Reviewed by Antti Koivisto.
+
+        * LayoutReloaded/misc/LFC-passing-tests.txt:
+
 2018-11-23  Alberto Garcia  <[email protected]>
 
         [GTK] [WPE] Tools/Platform{GTK,WPE}.cmake files missing from the tarballs

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


--- trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2018-11-23 15:07:40 UTC (rev 238459)
+++ trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2018-11-23 17:05:43 UTC (rev 238460)
@@ -76,6 +76,7 @@
 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/inline/inline-content-with-image-simple.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