Changeset 287447 in webkit
- Timestamp:
- Dec 26, 2021, 11:24:52 AM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r287446 r287447 1 2021-12-26 Alan Bujtas <zalan@apple.com> 2 3 [IFC][Integration] Update text renderer's needsVisualReordering bit 4 https://bugs.webkit.org/show_bug.cgi?id=234688 5 6 Reviewed by Antti Koivisto. 7 8 This is similar to legacy line layout where the RenderText's needsVisualReordering is 9 updated as the (bidi) text box is being placed on the line. 10 Here we update this bit right after the line layout, when we finished constructing the display boxes. 11 12 * layout/formattingContexts/inline/InlineItemsBuilder.cpp: 13 (WebCore::Layout::InlineItemsBuilder::handleTextContent): 14 * layout/integration/LayoutIntegrationBoxTree.cpp: 15 (WebCore::LayoutIntegration::BoxTree::buildTree): 16 * layout/integration/LayoutIntegrationInlineContentBuilder.cpp: 17 (WebCore::LayoutIntegration::InlineContentBuilder::InlineContentBuilder): 18 (WebCore::LayoutIntegration::InlineContentBuilder::build const): 19 * layout/integration/LayoutIntegrationInlineContentBuilder.h: 20 * layout/layouttree/LayoutInlineTextBox.cpp: 21 (WebCore::Layout::InlineTextBox::InlineTextBox): 22 (WebCore::Layout::m_canUseSimplifiedContentMeasuring): 23 (WebCore::Layout::m_containsBidiText): Deleted. 24 * layout/layouttree/LayoutInlineTextBox.h: 25 (WebCore::Layout::InlineTextBox::canUseSimplifiedContentMeasuring const): 26 (WebCore::Layout::InlineTextBox::containsBidiText const): Deleted. No need to cache this value on the layout box 27 InlineTextItems more or less have the same lifecycle as their associated layout boxes. 28 * layout/layouttree/LayoutTreeBuilder.cpp: 29 (WebCore::Layout::TreeBuilder::createTextBox): 30 1 31 2021-12-26 Tim Nguyen <ntim@apple.com> 2 32 -
trunk/Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.cpp
r287395 r287447 453 453 return inlineItems.append(InlineTextItem::createEmptyItem(inlineTextBox)); 454 454 455 m_needsVisualReordering = m_needsVisualReordering || inlineTextBox.containsBidiText();455 m_needsVisualReordering = m_needsVisualReordering || TextUtil::containsStrongDirectionalityText(text); 456 456 auto& style = inlineTextBox.style(); 457 457 auto shouldPreserveSpacesAndTabs = TextUtil::shouldPreserveSpacesAndTabs(inlineTextBox); -
trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp
r287444 r287447 98 98 auto style = RenderStyle::createAnonymousStyleWithDisplay(textRenderer.style(), DisplayType::Inline); 99 99 auto text = style.textSecurity() == TextSecurity::None ? textRenderer.text() : RenderBlock::updateSecurityDiscCharacters(style, textRenderer.text()); 100 auto containsBidiText = Layout::TextUtil::containsStrongDirectionalityText(text);101 if (containsBidiText)102 textRenderer.setNeedsVisualReordering();103 100 auto useSimplifiedTextMeasuring = textRenderer.canUseSimplifiedTextMeasuring() && (!firstLineStyle || firstLineStyle->fontCascade() == style.fontCascade()); 104 return makeUnique<Layout::InlineTextBox>(text, useSimplifiedTextMeasuring, containsBidiText,WTFMove(style), WTFMove(firstLineStyle));101 return makeUnique<Layout::InlineTextBox>(text, useSimplifiedTextMeasuring, WTFMove(style), WTFMove(firstLineStyle)); 105 102 } 106 103 -
trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp
r287393 r287447 58 58 } 59 59 60 InlineContentBuilder::InlineContentBuilder(const RenderBlockFlow& blockFlow, constBoxTree& boxTree)60 InlineContentBuilder::InlineContentBuilder(const RenderBlockFlow& blockFlow, BoxTree& boxTree) 61 61 : m_blockFlow(blockFlow) 62 62 , m_boxTree(boxTree) … … 68 68 // FIXME: This might need a different approach with partial layout where the layout code needs to know about the boxes. 69 69 inlineContent.boxes = WTFMove(inlineFormattingState.boxes()); 70 71 auto updateIfTextRenderersNeedVisualReordering = [&] { 72 // FIXME: We may want to have a global, "is this a bidi paragraph" flag to avoid this loop for non-rtl, non-bidi content. 73 for (auto& displayBox : inlineContent.boxes) { 74 auto& layoutBox = displayBox.layoutBox(); 75 if (!is<Layout::InlineTextBox>(layoutBox)) 76 continue; 77 if (displayBox.bidiLevel() != UBIDI_DEFAULT_LTR) 78 downcast<RenderText>(m_boxTree.rendererForLayoutBox(layoutBox)).setNeedsVisualReordering(); 79 } 80 }; 81 updateIfTextRenderersNeedVisualReordering(); 70 82 createDisplayLines(inlineFormattingState, inlineContent); 71 83 } -
trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.h
r282319 r287447 42 42 class InlineContentBuilder { 43 43 public: 44 InlineContentBuilder(const RenderBlockFlow&, constBoxTree&);44 InlineContentBuilder(const RenderBlockFlow&, BoxTree&); 45 45 46 46 void build(Layout::InlineFormattingState&, InlineContent&) const; … … 50 50 51 51 const RenderBlockFlow& m_blockFlow; 52 constBoxTree& m_boxTree;52 BoxTree& m_boxTree; 53 53 }; 54 54 -
trunk/Source/WebCore/layout/layouttree/LayoutInlineTextBox.cpp
r285807 r287447 37 37 WTF_MAKE_ISO_ALLOCATED_IMPL(InlineTextBox); 38 38 39 InlineTextBox::InlineTextBox(String content, bool canUseSimplifiedContentMeasuring, bool containsBidiText,RenderStyle&& style, std::unique_ptr<RenderStyle>&& firstLineStyle)39 InlineTextBox::InlineTextBox(String content, bool canUseSimplifiedContentMeasuring, RenderStyle&& style, std::unique_ptr<RenderStyle>&& firstLineStyle) 40 40 : Box({ }, WTFMove(style), WTFMove(firstLineStyle), Box::InlineTextBoxFlag) 41 41 , m_content(content) 42 42 , m_canUseSimplifiedContentMeasuring(canUseSimplifiedContentMeasuring) 43 , m_containsBidiText(containsBidiText)44 43 { 45 44 setIsAnonymous(); -
trunk/Source/WebCore/layout/layouttree/LayoutInlineTextBox.h
r285807 r287447 38 38 WTF_MAKE_ISO_ALLOCATED(InlineTextBox); 39 39 public: 40 InlineTextBox(String, bool canUseSimplifiedContentMeasuring, bool containsBidiText,RenderStyle&&, std::unique_ptr<RenderStyle>&& firstLineStyle = nullptr);40 InlineTextBox(String, bool canUseSimplifiedContentMeasuring, RenderStyle&&, std::unique_ptr<RenderStyle>&& firstLineStyle = nullptr); 41 41 virtual ~InlineTextBox() = default; 42 42 … … 44 44 // FIXME: This should not be a box's property. 45 45 bool canUseSimplifiedContentMeasuring() const { return m_canUseSimplifiedContentMeasuring; } 46 bool containsBidiText() const { return m_containsBidiText; }47 46 48 47 private: 49 48 String m_content; 50 49 bool m_canUseSimplifiedContentMeasuring { false }; 51 bool m_containsBidiText { false };52 50 }; 53 51 -
trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp
r287444 r287447 135 135 std::unique_ptr<Box> TreeBuilder::createTextBox(String text, bool canUseSimplifiedTextMeasuring, RenderStyle&& style) 136 136 { 137 return makeUnique<InlineTextBox>(text, canUseSimplifiedTextMeasuring, TextUtil::containsStrongDirectionalityText(text),WTFMove(style));137 return makeUnique<InlineTextBox>(text, canUseSimplifiedTextMeasuring, WTFMove(style)); 138 138 } 139 139
Note:
See TracChangeset
for help on using the changeset viewer.