Changeset 254630 in webkit
- Timestamp:
- Jan 15, 2020 1:17:50 PM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r254629 r254630 1 2020-01-15 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] LineLayoutContext::nextContentForLine should take LineCandidateContent& 4 https://bugs.webkit.org/show_bug.cgi?id=206300 5 <rdar://problem/58612197> 6 7 Reviewed by Antti Koivisto. 8 9 ~5% progression on PerformanceTests/Layout/line-layout-simple.html. 10 LineLayoutContext::nextContentForLine is hot and LineCandidateContent has Vector members (too heavy). 11 12 * layout/inlineformatting/LineLayoutContext.cpp: 13 (WebCore::Layout::LineCandidateContent::reset): 14 (WebCore::Layout::LineLayoutContext::layoutLine): 15 (WebCore::Layout::LineLayoutContext::nextContentForLine): 16 * layout/inlineformatting/LineLayoutContext.h: 17 1 18 2020-01-15 Zalan Bujtas <zalan@apple.com> 2 19 -
trunk/Source/WebCore/layout/inlineformatting/LineLayoutContext.cpp
r253958 r254630 186 186 const InlineItem* trailingLineBreak() const { return m_trailingLineBreak; } 187 187 188 void reset(); 189 188 190 private: 189 191 void setTrailingLineBreak(const InlineItem& lineBreakItem) { m_trailingLineBreak = &lineBreakItem; } … … 202 204 return m_floats.append(makeWeakPtr(inlineItem)); 203 205 m_inlineRuns.append({ inlineItem, *logicalWidth }); 206 } 207 208 void LineCandidateContent::reset() 209 { 210 m_inlineRuns.clear(); 211 m_floats.clear(); 212 m_trailingLineBreak = nullptr; 204 213 } 205 214 … … 259 268 auto currentItemIndex = leadingInlineItemIndex; 260 269 unsigned committedInlineItemCount = 0; 270 auto candidateContent = LineCandidateContent { }; 261 271 while (currentItemIndex < m_inlineItems.size()) { 262 272 // 1. Collect the set of runs that we can commit to the line as one entity e.g. <span>text_and_span_start_span_end</span>. … … 264 274 // 3. Check if the content fits the line and commit the content accordingly (full, partial or not commit at all). 265 275 // 4. Return if we are at the end of the line either by not being able to fit more content or because of an explicit line break. 266 auto candidateContent = nextContentForLine(currentItemIndex, partialLeadingContentLength, line.lineBox().logicalWidth());276 nextContentForLine(candidateContent, currentItemIndex, partialLeadingContentLength, line.lineBox().logicalWidth()); 267 277 if (candidateContent.hasIntrusiveFloats()) { 268 278 // Add floats first because they shrink the available horizontal space for the rest of the content. … … 329 339 } 330 340 331 LineCandidateContent LineLayoutContext::nextContentForLine(unsigned inlineItemIndex, Optional<unsigned> partialLeadingContentLength, InlineLayoutUnit currentLogicalRight)341 void LineLayoutContext::nextContentForLine(LineCandidateContent& candidateContent, unsigned inlineItemIndex, Optional<unsigned> partialLeadingContentLength, InlineLayoutUnit currentLogicalRight) 332 342 { 333 343 ASSERT(inlineItemIndex < m_inlineItems.size()); 344 candidateContent.reset(); 334 345 // 1. Simply add any overflow content from the previous line to the candidate content. It's always a text content. 335 346 // 2. Find the next soft wrap position or explicit line break. … … 339 350 ASSERT(softWrapOpportunityIndex <= m_inlineItems.size()); 340 351 341 auto candidateContent = LineCandidateContent { };342 352 if (partialLeadingContentLength) { 343 353 // Handle leading partial content first (split text from the previous line). … … 362 372 currentLogicalRight += inlineItenmWidth; 363 373 } 364 return candidateContent;365 374 } 366 375 -
trunk/Source/WebCore/layout/inlineformatting/LineLayoutContext.h
r253958 r254630 55 55 56 56 private: 57 LineCandidateContent nextContentForLine(unsigned inlineItemIndex, Optional<unsigned> overflowLength, InlineLayoutUnit currentLogicalRight);57 void nextContentForLine(LineCandidateContent&, unsigned inlineItemIndex, Optional<unsigned> overflowLength, InlineLayoutUnit currentLogicalRight); 58 58 struct Result { 59 59 LineBreaker::IsEndOfLine isEndOfLine { LineBreaker::IsEndOfLine::No };
Note: See TracChangeset
for help on using the changeset viewer.