Changeset 287819 in webkit
- Timestamp:
- Jan 9, 2022, 5:50:27 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
layout/formattingContexts/inline/InlineLine.cpp (modified) (7 diffs)
-
layout/formattingContexts/inline/InlineLine.h (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r287818 r287819 1 2022-01-09 Alan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] Line::Run needs access to FontCascade 4 https://bugs.webkit.org/show_bug.cgi?id=235009 5 6 Reviewed by Antti Koivisto. 7 8 This is in preparation for computing trimmed trailing content width properly. 9 10 * layout/formattingContexts/inline/InlineLine.cpp: 11 (WebCore::Layout::Line::append): 12 (WebCore::Layout::Line::appendLineBreak): 13 (WebCore::Layout::Line::appendWordBreakOpportunity): 14 (WebCore::Layout::Line::Run::Run): 15 (WebCore::Layout::m_textContent): 16 (WebCore::Layout::m_style): Deleted. - We learnt in the past that expanding structures like this (stack backed, large in number) could 17 lead to measurable perf regression. 18 * layout/formattingContexts/inline/InlineLine.h: 19 (WebCore::Layout::Line::Run::shouldTrailingWhitespaceHang const): 20 (WebCore::Layout::Line::Run::inlineDirection const): 21 (WebCore::Layout::Line::Run::letterSpacing const): 22 (WebCore::Layout::Line::Run::hasTextCombine const): 23 1 24 2022-01-09 Antti Koivisto <antti@apple.com> 2 25 -
trunk/Source/WebCore/layout/formattingContexts/inline/InlineLine.cpp
r287558 r287819 206 206 appendTextContent(downcast<InlineTextItem>(inlineItem), style, logicalWidth); 207 207 else if (inlineItem.isLineBreak()) 208 appendLineBreak(inlineItem );208 appendLineBreak(inlineItem, style); 209 209 else if (inlineItem.isWordBreakOpportunity()) 210 appendWordBreakOpportunity(inlineItem );210 appendWordBreakOpportunity(inlineItem, style); 211 211 else if (inlineItem.isInlineBoxStart()) 212 212 appendInlineBoxStart(inlineItem, style, logicalWidth); … … 373 373 } 374 374 375 void Line::appendLineBreak(const InlineItem& inlineItem )375 void Line::appendLineBreak(const InlineItem& inlineItem, const RenderStyle& style) 376 376 { 377 377 m_trailingSoftHyphenWidth = { }; 378 378 if (inlineItem.isHardLineBreak()) { 379 379 ++m_nonSpanningInlineLevelBoxCount; 380 return m_runs.append({ inlineItem, lastRunLogicalRight() });380 return m_runs.append({ inlineItem, style, lastRunLogicalRight() }); 381 381 } 382 382 // Soft line breaks (preserved new line characters) require inline text boxes for compatibility reasons. 383 383 ASSERT(inlineItem.isSoftLineBreak()); 384 m_runs.append({ downcast<InlineSoftLineBreakItem>(inlineItem), lastRunLogicalRight() });385 } 386 387 void Line::appendWordBreakOpportunity(const InlineItem& inlineItem )388 { 389 m_runs.append({ inlineItem, lastRunLogicalRight() });384 m_runs.append({ downcast<InlineSoftLineBreakItem>(inlineItem), inlineItem.style(), lastRunLogicalRight() }); 385 } 386 387 void Line::appendWordBreakOpportunity(const InlineItem& inlineItem, const RenderStyle& style) 388 { 389 m_runs.append({ inlineItem, style, lastRunLogicalRight() }); 390 390 } 391 391 … … 539 539 : m_type(toLineRunType(inlineItem.type())) 540 540 , m_layoutBox(&inlineItem.layoutBox()) 541 , m_style(style) 541 542 , m_logicalLeft(logicalLeft) 542 543 , m_logicalWidth(logicalWidth) 543 , m_style({ { }, style.direction(), { }, { } })544 544 , m_bidiLevel(inlineItem.bidiLevel()) 545 545 { 546 546 } 547 547 548 Line::Run::Run(const InlineItem& zeroWidhtInlineItem, InlineLayoutUnit logicalLeft)548 Line::Run::Run(const InlineItem& zeroWidhtInlineItem, const RenderStyle& style, InlineLayoutUnit logicalLeft) 549 549 : m_type(toLineRunType(zeroWidhtInlineItem.type())) 550 550 , m_layoutBox(&zeroWidhtInlineItem.layoutBox()) 551 , m_style(style) 551 552 , m_logicalLeft(logicalLeft) 552 553 , m_bidiLevel(zeroWidhtInlineItem.bidiLevel()) … … 557 558 : m_type(Type::LineSpanningInlineBoxStart) 558 559 , m_layoutBox(&lineSpanningInlineBoxItem.layoutBox()) 560 , m_style(lineSpanningInlineBoxItem.style()) 559 561 , m_logicalLeft(logicalLeft) 560 562 , m_logicalWidth(logicalWidth) … … 564 566 } 565 567 566 Line::Run::Run(const InlineSoftLineBreakItem& softLineBreakItem, InlineLayoutUnit logicalLeft)568 Line::Run::Run(const InlineSoftLineBreakItem& softLineBreakItem, const RenderStyle& style, InlineLayoutUnit logicalLeft) 567 569 : m_type(Type::SoftLineBreak) 568 570 , m_layoutBox(&softLineBreakItem.layoutBox()) 571 , m_style(style) 569 572 , m_logicalLeft(logicalLeft) 570 573 , m_textContent({ softLineBreakItem.position(), 1 }) … … 576 579 : m_type(inlineTextItem.isWordSeparator() ? Type::WordSeparator : Type::Text) 577 580 , m_layoutBox(&inlineTextItem.layoutBox()) 581 , m_style(style) 578 582 , m_logicalLeft(logicalLeft) 579 583 , m_logicalWidth(logicalWidth) … … 581 585 , m_trailingWhitespaceWidth(m_trailingWhitespaceType != TrailingWhitespace::None ? logicalWidth : InlineLayoutUnit { }) 582 586 , m_textContent({ inlineTextItem.start(), m_trailingWhitespaceType == TrailingWhitespace::Collapsed ? 1 : inlineTextItem.length() }) 583 , m_style({ style.whiteSpace() == WhiteSpace::PreWrap, style.direction(), style.letterSpacing(), style.hasTextCombine() })584 587 , m_bidiLevel(inlineTextItem.bidiLevel()) 585 588 { -
trunk/Source/WebCore/layout/formattingContexts/inline/InlineLine.h
r287504 r287819 121 121 122 122 Run(const InlineTextItem&, const RenderStyle&, InlineLayoutUnit logicalLeft, InlineLayoutUnit logicalWidth); 123 Run(const InlineSoftLineBreakItem&, InlineLayoutUnit logicalLeft);123 Run(const InlineSoftLineBreakItem&, const RenderStyle&, InlineLayoutUnit logicalLeft); 124 124 Run(const InlineItem&, const RenderStyle&, InlineLayoutUnit logicalLeft, InlineLayoutUnit logicalWidth); 125 Run(const InlineItem&, InlineLayoutUnit logicalLeft);125 Run(const InlineItem&, const RenderStyle&, InlineLayoutUnit logicalLeft); 126 126 Run(const InlineItem& lineSpanningInlineBoxItem, InlineLayoutUnit logicalLeft, InlineLayoutUnit logicalWidth); 127 127 … … 149 149 Type m_type { Type::Text }; 150 150 const Box* m_layoutBox { nullptr }; 151 const RenderStyle& m_style; 151 152 InlineLayoutUnit m_logicalLeft { 0 }; 152 153 InlineLayoutUnit m_logicalWidth { 0 }; … … 155 156 std::optional<Text> m_textContent; 156 157 InlineDisplay::Box::Expansion m_expansion; 157 struct Style {158 bool shouldTrailingWhitespaceHang { false };159 TextDirection inlineDirection { TextDirection::RTL };160 InlineLayoutUnit letterSpacing { 0 };161 bool hasTextCombine { false };162 };163 Style m_style { };164 158 UBiDiLevel m_bidiLevel { UBIDI_DEFAULT_LTR }; 165 159 }; … … 177 171 void appendInlineBoxStart(const InlineItem&, const RenderStyle&, InlineLayoutUnit logicalWidth); 178 172 void appendInlineBoxEnd(const InlineItem&, const RenderStyle&, InlineLayoutUnit logicalWidth); 179 void appendLineBreak(const InlineItem& );180 void appendWordBreakOpportunity(const InlineItem& );173 void appendLineBreak(const InlineItem&, const RenderStyle&); 174 void appendWordBreakOpportunity(const InlineItem&, const RenderStyle&); 181 175 182 176 InlineLayoutUnit addBorderAndPaddingEndForInlineBoxDecorationClone(const InlineItem& inlineBoxStartItem); … … 278 272 inline bool Line::Run::shouldTrailingWhitespaceHang() const 279 273 { 280 return m_style. shouldTrailingWhitespaceHang;274 return m_style.whiteSpace() == WhiteSpace::PreWrap; 281 275 } 282 276 283 277 inline TextDirection Line::Run::inlineDirection() const 284 278 { 285 return m_style. inlineDirection;279 return m_style.direction(); 286 280 } 287 281 288 282 inline InlineLayoutUnit Line::Run::letterSpacing() const 289 283 { 290 return m_style.letterSpacing ;284 return m_style.letterSpacing(); 291 285 } 292 286 293 287 inline bool Line::Run::hasTextCombine() const 294 288 { 295 return m_style.hasTextCombine ;289 return m_style.hasTextCombine(); 296 290 } 297 291
Note:
See TracChangeset
for help on using the changeset viewer.