Title: [290388] trunk/Source/WebCore
Revision
290388
Author
[email protected]
Date
2022-02-23 12:34:08 -0800 (Wed, 23 Feb 2022)

Log Message

[IFC][Integration] LineLayout::firstLinePhysicalBaseline/lastLineLogicalBaseline should flip box baseline value for vertical-lr
https://bugs.webkit.org/show_bug.cgi?id=237090

Reviewed by Antti Koivisto.

* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::firstLinePhysicalBaseline const):
(WebCore::LayoutIntegration::LineLayout::lastLineLogicalBaseline const):
(WebCore::LayoutIntegration::LineLayout::firstInlineBoxRect const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (290387 => 290388)


--- trunk/Source/WebCore/ChangeLog	2022-02-23 20:12:24 UTC (rev 290387)
+++ trunk/Source/WebCore/ChangeLog	2022-02-23 20:34:08 UTC (rev 290388)
@@ -1,3 +1,15 @@
+2022-02-23  Alan Bujtas  <[email protected]>
+
+        [IFC][Integration] LineLayout::firstLinePhysicalBaseline/lastLineLogicalBaseline should flip box baseline value for vertical-lr
+        https://bugs.webkit.org/show_bug.cgi?id=237090
+
+        Reviewed by Antti Koivisto.
+
+        * layout/integration/LayoutIntegrationLineLayout.cpp:
+        (WebCore::LayoutIntegration::LineLayout::firstLinePhysicalBaseline const):
+        (WebCore::LayoutIntegration::LineLayout::lastLineLogicalBaseline const):
+        (WebCore::LayoutIntegration::LineLayout::firstInlineBoxRect const):
+
 2022-02-23  J Pascoe  <[email protected]>
 
         Prevent use of PDFKit when using PDF.js

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (290387 => 290388)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2022-02-23 20:12:24 UTC (rev 290387)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2022-02-23 20:34:08 UTC (rev 290388)
@@ -441,10 +441,17 @@
     }
 
     auto& firstLine = m_inlineContent->lines.first();
-    if (rootLayoutBox().style().isHorizontalWritingMode())
+    switch (rootLayoutBox().style().writingMode()) {
+    case WritingMode::TopToBottom:
         return LayoutUnit { firstLine.lineBoxTop() + firstLine.baseline() };
-
-    return LayoutUnit { firstLine.lineBoxLeft() + (firstLine.lineBoxWidth() - firstLine.baseline()) };
+    case WritingMode::LeftToRight:
+        return LayoutUnit { firstLine.lineBoxLeft() + (firstLine.lineBoxWidth() - firstLine.baseline()) };
+    case WritingMode::RightToLeft:
+        return LayoutUnit { firstLine.lineBoxLeft() + firstLine.baseline() };
+    default:
+        ASSERT_NOT_REACHED();
+        return { };
+    }
 }
 
 LayoutUnit LineLayout::lastLineLogicalBaseline() const
@@ -455,15 +462,23 @@
     }
 
     auto& lastLine = m_inlineContent->lines.last();
-    if (rootLayoutBox().style().isHorizontalWritingMode())
+    switch (rootLayoutBox().style().writingMode()) {
+    case WritingMode::TopToBottom:
         return LayoutUnit { lastLine.lineBoxTop() + lastLine.baseline() };
+    case WritingMode::LeftToRight: {
+        // FIXME: We should set the computed height on the root's box geometry (in RenderBlockFlow) so that
+        // we could call m_layoutState.geometryForRootBox().borderBoxHeight() instead.
 
-    // FIXME: We should set the computed height on the root's box geometry (in RenderBlockFlow) so that
-    // we could call m_layoutState.geometryForRootBox().borderBoxHeight() instead.
-
-    // Line is always visual coordinates while logicalHeight is not (i.e. this translate to "box visual width" - "line visual right")
-    auto lineLogicalTop = flow().logicalHeight() - lastLine.lineBoxRight();
-    return LayoutUnit { lineLogicalTop + lastLine.baseline() };
+        // Line is always visual coordinates while logicalHeight is not (i.e. this translate to "box visual width" - "line visual right")
+        auto lineLogicalTop = flow().logicalHeight() - lastLine.lineBoxRight();
+        return LayoutUnit { lineLogicalTop + lastLine.baseline() };
+    }
+    case WritingMode::RightToLeft:
+        return LayoutUnit { lastLine.lineBoxLeft() + lastLine.baseline() };
+    default:
+        ASSERT_NOT_REACHED();
+        return { };
+    }
 }
 
 void LineLayout::adjustForPagination()
@@ -572,7 +587,7 @@
     // FIXME: We should be able to flip the display boxes soon after the root block
     // is finished sizing in one go.
     auto firstBoxRect = Layout::toLayoutRect(firstBox->rect());
-    switch (flow().style().writingMode()) {
+    switch (rootLayoutBox().style().writingMode()) {
     case WritingMode::TopToBottom:
     case WritingMode::LeftToRight:
         return firstBoxRect;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to