Title: [253255] trunk/Source/WebCore
Revision
253255
Author
[email protected]
Date
2019-12-07 10:18:16 -0800 (Sat, 07 Dec 2019)

Log Message

[LFC][IFC] Introduce InlineLayoutUnit
https://bugs.webkit.org/show_bug.cgi?id=204986
<rdar://problem/57728333>

Reviewed by Antti Koivisto.

While IFC uses LayoutUnit type solely to compute inline geometry, complex line layout (CLL) has
adopted several different types over time (int, float and LayoutUnit). These types all have different precisions.
In order to match CLL's output (inline tree geometry) IFC needs to use a type that has
roughly the same precision as what CLL uses.
LayoutUnit currently does not have high enough precision (1/64) to produce matching results.
This patch introduces InlineLayoutUnit. It is going to be mapped to 'float' for now (in a subsequent patch).
It helps to keep one uniform type across the IFC codebase and we could also just re-map it to something
more appropriate in the future.

* layout/LayoutUnits.h:
* layout/displaytree/DisplayLineBox.h:
(WebCore::Display::LineBox::Baseline::height const):
(WebCore::Display::LineBox::logicalLeft const):
(WebCore::Display::LineBox::logicalRight const):
(WebCore::Display::LineBox::logicalTop const):
(WebCore::Display::LineBox::logicalBottom const):
(WebCore::Display::LineBox::logicalWidth const):
(WebCore::Display::LineBox::logicalHeight const):
(WebCore::Display::LineBox::setLogicalHeight):
(WebCore::Display::LineBox::setLogicalWidth):
(WebCore::Display::LineBox::moveHorizontally):
(WebCore::Display::LineBox::expandHorizontally):
(WebCore::Display::LineBox::shrinkHorizontally):
(WebCore::Display::LineBox::expandVertically):
(WebCore::Display::LineBox::shrinkVertically):
(WebCore::Display::LineBox::LineBox):
(WebCore::Display::LineBox::setLogicalHeightIfGreater):
(WebCore::Display::LineBox::setBaselineOffsetIfGreater):
(WebCore::Display::LineBox::setAscentIfGreater):
(WebCore::Display::LineBox::setDescentIfGreater):
(WebCore::Display::LineBox::baselineOffset const):
(WebCore::Display::LineBox::Baseline::Baseline):
(WebCore::Display::LineBox::Baseline::setAscent):
(WebCore::Display::LineBox::Baseline::setDescent):
(WebCore::Display::LineBox::Baseline::ascent const):
(WebCore::Display::LineBox::Baseline::descent const):
* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraints):
(WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthForConstraint const):
(WebCore::Layout::InlineFormattingContext::constraintsForLine):
* layout/inlineformatting/InlineFormattingContext.h:
* layout/inlineformatting/InlineFormattingContextQuirks.cpp:
(WebCore::Layout::InlineFormattingContext::Quirks::lineHeightConstraints const):
* layout/inlineformatting/InlineLineBreaker.cpp:
(WebCore::Layout::LineBreaker::shouldWrapFloatBox):
(WebCore::Layout::LineBreaker::wordBreakingBehavior const):
(WebCore::Layout::LineBreaker::tryBreakingTextRun const):
(WebCore::Layout::LineBreaker::Content::append):
* layout/inlineformatting/InlineLineBreaker.h:
(WebCore::Layout::LineBreaker::Content::width const):
(WebCore::Layout::LineBreaker::Content::nonTrimmableWidth const):
* layout/inlineformatting/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::Run::setComputedHorizontalExpansion):
(WebCore::Layout::LineBuilder::initialize):
(WebCore::Layout::LineBuilder::alignContentVertically):
(WebCore::Layout::LineBuilder::justifyRuns const):
(WebCore::Layout::LineBuilder::alignContentHorizontally const):
(WebCore::Layout::LineBuilder::moveLogicalLeft):
(WebCore::Layout::LineBuilder::moveLogicalRight):
(WebCore::Layout::LineBuilder::append):
(WebCore::Layout::LineBuilder::appendNonBreakableSpace):
(WebCore::Layout::LineBuilder::appendInlineContainerStart):
(WebCore::Layout::LineBuilder::appendInlineContainerEnd):
(WebCore::Layout::LineBuilder::appendTextContent):
(WebCore::Layout::LineBuilder::appendNonReplacedInlineBox):
(WebCore::Layout::LineBuilder::appendReplacedInlineBox):
(WebCore::Layout::LineBuilder::runContentHeight const):
(WebCore::Layout::LineBuilder::halfLeadingMetrics):
(WebCore::Layout::LineBuilder::TrimmableContent::append):
(WebCore::Layout::LineBuilder::TrimmableContent::trim):
(WebCore::Layout::LineBuilder::TrimmableContent::trimTrailingRun):
(WebCore::Layout::LineBuilder::InlineItemRun::InlineItemRun):
(WebCore::Layout::LineBuilder::InlineItemRun::trailingLetterSpacing const):
* layout/inlineformatting/InlineLineBuilder.h:
(WebCore::Layout::LineBuilder::availableWidth const):
(WebCore::Layout::LineBuilder::trailingTrimmableWidth const):
(WebCore::Layout::LineBuilder::Run::adjustLogicalTop):
(WebCore::Layout::LineBuilder::Run::moveHorizontally):
(WebCore::Layout::LineBuilder::Run::moveVertically):
(WebCore::Layout::LineBuilder::Run::setLogicalHeight):
(WebCore::Layout::LineBuilder::logicalTop const):
(WebCore::Layout::LineBuilder::logicalBottom const):
(WebCore::Layout::LineBuilder::logicalLeft const):
(WebCore::Layout::LineBuilder::logicalRight const):
(WebCore::Layout::LineBuilder::logicalWidth const):
(WebCore::Layout::LineBuilder::logicalHeight const):
(WebCore::Layout::LineBuilder::contentLogicalWidth const):
(WebCore::Layout::LineBuilder::contentLogicalRight const):
(WebCore::Layout::LineBuilder::baselineOffset const):
(WebCore::Layout::LineBuilder::InlineItemRun::logicalLeft const):
(WebCore::Layout::LineBuilder::InlineItemRun::logicalWidth const):
(WebCore::Layout::LineBuilder::InlineItemRun::moveHorizontally):
(WebCore::Layout::LineBuilder::TrimmableContent::width const):
* layout/inlineformatting/InlineTextItem.cpp:
(WebCore::Layout::InlineTextItem::createAndAppendTextItems):
(WebCore::Layout::InlineTextItem::createWhitespaceItem):
(WebCore::Layout::InlineTextItem::createNonWhitespaceItem):
(WebCore::Layout::InlineTextItem::InlineTextItem):
* layout/inlineformatting/InlineTextItem.h:
(WebCore::Layout::InlineTextItem::width const):
* layout/inlineformatting/LineLayoutContext.cpp:
(WebCore::Layout::inlineItemWidth):
* layout/inlineformatting/text/TextUtil.cpp:
(WebCore::Layout::TextUtil::width):
(WebCore::Layout::TextUtil::fixedPitchWidth):
(WebCore::Layout::TextUtil::split):
* layout/inlineformatting/text/TextUtil.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (253254 => 253255)


--- trunk/Source/WebCore/ChangeLog	2019-12-07 15:21:02 UTC (rev 253254)
+++ trunk/Source/WebCore/ChangeLog	2019-12-07 18:18:16 UTC (rev 253255)
@@ -1,3 +1,119 @@
+2019-12-07  Zalan Bujtas  <[email protected]>
+
+        [LFC][IFC] Introduce InlineLayoutUnit
+        https://bugs.webkit.org/show_bug.cgi?id=204986
+        <rdar://problem/57728333>
+
+        Reviewed by Antti Koivisto.
+
+        While IFC uses LayoutUnit type solely to compute inline geometry, complex line layout (CLL) has
+        adopted several different types over time (int, float and LayoutUnit). These types all have different precisions.
+        In order to match CLL's output (inline tree geometry) IFC needs to use a type that has
+        roughly the same precision as what CLL uses.
+        LayoutUnit currently does not have high enough precision (1/64) to produce matching results.
+        This patch introduces InlineLayoutUnit. It is going to be mapped to 'float' for now (in a subsequent patch).
+        It helps to keep one uniform type across the IFC codebase and we could also just re-map it to something
+        more appropriate in the future. 
+
+        * layout/LayoutUnits.h:
+        * layout/displaytree/DisplayLineBox.h:
+        (WebCore::Display::LineBox::Baseline::height const):
+        (WebCore::Display::LineBox::logicalLeft const):
+        (WebCore::Display::LineBox::logicalRight const):
+        (WebCore::Display::LineBox::logicalTop const):
+        (WebCore::Display::LineBox::logicalBottom const):
+        (WebCore::Display::LineBox::logicalWidth const):
+        (WebCore::Display::LineBox::logicalHeight const):
+        (WebCore::Display::LineBox::setLogicalHeight):
+        (WebCore::Display::LineBox::setLogicalWidth):
+        (WebCore::Display::LineBox::moveHorizontally):
+        (WebCore::Display::LineBox::expandHorizontally):
+        (WebCore::Display::LineBox::shrinkHorizontally):
+        (WebCore::Display::LineBox::expandVertically):
+        (WebCore::Display::LineBox::shrinkVertically):
+        (WebCore::Display::LineBox::LineBox):
+        (WebCore::Display::LineBox::setLogicalHeightIfGreater):
+        (WebCore::Display::LineBox::setBaselineOffsetIfGreater):
+        (WebCore::Display::LineBox::setAscentIfGreater):
+        (WebCore::Display::LineBox::setDescentIfGreater):
+        (WebCore::Display::LineBox::baselineOffset const):
+        (WebCore::Display::LineBox::Baseline::Baseline):
+        (WebCore::Display::LineBox::Baseline::setAscent):
+        (WebCore::Display::LineBox::Baseline::setDescent):
+        (WebCore::Display::LineBox::Baseline::ascent const):
+        (WebCore::Display::LineBox::Baseline::descent const):
+        * layout/inlineformatting/InlineFormattingContext.cpp:
+        (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraints):
+        (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthForConstraint const):
+        (WebCore::Layout::InlineFormattingContext::constraintsForLine):
+        * layout/inlineformatting/InlineFormattingContext.h:
+        * layout/inlineformatting/InlineFormattingContextQuirks.cpp:
+        (WebCore::Layout::InlineFormattingContext::Quirks::lineHeightConstraints const):
+        * layout/inlineformatting/InlineLineBreaker.cpp:
+        (WebCore::Layout::LineBreaker::shouldWrapFloatBox):
+        (WebCore::Layout::LineBreaker::wordBreakingBehavior const):
+        (WebCore::Layout::LineBreaker::tryBreakingTextRun const):
+        (WebCore::Layout::LineBreaker::Content::append):
+        * layout/inlineformatting/InlineLineBreaker.h:
+        (WebCore::Layout::LineBreaker::Content::width const):
+        (WebCore::Layout::LineBreaker::Content::nonTrimmableWidth const):
+        * layout/inlineformatting/InlineLineBuilder.cpp:
+        (WebCore::Layout::LineBuilder::Run::setComputedHorizontalExpansion):
+        (WebCore::Layout::LineBuilder::initialize):
+        (WebCore::Layout::LineBuilder::alignContentVertically):
+        (WebCore::Layout::LineBuilder::justifyRuns const):
+        (WebCore::Layout::LineBuilder::alignContentHorizontally const):
+        (WebCore::Layout::LineBuilder::moveLogicalLeft):
+        (WebCore::Layout::LineBuilder::moveLogicalRight):
+        (WebCore::Layout::LineBuilder::append):
+        (WebCore::Layout::LineBuilder::appendNonBreakableSpace):
+        (WebCore::Layout::LineBuilder::appendInlineContainerStart):
+        (WebCore::Layout::LineBuilder::appendInlineContainerEnd):
+        (WebCore::Layout::LineBuilder::appendTextContent):
+        (WebCore::Layout::LineBuilder::appendNonReplacedInlineBox):
+        (WebCore::Layout::LineBuilder::appendReplacedInlineBox):
+        (WebCore::Layout::LineBuilder::runContentHeight const):
+        (WebCore::Layout::LineBuilder::halfLeadingMetrics):
+        (WebCore::Layout::LineBuilder::TrimmableContent::append):
+        (WebCore::Layout::LineBuilder::TrimmableContent::trim):
+        (WebCore::Layout::LineBuilder::TrimmableContent::trimTrailingRun):
+        (WebCore::Layout::LineBuilder::InlineItemRun::InlineItemRun):
+        (WebCore::Layout::LineBuilder::InlineItemRun::trailingLetterSpacing const):
+        * layout/inlineformatting/InlineLineBuilder.h:
+        (WebCore::Layout::LineBuilder::availableWidth const):
+        (WebCore::Layout::LineBuilder::trailingTrimmableWidth const):
+        (WebCore::Layout::LineBuilder::Run::adjustLogicalTop):
+        (WebCore::Layout::LineBuilder::Run::moveHorizontally):
+        (WebCore::Layout::LineBuilder::Run::moveVertically):
+        (WebCore::Layout::LineBuilder::Run::setLogicalHeight):
+        (WebCore::Layout::LineBuilder::logicalTop const):
+        (WebCore::Layout::LineBuilder::logicalBottom const):
+        (WebCore::Layout::LineBuilder::logicalLeft const):
+        (WebCore::Layout::LineBuilder::logicalRight const):
+        (WebCore::Layout::LineBuilder::logicalWidth const):
+        (WebCore::Layout::LineBuilder::logicalHeight const):
+        (WebCore::Layout::LineBuilder::contentLogicalWidth const):
+        (WebCore::Layout::LineBuilder::contentLogicalRight const):
+        (WebCore::Layout::LineBuilder::baselineOffset const):
+        (WebCore::Layout::LineBuilder::InlineItemRun::logicalLeft const):
+        (WebCore::Layout::LineBuilder::InlineItemRun::logicalWidth const):
+        (WebCore::Layout::LineBuilder::InlineItemRun::moveHorizontally):
+        (WebCore::Layout::LineBuilder::TrimmableContent::width const):
+        * layout/inlineformatting/InlineTextItem.cpp:
+        (WebCore::Layout::InlineTextItem::createAndAppendTextItems):
+        (WebCore::Layout::InlineTextItem::createWhitespaceItem):
+        (WebCore::Layout::InlineTextItem::createNonWhitespaceItem):
+        (WebCore::Layout::InlineTextItem::InlineTextItem):
+        * layout/inlineformatting/InlineTextItem.h:
+        (WebCore::Layout::InlineTextItem::width const):
+        * layout/inlineformatting/LineLayoutContext.cpp:
+        (WebCore::Layout::inlineItemWidth):
+        * layout/inlineformatting/text/TextUtil.cpp:
+        (WebCore::Layout::TextUtil::width):
+        (WebCore::Layout::TextUtil::fixedPitchWidth):
+        (WebCore::Layout::TextUtil::split):
+        * layout/inlineformatting/text/TextUtil.h:
+
 2019-12-07  Antti Koivisto  <[email protected]>
 
         [LFC][IFC] Move LineBox to Display namespace

Modified: trunk/Source/WebCore/layout/LayoutUnits.h (253254 => 253255)


--- trunk/Source/WebCore/layout/LayoutUnits.h	2019-12-07 15:21:02 UTC (rev 253254)
+++ trunk/Source/WebCore/layout/LayoutUnits.h	2019-12-07 18:18:16 UTC (rev 253255)
@@ -38,6 +38,8 @@
 class Box;
 }
 
+using InlineLayoutUnit = LayoutUnit;
+
 namespace Layout {
 
 struct Position {

Modified: trunk/Source/WebCore/layout/displaytree/DisplayLineBox.h (253254 => 253255)


--- trunk/Source/WebCore/layout/displaytree/DisplayLineBox.h	2019-12-07 15:21:02 UTC (rev 253254)
+++ trunk/Source/WebCore/layout/displaytree/DisplayLineBox.h	2019-12-07 18:18:16 UTC (rev 253255)
@@ -36,17 +36,17 @@
     WTF_MAKE_FAST_ALLOCATED;
 public:
     struct Baseline {
-        Baseline(LayoutUnit ascent, LayoutUnit descent);
+        Baseline(InlineLayoutUnit ascent, InlineLayoutUnit descent);
         Baseline() = default;
 
-        void setAscent(LayoutUnit);
-        void setDescent(LayoutUnit);
+        void setAscent(InlineLayoutUnit);
+        void setDescent(InlineLayoutUnit);
 
         void reset();
 
-        LayoutUnit height() const { return ascent() + descent(); }
-        LayoutUnit ascent() const;
-        LayoutUnit descent() const;
+        InlineLayoutUnit height() const { return ascent() + descent(); }
+        InlineLayoutUnit ascent() const;
+        InlineLayoutUnit descent() const;
 
     private:
 #if !ASSERT_DISABLED
@@ -53,22 +53,22 @@
         bool m_hasValidAscent { false };
         bool m_hasValidDescent { false };
 #endif
-        LayoutUnit m_ascent;
-        LayoutUnit m_descent;
+        InlineLayoutUnit m_ascent;
+        InlineLayoutUnit m_descent;
     };
 
-    LineBox(Rect, const Baseline&, LayoutUnit baselineOffset);
+    LineBox(Rect, const Baseline&, InlineLayoutUnit baselineOffset);
     LineBox() = default;
     
     LayoutPoint logicalTopLeft() const { return m_rect.topLeft(); }
 
-    LayoutUnit logicalLeft() const { return m_rect.left(); }
-    LayoutUnit logicalRight() const { return m_rect.right(); }
-    LayoutUnit logicalTop() const { return m_rect.top(); }
-    LayoutUnit logicalBottom() const { return m_rect.bottom(); }
+    InlineLayoutUnit logicalLeft() const { return m_rect.left(); }
+    InlineLayoutUnit logicalRight() const { return m_rect.right(); }
+    InlineLayoutUnit logicalTop() const { return m_rect.top(); }
+    InlineLayoutUnit logicalBottom() const { return m_rect.bottom(); }
 
-    LayoutUnit logicalWidth() const { return m_rect.width(); }
-    LayoutUnit logicalHeight() const { return m_rect.height(); }
+    InlineLayoutUnit logicalWidth() const { return m_rect.width(); }
+    InlineLayoutUnit logicalHeight() const { return m_rect.height(); }
 
     const Baseline& baseline() const;
     // Baseline offset from line logical top. Note that offset does not necessarily equal to ascent.
@@ -86,27 +86,27 @@
     //   | descent                                    v
     //   v
     // -------------------    line logical bottom  -------------------
-    LayoutUnit baselineOffset() const;
-    void setBaselineOffsetIfGreater(LayoutUnit);
-    void setAscentIfGreater(LayoutUnit);
-    void setDescentIfGreater(LayoutUnit);
+    InlineLayoutUnit baselineOffset() const;
+    void setBaselineOffsetIfGreater(InlineLayoutUnit);
+    void setAscentIfGreater(InlineLayoutUnit);
+    void setDescentIfGreater(InlineLayoutUnit);
 
     void resetBaseline();
     void resetDescent() { m_baseline.setDescent(0_lu); }
 
     void setLogicalTopLeft(LayoutPoint logicalTopLeft) { m_rect.setTopLeft(logicalTopLeft); }
-    void setLogicalHeight(LayoutUnit logicalHeight) { m_rect.setHeight(logicalHeight); }
+    void setLogicalHeight(InlineLayoutUnit logicalHeight) { m_rect.setHeight(logicalHeight); }
 
-    void setLogicalHeightIfGreater(LayoutUnit);
-    void setLogicalWidth(LayoutUnit logicalWidth) { m_rect.setWidth(logicalWidth); }
+    void setLogicalHeightIfGreater(InlineLayoutUnit);
+    void setLogicalWidth(InlineLayoutUnit logicalWidth) { m_rect.setWidth(logicalWidth); }
 
-    void moveHorizontally(LayoutUnit delta) { m_rect.moveHorizontally(delta); }
+    void moveHorizontally(InlineLayoutUnit delta) { m_rect.moveHorizontally(delta); }
 
-    void expandHorizontally(LayoutUnit delta) { m_rect.expandHorizontally(delta); }
-    void shrinkHorizontally(LayoutUnit delta) { expandHorizontally(-delta); }
+    void expandHorizontally(InlineLayoutUnit delta) { m_rect.expandHorizontally(delta); }
+    void shrinkHorizontally(InlineLayoutUnit delta) { expandHorizontally(-delta); }
 
-    void expandVertically(LayoutUnit delta) { m_rect.expandVertically(delta); }
-    void shrinkVertically(LayoutUnit delta) { expandVertically(-delta); }
+    void expandVertically(InlineLayoutUnit delta) { m_rect.expandVertically(delta); }
+    void shrinkVertically(InlineLayoutUnit delta) { expandVertically(-delta); }
 
     // https://www.w3.org/TR/CSS22/visuren.html#inline-formatting
     // Line boxes that contain no text, no preserved white space, no inline elements with non-zero margins, padding, or borders,
@@ -125,11 +125,11 @@
 #endif
     Rect m_rect;
     Baseline m_baseline;
-    LayoutUnit m_baselineOffset;
+    InlineLayoutUnit m_baselineOffset;
     bool m_isConsideredEmpty { true };
 };
 
-inline LineBox::LineBox(Rect rect, const Baseline& baseline, LayoutUnit baselineOffset)
+inline LineBox::LineBox(Rect rect, const Baseline& baseline, InlineLayoutUnit baselineOffset)
     : m_rect(rect)
     , m_baseline(baseline)
     , m_baselineOffset(baselineOffset)
@@ -140,7 +140,7 @@
 #endif
 }
 
-inline void LineBox::setLogicalHeightIfGreater(LayoutUnit logicalHeight)
+inline void LineBox::setLogicalHeightIfGreater(InlineLayoutUnit logicalHeight)
 {
     if (logicalHeight <= m_rect.height())
         return;
@@ -153,7 +153,7 @@
     return m_baseline;
 }
 
-inline void LineBox::setBaselineOffsetIfGreater(LayoutUnit baselineOffset)
+inline void LineBox::setBaselineOffsetIfGreater(InlineLayoutUnit baselineOffset)
 {
 #if !ASSERT_DISABLED
     m_hasValidBaselineOffset = true;
@@ -161,7 +161,7 @@
     m_baselineOffset = std::max(baselineOffset, m_baselineOffset);
 }
 
-inline void LineBox::setAscentIfGreater(LayoutUnit ascent)
+inline void LineBox::setAscentIfGreater(InlineLayoutUnit ascent)
 {
     if (ascent < m_baseline.ascent())
         return;
@@ -169,7 +169,7 @@
     m_baseline.setAscent(ascent);
 }
 
-inline void LineBox::setDescentIfGreater(LayoutUnit descent)
+inline void LineBox::setDescentIfGreater(InlineLayoutUnit descent)
 {
     if (descent < m_baseline.descent())
         return;
@@ -176,7 +176,7 @@
     m_baseline.setDescent(descent);
 }
 
-inline LayoutUnit LineBox::baselineOffset() const
+inline InlineLayoutUnit LineBox::baselineOffset() const
 {
     ASSERT(m_hasValidBaselineOffset);
     return m_baselineOffset;
@@ -191,7 +191,7 @@
     m_baseline.reset();
 }
 
-inline LineBox::Baseline::Baseline(LayoutUnit ascent, LayoutUnit descent)
+inline LineBox::Baseline::Baseline(InlineLayoutUnit ascent, InlineLayoutUnit descent)
     : m_ascent(ascent)
     , m_descent(descent)
 {
@@ -201,7 +201,7 @@
 #endif
 }
 
-inline void LineBox::Baseline::setAscent(LayoutUnit ascent)
+inline void LineBox::Baseline::setAscent(InlineLayoutUnit ascent)
 {
 #if !ASSERT_DISABLED
     m_hasValidAscent = true;
@@ -209,7 +209,7 @@
     m_ascent = ascent;
 }
 
-inline void LineBox::Baseline::setDescent(LayoutUnit descent)
+inline void LineBox::Baseline::setDescent(InlineLayoutUnit descent)
 {
 #if !ASSERT_DISABLED
     m_hasValidDescent = true;
@@ -227,13 +227,13 @@
     m_descent = 0_lu;
 }
 
-inline LayoutUnit LineBox::Baseline::ascent() const
+inline InlineLayoutUnit LineBox::Baseline::ascent() const
 {
     ASSERT(m_hasValidAscent);
     return m_ascent;
 }
 
-inline LayoutUnit LineBox::Baseline::descent() const
+inline InlineLayoutUnit LineBox::Baseline::descent() const
 {
     ASSERT(m_hasValidDescent);
     return m_descent;

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (253254 => 253255)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2019-12-07 15:21:02 UTC (rev 253254)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2019-12-07 18:18:16 UTC (rev 253255)
@@ -223,15 +223,15 @@
         return computedIntrinsicWidthForConstraint(usedHorizontalValues);
     };
 
-    auto constraints = geometry().constrainByMinMaxWidth(root(), { maximumLineWidth(0), maximumLineWidth(LayoutUnit::max()) });
+    auto constraints = geometry().constrainByMinMaxWidth(root(), { maximumLineWidth(0), maximumLineWidth(InlineLayoutUnit::max()) });
     formattingState().setIntrinsicWidthConstraints(constraints);
     return constraints;
 }
 
-LayoutUnit InlineFormattingContext::computedIntrinsicWidthForConstraint(const UsedHorizontalValues& usedHorizontalValues) const
+InlineLayoutUnit InlineFormattingContext::computedIntrinsicWidthForConstraint(const UsedHorizontalValues& usedHorizontalValues) const
 {
     auto& inlineItems = formattingState().inlineItems();
-    LayoutUnit maximumLineWidth;
+    InlineLayoutUnit maximumLineWidth;
     unsigned leadingInlineItemIndex = 0;
     auto lineBuilder = LineBuilder { *this, root().style().textAlign(), LineBuilder::SkipAlignment::Yes };
     auto lineLayoutContext = LineLayoutContext { *this, root(), inlineItems };
@@ -241,7 +241,7 @@
         auto lineContent = lineLayoutContext.layoutLine(lineBuilder, leadingInlineItemIndex, { });
 
         leadingInlineItemIndex = *lineContent.trailingInlineItemIndex + 1;
-        LayoutUnit floatsWidth;
+        InlineLayoutUnit floatsWidth;
         for (auto& floatItem : lineContent.floats)
             floatsWidth += geometryForBox(floatItem->layoutBox()).marginBoxWidth();
         maximumLineWidth = std::max(maximumLineWidth, floatsWidth + lineContent.lineBox.logicalWidth());
@@ -371,7 +371,7 @@
     }
 }
 
-LineBuilder::Constraints InlineFormattingContext::constraintsForLine(const UsedHorizontalValues& usedHorizontalValues, const LayoutUnit lineLogicalTop)
+LineBuilder::Constraints InlineFormattingContext::constraintsForLine(const UsedHorizontalValues& usedHorizontalValues, const InlineLayoutUnit lineLogicalTop)
 {
     auto lineLogicalLeft = geometryForBox(root()).contentBoxLeft();
     auto availableWidth = usedHorizontalValues.constraints.width;

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h (253254 => 253255)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h	2019-12-07 15:21:02 UTC (rev 253254)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h	2019-12-07 18:18:16 UTC (rev 253255)
@@ -82,7 +82,7 @@
 
     void computeIntrinsicWidthForFormattingRoot(const Box&, const UsedHorizontalValues&);
     void computeWidthAndHeightForReplacedInlineBox(const Box&, const UsedHorizontalValues&, const UsedVerticalValues&);
-    LayoutUnit computedIntrinsicWidthForConstraint(const UsedHorizontalValues&) const;
+    InlineLayoutUnit computedIntrinsicWidthForConstraint(const UsedHorizontalValues&) const;
 
     void computeHorizontalMargin(const Box&, const UsedHorizontalValues&);
     void computeHeightAndMargin(const Box&, const UsedHorizontalValues&, const UsedVerticalValues&);
@@ -89,7 +89,7 @@
     void computeWidthAndMargin(const Box&, const UsedHorizontalValues&);
 
     void collectInlineContentIfNeeded();
-    LineBuilder::Constraints constraintsForLine(const UsedHorizontalValues&, const LayoutUnit lineLogicalTop);
+    LineBuilder::Constraints constraintsForLine(const UsedHorizontalValues&, const InlineLayoutUnit lineLogicalTop);
     void setDisplayBoxesForLine(const LineLayoutContext::LineContent&, const UsedHorizontalValues&);
     void invalidateFormattingState(const InvalidationState&);
 

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextQuirks.cpp (253254 => 253255)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextQuirks.cpp	2019-12-07 15:21:02 UTC (rev 253254)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextQuirks.cpp	2019-12-07 18:18:16 UTC (rev 253255)
@@ -89,7 +89,7 @@
         return { initialBaselineOffset, initialBaselineOffset, Display::LineBox::Baseline { strutBaselineOffset, strutHeight - strutBaselineOffset } };
     }
     // FIXME: The only reason why we use intValue() here is to match current inline tree (integral)behavior.
-    auto initialLineHeight = LayoutUnit { lineHeight.intValue() };
+    auto initialLineHeight = InlineLayoutUnit { lineHeight.intValue() };
     auto initialBaselineOffset = LineBuilder::halfLeadingMetrics(formattingRoot.style().fontMetrics(), initialLineHeight).ascent();
     return { initialLineHeight, initialBaselineOffset, Display::LineBox::Baseline { strutBaselineOffset, strutHeight - strutBaselineOffset } };
 }

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp (253254 => 253255)


--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp	2019-12-07 15:21:02 UTC (rev 253254)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp	2019-12-07 18:18:16 UTC (rev 253255)
@@ -93,16 +93,16 @@
     return { lineStatus.lineIsEmpty ? BreakingContext::ContentWrappingRule::Keep : BreakingContext::ContentWrappingRule::Push, { } };
 }
 
-bool LineBreaker::shouldWrapFloatBox(LayoutUnit floatLogicalWidth, LayoutUnit availableWidth, bool lineIsEmpty)
+bool LineBreaker::shouldWrapFloatBox(InlineLayoutUnit floatLogicalWidth, InlineLayoutUnit availableWidth, bool lineIsEmpty)
 {
     return !lineIsEmpty && floatLogicalWidth > availableWidth;
 }
 
-Optional<LineBreaker::BreakingContext::PartialTrailingContent> LineBreaker::wordBreakingBehavior(const Content::RunList& runs, LayoutUnit availableWidth) const
+Optional<LineBreaker::BreakingContext::PartialTrailingContent> LineBreaker::wordBreakingBehavior(const Content::RunList& runs, InlineLayoutUnit availableWidth) const
 {
     // Check where the overflow occurs and use the corresponding style to figure out the breaking behaviour.
     // <span style="word-break: normal">first</span><span style="word-break: break-all">second</span><span style="word-break: normal">third</span>
-    LayoutUnit accumulatedRunWidth;
+    InlineLayoutUnit accumulatedRunWidth;
     unsigned index = 0;
     while (index < runs.size()) {
         auto& run = runs[index];
@@ -133,7 +133,7 @@
     return { };
 }
 
-Optional<LineBreaker::LeftSide> LineBreaker::tryBreakingTextRun(const Content::Run& overflowRun, LayoutUnit availableWidth) const
+Optional<LineBreaker::LeftSide> LineBreaker::tryBreakingTextRun(const Content::Run& overflowRun, InlineLayoutUnit availableWidth) const
 {
     ASSERT(overflowRun.inlineItem.isText());
     auto& style = overflowRun.inlineItem.style();
@@ -161,7 +161,7 @@
 
     auto& fontCascade = style.fontCascade();
     // FIXME: We might want to cache the hyphen width.
-    auto hyphenWidth = LayoutUnit { fontCascade.width(TextRun { StringView { style.hyphenString() } }) };
+    auto hyphenWidth = InlineLayoutUnit { fontCascade.width(TextRun { StringView { style.hyphenString() } }) };
     auto availableWidthExcludingHyphen = availableWidth - hyphenWidth;
 
     // For spaceWidth() see webkit.org/b/169613
@@ -272,7 +272,7 @@
     return true;
 }
 
-void LineBreaker::Content::append(const InlineItem& inlineItem, LayoutUnit logicalWidth)
+void LineBreaker::Content::append(const InlineItem& inlineItem, InlineLayoutUnit logicalWidth)
 {
     ASSERT(!inlineItem.isFloat());
     ASSERT(inlineItem.isLineBreak() || !isAtContentBoundary(inlineItem, *this));

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.h (253254 => 253255)


--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.h	2019-12-07 15:21:02 UTC (rev 253254)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.h	2019-12-07 18:18:16 UTC (rev 253255)
@@ -27,7 +27,7 @@
 
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
 
-#include "LayoutUnit.h"
+#include "LayoutUnits.h"
 
 namespace WebCore {
 namespace Layout {
@@ -47,7 +47,7 @@
         struct PartialTrailingContent {
             unsigned runIndex { 0 };
             unsigned length { 0 };
-            LayoutUnit logicalWidth;
+            InlineLayoutUnit logicalWidth;
             bool needsHyphen { false };
         };
         Optional<PartialTrailingContent> partialTrailingContent;
@@ -63,7 +63,7 @@
     // [container start][span1][container end][between][container start][span2][container end]
     // see https://drafts.csswg.org/css-text-3/#line-break-details
     struct Content {
-        void append(const InlineItem&, LayoutUnit logicalWidth);
+        void append(const InlineItem&, InlineLayoutUnit logicalWidth);
         void reset();
         void trim(unsigned newSize);
 
@@ -71,7 +71,7 @@
 
         struct Run {
             const InlineItem& inlineItem;
-            LayoutUnit logicalWidth;
+            InlineLayoutUnit logicalWidth;
         };
         using RunList = Vector<Run, 30>;
 
@@ -81,8 +81,8 @@
         bool hasTextContentOnly() const;
         bool hasNonContentRunsOnly() const;
         unsigned size() const { return m_continousRuns.size(); }
-        LayoutUnit width() const { return m_width; }
-        LayoutUnit nonTrimmableWidth() const { return m_width - m_trailingTrimmableContent.width; }
+        InlineLayoutUnit width() const { return m_width; }
+        InlineLayoutUnit nonTrimmableWidth() const { return m_width - m_trailingTrimmableContent.width; }
 
         bool hasTrailingTrimmableContent() const { return !!m_trailingTrimmableContent.width; }
         bool isTrailingContentFullyTrimmable() const { return m_trailingTrimmableContent.isFullyTrimmable; }
@@ -93,31 +93,31 @@
             void reset();
 
             bool isFullyTrimmable { false };
-            LayoutUnit width;
+            InlineLayoutUnit width;
         };
         TrailingTrimmableContent m_trailingTrimmableContent;
-        LayoutUnit m_width;
+        InlineLayoutUnit m_width;
     };
 
     struct LineStatus {
-        LayoutUnit availableWidth;
-        LayoutUnit trimmableWidth;
+        InlineLayoutUnit availableWidth;
+        InlineLayoutUnit trimmableWidth;
         bool lineHasFullyTrimmableTrailingRun;
         bool lineIsEmpty;
     };
     BreakingContext breakingContextForInlineContent(const Content& candidateRuns, const LineStatus&);
-    bool shouldWrapFloatBox(LayoutUnit floatLogicalWidth, LayoutUnit availableWidth, bool lineIsEmpty);
+    bool shouldWrapFloatBox(InlineLayoutUnit floatLogicalWidth, InlineLayoutUnit availableWidth, bool lineIsEmpty);
 
     void setHyphenationDisabled() { n_hyphenationIsDisabled = true; }
 
 private:
-    Optional<BreakingContext::PartialTrailingContent> wordBreakingBehavior(const Content::RunList&, LayoutUnit availableWidth) const;
+    Optional<BreakingContext::PartialTrailingContent> wordBreakingBehavior(const Content::RunList&, InlineLayoutUnit availableWidth) const;
     struct LeftSide {
         unsigned length { 0 };
-        LayoutUnit logicalWidth;
+        InlineLayoutUnit logicalWidth;
         bool needsHyphen { false };
     };
-    Optional<LeftSide> tryBreakingTextRun(const Content::Run& overflowRun, LayoutUnit availableWidth) const;
+    Optional<LeftSide> tryBreakingTextRun(const Content::Run& overflowRun, InlineLayoutUnit availableWidth) const;
 
     bool n_hyphenationIsDisabled { false };
 };

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp (253254 => 253255)


--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp	2019-12-07 15:21:02 UTC (rev 253254)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp	2019-12-07 18:18:16 UTC (rev 253255)
@@ -50,7 +50,7 @@
     const InlineItemRun& m_initialInlineRun;
     const bool m_textIsAlignJustify { false };
     unsigned m_expandedLength { 0 };
-    LayoutUnit m_expandedWidth;
+    InlineLayoutUnit m_expandedWidth;
     bool m_trailingRunCanBeExpanded { false };
     bool m_hasTrailingExpansionOpportunity { false };
     unsigned m_expansionOpportunityCount { 0 };
@@ -144,7 +144,7 @@
     return { };
 }
 
-void LineBuilder::Run::setComputedHorizontalExpansion(LayoutUnit logicalExpansion)
+void LineBuilder::Run::setComputedHorizontalExpansion(InlineLayoutUnit logicalExpansion)
 {
     ASSERT(isText());
     ASSERT(hasExpansionOpportunity());
@@ -168,8 +168,8 @@
 {
     ASSERT(m_skipAlignment || constraints.heightAndBaseline);
 
-    LayoutUnit initialLineHeight;
-    LayoutUnit initialBaselineOffset;
+    InlineLayoutUnit initialLineHeight;
+    InlineLayoutUnit initialBaselineOffset;
     if (constraints.heightAndBaseline) {
         m_initialStrut = constraints.heightAndBaseline->strut;
         initialLineHeight = constraints.heightAndBaseline->height;
@@ -238,7 +238,7 @@
 {
     ASSERT(!m_skipAlignment);
     for (auto& run : runList) {
-        LayoutUnit logicalTop;
+        InlineLayoutUnit logicalTop;
         auto& layoutBox = run.layoutBox();
         auto verticalAlign = layoutBox.style().verticalAlign();
         auto ascent = layoutBox.style().fontMetrics().ascent();
@@ -306,7 +306,7 @@
         return;
     // Distribute the extra space.
     auto expansionToDistribute = availableWidth() / expansionOpportunityCount;
-    LayoutUnit accumulatedExpansion;
+    InlineLayoutUnit accumulatedExpansion;
     for (auto& run : runList) {
         // Expand and moves runs by the accumulated expansion.
         if (!run.hasExpansionOpportunity()) {
@@ -334,7 +334,7 @@
         return;
     }
 
-    auto adjustmentForAlignment = [&]() -> Optional<LayoutUnit> {
+    auto adjustmentForAlignment = [&]() -> Optional<InlineLayoutUnit> {
         switch (*m_horizontalAlignment) {
         case TextAlignMode::Left:
         case TextAlignMode::WebKitLeft:
@@ -387,7 +387,7 @@
     m_lineIsVisuallyEmptyBeforeTrimmableContent = { };
 }
 
-void LineBuilder::moveLogicalLeft(LayoutUnit delta)
+void LineBuilder::moveLogicalLeft(InlineLayoutUnit delta)
 {
     if (!delta)
         return;
@@ -396,13 +396,13 @@
     m_lineLogicalWidth -= delta;
 }
 
-void LineBuilder::moveLogicalRight(LayoutUnit delta)
+void LineBuilder::moveLogicalRight(InlineLayoutUnit delta)
 {
     ASSERT(delta > 0);
     m_lineLogicalWidth -= delta;
 }
 
-void LineBuilder::append(const InlineItem& inlineItem, LayoutUnit logicalWidth)
+void LineBuilder::append(const InlineItem& inlineItem, InlineLayoutUnit logicalWidth)
 {
     if (inlineItem.isText())
         appendTextContent(downcast<InlineTextItem>(inlineItem), logicalWidth);
@@ -425,19 +425,19 @@
         m_lineBox.setIsConsideredNonEmpty();
 }
 
-void LineBuilder::appendNonBreakableSpace(const InlineItem& inlineItem, LayoutUnit logicalLeft, LayoutUnit logicalWidth)
+void LineBuilder::appendNonBreakableSpace(const InlineItem& inlineItem, InlineLayoutUnit logicalLeft, InlineLayoutUnit logicalWidth)
 {
     m_inlineItemRuns.append({ inlineItem, logicalLeft, logicalWidth });
     m_lineBox.expandHorizontally(logicalWidth);
 }
 
-void LineBuilder::appendInlineContainerStart(const InlineItem& inlineItem, LayoutUnit logicalWidth)
+void LineBuilder::appendInlineContainerStart(const InlineItem& inlineItem, InlineLayoutUnit logicalWidth)
 {
     // This is really just a placeholder to mark the start of the inline level container <span>.
     appendNonBreakableSpace(inlineItem, contentLogicalWidth(), logicalWidth);
 }
 
-void LineBuilder::appendInlineContainerEnd(const InlineItem& inlineItem, LayoutUnit logicalWidth)
+void LineBuilder::appendInlineContainerEnd(const InlineItem& inlineItem, InlineLayoutUnit logicalWidth)
 {
     // This is really just a placeholder to mark the end of the inline level container </span>.
     auto trimTrailingLetterSpacing = [&] {
@@ -451,7 +451,7 @@
     appendNonBreakableSpace(inlineItem, contentLogicalRight(), logicalWidth);
 }
 
-void LineBuilder::appendTextContent(const InlineTextItem& inlineItem, LayoutUnit logicalWidth)
+void LineBuilder::appendTextContent(const InlineTextItem& inlineItem, InlineLayoutUnit logicalWidth)
 {
     auto willCollapseCompletely = [&] {
         // Empty run.
@@ -510,7 +510,7 @@
     }
 }
 
-void LineBuilder::appendNonReplacedInlineBox(const InlineItem& inlineItem, LayoutUnit logicalWidth)
+void LineBuilder::appendNonReplacedInlineBox(const InlineItem& inlineItem, InlineLayoutUnit logicalWidth)
 {
     auto& layoutBox = inlineItem.layoutBox();
     auto& boxGeometry = formattingContext().geometryForBox(layoutBox);
@@ -520,7 +520,7 @@
     m_trimmableContent.reset();
 }
 
-void LineBuilder::appendReplacedInlineBox(const InlineItem& inlineItem, LayoutUnit logicalWidth)
+void LineBuilder::appendReplacedInlineBox(const InlineItem& inlineItem, InlineLayoutUnit logicalWidth)
 {
     ASSERT(inlineItem.layoutBox().isReplaced());
     // FIXME: Surely replaced boxes behave differently.
@@ -624,7 +624,7 @@
     ASSERT_NOT_REACHED();
 }
 
-LayoutUnit LineBuilder::runContentHeight(const Run& run) const
+InlineLayoutUnit LineBuilder::runContentHeight(const Run& run) const
 {
     ASSERT(!m_skipAlignment);
     auto& fontMetrics = run.style().fontMetrics();
@@ -677,7 +677,7 @@
     return false;
 }
 
-Display::LineBox::Baseline LineBuilder::halfLeadingMetrics(const FontMetrics& fontMetrics, LayoutUnit lineLogicalHeight)
+Display::LineBox::Baseline LineBuilder::halfLeadingMetrics(const FontMetrics& fontMetrics, InlineLayoutUnit lineLogicalHeight)
 {
     auto ascent = fontMetrics.ascent();
     auto descent = fontMetrics.descent();
@@ -707,7 +707,7 @@
 void LineBuilder::TrimmableContent::append(size_t runIndex)
 {
     auto& trimmableRun = m_inlineitemRunList[runIndex];
-    LayoutUnit trimmableWidth;
+    InlineLayoutUnit trimmableWidth;
     auto isFullyTrimmable = trimmableRun.isTrimmableWhitespace();
     if (isFullyTrimmable)
         trimmableWidth = trimmableRun.logicalWidth();
@@ -724,7 +724,7 @@
     m_firstRunIndex = m_firstRunIndex.valueOr(runIndex);
 }
 
-LayoutUnit LineBuilder::TrimmableContent::trim()
+InlineLayoutUnit LineBuilder::TrimmableContent::trim()
 {
     ASSERT(!isEmpty());
 #ifndef NDEBUG
@@ -734,7 +734,7 @@
     // <span> </span><span></span> ->
     // [whitespace][container end][container start][container end]
     // Trim the whitespace run and move the trailing inline container runs to the left.
-    LayoutUnit accumulatedTrimmedWidth;
+    InlineLayoutUnit accumulatedTrimmedWidth;
     for (auto index = *m_firstRunIndex; index < m_inlineitemRunList.size(); ++index) {
         auto& run = m_inlineitemRunList[index];
         run.moveHorizontally(-accumulatedTrimmedWidth);
@@ -761,7 +761,7 @@
     return accumulatedTrimmedWidth;
 }
 
-LayoutUnit LineBuilder::TrimmableContent::trimTrailingRun()
+InlineLayoutUnit LineBuilder::TrimmableContent::trimTrailingRun()
 {
     ASSERT(!isEmpty());
     // Find the last trimmable run (it is not necessarily the last run e.g [container start][whitespace][container end])
@@ -771,7 +771,7 @@
             ASSERT(run.isContainerStart() || run.isContainerEnd());
             continue;
         }
-        LayoutUnit trimmedWidth;
+        InlineLayoutUnit trimmedWidth;
         if (run.isWhitespace()) {
             trimmedWidth = run.logicalWidth();
             run.setCollapsesToZeroAdvanceWidth();
@@ -792,7 +792,7 @@
     return 0_lu;
 }
 
-LineBuilder::InlineItemRun::InlineItemRun(const InlineItem& inlineItem, LayoutUnit logicalLeft, LayoutUnit logicalWidth, WTF::Optional<Display::Run::TextContext> textContext)
+LineBuilder::InlineItemRun::InlineItemRun(const InlineItem& inlineItem, InlineLayoutUnit logicalLeft, InlineLayoutUnit logicalWidth, WTF::Optional<Display::Run::TextContext> textContext)
     : m_inlineItem(inlineItem)
     , m_logicalLeft(logicalLeft)
     , m_logicalWidth(logicalWidth)
@@ -812,11 +812,11 @@
     return !isWhitespace() && style().letterSpacing() > 0;
 }
 
-LayoutUnit LineBuilder::InlineItemRun::trailingLetterSpacing() const
+InlineLayoutUnit LineBuilder::InlineItemRun::trailingLetterSpacing() const
 {
     if (!hasTrailingLetterSpacing())
         return 0_lu;
-    return LayoutUnit { style().letterSpacing() };
+    return InlineLayoutUnit { style().letterSpacing() };
 }
 
 void LineBuilder::InlineItemRun::setCollapsesToZeroAdvanceWidth()

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h (253254 => 253255)


--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h	2019-12-07 15:21:02 UTC (rev 253254)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h	2019-12-07 18:18:16 UTC (rev 253255)
@@ -44,11 +44,11 @@
 public:
     struct Constraints {
         LayoutPoint logicalTopLeft;
-        LayoutUnit availableLogicalWidth;
+        InlineLayoutUnit availableLogicalWidth;
         bool lineIsConstrainedByFloat { false };
         struct HeightAndBaseline {
-            LayoutUnit height;
-            LayoutUnit baselineOffset;
+            InlineLayoutUnit height;
+            InlineLayoutUnit baselineOffset;
             Optional<Display::LineBox::Baseline> strut;
         };
         Optional<HeightAndBaseline> heightAndBaseline;
@@ -59,17 +59,17 @@
     ~LineBuilder();
 
     void initialize(const Constraints&);
-    void append(const InlineItem&, LayoutUnit logicalWidth);
+    void append(const InlineItem&, InlineLayoutUnit logicalWidth);
     bool isVisuallyEmpty() const { return m_lineBox.isConsideredEmpty(); }
     bool hasIntrusiveFloat() const { return m_hasIntrusiveFloat; }
-    LayoutUnit availableWidth() const { return logicalWidth() - contentLogicalWidth(); }
+    InlineLayoutUnit availableWidth() const { return logicalWidth() - contentLogicalWidth(); }
 
-    LayoutUnit trailingTrimmableWidth() const { return m_trimmableContent.width(); }
+    InlineLayoutUnit trailingTrimmableWidth() const { return m_trimmableContent.width(); }
     bool isTrailingRunFullyTrimmable() const { return m_trimmableContent.isTrailingRunFullyTrimmable(); }
 
     const Display::LineBox& lineBox() const { return m_lineBox; }
-    void moveLogicalLeft(LayoutUnit);
-    void moveLogicalRight(LayoutUnit);
+    void moveLogicalLeft(InlineLayoutUnit);
+    void moveLogicalRight(InlineLayoutUnit);
     void setHasIntrusiveFloat() { m_hasIntrusiveFloat = true; }
 
     struct Run {
@@ -93,15 +93,15 @@
     private:
         friend class LineBuilder;
 
-        void adjustLogicalTop(LayoutUnit logicalTop) { m_logicalRect.setTop(logicalTop); }
-        void moveHorizontally(LayoutUnit offset) { m_logicalRect.moveHorizontally(offset); }
-        void moveVertically(LayoutUnit offset) { m_logicalRect.moveVertically(offset); }
-        void setLogicalHeight(LayoutUnit logicalHeight) { m_logicalRect.setHeight(logicalHeight); }
+        void adjustLogicalTop(InlineLayoutUnit logicalTop) { m_logicalRect.setTop(logicalTop); }
+        void moveHorizontally(InlineLayoutUnit offset) { m_logicalRect.moveHorizontally(offset); }
+        void moveVertically(InlineLayoutUnit offset) { m_logicalRect.moveVertically(offset); }
+        void setLogicalHeight(InlineLayoutUnit logicalHeight) { m_logicalRect.setHeight(logicalHeight); }
 
         bool hasExpansionOpportunity() const { return m_expansionOpportunityCount; }
         Optional<ExpansionBehavior> expansionBehavior() const;
         unsigned expansionOpportunityCount() const { return m_expansionOpportunityCount; }
-        void setComputedHorizontalExpansion(LayoutUnit logicalExpansion);
+        void setComputedHorizontalExpansion(InlineLayoutUnit logicalExpansion);
         void adjustExpansionBehavior(ExpansionBehavior);
 
         const Box* m_layoutBox { nullptr };
@@ -115,28 +115,28 @@
     enum class IsLastLineWithInlineContent { No, Yes };
     RunList close(IsLastLineWithInlineContent = IsLastLineWithInlineContent::No);
 
-    static Display::LineBox::Baseline halfLeadingMetrics(const FontMetrics&, LayoutUnit lineLogicalHeight);
+    static Display::LineBox::Baseline halfLeadingMetrics(const FontMetrics&, InlineLayoutUnit lineLogicalHeight);
 
 private:
-    LayoutUnit logicalTop() const { return m_lineBox.logicalTop(); }
-    LayoutUnit logicalBottom() const { return m_lineBox.logicalBottom(); }
+    InlineLayoutUnit logicalTop() const { return m_lineBox.logicalTop(); }
+    InlineLayoutUnit logicalBottom() const { return m_lineBox.logicalBottom(); }
 
-    LayoutUnit logicalLeft() const { return m_lineBox.logicalLeft(); }
-    LayoutUnit logicalRight() const { return logicalLeft() + logicalWidth(); }
+    InlineLayoutUnit logicalLeft() const { return m_lineBox.logicalLeft(); }
+    InlineLayoutUnit logicalRight() const { return logicalLeft() + logicalWidth(); }
 
-    LayoutUnit logicalWidth() const { return m_lineLogicalWidth; }
-    LayoutUnit logicalHeight() const { return m_lineBox.logicalHeight(); }
+    InlineLayoutUnit logicalWidth() const { return m_lineLogicalWidth; }
+    InlineLayoutUnit logicalHeight() const { return m_lineBox.logicalHeight(); }
 
-    LayoutUnit contentLogicalWidth() const { return m_lineBox.logicalWidth(); }
-    LayoutUnit contentLogicalRight() const { return m_lineBox.logicalRight(); }
-    LayoutUnit baselineOffset() const { return m_lineBox.baselineOffset(); }
+    InlineLayoutUnit contentLogicalWidth() const { return m_lineBox.logicalWidth(); }
+    InlineLayoutUnit contentLogicalRight() const { return m_lineBox.logicalRight(); }
+    InlineLayoutUnit baselineOffset() const { return m_lineBox.baselineOffset(); }
 
-    void appendNonBreakableSpace(const InlineItem&, LayoutUnit logicalLeft, LayoutUnit logicalWidth);
-    void appendTextContent(const InlineTextItem&, LayoutUnit logicalWidth);
-    void appendNonReplacedInlineBox(const InlineItem&, LayoutUnit logicalWidth);
-    void appendReplacedInlineBox(const InlineItem&, LayoutUnit logicalWidth);
-    void appendInlineContainerStart(const InlineItem&, LayoutUnit logicalWidth);
-    void appendInlineContainerEnd(const InlineItem&, LayoutUnit logicalWidth);
+    void appendNonBreakableSpace(const InlineItem&, InlineLayoutUnit logicalLeft, InlineLayoutUnit logicalWidth);
+    void appendTextContent(const InlineTextItem&, InlineLayoutUnit logicalWidth);
+    void appendNonReplacedInlineBox(const InlineItem&, InlineLayoutUnit logicalWidth);
+    void appendReplacedInlineBox(const InlineItem&, InlineLayoutUnit logicalWidth);
+    void appendInlineContainerStart(const InlineItem&, InlineLayoutUnit logicalWidth);
+    void appendInlineContainerEnd(const InlineItem&, InlineLayoutUnit logicalWidth);
     void appendLineBreak(const InlineItem&);
 
     void removeTrailingTrimmableContent();
@@ -144,7 +144,7 @@
     void alignContentVertically(RunList&);
 
     void adjustBaselineAndLineHeight(const Run&);
-    LayoutUnit runContentHeight(const Run&) const;
+    InlineLayoutUnit runContentHeight(const Run&) const;
 
     bool isTextAlignJustify() const { return m_horizontalAlignment == TextAlignMode::Justify; };
     void justifyRuns(RunList&) const;
@@ -156,12 +156,12 @@
 
     class InlineItemRun {
     public:
-        InlineItemRun(const InlineItem&, LayoutUnit logicalLeft, LayoutUnit logicalWidth, WTF::Optional<Display::Run::TextContext> = WTF::nullopt);
+        InlineItemRun(const InlineItem&, InlineLayoutUnit logicalLeft, InlineLayoutUnit logicalWidth, WTF::Optional<Display::Run::TextContext> = WTF::nullopt);
 
         const Box& layoutBox() const { return m_inlineItem.layoutBox(); }
         const RenderStyle& style() const { return layoutBox().style(); }
-        LayoutUnit logicalLeft() const { return m_logicalLeft; }
-        LayoutUnit logicalWidth() const { return m_logicalWidth; }
+        InlineLayoutUnit logicalLeft() const { return m_logicalLeft; }
+        InlineLayoutUnit logicalWidth() const { return m_logicalWidth; }
         const Optional<Display::Run::TextContext>& textContext() const { return m_textContext; }
 
         bool isText() const { return m_inlineItem.isText(); }
@@ -174,12 +174,12 @@
         void setIsCollapsed() { m_isCollapsed = true; }
         bool isCollapsed() const { return m_isCollapsed; }
 
-        void moveHorizontally(LayoutUnit offset) { m_logicalLeft += offset; }
+        void moveHorizontally(InlineLayoutUnit offset) { m_logicalLeft += offset; }
 
         bool isTrimmableWhitespace() const;
         bool hasTrailingLetterSpacing() const;
 
-        LayoutUnit trailingLetterSpacing() const;
+        InlineLayoutUnit trailingLetterSpacing() const;
         void removeTrailingLetterSpacing();
 
         void setCollapsesToZeroAdvanceWidth();
@@ -192,8 +192,8 @@
 
     private:
         const InlineItem& m_inlineItem;
-        LayoutUnit m_logicalLeft;
-        LayoutUnit m_logicalWidth;
+        InlineLayoutUnit m_logicalLeft;
+        InlineLayoutUnit m_logicalWidth;
         const Optional<Display::Run::TextContext> m_textContext;
         bool m_isCollapsed { false };
         bool m_collapsedToZeroAdvanceWidth { false };
@@ -205,11 +205,11 @@
         TrimmableContent(InlineItemRunList&);
 
         void append(size_t runIndex);
-        LayoutUnit trim();
-        LayoutUnit trimTrailingRun();
+        InlineLayoutUnit trim();
+        InlineLayoutUnit trimTrailingRun();
         void reset();
 
-        LayoutUnit width() const { return m_width; }
+        InlineLayoutUnit width() const { return m_width; }
         Optional<size_t> firstRunIndex() { return m_firstRunIndex; }
         bool isEmpty() const { return !m_firstRunIndex.hasValue(); }
         bool isTrailingRunFullyTrimmable() const { return m_lastRunIsFullyTrimmable; }
@@ -218,7 +218,7 @@
     private:
         InlineItemRunList& m_inlineitemRunList;
         Optional<size_t> m_firstRunIndex;
-        LayoutUnit m_width;
+        InlineLayoutUnit m_width;
         bool m_lastRunIsFullyTrimmable { false };
     };
 
@@ -226,7 +226,7 @@
     InlineItemRunList m_inlineItemRuns;
     TrimmableContent m_trimmableContent;
     Optional<Display::LineBox::Baseline> m_initialStrut;
-    LayoutUnit m_lineLogicalWidth;
+    InlineLayoutUnit m_lineLogicalWidth;
     Optional<TextAlignMode> m_horizontalAlignment;
     bool m_skipAlignment { false };
     bool m_hasIntrusiveFloat { false };

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.cpp (253254 => 253255)


--- trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.cpp	2019-12-07 15:21:02 UTC (rev 253254)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.cpp	2019-12-07 18:18:16 UTC (rev 253255)
@@ -95,7 +95,7 @@
     LazyLineBreakIterator lineBreakIterator(text);
     unsigned currentPosition = 0;
 
-    auto inlineItemWidth = [&](auto startPosition, auto length) -> Optional<LayoutUnit> {
+    auto inlineItemWidth = [&](auto startPosition, auto length) -> Optional<InlineLayoutUnit> {
         if (!textContext.canUseSimplifiedContentMeasuring)
             return { };
         return TextUtil::width(inlineBox, startPosition, startPosition + length);
@@ -116,7 +116,7 @@
         if (isWhitespaceCharacter(text[currentPosition], style.preserveNewline())) {
             auto length = moveToNextNonWhitespacePosition(text, currentPosition, style.preserveNewline());
             auto simpleSingleWhitespaceContent = textContext.canUseSimplifiedContentMeasuring && (length == 1 || style.collapseWhiteSpace());
-            auto width = simpleSingleWhitespaceContent ? makeOptional(LayoutUnit { font.spaceWidth() }) : inlineItemWidth(currentPosition, length);
+            auto width = simpleSingleWhitespaceContent ? makeOptional(InlineLayoutUnit { font.spaceWidth() }) : inlineItemWidth(currentPosition, length);
             inlineContent.append(InlineTextItem::createWhitespaceItem(inlineBox, currentPosition, length, width));
             currentPosition += length;
             continue;
@@ -128,12 +128,12 @@
     }
 }
 
-std::unique_ptr<InlineTextItem> InlineTextItem::createWhitespaceItem(const Box& inlineBox, unsigned start, unsigned length, Optional<LayoutUnit> width)
+std::unique_ptr<InlineTextItem> InlineTextItem::createWhitespaceItem(const Box& inlineBox, unsigned start, unsigned length, Optional<InlineLayoutUnit> width)
 {
     return makeUnique<InlineTextItem>(inlineBox, start, length, width, TextItemType::Whitespace);
 }
 
-std::unique_ptr<InlineTextItem> InlineTextItem::createNonWhitespaceItem(const Box& inlineBox, unsigned start, unsigned length, Optional<LayoutUnit> width)
+std::unique_ptr<InlineTextItem> InlineTextItem::createNonWhitespaceItem(const Box& inlineBox, unsigned start, unsigned length, Optional<InlineLayoutUnit> width)
 {
     return makeUnique<InlineTextItem>(inlineBox, start, length, width, TextItemType::NonWhitespace);
 }
@@ -143,7 +143,7 @@
     return makeUnique<InlineTextItem>(inlineBox);
 }
 
-InlineTextItem::InlineTextItem(const Box& inlineBox, unsigned start, unsigned length, Optional<LayoutUnit> width, TextItemType textItemType)
+InlineTextItem::InlineTextItem(const Box& inlineBox, unsigned start, unsigned length, Optional<InlineLayoutUnit> width, TextItemType textItemType)
     : InlineItem(inlineBox, Type::Text)
     , m_start(start)
     , m_length(length)

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.h (253254 => 253255)


--- trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.h	2019-12-07 15:21:02 UTC (rev 253254)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.h	2019-12-07 18:18:16 UTC (rev 253255)
@@ -37,8 +37,8 @@
 public:
     static void createAndAppendTextItems(InlineItems&, const Box&);
 
-    static std::unique_ptr<InlineTextItem> createWhitespaceItem(const Box&, unsigned start, unsigned length, Optional<LayoutUnit> width);
-    static std::unique_ptr<InlineTextItem> createNonWhitespaceItem(const Box&, unsigned start, unsigned length, Optional<LayoutUnit> width);
+    static std::unique_ptr<InlineTextItem> createWhitespaceItem(const Box&, unsigned start, unsigned length, Optional<InlineLayoutUnit> width);
+    static std::unique_ptr<InlineTextItem> createNonWhitespaceItem(const Box&, unsigned start, unsigned length, Optional<InlineLayoutUnit> width);
     static std::unique_ptr<InlineTextItem> createEmptyItem(const Box&);
 
     unsigned start() const { return m_start; }
@@ -47,19 +47,19 @@
 
     bool isWhitespace() const { return m_textItemType == TextItemType::Whitespace; }
     bool isCollapsible() const { return isWhitespace() && style().collapseWhiteSpace(); }
-    Optional<LayoutUnit> width() const { return m_width; }
+    Optional<InlineLayoutUnit> width() const { return m_width; }
 
     std::unique_ptr<InlineTextItem> left(unsigned length) const;
     std::unique_ptr<InlineTextItem> right(unsigned length) const;
 
     enum class TextItemType { Undefined, Whitespace, NonWhitespace };
-    InlineTextItem(const Box&, unsigned start, unsigned length, Optional<LayoutUnit> width, TextItemType);
+    InlineTextItem(const Box&, unsigned start, unsigned length, Optional<InlineLayoutUnit> width, TextItemType);
     InlineTextItem(const Box&);
 
 private:
     unsigned m_start { 0 };
     unsigned m_length { 0 };
-    Optional<LayoutUnit> m_width;
+    Optional<InlineLayoutUnit> m_width;
     TextItemType m_textItemType { TextItemType::Undefined };
 };
 

Modified: trunk/Source/WebCore/layout/inlineformatting/LineLayoutContext.cpp (253254 => 253255)


--- trunk/Source/WebCore/layout/inlineformatting/LineLayoutContext.cpp	2019-12-07 15:21:02 UTC (rev 253254)
+++ trunk/Source/WebCore/layout/inlineformatting/LineLayoutContext.cpp	2019-12-07 18:18:16 UTC (rev 253255)
@@ -35,7 +35,7 @@
 namespace WebCore {
 namespace Layout {
 
-static LayoutUnit inlineItemWidth(const FormattingContext& formattingContext, const InlineItem& inlineItem, LayoutUnit contentLogicalLeft)
+static InlineLayoutUnit inlineItemWidth(const FormattingContext& formattingContext, const InlineItem& inlineItem, InlineLayoutUnit contentLogicalLeft)
 {
     if (inlineItem.isLineBreak())
         return 0_lu;
@@ -47,7 +47,7 @@
             auto end = inlineTextItem.isCollapsible() ? inlineTextItem.start() + 1 : inlineTextItem.end();
             contentWidth = TextUtil::width(inlineTextItem.layoutBox(), inlineTextItem.start(), end, contentLogicalLeft);
         }
-        auto wordSpacing = inlineTextItem.isWhitespace() ? LayoutUnit(inlineTextItem.style().fontCascade().wordSpacing()) : 0_lu;
+        auto wordSpacing = inlineTextItem.isWhitespace() ? InlineLayoutUnit(inlineTextItem.style().fontCascade().wordSpacing()) : 0_lu;
         return *contentWidth + wordSpacing;
     }
 

Modified: trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp (253254 => 253255)


--- trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp	2019-12-07 15:21:02 UTC (rev 253254)
+++ trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp	2019-12-07 18:18:16 UTC (rev 253255)
@@ -39,7 +39,7 @@
     return WTF::nullopt;
 }
 
-LayoutUnit TextUtil::width(const Box& inlineBox, unsigned from, unsigned to, LayoutUnit contentLogicalLeft)
+InlineLayoutUnit TextUtil::width(const Box& inlineBox, unsigned from, unsigned to, InlineLayoutUnit contentLogicalLeft)
 {
     auto& style = inlineBox.style();
     auto& font = style.fontCascade();
@@ -71,10 +71,10 @@
     if (measureWithEndSpace)
         width -= (font.spaceWidth() + font.wordSpacing());
 
-    return std::max(0_lu, LayoutUnit::fromFloatRound(width));
+    return std::max(0_lu, InlineLayoutUnit::fromFloatRound(width));
 }
 
-LayoutUnit TextUtil::fixedPitchWidth(const StringView& text, const RenderStyle& style, unsigned from, unsigned to, LayoutUnit contentLogicalLeft)
+InlineLayoutUnit TextUtil::fixedPitchWidth(const StringView& text, const RenderStyle& style, unsigned from, unsigned to, InlineLayoutUnit contentLogicalLeft)
 {
     auto& font = style.fontCascade();
     auto monospaceCharacterWidth = font.spaceWidth();
@@ -90,19 +90,19 @@
             width += font.wordSpacing();
     }
 
-    return std::max(0_lu, LayoutUnit::fromFloatRound(width));
+    return std::max(0_lu, InlineLayoutUnit::fromFloatRound(width));
 }
 
-TextUtil::SplitData TextUtil::split(const Box& inlineBox, unsigned startPosition, unsigned length, LayoutUnit textWidth, LayoutUnit availableWidth, LayoutUnit contentLogicalLeft)
+TextUtil::SplitData TextUtil::split(const Box& inlineBox, unsigned startPosition, unsigned length, InlineLayoutUnit textWidth, InlineLayoutUnit availableWidth, InlineLayoutUnit contentLogicalLeft)
 {
     ASSERT(availableWidth >= 0);
     auto left = startPosition;
     // Pathological case of (extremely)long string and narrow lines.
     // Adjust the range so that we can pick a reasonable midpoint.
-    LayoutUnit averageCharacterWidth = textWidth / length;
+    InlineLayoutUnit averageCharacterWidth = textWidth / length;
     auto right = std::min<unsigned>(left + (2 * availableWidth / averageCharacterWidth).toUnsigned(), (startPosition + length - 1));
     // Preserve the left width for the final split position so that we don't need to remeasure the left side again.
-    LayoutUnit leftSideWidth = 0;
+    InlineLayoutUnit leftSideWidth = 0;
     while (left < right) {
         auto middle = (left + right) / 2;
         auto width = TextUtil::width(inlineBox, startPosition, middle + 1, contentLogicalLeft);

Modified: trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.h (253254 => 253255)


--- trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.h	2019-12-07 15:21:02 UTC (rev 253254)
+++ trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.h	2019-12-07 18:18:16 UTC (rev 253255)
@@ -37,18 +37,18 @@
 
 class TextUtil {
 public:
-    static LayoutUnit width(const Box&, unsigned from, unsigned to, LayoutUnit contentLogicalLeft = 0_lu);
+    static InlineLayoutUnit width(const Box&, unsigned from, unsigned to, InlineLayoutUnit contentLogicalLeft = 0_lu);
     static Optional<unsigned> hyphenPositionBefore(const InlineItem&, unsigned from, unsigned length);
     struct SplitData {
         unsigned start { 0 };
         unsigned length { 0 };
-        LayoutUnit logicalWidth;
+        InlineLayoutUnit logicalWidth;
     };
-    static SplitData split(const Box&, unsigned startPosition, unsigned length, LayoutUnit textWidth, LayoutUnit availableWidth, LayoutUnit contentLogicalLeft);
+    static SplitData split(const Box&, unsigned startPosition, unsigned length, InlineLayoutUnit textWidth, InlineLayoutUnit availableWidth, InlineLayoutUnit contentLogicalLeft);
     static bool shouldPreserveTrailingWhitespace(const RenderStyle&);
 
 private:
-    static LayoutUnit fixedPitchWidth(const StringView&, const RenderStyle&, unsigned from, unsigned to, LayoutUnit contentLogicalLeft);
+    static InlineLayoutUnit fixedPitchWidth(const StringView&, const RenderStyle&, unsigned from, unsigned to, InlineLayoutUnit contentLogicalLeft);
 };
 
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to