Title: [270143] trunk/Source/WebCore
Revision
270143
Author
[email protected]
Date
2020-11-21 04:56:46 -0800 (Sat, 21 Nov 2020)

Log Message

[LFC][Integration] Add contentLogicalOffset and contentLogicalWidth to InlineLineGeometry(Line)
https://bugs.webkit.org/show_bug.cgi?id=219220

Reviewed by Antti Koivisto.

This helps to match the legacy root inline box's geometry where
line left + content offset == root inline box left edge
line left + content offset + content width = root inline box right edge

* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent):
* layout/inlineformatting/InlineLineGeometry.h:
(WebCore::Layout::InlineLineGeometry::contentOffset const):
(WebCore::Layout::InlineLineGeometry::contentWidth const):
(WebCore::Layout::InlineLineGeometry::InlineLineGeometry):
(WebCore::Layout::InlineLineGeometry::horizontalAlignmentOffset const): Deleted.
* layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
(WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLines const):
* layout/integration/LayoutIntegrationLine.h:
(WebCore::LayoutIntegration::Line::Line):
(WebCore::LayoutIntegration::Line::contentOffset const):
(WebCore::LayoutIntegration::Line::contentWidth const):
(WebCore::LayoutIntegration::Line::horizontalAlignmentOffset const): Deleted.
* layout/integration/LayoutIntegrationLineIteratorModernPath.h:
(WebCore::LayoutIntegration::LineIteratorModernPath::contentLogicalLeft const):
(WebCore::LayoutIntegration::LineIteratorModernPath::contentLogicalRight const):
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::paint):
* layout/integration/LayoutIntegrationPagination.cpp:
(WebCore::LayoutIntegration::makeAdjustedContent):
* layout/integration/LayoutIntegrationRunIteratorModernPath.h:
(WebCore::LayoutIntegration::RunIteratorModernPath::createTextRun const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (270142 => 270143)


--- trunk/Source/WebCore/ChangeLog	2020-11-21 08:11:34 UTC (rev 270142)
+++ trunk/Source/WebCore/ChangeLog	2020-11-21 12:56:46 UTC (rev 270143)
@@ -1,3 +1,38 @@
+2020-11-21  Zalan Bujtas  <[email protected]>
+
+        [LFC][Integration] Add contentLogicalOffset and contentLogicalWidth to InlineLineGeometry(Line)
+        https://bugs.webkit.org/show_bug.cgi?id=219220
+
+        Reviewed by Antti Koivisto.
+
+        This helps to match the legacy root inline box's geometry where
+        line left + content offset == root inline box left edge
+        line left + content offset + content width = root inline box right edge
+
+        * layout/inlineformatting/InlineFormattingContext.cpp:
+        (WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent):
+        * layout/inlineformatting/InlineLineGeometry.h:
+        (WebCore::Layout::InlineLineGeometry::contentOffset const):
+        (WebCore::Layout::InlineLineGeometry::contentWidth const):
+        (WebCore::Layout::InlineLineGeometry::InlineLineGeometry):
+        (WebCore::Layout::InlineLineGeometry::horizontalAlignmentOffset const): Deleted.
+        * layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
+        (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLines const):
+        * layout/integration/LayoutIntegrationLine.h:
+        (WebCore::LayoutIntegration::Line::Line):
+        (WebCore::LayoutIntegration::Line::contentOffset const):
+        (WebCore::LayoutIntegration::Line::contentWidth const):
+        (WebCore::LayoutIntegration::Line::horizontalAlignmentOffset const): Deleted.
+        * layout/integration/LayoutIntegrationLineIteratorModernPath.h:
+        (WebCore::LayoutIntegration::LineIteratorModernPath::contentLogicalLeft const):
+        (WebCore::LayoutIntegration::LineIteratorModernPath::contentLogicalRight const):
+        * layout/integration/LayoutIntegrationLineLayout.cpp:
+        (WebCore::LayoutIntegration::LineLayout::paint):
+        * layout/integration/LayoutIntegrationPagination.cpp:
+        (WebCore::LayoutIntegration::makeAdjustedContent):
+        * layout/integration/LayoutIntegrationRunIteratorModernPath.h:
+        (WebCore::LayoutIntegration::RunIteratorModernPath::createTextRun const):
+
 2020-11-21  Jiewen Tan  <[email protected]>
 
         [WebAuthn] Implement SPI for AuthenticationServices.Framework

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (270142 => 270143)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2020-11-21 08:11:34 UTC (rev 270142)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2020-11-21 12:56:46 UTC (rev 270143)
@@ -493,7 +493,7 @@
     updateBoxGeometry();
 
     auto constructLineGeometry = [&] {
-        formattingState.addLine({ lineLogicalRect, lineBox.logicalSize(), lineBox.alignmentBaseline(), lineBox.horizontalAlignmentOffset().valueOr(InlineLayoutUnit { }) });
+        formattingState.addLine({ lineLogicalRect, lineBox.logicalSize(), lineBox.alignmentBaseline(), lineBox.horizontalAlignmentOffset().valueOr(InlineLayoutUnit { }), lineContent.contentLogicalWidth });
     };
     constructLineGeometry();
 

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp (270142 => 270143)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp	2020-11-21 08:11:34 UTC (rev 270142)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp	2020-11-21 12:56:46 UTC (rev 270143)
@@ -155,7 +155,7 @@
 {
     auto& runs = lineContent.runs;
     auto lineLogicalWidth = lineContent.lineLogicalWidth;
-    auto contentLogicalWidth = lineContent.lineContentLogicalWidth;
+    auto contentLogicalWidth = lineContent.contentLogicalWidth;
     auto isLineConsideredEmpty = lineContent.isLineConsideredEmpty ? LineBox::IsLineConsideredEmpty::Yes : LineBox::IsLineConsideredEmpty::No;
     auto lineBox = LineBox { lineContent.logicalTopLeft, contentLogicalWidth, isLineConsideredEmpty };
 

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h (270142 => 270143)


--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h	2020-11-21 08:11:34 UTC (rev 270142)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h	2020-11-21 12:56:46 UTC (rev 270143)
@@ -59,7 +59,7 @@
         bool hasIntrusiveFloat { false };
         InlineLayoutPoint logicalTopLeft;
         InlineLayoutUnit lineLogicalWidth;
-        InlineLayoutUnit lineContentLogicalWidth;
+        InlineLayoutUnit contentLogicalWidth;
         bool isLineConsideredEmpty { true };
         bool isLastLineWithInlineContent { true };
         const Line::RunList& runs;

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineGeometry.h (270142 => 270143)


--- trunk/Source/WebCore/layout/inlineformatting/InlineLineGeometry.h	2020-11-21 08:11:34 UTC (rev 270142)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineGeometry.h	2020-11-21 12:56:46 UTC (rev 270143)
@@ -35,7 +35,7 @@
 class InlineLineGeometry {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    InlineLineGeometry(const InlineRect& lineLogicalRect, const InlineLayoutSize& lineBoxLogicalSize, InlineLayoutUnit aligmentBaseline, InlineLayoutUnit horizontalAlignmentOffset);
+    InlineLineGeometry(const InlineRect& lineLogicalRect, const InlineLayoutSize& lineBoxLogicalSize, InlineLayoutUnit aligmentBaseline, InlineLayoutUnit contentLogicalLeftOffset, InlineLayoutUnit contentLogicalWidth);
 
     InlineLayoutUnit logicalLeft() const { return logicalRect().left(); };
     InlineLayoutUnit logicalRight() const { return logicalRect().right(); };
@@ -50,8 +50,10 @@
     const InlineLayoutSize& lineBoxLogicalSize() const { return m_lineBoxLogicalSize; }
 
     InlineLayoutUnit baseline() const { return m_aligmentBaseline; }
-    InlineLayoutUnit horizontalAlignmentOffset() const { return m_horizontalAlignmentOffset; }
 
+    InlineLayoutUnit contentLogicalLeftOffset() const { return m_contentLogicalLeftOffset; }
+    InlineLayoutUnit contentLogicalWidth() const { return m_contentLogicalWidth; }
+
     void moveVertically(InlineLayoutUnit offset) { m_logicalRect.moveVertically(offset); }
 
 private:
@@ -58,14 +60,16 @@
     InlineRect m_logicalRect;
     InlineLayoutSize m_lineBoxLogicalSize;
     InlineLayoutUnit m_aligmentBaseline { 0 };
-    InlineLayoutUnit m_horizontalAlignmentOffset { 0 };
+    InlineLayoutUnit m_contentLogicalLeftOffset { 0 };
+    InlineLayoutUnit m_contentLogicalWidth { 0 };
 };
 
-inline InlineLineGeometry::InlineLineGeometry(const InlineRect& lineLogicalRect, const InlineLayoutSize& lineBoxLogicalSize, InlineLayoutUnit aligmentBaseline, InlineLayoutUnit horizontalAlignmentOffset)
+inline InlineLineGeometry::InlineLineGeometry(const InlineRect& lineLogicalRect, const InlineLayoutSize& lineBoxLogicalSize, InlineLayoutUnit aligmentBaseline, InlineLayoutUnit contentLogicalLeftOffset, InlineLayoutUnit contentLogicalWidth)
     : m_logicalRect(lineLogicalRect)
     , m_lineBoxLogicalSize(lineBoxLogicalSize)
     , m_aligmentBaseline(aligmentBaseline)
-    , m_horizontalAlignmentOffset(horizontalAlignmentOffset)
+    , m_contentLogicalLeftOffset(contentLogicalLeftOffset)
+    , m_contentLogicalWidth(contentLogicalWidth)
 {
 }
 

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp (270142 => 270143)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp	2020-11-21 08:11:34 UTC (rev 270142)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp	2020-11-21 12:56:46 UTC (rev 270143)
@@ -344,7 +344,7 @@
             enclosingTopAndBottom.top = roundToInt(enclosingTopAndBottom.top);
             enclosingTopAndBottom.bottom = roundToInt(enclosingTopAndBottom.bottom);
         }
-        inlineContent.lines.append({ firstRunIndex, runCount, lineRect, lineBoxLogicalSize.width(), enclosingTopAndBottom, scrollableOverflowRect, lineInkOverflowRect, line.baseline(), line.horizontalAlignmentOffset() });
+        inlineContent.lines.append({ firstRunIndex, runCount, lineRect, lineBoxLogicalSize.width(), enclosingTopAndBottom, scrollableOverflowRect, lineInkOverflowRect, line.baseline(), line.contentLogicalLeftOffset(), line.contentLogicalWidth() });
     }
 }
 

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h (270142 => 270143)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h	2020-11-21 08:11:34 UTC (rev 270142)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h	2020-11-21 12:56:46 UTC (rev 270143)
@@ -40,7 +40,7 @@
         float top { 0 };
         float bottom { 0 };
     };
-    Line(size_t firstRunIndex, size_t runCount, const FloatRect& lineRect, float lineBoxWidth, EnclosingTopAndBottom enclosingTopAndBottom, const FloatRect& scrollableOverflow, const FloatRect& inkOverflow, float baseline, float horizontalAlignmentOffset)
+    Line(size_t firstRunIndex, size_t runCount, const FloatRect& lineRect, float lineBoxWidth, EnclosingTopAndBottom enclosingTopAndBottom, const FloatRect& scrollableOverflow, const FloatRect& inkOverflow, float baseline, float contentLeftOffset, float contentWidth)
         : m_firstRunIndex(firstRunIndex)
         , m_runCount(runCount)
         , m_lineRect(lineRect)
@@ -49,7 +49,8 @@
         , m_scrollableOverflow(scrollableOverflow)
         , m_inkOverflow(inkOverflow)
         , m_baseline(baseline)
-        , m_horizontalAlignmentOffset(horizontalAlignmentOffset)
+        , m_contentLeftOffset(contentLeftOffset)
+        , m_contentWidth(contentWidth)
     {
     }
 
@@ -62,7 +63,8 @@
     const FloatRect& scrollableOverflow() const { return m_scrollableOverflow; }
     const FloatRect& inkOverflow() const { return m_inkOverflow; }
     float baseline() const { return m_baseline; }
-    float horizontalAlignmentOffset() const { return m_horizontalAlignmentOffset; }
+    float contentLeftOffset() const { return m_contentLeftOffset; }
+    float contentWidth() const { return m_contentWidth; }
 
 private:
     size_t m_firstRunIndex { 0 };
@@ -77,7 +79,8 @@
     FloatRect m_scrollableOverflow;
     FloatRect m_inkOverflow;
     float m_baseline { 0 };
-    float m_horizontalAlignmentOffset { 0 };
+    float m_contentLeftOffset { 0 };
+    float m_contentWidth { 0 };
 };
 
 }

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineIteratorModernPath.h (270142 => 270143)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineIteratorModernPath.h	2020-11-21 08:11:34 UTC (rev 270142)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineIteratorModernPath.h	2020-11-21 12:56:46 UTC (rev 270143)
@@ -59,8 +59,8 @@
     LayoutUnit selectionTopForHitTesting() const { return top(); }
     LayoutUnit selectionBottom() const { return bottom(); }
 
-    float contentLogicalLeft() const { return line().rect().x() + line().horizontalAlignmentOffset(); }
-    float contentLogicalRight() const { return contentLogicalLeft() + line().rect().width(); }
+    float contentLogicalLeft() const { return line().rect().x() + line().contentLeftOffset(); }
+    float contentLogicalRight() const { return contentLogicalLeft() + line().contentWidth(); }
     float y() const { return lineBoxTop(); }
     float logicalHeight() const { return line().rect().height(); }
     bool isHorizontal() const { return true; }

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (270142 => 270143)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2020-11-21 08:11:34 UTC (rev 270142)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2020-11-21 12:56:46 UTC (rev 270143)
@@ -415,7 +415,7 @@
         auto expansion = run.expansion();
         // TextRun expects the xPos to be adjusted with the aligment offset (e.g. when the line is center aligned
         // and the run starts at 100px, due to the horizontal aligment, the xpos is supposed to be at 0px).
-        auto xPos = rect.x() - (line.rect().x() + line.horizontalAlignmentOffset());
+        auto xPos = rect.x() - (line.rect().x() + line.contentLeftOffset());
         WebCore::TextRun textRun { textContent.renderedContent(), xPos, expansion.horizontalExpansion, expansion.behavior };
         textRun.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
         FloatPoint textOrigin { rect.x() + paintOffset.x(), roundToDevicePixel(baseline, deviceScaleFactor) };

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationPagination.cpp (270142 => 270143)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationPagination.cpp	2020-11-21 08:11:34 UTC (rev 270142)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationPagination.cpp	2020-11-21 12:56:46 UTC (rev 270143)
@@ -135,7 +135,8 @@
             moveVertically(line.scrollableOverflow(), offset),
             moveVertically(line.inkOverflow(), offset),
             line.baseline(),
-            line.horizontalAlignmentOffset()
+            line.contentLeftOffset(),
+            line.contentWidth()
         };
     };
 

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorModernPath.h (270142 => 270143)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorModernPath.h	2020-11-21 08:11:34 UTC (rev 270142)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorModernPath.h	2020-11-21 12:56:46 UTC (rev 270143)
@@ -221,7 +221,7 @@
         auto& style = run().style();
         auto expansion = run().expansion();
         auto rect = this->rect();
-        auto xPos = rect.x() - (line().rect().x() + line().horizontalAlignmentOffset());
+        auto xPos = rect.x() - (line().rect().x() + line().contentLeftOffset());
 
         auto textForRun = [&] {
             if (hyphenMode == HyphenMode::Ignore || !hasHyphen())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to