Changeset 286807 in webkit
- Timestamp:
- Dec 9, 2021, 3:11:34 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
layout/formattingContexts/inline/InlineItemsBuilder.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r286803 r286807 1 2021-12-09 Alan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] Stop including inline box start/end inline items in the visual reordering unless they are completely empty 4 https://bugs.webkit.org/show_bug.cgi?id=234035 5 6 Reviewed by Antti Koivisto. 7 8 When the visual order == logical order, we use the inline box start/end markers to 9 construct/finalize the inline box type of display boxes. 10 e.g <span>content</span> when we see the "<span>" run, we construct the inline box type of display box 11 and later when we come across the "</span>" run, we finalize its geometry. 12 Now with visual reordering, those explicit markers may be out of order. In such cases (bidi in general) we 13 switch over to relying solely on the content type of runs to create/finalize the required inline box type of display boxes (see InlineDisplayContentBuilder::ensureDisplayBoxForContainer). 14 15 This implicit way of constructing the inline box type of display boxes allows us to include only the minimum set of inline 16 items for visual reordering: 17 <span><span><span>content</span></span></span> 18 should produce only one entry for visual reordering. 19 It is essential to minimize the "noise" to limit the potential confusion introduced by non-content bidi runs (with their guessed levels). 20 21 * layout/formattingContexts/inline/InlineItemsBuilder.cpp: 22 (WebCore::Layout::InlineItemsBuilder::breakAndComputeBidiLevels): Reserve the guess bidi level for empty inline boxes only. 23 1 24 2021-12-09 Brent Fulgham <bfulgham@apple.com> 2 25 -
trunk/Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.cpp
r286801 r286807 322 322 return; 323 323 // Opaque items (inline items with no paragraph content) get their bidi level values from their adjacent items. 324 enum class InlineBoxHasContent : bool { No, Yes }; 325 Vector<InlineBoxHasContent> inlineBoxContentFlagStack; 326 inlineBoxContentFlagStack.reserveInitialCapacity(inlineItems.size()); 324 327 auto lastBidiLevel = rootBidiLevel; 325 328 for (auto index = inlineItems.size(); index--;) { 329 auto& inlineItem = inlineItems[index]; 326 330 if (inlineItemOffsets[index]) { 327 lastBidiLevel = inlineItems[index].bidiLevel(); 331 lastBidiLevel = inlineItem.bidiLevel(); 332 inlineBoxContentFlagStack.fill(InlineBoxHasContent::Yes); 328 333 continue; 329 334 } 330 if (inlineItems[index].isInlineBoxStart()) { 335 if (inlineItem.isInlineBoxStart()) { 336 ASSERT(!inlineBoxContentFlagStack.isEmpty()); 331 337 // Inline box start (e.g <span>) uses its content bidi level (next inline item). 332 inlineItems[index].setBidiLevel( lastBidiLevel);338 inlineItems[index].setBidiLevel(inlineBoxContentFlagStack.takeLast() == InlineBoxHasContent::Yes ? InlineItem::opaqueBidiLevel : lastBidiLevel); 333 339 continue; 334 340 } 335 if (inlineItems[index].isInlineBoxEnd()) { 341 if (inlineItem.isInlineBoxEnd()) { 342 inlineBoxContentFlagStack.append(InlineBoxHasContent::No); 336 343 // Let's not confuse ubidi with non-content entries. Opaque runs are excluded from the visual list. 337 inlineItems[index].setBidiLevel(InlineItem::opaqueBidiLevel); 344 inlineItem.setBidiLevel(InlineItem::opaqueBidiLevel); 345 continue; 346 } 347 if (inlineItem.isWordBreakOpportunity()) { 348 inlineItem.setBidiLevel(InlineItem::opaqueBidiLevel); 338 349 continue; 339 350 }
Note:
See TracChangeset
for help on using the changeset viewer.