Title: [285171] trunk/Source/WebCore
Revision
285171
Author
an...@apple.com
Date
2021-11-02 12:02:46 -0700 (Tue, 02 Nov 2021)

Log Message

[LFC][Integration] Provide bidi properties when constructing TextRun
https://bugs.webkit.org/show_bug.cgi?id=232632

Reviewed by Alan Bujtas.

Enable correct painting of bidi text runs.

* layout/integration/InlineIteratorBoxModernPath.h:
(WebCore::InlineIterator::BoxModernPath::createTextRun const):
(WebCore::InlineIterator::BoxModernPath::renderText const):
(WebCore::InlineIterator::BoxModernPath::direction const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (285170 => 285171)


--- trunk/Source/WebCore/ChangeLog	2021-11-02 18:36:32 UTC (rev 285170)
+++ trunk/Source/WebCore/ChangeLog	2021-11-02 19:02:46 UTC (rev 285171)
@@ -1,3 +1,17 @@
+2021-11-02  Antti Koivisto  <an...@apple.com>
+
+        [LFC][Integration] Provide bidi properties when constructing TextRun
+        https://bugs.webkit.org/show_bug.cgi?id=232632
+
+        Reviewed by Alan Bujtas.
+
+        Enable correct painting of bidi text runs.
+
+        * layout/integration/InlineIteratorBoxModernPath.h:
+        (WebCore::InlineIterator::BoxModernPath::createTextRun const):
+        (WebCore::InlineIterator::BoxModernPath::renderText const):
+        (WebCore::InlineIterator::BoxModernPath::direction const):
+
 2021-11-02  Kate Cheney  <katherine_che...@apple.com>
 
         PCM: Safari on iOS and macOS are not sending ad click attribution reports for Private Click Measurement

Modified: trunk/Source/WebCore/layout/integration/InlineIteratorBoxModernPath.h (285170 => 285171)


--- trunk/Source/WebCore/layout/integration/InlineIteratorBoxModernPath.h	2021-11-02 18:36:32 UTC (rev 285170)
+++ trunk/Source/WebCore/layout/integration/InlineIteratorBoxModernPath.h	2021-11-02 19:02:46 UTC (rev 285171)
@@ -55,6 +55,7 @@
     FloatRect rect() const { return box().logicalRect(); }
 
     bool isHorizontal() const { return true; }
+    // FIXME: Provide or remove.
     bool dirOverride() const { return false; }
     bool isLineBreak() const { return box().isLineBreak(); }
 
@@ -288,11 +289,16 @@
             return makeString(text(), style.hyphenString());
         }();
 
-        TextRun textRun { textForRun, xPos, expansion.horizontalExpansion, expansion.behavior };
+        bool directionalOverride = dirOverride() || style.rtlOrdering() == Order::Visual;
+        bool characterScanForCodePath = !renderText().canUseSimpleFontCodePath();
+        TextRun textRun { textForRun, xPos, expansion.horizontalExpansion, expansion.behavior, direction(), directionalOverride, characterScanForCodePath };
         textRun.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
         return textRun;
     };
 
+    const RenderText& renderText() const { return downcast<RenderText>(renderer()); }
+    TextDirection direction() const { return bidiLevel() % 2 ? TextDirection::RTL : TextDirection::LTR; }
+
     RefPtr<const LayoutIntegration::InlineContent> m_inlineContent;
     size_t m_boxIndex { 0 };
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to