Title: [285780] trunk/Source/WebCore
- Revision
- 285780
- Author
- za...@apple.com
- Date
- 2021-11-13 13:59:47 -0800 (Sat, 13 Nov 2021)
Log Message
[LFC][IFC] Inline box end (opaque to bidi) should get the bidi level from its adjacent content
https://bugs.webkit.org/show_bug.cgi?id=233082
Reviewed by Antti Koivisto.
While the inline box start item (<span>) gets the bidi level from the next (adjacent) content, inline box end (</span>)
should get it from the previous content (these are opaque inline items).
e.g <span>bidi content</span>
both the inline box start and the inline box end items get their bidi level from the "bidi content" inline text item.
* layout/formattingContexts/inline/InlineItemsBuilder.cpp:
(WebCore::Layout::InlineItemsBuilder::breakAndComputeBidiLevels):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (285779 => 285780)
--- trunk/Source/WebCore/ChangeLog 2021-11-13 21:58:50 UTC (rev 285779)
+++ trunk/Source/WebCore/ChangeLog 2021-11-13 21:59:47 UTC (rev 285780)
@@ -1,3 +1,19 @@
+2021-11-13 Alan Bujtas <za...@apple.com>
+
+ [LFC][IFC] Inline box end (opaque to bidi) should get the bidi level from its adjacent content
+ https://bugs.webkit.org/show_bug.cgi?id=233082
+
+ Reviewed by Antti Koivisto.
+
+ While the inline box start item (<span>) gets the bidi level from the next (adjacent) content, inline box end (</span>)
+ should get it from the previous content (these are opaque inline items).
+
+ e.g <span>bidi content</span>
+ both the inline box start and the inline box end items get their bidi level from the "bidi content" inline text item.
+
+ * layout/formattingContexts/inline/InlineItemsBuilder.cpp:
+ (WebCore::Layout::InlineItemsBuilder::breakAndComputeBidiLevels):
+
2021-11-12 Timothy Hatcher <timo...@apple.com>
webView._isBeingInspected does not work with Service Worker pages
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.cpp (285779 => 285780)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.cpp 2021-11-13 21:58:50 UTC (rev 285779)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.cpp 2021-11-13 21:59:47 UTC (rev 285780)
@@ -324,10 +324,28 @@
// Opaque items (inline items with no paragraph content) get their bidi level values from their adjacent items.
auto lastBidiLevel = rootBidiLevel;
for (auto index = inlineItems.size(); index--;) {
- if (!inlineItemOffsets[index])
+ if (inlineItemOffsets[index]) {
+ lastBidiLevel = inlineItems[index].bidiLevel();
+ continue;
+ }
+ if (inlineItems[index].isInlineBoxStart()) {
+ // Inline box start (e.g <span>) uses its content bidi level (next inline item).
inlineItems[index].setBidiLevel(lastBidiLevel);
- else
- lastBidiLevel = inlineItems[index].bidiLevel();
+ continue;
+ }
+ if (inlineItems[index].isInlineBoxEnd()) {
+ // Inline box end (e.g. </span>) also uses the content bidi level, but in this case it's the previous content.
+ auto previousBidiLevel = [&]() -> std::optional<UBiDiLevel> {
+ for (auto i = index; i--;) {
+ if (inlineItemOffsets[i])
+ return inlineItems[i].bidiLevel();
+ }
+ return { };
+ }();
+ inlineItems[index].setBidiLevel(previousBidiLevel.value_or(rootBidiLevel));
+ continue;
+ }
+ ASSERT_NOT_REACHED();
}
};
setBidiLevelForOpaqueInlineItems();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes