Title: [275413] trunk/Source/WebCore
Revision
275413
Author
[email protected]
Date
2021-04-02 02:07:41 -0700 (Fri, 02 Apr 2021)

Log Message

Subpixel layout: Switch inlines' baseline positioning from int to LayoutUnit.
https://bugs.webkit.org/show_bug.cgi?id=133932

Patch by Rob Buis <[email protected]> on 2021-04-02
Reviewed by Zalan Bujtas.

This change converts the int returns type to LayoutUnit.
To match the old behavior, the implicit toInt() calls
have been replaced by explicit toInt() calls.

* rendering/GridBaselineAlignment.cpp:
(WebCore::GridBaselineAlignment::ascentForChild const):
* rendering/InlineBox.cpp:
(WebCore::InlineBox::baselinePosition const):
* rendering/InlineBox.h:
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::baselinePosition const):
* rendering/InlineTextBox.h:
* rendering/RenderAttachment.cpp:
(WebCore::RenderAttachment::baselinePosition const):
* rendering/RenderAttachment.h:
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::baselinePosition const):
(WebCore::RenderBlock::firstLineBaseline const):
(WebCore::RenderBlock::inlineBlockBaseline const):
* rendering/RenderBlock.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::firstLineBaseline const):
(WebCore::RenderBlockFlow::inlineBlockBaseline const):
* rendering/RenderBlockFlow.h:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::baselinePosition const):
* rendering/RenderBox.h:
(WebCore::RenderBox::firstLineBaseline const):
(WebCore::RenderBox::inlineBlockBaseline const):
* rendering/RenderBoxModelObject.h:
* rendering/RenderButton.cpp:
(WebCore::RenderButton::baselinePosition const):
* rendering/RenderButton.h:
* rendering/RenderFlexibleBox.cpp:
(WebCore::synthesizedBaselineFromBorderBox):
(WebCore::RenderFlexibleBox::baselinePosition const):
(WebCore::RenderFlexibleBox::firstLineBaseline const):
(WebCore::RenderFlexibleBox::inlineBlockBaseline const):
* rendering/RenderFlexibleBox.h:
* rendering/RenderGrid.cpp:
(WebCore::synthesizedBaselineFromBorderBox):
(WebCore::RenderGrid::baselinePosition const):
(WebCore::RenderGrid::firstLineBaseline const):
(WebCore::RenderGrid::inlineBlockBaseline const):
* rendering/RenderGrid.h:
* rendering/RenderInline.cpp:
(WebCore::RenderInline::baselinePosition const):
* rendering/RenderInline.h:
* rendering/RenderLineBreak.cpp:
(WebCore::RenderLineBreak::baselinePosition const):
* rendering/RenderLineBreak.h:
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::baselinePosition const):
* rendering/RenderListBox.h:
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::baselinePosition const):
* rendering/RenderListMarker.h:
* rendering/RenderMenuList.h:
* rendering/RenderSlider.cpp:
(WebCore::RenderSlider::baselinePosition const):
* rendering/RenderSlider.h:
* rendering/RenderTable.cpp:
(WebCore::RenderTable::baselinePosition const):
(WebCore::RenderTable::inlineBlockBaseline const):
(WebCore::RenderTable::firstLineBaseline const):
* rendering/RenderTable.h:
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::firstLineBaseline const):
* rendering/RenderTableSection.h:
* rendering/RenderTextControl.h:
* rendering/RenderTextControlMultiLine.cpp:
(WebCore::RenderTextControlMultiLine::baselinePosition const):
* rendering/RenderTextControlMultiLine.h:
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::baselinePosition const):
* rendering/RootInlineBox.h:
* rendering/mathml/RenderMathMLBlock.cpp:
(WebCore::RenderMathMLBlock::baselinePosition const):
(WebCore::RenderMathMLTable::firstLineBaseline const):
* rendering/mathml/RenderMathMLBlock.h:
(WebCore::RenderMathMLBlock::ascentForChild):
* rendering/mathml/RenderMathMLFraction.cpp:
(WebCore::RenderMathMLFraction::firstLineBaseline const):
* rendering/mathml/RenderMathMLFraction.h:
* rendering/mathml/RenderMathMLOperator.cpp:
(WebCore::RenderMathMLOperator::firstLineBaseline const):
* rendering/mathml/RenderMathMLOperator.h:
* rendering/mathml/RenderMathMLPadded.cpp:
(WebCore::RenderMathMLPadded::firstLineBaseline const):
* rendering/mathml/RenderMathMLPadded.h:
* rendering/mathml/RenderMathMLRow.cpp:
(WebCore::RenderMathMLRow::firstLineBaseline const):
* rendering/mathml/RenderMathMLRow.h:
* rendering/mathml/RenderMathMLScripts.cpp:
(WebCore::RenderMathMLScripts::firstLineBaseline const):
* rendering/mathml/RenderMathMLScripts.h:
* rendering/mathml/RenderMathMLSpace.cpp:
(WebCore::RenderMathMLSpace::firstLineBaseline const):
* rendering/mathml/RenderMathMLSpace.h:
* rendering/mathml/RenderMathMLToken.cpp:
(WebCore::RenderMathMLToken::firstLineBaseline const):
* rendering/mathml/RenderMathMLToken.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (275412 => 275413)


--- trunk/Source/WebCore/ChangeLog	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/ChangeLog	2021-04-02 09:07:41 UTC (rev 275413)
@@ -1,3 +1,113 @@
+2021-04-02  Rob Buis  <[email protected]>
+
+        Subpixel layout: Switch inlines' baseline positioning from int to LayoutUnit.
+        https://bugs.webkit.org/show_bug.cgi?id=133932
+
+        Reviewed by Zalan Bujtas.
+
+        This change converts the int returns type to LayoutUnit.
+        To match the old behavior, the implicit toInt() calls
+        have been replaced by explicit toInt() calls.
+
+        * rendering/GridBaselineAlignment.cpp:
+        (WebCore::GridBaselineAlignment::ascentForChild const):
+        * rendering/InlineBox.cpp:
+        (WebCore::InlineBox::baselinePosition const):
+        * rendering/InlineBox.h:
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::baselinePosition const):
+        * rendering/InlineTextBox.h:
+        * rendering/RenderAttachment.cpp:
+        (WebCore::RenderAttachment::baselinePosition const):
+        * rendering/RenderAttachment.h:
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::baselinePosition const):
+        (WebCore::RenderBlock::firstLineBaseline const):
+        (WebCore::RenderBlock::inlineBlockBaseline const):
+        * rendering/RenderBlock.h:
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::firstLineBaseline const):
+        (WebCore::RenderBlockFlow::inlineBlockBaseline const):
+        * rendering/RenderBlockFlow.h:
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::baselinePosition const):
+        * rendering/RenderBox.h:
+        (WebCore::RenderBox::firstLineBaseline const):
+        (WebCore::RenderBox::inlineBlockBaseline const):
+        * rendering/RenderBoxModelObject.h:
+        * rendering/RenderButton.cpp:
+        (WebCore::RenderButton::baselinePosition const):
+        * rendering/RenderButton.h:
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::synthesizedBaselineFromBorderBox):
+        (WebCore::RenderFlexibleBox::baselinePosition const):
+        (WebCore::RenderFlexibleBox::firstLineBaseline const):
+        (WebCore::RenderFlexibleBox::inlineBlockBaseline const):
+        * rendering/RenderFlexibleBox.h:
+        * rendering/RenderGrid.cpp:
+        (WebCore::synthesizedBaselineFromBorderBox):
+        (WebCore::RenderGrid::baselinePosition const):
+        (WebCore::RenderGrid::firstLineBaseline const):
+        (WebCore::RenderGrid::inlineBlockBaseline const):
+        * rendering/RenderGrid.h:
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::baselinePosition const):
+        * rendering/RenderInline.h:
+        * rendering/RenderLineBreak.cpp:
+        (WebCore::RenderLineBreak::baselinePosition const):
+        * rendering/RenderLineBreak.h:
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::baselinePosition const):
+        * rendering/RenderListBox.h:
+        * rendering/RenderListMarker.cpp:
+        (WebCore::RenderListMarker::baselinePosition const):
+        * rendering/RenderListMarker.h:
+        * rendering/RenderMenuList.h:
+        * rendering/RenderSlider.cpp:
+        (WebCore::RenderSlider::baselinePosition const):
+        * rendering/RenderSlider.h:
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::baselinePosition const):
+        (WebCore::RenderTable::inlineBlockBaseline const):
+        (WebCore::RenderTable::firstLineBaseline const):
+        * rendering/RenderTable.h:
+        * rendering/RenderTableSection.cpp:
+        (WebCore::RenderTableSection::firstLineBaseline const):
+        * rendering/RenderTableSection.h:
+        * rendering/RenderTextControl.h:
+        * rendering/RenderTextControlMultiLine.cpp:
+        (WebCore::RenderTextControlMultiLine::baselinePosition const):
+        * rendering/RenderTextControlMultiLine.h:
+        * rendering/RootInlineBox.cpp:
+        (WebCore::RootInlineBox::baselinePosition const):
+        * rendering/RootInlineBox.h:
+        * rendering/mathml/RenderMathMLBlock.cpp:
+        (WebCore::RenderMathMLBlock::baselinePosition const):
+        (WebCore::RenderMathMLTable::firstLineBaseline const):
+        * rendering/mathml/RenderMathMLBlock.h:
+        (WebCore::RenderMathMLBlock::ascentForChild):
+        * rendering/mathml/RenderMathMLFraction.cpp:
+        (WebCore::RenderMathMLFraction::firstLineBaseline const):
+        * rendering/mathml/RenderMathMLFraction.h:
+        * rendering/mathml/RenderMathMLOperator.cpp:
+        (WebCore::RenderMathMLOperator::firstLineBaseline const):
+        * rendering/mathml/RenderMathMLOperator.h:
+        * rendering/mathml/RenderMathMLPadded.cpp:
+        (WebCore::RenderMathMLPadded::firstLineBaseline const):
+        * rendering/mathml/RenderMathMLPadded.h:
+        * rendering/mathml/RenderMathMLRow.cpp:
+        (WebCore::RenderMathMLRow::firstLineBaseline const):
+        * rendering/mathml/RenderMathMLRow.h:
+        * rendering/mathml/RenderMathMLScripts.cpp:
+        (WebCore::RenderMathMLScripts::firstLineBaseline const):
+        * rendering/mathml/RenderMathMLScripts.h:
+        * rendering/mathml/RenderMathMLSpace.cpp:
+        (WebCore::RenderMathMLSpace::firstLineBaseline const):
+        * rendering/mathml/RenderMathMLSpace.h:
+        * rendering/mathml/RenderMathMLToken.cpp:
+        (WebCore::RenderMathMLToken::firstLineBaseline const):
+        * rendering/mathml/RenderMathMLToken.h:
+
 2021-04-02  Philippe Normand  <[email protected]>
 
         REGRESSION(r268176): [GStreamer] media/video-orientation-canvas.html fails

Modified: trunk/Source/WebCore/rendering/GridBaselineAlignment.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/GridBaselineAlignment.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/GridBaselineAlignment.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -65,7 +65,7 @@
 LayoutUnit GridBaselineAlignment::ascentForChild(const RenderBox& child, GridAxis baselineAxis) const
 {
     LayoutUnit margin = isDescentBaselineForChild(child, baselineAxis) ? marginUnderForChild(child, baselineAxis) : marginOverForChild(child, baselineAxis);
-    LayoutUnit baseline(isParallelToBaselineAxisForChild(child, baselineAxis) ? child.firstLineBaseline().valueOr(-1) : -1);
+    LayoutUnit baseline(isParallelToBaselineAxisForChild(child, baselineAxis) ? child.firstLineBaseline().valueOr(LayoutUnit(-1)) : LayoutUnit(-1));
     // We take border-box's under edge if no valid baseline.
     if (baseline == -1) {
         if (isHorizontalBaselineAxis(baselineAxis))

Modified: trunk/Source/WebCore/rendering/InlineBox.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/InlineBox.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/InlineBox.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -145,7 +145,7 @@
     return result;
 }
 
-int InlineBox::baselinePosition(FontBaseline baselineType) const
+LayoutUnit InlineBox::baselinePosition(FontBaseline baselineType) const
 {
     return boxModelObject()->baselinePosition(baselineType, m_bitfields.firstLine(), isHorizontal() ? HorizontalLine : VerticalLine, PositionOnContainingLine);
 }

Modified: trunk/Source/WebCore/rendering/InlineBox.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/InlineBox.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/InlineBox.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -204,7 +204,7 @@
     FloatRect logicalFrameRect() const { return isHorizontal() ? FloatRect(m_topLeft.x(), m_topLeft.y(), m_logicalWidth, logicalHeight()) : FloatRect(m_topLeft.y(), m_topLeft.x(), m_logicalWidth, logicalHeight()); }
     FloatRect frameRect() const { return FloatRect(topLeft(), size()); }
 
-    WEBCORE_EXPORT virtual int baselinePosition(FontBaseline baselineType) const;
+    WEBCORE_EXPORT virtual LayoutUnit baselinePosition(FontBaseline baselineType) const;
     WEBCORE_EXPORT virtual LayoutUnit lineHeight() const;
 
     WEBCORE_EXPORT virtual int caretMinOffset() const;

Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/InlineTextBox.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -119,7 +119,7 @@
     gTextBoxesWithOverflow->add(this, rect);
 }
 
-int InlineTextBox::baselinePosition(FontBaseline baselineType) const
+LayoutUnit InlineTextBox::baselinePosition(FontBaseline baselineType) const
 {
     if (!parent())
         return 0;

Modified: trunk/Source/WebCore/rendering/InlineTextBox.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/InlineTextBox.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/InlineTextBox.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -92,7 +92,7 @@
 
     static inline bool compareByStart(const InlineTextBox* first, const InlineTextBox* second) { return first->start() < second->start(); }
 
-    int baselinePosition(FontBaseline) const final;
+    LayoutUnit baselinePosition(FontBaseline) const final;
     LayoutUnit lineHeight() const final;
 
     Optional<bool> emphasisMarkExistsAndIsAbove(const RenderStyle&) const;

Modified: trunk/Source/WebCore/rendering/RenderAttachment.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderAttachment.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderAttachment.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -72,7 +72,7 @@
     repaint();
 }
 
-int RenderAttachment::baselinePosition(FontBaseline, bool, LineDirectionMode, LinePositionMode) const
+LayoutUnit RenderAttachment::baselinePosition(FontBaseline, bool, LineDirectionMode, LinePositionMode) const
 {
     return theme().attachmentBaseline(*this);
 }

Modified: trunk/Source/WebCore/rendering/RenderAttachment.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderAttachment.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderAttachment.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -54,7 +54,7 @@
 
     void layout() override;
 
-    int baselinePosition(FontBaseline, bool, LineDirectionMode, LinePositionMode) const override;
+    LayoutUnit baselinePosition(FontBaseline, bool, LineDirectionMode, LinePositionMode) const override;
 
     LayoutUnit m_minimumIntrinsicWidth;
     bool m_shouldDrawBorder { true };

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -2481,7 +2481,7 @@
     return style().computedLineHeight();
 }
 
-int RenderBlock::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
+LayoutUnit RenderBlock::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
 {
     // Inline blocks are replaced elements. Otherwise, just pass off to
     // the base class.  If we're being queried as though we're the root line
@@ -2516,7 +2516,7 @@
             return scrollableArea->horizontalScrollbar() || scrollableArea->scrollOffset().x();
         };
 
-        Optional<int> baselinePos = ignoreBaseline() ? Optional<int>() : inlineBlockBaseline(direction);
+        auto baselinePos = ignoreBaseline() ? Optional<LayoutUnit>() : inlineBlockBaseline(direction);
         
         if (isDeprecatedFlexibleBox()) {
             // Historically, we did this check for all baselines. But we can't
@@ -2526,7 +2526,7 @@
             // For simplicity, we use this for all uses of deprecated flexbox.
             LayoutUnit bottomOfContent = direction == HorizontalLine ? borderTop() + paddingTop() + contentHeight() : borderRight() + paddingRight() + contentWidth();
             if (baselinePos && baselinePos.value() > bottomOfContent)
-                baselinePos = Optional<int>();
+                baselinePos = Optional<LayoutUnit>();
         }
         if (baselinePos)
             return direction == HorizontalLine ? marginTop() + baselinePos.value() : marginRight() + baselinePos.value();
@@ -2536,7 +2536,7 @@
 
     const RenderStyle& style = firstLine ? firstLineStyle() : this->style();
     const FontMetrics& fontMetrics = style.fontMetrics();
-    return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2;
+    return LayoutUnit { fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2 }.toInt();
 }
 
 LayoutUnit RenderBlock::minLineHeightForReplacedRenderer(bool isFirstLine, LayoutUnit replacedHeight) const
@@ -2551,25 +2551,25 @@
     return std::max<LayoutUnit>(replacedHeight, lineHeight(isFirstLine, isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes));
 }
 
-Optional<int> RenderBlock::firstLineBaseline() const
+Optional<LayoutUnit> RenderBlock::firstLineBaseline() const
 {
     if (isWritingModeRoot() && !isRubyRun())
-        return Optional<int>();
+        return Optional<LayoutUnit>();
 
     for (RenderBox* curr = firstChildBox(); curr; curr = curr->nextSiblingBox()) {
         if (!curr->isFloatingOrOutOfFlowPositioned()) {
-            if (Optional<int> result = curr->firstLineBaseline())
-                return Optional<int>(curr->logicalTop() + result.value()); // Translate to our coordinate space.
+            if (auto result = curr->firstLineBaseline())
+                return LayoutUnit { curr->logicalTop() + result.value() }; // Translate to our coordinate space.
         }
     }
 
-    return Optional<int>();
+    return Optional<LayoutUnit>();
 }
 
-Optional<int> RenderBlock::inlineBlockBaseline(LineDirectionMode lineDirection) const
+Optional<LayoutUnit> RenderBlock::inlineBlockBaseline(LineDirectionMode lineDirection) const
 {
     if (isWritingModeRoot() && !isRubyRun())
-        return Optional<int>();
+        return Optional<LayoutUnit>();
 
     bool haveNormalFlowChild = false;
     for (auto* box = lastChildBox(); box; box = box->previousSiblingBox()) {
@@ -2576,18 +2576,18 @@
         if (box->isFloatingOrOutOfFlowPositioned())
             continue;
         haveNormalFlowChild = true;
-        if (Optional<int> result = box->inlineBlockBaseline(lineDirection))
-            return Optional<int>(box->logicalTop() + result.value()); // Translate to our coordinate space.
+        if (auto result = box->inlineBlockBaseline(lineDirection))
+            return LayoutUnit { (box->logicalTop() + result.value()).toInt() }; // Translate to our coordinate space.
     }
 
     if (!haveNormalFlowChild && hasLineIfEmpty()) {
         auto& fontMetrics = firstLineStyle().fontMetrics();
-        return Optional<int>(fontMetrics.ascent()
+        return LayoutUnit { LayoutUnit(fontMetrics.ascent()
             + (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes) - fontMetrics.height()) / 2
-            + (lineDirection == HorizontalLine ? borderTop() + paddingTop() : borderRight() + paddingRight()));
+            + (lineDirection == HorizontalLine ? borderTop() + paddingTop() : borderRight() + paddingRight())).toInt() };
     }
 
-    return Optional<int>();
+    return Optional<LayoutUnit>();
 }
 
 static inline bool isRenderBlockFlowOrRenderButton(RenderElement& renderElement)

Modified: trunk/Source/WebCore/rendering/RenderBlock.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderBlock.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderBlock.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -65,7 +65,7 @@
 public:
     // These two functions are overridden for inline-block.
     LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const final;
-    int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
+    LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
 
     LayoutUnit minLineHeightForReplacedRenderer(bool isFirstLine, LayoutUnit replacedHeight) const;
 
@@ -353,8 +353,8 @@
     void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const override;
     void computePreferredLogicalWidths() override;
     
-    Optional<int> firstLineBaseline() const override;
-    Optional<int> inlineBlockBaseline(LineDirectionMode) const override;
+    Optional<LayoutUnit> firstLineBaseline() const override;
+    Optional<LayoutUnit> inlineBlockBaseline(LineDirectionMode) const override;
 
     // Delay updating scrollbars until endAndCommitUpdateScrollInfoAfterLayoutTransaction() is called. These functions are used
     // when a flexbox is laying out its descendants. If multiple calls are made to beginUpdateScrollInfoAfterLayoutTransaction()

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -3106,7 +3106,7 @@
     }
 }
 
-Optional<int> RenderBlockFlow::firstLineBaseline() const
+Optional<LayoutUnit> RenderBlockFlow::firstLineBaseline() const
 {
     if (isWritingModeRoot() && !isRubyRun() && !isGridItem())
         return WTF::nullopt;
@@ -3119,16 +3119,16 @@
 
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
     if (modernLineLayout())
-        return floorToInt(modernLineLayout()->firstLineBaseline());
+        return LayoutUnit { floorToInt(modernLineLayout()->firstLineBaseline()) };
 #endif
 
     ASSERT(firstRootBox());
     if (style().isFlippedLinesWritingMode())
-        return firstRootBox()->logicalTop() + firstLineStyle().fontMetrics().descent(firstRootBox()->baselineType());
-    return firstRootBox()->logicalTop() + firstLineStyle().fontMetrics().ascent(firstRootBox()->baselineType());
+        return LayoutUnit { firstRootBox()->logicalTop() + firstLineStyle().fontMetrics().descent(firstRootBox()->baselineType()) };
+    return LayoutUnit { firstRootBox()->logicalTop() + firstLineStyle().fontMetrics().ascent(firstRootBox()->baselineType()) };
 }
 
-Optional<int> RenderBlockFlow::inlineBlockBaseline(LineDirectionMode lineDirection) const
+Optional<LayoutUnit> RenderBlockFlow::inlineBlockBaseline(LineDirectionMode lineDirection) const
 {
     if (isWritingModeRoot() && !isRubyRun())
         return WTF::nullopt;
@@ -3144,7 +3144,7 @@
     float boxHeight = lineDirection == HorizontalLine ? height() + m_marginBox.bottom() : width() + m_marginBox.left();
     float lastBaseline = 0;
     if (!childrenInline()) {
-        Optional<int> inlineBlockBaseline = RenderBlock::inlineBlockBaseline(lineDirection);
+        auto inlineBlockBaseline = RenderBlock::inlineBlockBaseline(lineDirection);
         if (!inlineBlockBaseline)
             return inlineBlockBaseline;
         lastBaseline = inlineBlockBaseline.value();
@@ -3153,9 +3153,9 @@
             if (!hasLineIfEmpty())
                 return WTF::nullopt;
             const auto& fontMetrics = firstLineStyle().fontMetrics();
-            return Optional<int>(fontMetrics.ascent()
+            return LayoutUnit { LayoutUnit(fontMetrics.ascent()
                 + (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes) - fontMetrics.height()) / 2
-                + (lineDirection == HorizontalLine ? borderTop() + paddingTop() : borderRight() + paddingRight()));
+                + (lineDirection == HorizontalLine ? borderTop() + paddingTop() : borderRight() + paddingRight())).toInt() };
         }
 
         if (complexLineLayout()) {
@@ -3173,7 +3173,7 @@
     // According to the CSS spec http://www.w3.org/TR/CSS21/visudet.html, we shouldn't be performing this min, but should
     // instead be returning boxHeight directly. However, we feel that a min here is better behavior (and is consistent
     // enough with the spec to not cause tons of breakages).
-    return style().overflowY() == Overflow::Visible ? lastBaseline : std::min(boxHeight, lastBaseline);
+    return LayoutUnit { style().overflowY() == Overflow::Visible ? lastBaseline : std::min(boxHeight, lastBaseline) };
 }
 
 void RenderBlockFlow::setSelectionState(HighlightState state)

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -450,8 +450,8 @@
 
     void createFloatingObjects();
 
-    Optional<int> firstLineBaseline() const override;
-    Optional<int> inlineBlockBaseline(LineDirectionMode) const override;
+    Optional<LayoutUnit> firstLineBaseline() const override;
+    Optional<LayoutUnit> inlineBlockBaseline(LineDirectionMode) const override;
 
     bool isMultiColumnBlockFlow() const override { return multiColumnFlow(); }
     

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -4866,7 +4866,7 @@
     return 0;
 }
 
-int RenderBox::baselinePosition(FontBaseline baselineType, bool /*firstLine*/, LineDirectionMode direction, LinePositionMode /*linePositionMode*/) const
+LayoutUnit RenderBox::baselinePosition(FontBaseline baselineType, bool /*firstLine*/, LineDirectionMode direction, LinePositionMode /*linePositionMode*/) const
 {
     if (isReplaced()) {
         auto result = roundToInt(direction == HorizontalLine ? m_marginBox.top() + height() + m_marginBox.bottom() : m_marginBox.right() + width() + m_marginBox.left());

Modified: trunk/Source/WebCore/rendering/RenderBox.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderBox.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -541,8 +541,8 @@
     
     RenderLayer* enclosingFloatPaintingLayer() const;
     
-    virtual Optional<int> firstLineBaseline() const { return Optional<int>(); }
-    virtual Optional<int> inlineBlockBaseline(LineDirectionMode) const { return Optional<int>(); } // Returns empty if we should skip this box when computing the baseline of an inline-block.
+    virtual Optional<LayoutUnit> firstLineBaseline() const { return Optional<LayoutUnit>(); }
+    virtual Optional<LayoutUnit> inlineBlockBaseline(LineDirectionMode) const { return Optional<LayoutUnit>(); } // Returns empty if we should skip this box when computing the baseline of an inline-block.
 
     bool shrinkToAvoidFloats() const;
     virtual bool avoidsFloats() const;
@@ -555,7 +555,7 @@
     bool isFlexItemIncludingDeprecated() const { return !isInline() && !isFloatingOrOutOfFlowPositioned() && parent() && parent()->isFlexibleBoxIncludingDeprecated(); }
     
     LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
-    int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
+    LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
 
     LayoutUnit offsetLeft() const override;
     LayoutUnit offsetTop() const override;

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -216,7 +216,7 @@
 
     // Overridden by subclasses to determine line height and baseline position.
     virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const = 0;
-    virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const = 0;
+    virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const = 0;
 
     void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) const override;
 

Modified: trunk/Source/WebCore/rendering/RenderButton.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderButton.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderButton.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -148,7 +148,7 @@
     return direction == HorizontalLine ? box.borderTop() + box.paddingTop() + box.contentHeight() : box.borderRight() + box.paddingRight() + box.contentWidth();
 }
 
-int RenderButton::baselinePosition(FontBaseline, bool, LineDirectionMode direction, LinePositionMode) const
+LayoutUnit RenderButton::baselinePosition(FontBaseline, bool, LineDirectionMode direction, LinePositionMode) const
 {
     // We cannot rely on RenderFlexibleBox::baselinePosition() because of flexboxes have some special behavior
     // regarding baselines that shouldn't apply to buttons.

Modified: trunk/Source/WebCore/rendering/RenderButton.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderButton.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderButton.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -61,7 +61,7 @@
     RenderBlock* innerRenderer() const { return m_inner.get(); }
     void setInnerRenderer(RenderBlock&);
 
-    int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
+    LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
 
 private:
     void element() const = delete;

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -144,12 +144,12 @@
     minLogicalWidth += scrollbarWidth;
 }
 
-static int synthesizedBaselineFromBorderBox(const RenderBox& box, LineDirectionMode direction)
+static LayoutUnit synthesizedBaselineFromBorderBox(const RenderBox& box, LineDirectionMode direction)
 {
-    return (direction == HorizontalLine ? box.size().height() : box.size().width()).toInt();
+    return direction == HorizontalLine ? box.size().height() : box.size().width();
 }
 
-int RenderFlexibleBox::baselinePosition(FontBaseline, bool, LineDirectionMode direction, LinePositionMode) const
+LayoutUnit RenderFlexibleBox::baselinePosition(FontBaseline, bool, LineDirectionMode direction, LinePositionMode) const
 {
     auto baseline = firstLineBaseline();
     if (!baseline)
@@ -158,10 +158,10 @@
     return baseline.value() + (direction == HorizontalLine ? marginTop() : marginRight()).toInt();
 }
 
-Optional<int> RenderFlexibleBox::firstLineBaseline() const
+Optional<LayoutUnit> RenderFlexibleBox::firstLineBaseline() const
 {
     if (isWritingModeRoot() || m_numberOfInFlowChildrenOnFirstLine <= 0)
-        return Optional<int>();
+        return Optional<LayoutUnit>();
     RenderBox* baselineChild = nullptr;
     int childNumber = 0;
     for (RenderBox* child = m_orderIterator.first(); child; child = m_orderIterator.next()) {
@@ -180,25 +180,25 @@
     }
 
     if (!baselineChild)
-        return Optional<int>();
+        return Optional<LayoutUnit>();
 
     if (!isColumnFlow() && !mainAxisIsChildInlineAxis(*baselineChild))
-        return Optional<int>(crossAxisExtentForChild(*baselineChild) + baselineChild->logicalTop());
+        return LayoutUnit { (crossAxisExtentForChild(*baselineChild) + baselineChild->logicalTop()).toInt() };
     if (isColumnFlow() && mainAxisIsChildInlineAxis(*baselineChild))
-        return Optional<int>(mainAxisExtentForChild(*baselineChild) + baselineChild->logicalTop());
+        return LayoutUnit { (mainAxisExtentForChild(*baselineChild) + baselineChild->logicalTop()).toInt() };
 
-    Optional<int> baseline = baselineChild->firstLineBaseline();
+    Optional<LayoutUnit> baseline = baselineChild->firstLineBaseline();
     if (!baseline) {
         // FIXME: We should pass |direction| into firstLineBoxBaseline and stop bailing out if we're a writing mode root.
         // This would also fix some cases where the flexbox is orthogonal to its container.
         LineDirectionMode direction = isHorizontalWritingMode() ? HorizontalLine : VerticalLine;
-        return Optional<int>(synthesizedBaselineFromBorderBox(*baselineChild, direction) + baselineChild->logicalTop());
+        return synthesizedBaselineFromBorderBox(*baselineChild, direction) + baselineChild->logicalTop();
     }
 
-    return Optional<int>(baseline.value() + baselineChild->logicalTop());
+    return LayoutUnit { (baseline.value() + baselineChild->logicalTop()).toInt() };
 }
 
-Optional<int> RenderFlexibleBox::inlineBlockBaseline(LineDirectionMode) const
+Optional<LayoutUnit> RenderFlexibleBox::inlineBlockBaseline(LineDirectionMode) const
 {
     return firstLineBaseline();
 }

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -52,9 +52,9 @@
     bool canDropAnonymousBlockChild() const final { return false; }
     void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) final;
 
-    int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
-    Optional<int> firstLineBaseline() const override;
-    Optional<int> inlineBlockBaseline(LineDirectionMode) const override;
+    LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
+    Optional<LayoutUnit> firstLineBaseline() const override;
+    Optional<LayoutUnit> inlineBlockBaseline(LineDirectionMode) const override;
 
     void styleDidChange(StyleDifference, const RenderStyle*) override;
     bool hitTestChildren(const HitTestRequest&, HitTestResult&, const HitTestLocation&, const LayoutPoint& adjustedLocation, HitTestAction) override;

Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderGrid.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -1233,7 +1233,7 @@
 }
 
 // FIXME: This logic could be refactored somehow and defined in RenderBox.
-static int synthesizedBaselineFromBorderBox(const RenderBox& box, LineDirectionMode direction)
+static LayoutUnit synthesizedBaselineFromBorderBox(const RenderBox& box, LineDirectionMode direction)
 {
     return (direction == HorizontalLine ? box.size().height() : box.size().width()).toInt();
 }
@@ -1253,7 +1253,7 @@
 }
 
 // FIXME: This logic is shared by RenderFlexibleBox, so it might be refactored somehow.
-int RenderGrid::baselinePosition(FontBaseline, bool, LineDirectionMode direction, LinePositionMode mode) const
+LayoutUnit RenderGrid::baselinePosition(FontBaseline, bool, LineDirectionMode direction, LinePositionMode mode) const
 {
     ASSERT_UNUSED(mode, mode == PositionOnContainingLine);
     auto baseline = firstLineBaseline();
@@ -1263,7 +1263,7 @@
     return baseline.value() + (direction == HorizontalLine ? marginTop() : marginRight()).toInt();
 }
 
-Optional<int> RenderGrid::firstLineBaseline() const
+Optional<LayoutUnit> RenderGrid::firstLineBaseline() const
 {
     if (isWritingModeRoot() || !m_grid.hasGridItems())
         return WTF::nullopt;
@@ -1294,12 +1294,12 @@
         // FIXME: We should pass |direction| into firstLineBaseline and stop bailing out if we're a writing
         // mode root. This would also fix some cases where the grid is orthogonal to its container.
         LineDirectionMode direction = isHorizontalWritingMode() ? HorizontalLine : VerticalLine;
-        return synthesizedBaselineFromBorderBox(*baselineChild, direction) + logicalTopForChild(*baselineChild).toInt();
+        return synthesizedBaselineFromBorderBox(*baselineChild, direction) + logicalTopForChild(*baselineChild);
     }
     return baseline.value() + baselineChild->logicalTop().toInt();
 }
 
-Optional<int> RenderGrid::inlineBlockBaseline(LineDirectionMode) const
+Optional<LayoutUnit> RenderGrid::inlineBlockBaseline(LineDirectionMode) const
 {
     return firstLineBaseline();
 }

Modified: trunk/Source/WebCore/rendering/RenderGrid.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderGrid.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderGrid.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -169,9 +169,9 @@
     void updateAutoMarginsInColumnAxisIfNeeded(RenderBox&);
     void updateAutoMarginsInRowAxisIfNeeded(RenderBox&);
 
-    int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const final;
-    Optional<int> firstLineBaseline() const final;
-    Optional<int> inlineBlockBaseline(LineDirectionMode) const final;
+    LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const final;
+    Optional<LayoutUnit> firstLineBaseline() const final;
+    Optional<LayoutUnit> inlineBlockBaseline(LineDirectionMode) const final;
     bool isInlineBaselineAlignedChild(const RenderBox&) const;
 
     LayoutUnit columnAxisBaselineOffsetForChild(const RenderBox&) const;

Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderInline.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -1162,11 +1162,11 @@
     return style().computedLineHeight();
 }
 
-int RenderInline::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
+LayoutUnit RenderInline::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
 {
     const RenderStyle& style = firstLine ? firstLineStyle() : this->style();
     const FontMetrics& fontMetrics = style.fontMetrics();
-    return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2;
+    return LayoutUnit { (fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2).toInt() };
 }
 
 LayoutSize RenderInline::offsetForInFlowPositionedInline(const RenderBox* child) const

Modified: trunk/Source/WebCore/rendering/RenderInline.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderInline.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderInline.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -144,7 +144,7 @@
     void dirtyLinesFromChangedChild(RenderObject& child) final { m_lineBoxes.dirtyLinesFromChangedChild(*this, child); }
 
     LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const final;
-    int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const final;
+    LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const final;
     
     void updateHitTestResult(HitTestResult&, const LayoutPoint&) final;
 

Modified: trunk/Source/WebCore/rendering/RenderLineBreak.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderLineBreak.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderLineBreak.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -76,11 +76,11 @@
     return m_cachedLineHeight;
 }
 
-int RenderLineBreak::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
+LayoutUnit RenderLineBreak::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
 {
     const RenderStyle& style = firstLine ? firstLineStyle() : this->style();
     const FontMetrics& fontMetrics = style.fontMetrics();
-    return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2;
+    return LayoutUnit { (fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2).toInt() };
 }
 
 std::unique_ptr<InlineElementBox> RenderLineBreak::createInlineBox()

Modified: trunk/Source/WebCore/rendering/RenderLineBreak.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderLineBreak.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderLineBreak.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -67,7 +67,7 @@
     bool canBeSelectionLeaf() const final;
 
     LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode) const final;
-    int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode) const final;
+    LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode) const final;
 
     LayoutUnit marginTop() const final { return 0; }
     LayoutUnit marginBottom() const final { return 0; }

Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderListBox.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -273,7 +273,7 @@
     return RenderBox::computeLogicalHeight(height, logicalTop);
 }
 
-int RenderListBox::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode lineDirection, LinePositionMode linePositionMode) const
+LayoutUnit RenderListBox::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode lineDirection, LinePositionMode linePositionMode) const
 {
     return RenderBox::baselinePosition(baselineType, firstLine, lineDirection, linePositionMode) - baselineAdjustment;
 }

Modified: trunk/Source/WebCore/rendering/RenderListBox.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderListBox.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderListBox.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -87,7 +87,7 @@
 
     void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const override;
     void computePreferredLogicalWidths() override;
-    int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
+    LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
     LogicalExtentComputedValues computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop) const override;
 
     void layout() override;

Modified: trunk/Source/WebCore/rendering/RenderListMarker.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderListMarker.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderListMarker.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -1791,7 +1791,7 @@
     return RenderBox::lineHeight(firstLine, direction, linePositionMode);
 }
 
-int RenderListMarker::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
+LayoutUnit RenderListMarker::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
 {
     if (!isImage())
         return m_listItem->baselinePosition(baselineType, firstLine, direction, PositionOfInteriorLineBoxes);

Modified: trunk/Source/WebCore/rendering/RenderListMarker.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderListMarker.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderListMarker.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -69,7 +69,7 @@
     std::unique_ptr<InlineElementBox> createInlineBox() override;
 
     LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
-    int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
+    LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
 
     bool isImage() const override;
     bool isText() const { return !isImage(); }

Modified: trunk/Source/WebCore/rendering/RenderMenuList.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderMenuList.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderMenuList.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -125,12 +125,12 @@
 
     // Flexbox defines baselines differently than regular blocks.
     // For backwards compatibility, menulists need to do the regular block behavior.
-    int baselinePosition(FontBaseline baseline, bool firstLine, LineDirectionMode direction, LinePositionMode position) const override
+    LayoutUnit baselinePosition(FontBaseline baseline, bool firstLine, LineDirectionMode direction, LinePositionMode position) const override
     {
         return RenderBlock::baselinePosition(baseline, firstLine, direction, position);
     }
-    Optional<int> firstLineBaseline() const override { return RenderBlock::firstLineBaseline(); }
-    Optional<int> inlineBlockBaseline(LineDirectionMode direction) const override { return RenderBlock::inlineBlockBaseline(direction); }
+    Optional<LayoutUnit> firstLineBaseline() const override { return RenderBlock::firstLineBaseline(); }
+    Optional<LayoutUnit> inlineBlockBaseline(LineDirectionMode direction) const override { return RenderBlock::inlineBlockBaseline(direction); }
 
     void getItemBackgroundColor(unsigned listIndex, Color&, bool& itemHasCustomBackgroundColor) const;
 

Modified: trunk/Source/WebCore/rendering/RenderSlider.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderSlider.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderSlider.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -61,7 +61,7 @@
     return downcast<HTMLInputElement>(nodeForNonAnonymous());
 }
 
-int RenderSlider::baselinePosition(FontBaseline, bool /*firstLine*/, LineDirectionMode, LinePositionMode) const
+LayoutUnit RenderSlider::baselinePosition(FontBaseline, bool /*firstLine*/, LineDirectionMode, LinePositionMode) const
 {
     // FIXME: Patch this function for writing-mode.
     return height() + marginTop();

Modified: trunk/Source/WebCore/rendering/RenderSlider.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderSlider.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderSlider.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -45,7 +45,7 @@
     const char* renderName() const override { return "RenderSlider"; }
     bool isSlider() const override { return true; }
 
-    int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
+    LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
     void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const override;
     void computePreferredLogicalWidths() override;
     void layout() override;

Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderTable.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -1471,7 +1471,7 @@
     return nullptr;
 }
 
-int RenderTable::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
+LayoutUnit RenderTable::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
 {
     return valueOrCompute(firstLineBaseline(), [&] {
         return RenderBox::baselinePosition(baselineType, firstLine, direction, linePositionMode);
@@ -1478,13 +1478,13 @@
     });
 }
 
-Optional<int> RenderTable::inlineBlockBaseline(LineDirectionMode) const
+Optional<LayoutUnit> RenderTable::inlineBlockBaseline(LineDirectionMode) const
 {
     // Tables are skipped when computing an inline-block's baseline.
-    return Optional<int>();
+    return Optional<LayoutUnit>();
 }
 
-Optional<int> RenderTable::firstLineBaseline() const
+Optional<LayoutUnit> RenderTable::firstLineBaseline() const
 {
     // The baseline of a 'table' is the same as the 'inline-table' baseline per CSS 3 Flexbox (CSS 2.1
     // doesn't define the baseline of a 'table' only an 'inline-table').
@@ -1491,19 +1491,19 @@
     // This is also needed to properly determine the baseline of a cell if it has a table child.
 
     if (isWritingModeRoot())
-        return Optional<int>();
+        return Optional<LayoutUnit>();
 
     recalcSectionsIfNeeded();
 
     const RenderTableSection* topNonEmptySection = this->topNonEmptySection();
     if (!topNonEmptySection)
-        return Optional<int>();
+        return Optional<LayoutUnit>();
 
-    if (Optional<int> baseline = topNonEmptySection->firstLineBaseline())
-        return Optional<int>(topNonEmptySection->logicalTop() + baseline.value());
+    if (auto baseline = topNonEmptySection->firstLineBaseline())
+        return Optional<LayoutUnit>(topNonEmptySection->logicalTop() + baseline.value());
 
     // FIXME: A table row always has a baseline per CSS 2.1. Will this return the right value?
-    return Optional<int>();
+    return Optional<LayoutUnit>();
 }
 
 LayoutRect RenderTable::overflowClipRect(const LayoutPoint& location, RenderFragmentContainer* fragment, OverlayScrollbarSizeRelevancy relevancy, PaintPhase phase) const

Modified: trunk/Source/WebCore/rendering/RenderTable.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderTable.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderTable.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -292,9 +292,9 @@
     void computePreferredLogicalWidths() override;
     bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override;
 
-    int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const final;
-    Optional<int> firstLineBaseline() const override;
-    Optional<int> inlineBlockBaseline(LineDirectionMode) const final;
+    LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const final;
+    Optional<LayoutUnit> firstLineBaseline() const override;
+    Optional<LayoutUnit> inlineBlockBaseline(LineDirectionMode) const final;
 
     RenderTableCol* slowColElement(unsigned col, bool* startEdge, bool* endEdge) const;
 

Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderTableSection.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -867,16 +867,16 @@
     m_outerBorderEnd = calcOuterBorderEnd();
 }
 
-Optional<int> RenderTableSection::firstLineBaseline() const
+Optional<LayoutUnit> RenderTableSection::firstLineBaseline() const
 {
     if (!m_grid.size())
-        return Optional<int>();
+        return Optional<LayoutUnit>();
 
-    int firstLineBaseline = m_grid[0].baseline;
+    LayoutUnit firstLineBaseline = m_grid[0].baseline;
     if (firstLineBaseline)
-        return firstLineBaseline + roundToInt(m_rowPos[0]);
+        return firstLineBaseline + m_rowPos[0];
 
-    Optional<int> result;
+    Optional<LayoutUnit> result;
     const Row& firstRow = m_grid[0].row;
     for (size_t i = 0; i < firstRow.size(); ++i) {
         const CellStruct& cs = firstRow.at(i);
@@ -883,7 +883,7 @@
         const RenderTableCell* cell = cs.primaryCell();
         // Only cells with content have a baseline
         if (cell && cell->contentLogicalHeight()) {
-            int candidate = roundToInt(cell->logicalTop() + cell->borderAndPaddingBefore() + cell->contentLogicalHeight());
+            LayoutUnit candidate = cell->logicalTop() + cell->borderAndPaddingBefore() + cell->contentLogicalHeight();
             result = std::max(result.valueOr(candidate), candidate);
         }
     }

Modified: trunk/Source/WebCore/rendering/RenderTableSection.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderTableSection.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderTableSection.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -62,7 +62,7 @@
     RenderTableRow* firstRow() const;
     RenderTableRow* lastRow() const;
 
-    Optional<int> firstLineBaseline() const override;
+    Optional<LayoutUnit> firstLineBaseline() const override;
 
     void addCell(RenderTableCell*, RenderTableRow* row);
 

Modified: trunk/Source/WebCore/rendering/RenderTextControl.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderTextControl.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderTextControl.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -94,12 +94,12 @@
     { }
     virtual ~RenderTextControlInnerContainer() = default;
 
-    int baselinePosition(FontBaseline baseline, bool firstLine, LineDirectionMode direction, LinePositionMode position) const override
+    LayoutUnit baselinePosition(FontBaseline baseline, bool firstLine, LineDirectionMode direction, LinePositionMode position) const override
     {
         return RenderBlock::baselinePosition(baseline, firstLine, direction, position);
     }
-    Optional<int> firstLineBaseline() const override { return RenderBlock::firstLineBaseline(); }
-    Optional<int> inlineBlockBaseline(LineDirectionMode direction) const override { return RenderBlock::inlineBlockBaseline(direction); }
+    Optional<LayoutUnit> firstLineBaseline() const override { return RenderBlock::firstLineBaseline(); }
+    Optional<LayoutUnit> inlineBlockBaseline(LineDirectionMode direction) const override { return RenderBlock::inlineBlockBaseline(direction); }
 
 private:
     bool isFlexibleBoxImpl() const override { return true; }

Modified: trunk/Source/WebCore/rendering/RenderTextControlMultiLine.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderTextControlMultiLine.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderTextControlMultiLine.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -92,7 +92,7 @@
     return lineHeight * textAreaElement().rows() + nonContentHeight;
 }
 
-int RenderTextControlMultiLine::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
+LayoutUnit RenderTextControlMultiLine::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
 {
     return RenderBox::baselinePosition(baselineType, firstLine, direction, linePositionMode);
 }

Modified: trunk/Source/WebCore/rendering/RenderTextControlMultiLine.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/RenderTextControlMultiLine.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RenderTextControlMultiLine.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -45,7 +45,7 @@
     float getAverageCharWidth() override;
     LayoutUnit preferredContentLogicalWidth(float charWidth) const override;
     LayoutUnit computeControlLogicalHeight(LayoutUnit lineHeight, LayoutUnit nonContentHeight) const override;
-    int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
+    LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
 
     void layoutExcludedChildren(bool relayoutChildren) override;
 };

Modified: trunk/Source/WebCore/rendering/RootInlineBox.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/RootInlineBox.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RootInlineBox.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -101,7 +101,7 @@
     return false;
 }
 
-int RootInlineBox::baselinePosition(FontBaseline baselineType) const
+LayoutUnit RootInlineBox::baselinePosition(FontBaseline baselineType) const
 {
     return renderer().baselinePosition(baselineType, isFirstLine(), isHorizontal() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
 }

Modified: trunk/Source/WebCore/rendering/RootInlineBox.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/RootInlineBox.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/RootInlineBox.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -117,7 +117,7 @@
 
     bool isHyphenated() const;
 
-    int baselinePosition(FontBaseline baselineType) const final;
+    LayoutUnit baselinePosition(FontBaseline baselineType) const final;
     LayoutUnit lineHeight() const final;
 
     void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom) override;

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -95,7 +95,7 @@
     return horizontalOffset;
 }
 
-int RenderMathMLBlock::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
+LayoutUnit RenderMathMLBlock::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
 {
     // mathml.css sets math { -webkit-line-box-contain: glyphs replaced; line-height: 0; }, so when linePositionMode == PositionOfInteriorLineBoxes we want to
     // return 0 here to match our line-height. This matters when RootInlineBox::ascentAndDescentForBox is called on a RootInlineBox for an inline-block.
@@ -176,11 +176,11 @@
     }
 }
 
-Optional<int> RenderMathMLTable::firstLineBaseline() const
+Optional<LayoutUnit> RenderMathMLTable::firstLineBaseline() const
 {
     // By default the vertical center of <mtable> is aligned on the math axis.
     // This is different than RenderTable::firstLineBoxBaseline, which returns the baseline of the first row of a <table>.
-    return Optional<int>(logicalHeight() / 2 + axisHeight(style()));
+    return LayoutUnit { (logicalHeight() / 2 + axisHeight(style())).toInt() };
 }
 
 void RenderMathMLBlock::layoutItems(bool relayoutChildren)

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -59,7 +59,7 @@
     // https://bugs.webkit.org/show_bug.cgi?id=78617.
     virtual RenderMathMLOperator* unembellishedOperator() const { return 0; }
 
-    int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
+    LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
 
 #if ENABLE(DEBUG_MATH_LAYOUT)
     virtual void paint(PaintInfo&, const LayoutPoint&);
@@ -82,7 +82,7 @@
 
     static LayoutUnit ascentForChild(const RenderBox& child)
     {
-        return child.firstLineBaseline().valueOr(child.logicalHeight());
+        return child.firstLineBaseline().valueOr(child.logicalHeight().toInt());
     }
 
     void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) override;
@@ -113,7 +113,7 @@
 private:
     bool isRenderMathMLTable() const final { return true; }
     const char* renderName() const final { return "RenderMathMLTable"; }
-    Optional<int> firstLineBaseline() const final;
+    Optional<LayoutUnit> firstLineBaseline() const final;
 
     Ref<MathMLStyle> m_mathMLStyle;
 };

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -272,10 +272,10 @@
     info.context().drawLine(adjustedPaintOffset, roundedIntPoint(LayoutPoint(adjustedPaintOffset.x() + logicalWidth(), LayoutUnit(adjustedPaintOffset.y()))));
 }
 
-Optional<int> RenderMathMLFraction::firstLineBaseline() const
+Optional<LayoutUnit> RenderMathMLFraction::firstLineBaseline() const
 {
     if (isValid())
-        return Optional<int>(std::lround(static_cast<float>(fractionAscent())));
+        return LayoutUnit { roundf(static_cast<float>(fractionAscent())) };
     return RenderMathMLBlock::firstLineBaseline();
 }
 

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -51,7 +51,7 @@
 
     void computePreferredLogicalWidths() final;
     void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) final;
-    Optional<int> firstLineBaseline() const final;
+    Optional<LayoutUnit> firstLineBaseline() const final;
     void paint(PaintInfo&, const LayoutPoint&) final;
     RenderMathMLOperator* unembellishedOperator() const final;
 

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -301,10 +301,10 @@
     return (m_stretchDepthBelowBaseline - m_stretchHeightAboveBaseline - m_mathOperator.descent() + m_mathOperator.ascent()) / 2;
 }
 
-Optional<int> RenderMathMLOperator::firstLineBaseline() const
+Optional<LayoutUnit> RenderMathMLOperator::firstLineBaseline() const
 {
     if (useMathOperator())
-        return Optional<int>(std::lround(static_cast<float>(m_mathOperator.ascent() - verticalStretchedOperatorShift())));
+        return LayoutUnit { static_cast<int>(lround(static_cast<float>(m_mathOperator.ascent() - verticalStretchedOperatorShift()))) };
     return RenderMathMLToken::firstLineBaseline();
 }
 

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -79,7 +79,7 @@
     bool isRenderMathMLOperator() const final { return true; }
     bool isInvisibleOperator() const;
 
-    Optional<int> firstLineBaseline() const final;
+    Optional<LayoutUnit> firstLineBaseline() const final;
     RenderMathMLOperator* unembellishedOperator() const final { return const_cast<RenderMathMLOperator*>(this); }
 
     LayoutUnit verticalStretchedOperatorShift() const;

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLPadded.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLPadded.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLPadded.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -116,7 +116,7 @@
     clearNeedsLayout();
 }
 
-Optional<int> RenderMathMLPadded::firstLineBaseline() const
+Optional<LayoutUnit> RenderMathMLPadded::firstLineBaseline() const
 {
     // We try and calculate the baseline from the position of the first child.
     LayoutUnit ascent;
@@ -124,7 +124,7 @@
         ascent = ascentForChild(*baselineChild) + baselineChild->logicalTop() + voffset();
     else
         ascent = mpaddedHeight(0);
-    return Optional<int>(std::lround(static_cast<float>(ascent)));
+    return ascent;
 }
 
 }

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLPadded.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLPadded.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLPadded.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -43,7 +43,7 @@
 
     void computePreferredLogicalWidths() final;
     void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) final;
-    Optional<int> firstLineBaseline() const final;
+    Optional<LayoutUnit> firstLineBaseline() const final;
 
     MathMLPaddedElement& element() const { return static_cast<MathMLPaddedElement&>(nodeForNonAnonymous()); }
     LayoutUnit voffset() const;

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -52,13 +52,13 @@
     return static_cast<MathMLRowElement&>(nodeForNonAnonymous());
 }
 
-Optional<int> RenderMathMLRow::firstLineBaseline() const
+Optional<LayoutUnit> RenderMathMLRow::firstLineBaseline() const
 {
     auto* baselineChild = firstChildBox();
     if (!baselineChild)
-        return Optional<int>();
+        return Optional<LayoutUnit>();
 
-    return Optional<int>(static_cast<int>(lroundf(ascentForChild(*baselineChild) + baselineChild->logicalTop())));
+    return LayoutUnit { static_cast<int>(lroundf(ascentForChild(*baselineChild) + baselineChild->logicalTop())) };
 }
 
 static RenderMathMLOperator* toVerticalStretchyOperator(RenderBox* box)

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -42,7 +42,7 @@
 
 protected:
     void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) override;
-    Optional<int> firstLineBaseline() const override;
+    Optional<LayoutUnit> firstLineBaseline() const override;
 
     void stretchVerticalOperatorsAndLayoutChildren();
     void getContentBoundingBox(LayoutUnit& width, LayoutUnit& ascent, LayoutUnit& descent) const;

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -466,12 +466,12 @@
     clearNeedsLayout();
 }
 
-Optional<int> RenderMathMLScripts::firstLineBaseline() const
+Optional<LayoutUnit> RenderMathMLScripts::firstLineBaseline() const
 {
     auto* base = firstChildBox();
     if (!base)
-        return Optional<int>();
-    return Optional<int>(static_cast<int>(lroundf(ascentForChild(*base) + base->logicalTop())));
+        return Optional<LayoutUnit>();
+    return LayoutUnit { roundf(ascentForChild(*base) + base->logicalTop()) };
 }
 
 }

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -50,7 +50,7 @@
 
 private:
     MathMLScriptsElement& element() const;
-    Optional<int> firstLineBaseline() const final;
+    Optional<LayoutUnit> firstLineBaseline() const final;
     struct ReferenceChildren {
         RenderBox* base;
         RenderBox* prescriptDelimiter;

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -86,11 +86,11 @@
     clearNeedsLayout();
 }
 
-Optional<int> RenderMathMLSpace::firstLineBaseline() const
+Optional<LayoutUnit> RenderMathMLSpace::firstLineBaseline() const
 {
     LayoutUnit height, depth;
     getSpaceHeightAndDepth(height, depth);
-    return Optional<int>(height);
+    return height;
 }
 
 }

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -44,7 +44,7 @@
     bool isChildAllowed(const RenderObject&, const RenderStyle&) const final { return false; }
     void computePreferredLogicalWidths() final;
     void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) final;
-    Optional<int> firstLineBaseline() const final;
+    Optional<LayoutUnit> firstLineBaseline() const final;
 
     LayoutUnit spaceWidth() const;
     void getSpaceHeightAndDepth(LayoutUnit& height, LayoutUnit& depth) const;

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.cpp (275412 => 275413)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.cpp	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.cpp	2021-04-02 09:07:41 UTC (rev 275413)
@@ -554,12 +554,12 @@
     setMathVariantGlyphDirty();
 }
 
-Optional<int> RenderMathMLToken::firstLineBaseline() const
+Optional<LayoutUnit> RenderMathMLToken::firstLineBaseline() const
 {
     if (m_mathVariantCodePoint) {
         auto mathVariantGlyph = style().fontCascade().glyphDataForCharacter(m_mathVariantCodePoint.value(), m_mathVariantIsMirrored);
         if (mathVariantGlyph.font)
-            return Optional<int>(static_cast<int>(lroundf(-mathVariantGlyph.font->boundsForGlyph(mathVariantGlyph.glyph).y())));
+            return LayoutUnit { static_cast<int>(lroundf(-mathVariantGlyph.font->boundsForGlyph(mathVariantGlyph.glyph).y())) };
     }
     return RenderMathMLBlock::firstLineBaseline();
 }

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.h (275412 => 275413)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.h	2021-04-02 08:55:22 UTC (rev 275412)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.h	2021-04-02 09:07:41 UTC (rev 275413)
@@ -49,7 +49,7 @@
 protected:
     void paint(PaintInfo&, const LayoutPoint&) override;
     void paintChildren(PaintInfo& forSelf, const LayoutPoint&, PaintInfo& forChild, bool usePrintRect) override;
-    Optional<int> firstLineBaseline() const override;
+    Optional<LayoutUnit> firstLineBaseline() const override;
     void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) override;
     void computePreferredLogicalWidths() override;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to