[LFC][IFC] Use content direction for the first "unicode-paragraph" when "unicode-bidi: plaintext" is present
https://bugs.webkit.org/show_bug.cgi?id=235452
Reviewed by Antti Koivisto.
This makes the /css/css-writing-modes/bidi-plaintext-br-* tests pass (not enabled yet).
* layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::layoutInlineContent):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@288408 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index acb6e91..36968c8 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,5 +1,17 @@
2022-01-22 Alan Bujtas <zalan@apple.com>
+ [LFC][IFC] Use content direction for the first "unicode-paragraph" when "unicode-bidi: plaintext" is present
+ https://bugs.webkit.org/show_bug.cgi?id=235452
+
+ Reviewed by Antti Koivisto.
+
+ This makes the /css/css-writing-modes/bidi-plaintext-br-* tests pass (not enabled yet).
+
+ * layout/formattingContexts/inline/InlineLineBuilder.cpp:
+ (WebCore::Layout::LineBuilder::layoutInlineContent):
+
+2022-01-22 Alan Bujtas <zalan@apple.com>
+
[LFC][IFC] Alignment logic should take the line specific direction (which may be different from the root direction)
https://bugs.webkit.org/show_bug.cgi?id=235460
diff --git a/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp b/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp
index 3cad637..33270a3 100644
--- a/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp
+++ b/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp
@@ -358,11 +358,11 @@
auto inlineBaseDirectionForLineContent = [&] {
auto& rootStyle = !previousLine ? root().firstLineStyle() : root().style();
- auto shouldUseBlockDirection = rootStyle.unicodeBidi() != UnicodeBidi::Plaintext || !previousLine;
+ auto shouldUseBlockDirection = rootStyle.unicodeBidi() != UnicodeBidi::Plaintext;
if (shouldUseBlockDirection)
return rootStyle.direction();
// A previous line ending with a line break (<br> or preserved \n) introduces a new unicode paragraph with its own direction.
- if (!previousLine->endsWithLineBreak)
+ if (previousLine && !previousLine->endsWithLineBreak)
return previousLine->inlineBaseDirection;
return TextUtil::directionForTextContent(toString(lineRuns));
};