Title: [290382] trunk/Source/WebCore
Revision
290382
Author
za...@apple.com
Date
2022-02-23 10:26:38 -0800 (Wed, 23 Feb 2022)

Log Message

[IFC][Integration] LineLayout::firstInlineBoxRect should flip the rect coordinates for vertical-rl
https://bugs.webkit.org/show_bug.cgi?id=237036

Reviewed by Antti Koivisto and Darin Adler.

This is similar to what RenderInline::firstInlineBoxTopLeft does.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (290381 => 290382)


--- trunk/Source/WebCore/ChangeLog	2022-02-23 18:19:54 UTC (rev 290381)
+++ trunk/Source/WebCore/ChangeLog	2022-02-23 18:26:38 UTC (rev 290382)
@@ -1,3 +1,15 @@
+2022-02-23  Alan Bujtas  <za...@apple.com>
+
+        [IFC][Integration] LineLayout::firstInlineBoxRect should flip the rect coordinates for vertical-rl
+        https://bugs.webkit.org/show_bug.cgi?id=237036
+
+        Reviewed by Antti Koivisto and Darin Adler.
+
+        This is similar to what RenderInline::firstInlineBoxTopLeft does.
+
+        * layout/integration/LayoutIntegrationLineLayout.cpp:
+        (WebCore::LayoutIntegration::LineLayout::firstInlineBoxRect const):
+
 2022-02-23  J Pascoe  <j_pas...@apple.com>
 
         [WebAuthn] userHandle not marked nullable in _WKWebAuthenticationAssertionResponse

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (290381 => 290382)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2022-02-23 18:19:54 UTC (rev 290381)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2022-02-23 18:26:38 UTC (rev 290382)
@@ -565,11 +565,24 @@
 LayoutRect LineLayout::firstInlineBoxRect(const RenderInline& renderInline) const
 {
     auto& layoutBox = m_boxTree.layoutBoxForRenderer(renderInline);
+    auto* firstBox = m_inlineContent->firstBoxForLayoutBox(layoutBox);
+    if (!firstBox)
+        return { };
 
-    if (auto* box = m_inlineContent->firstBoxForLayoutBox(layoutBox))
-        return Layout::toLayoutRect(box->rect());
-
-    return { };
+    // 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()) {
+    case WritingMode::TopToBottom:
+    case WritingMode::LeftToRight:
+        return firstBoxRect;
+    case WritingMode::RightToLeft:
+        firstBoxRect.setX(flow().width() - firstBoxRect.maxX());
+        return firstBoxRect;
+    default:
+        ASSERT_NOT_REACHED();
+        return firstBoxRect;
+    }
 }
 
 LayoutRect LineLayout::enclosingBorderBoxRectFor(const RenderInline& renderInline) const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to