Changeset 270153 in webkit
- Timestamp:
- Nov 21, 2020 12:46:25 PM (3 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r270152 r270153 1 2020-11-21 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] Move current logicalLeft from ContinuousContent to LineStatus 4 https://bugs.webkit.org/show_bug.cgi?id=219237 5 6 Reviewed by Antti Koivisto. 7 8 Retain the content logical right in the LineStatus instead (this is used to measure text properly (see xPos) while finding hyphen position). 9 10 * layout/inlineformatting/InlineContentBreaker.cpp: 11 (WebCore::Layout::InlineContentBreaker::processOverflowingTextContent const): 12 (WebCore::Layout::InlineContentBreaker::ContinuousContent::reset): 13 * layout/inlineformatting/InlineContentBreaker.h: 14 (WebCore::Layout::InlineContentBreaker::ContinuousContent::logicalWidth const): 15 (WebCore::Layout::InlineContentBreaker::ContinuousContent::logicalLeft const): Deleted. 16 * layout/inlineformatting/InlineLineBuilder.cpp: 17 (WebCore::Layout::LineCandidate::InlineContent::reset): 18 (WebCore::Layout::LineCandidate::reset): 19 (WebCore::Layout::LineBuilder::nextContentForLine): 20 (WebCore::Layout::LineBuilder::handleFloatsAndInlineContent): 21 1 22 2020-11-21 Simon Fraser <simon.fraser@apple.com> 2 23 -
trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.cpp
r269535 r270153 275 275 // When the first span computes longer than the available space, by the time we get to the second span, the adjusted available space becomes negative. 276 276 auto adjustedAvailableWidth = std::max<InlineLayoutUnit>(0, lineStatus.availableWidth - accumulatedRunWidth); 277 if (auto partialRun = tryBreakingTextRun(run, continuousContent.logicalLeft()+ accumulatedRunWidth, adjustedAvailableWidth)) {277 if (auto partialRun = tryBreakingTextRun(run, lineStatus.contentLogicalRight + accumulatedRunWidth, adjustedAvailableWidth)) { 278 278 if (partialRun->length) 279 279 return TrailingTextContent { index, false, partialRun }; … … 297 297 if (isBreakableRun(run)) { 298 298 ASSERT(run.inlineItem.isText()); 299 if (auto partialRun = tryBreakingTextRun(run, continuousContent.logicalLeft()+ accumulatedRunWidth, maxInlineLayoutUnit())) {299 if (auto partialRun = tryBreakingTextRun(run, lineStatus.contentLogicalRight + accumulatedRunWidth, maxInlineLayoutUnit())) { 300 300 // We know this run fits, so if wrapping is allowed on the run, it should return a non-empty left-side. 301 301 ASSERT(partialRun->length); … … 413 413 } 414 414 415 void InlineContentBreaker::ContinuousContent::reset(InlineLayoutUnit contentLogicalLeft) 416 { 417 m_logicalLeft = contentLogicalLeft; 415 void InlineContentBreaker::ContinuousContent::reset() 416 { 418 417 m_logicalWidth = { }; 419 418 m_collapsibleLogicalWidth = { }; -
trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.h
r267946 r270153 80 80 struct ContinuousContent { 81 81 InlineLayoutUnit logicalWidth() const { return m_logicalWidth; } 82 InlineLayoutUnit logicalLeft() const { return m_logicalLeft; }83 82 InlineLayoutUnit collapsibleLogicalWidth() const { return m_collapsibleLogicalWidth; } 84 83 InlineLayoutUnit nonCollapsibleLogicalWidth() const { return logicalWidth() - collapsibleLogicalWidth(); } … … 87 86 88 87 void append(const InlineItem&, InlineLayoutUnit logicalWidth, Optional<InlineLayoutUnit> collapsibleWidth); 89 void reset( InlineLayoutUnit contentLogicalLeft);88 void reset(); 90 89 91 90 struct Run { … … 102 101 private: 103 102 RunList m_runs; 104 InlineLayoutUnit m_logicalLeft { 0 };105 103 InlineLayoutUnit m_logicalWidth { 0 }; 106 104 InlineLayoutUnit m_collapsibleLogicalWidth { 0 }; … … 108 106 109 107 struct LineStatus { 108 InlineLayoutUnit contentLogicalRight { 0 }; 110 109 InlineLayoutUnit availableWidth { 0 }; 111 110 InlineLayoutUnit collapsibleWidth { 0 }; -
trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp
r270151 r270153 125 125 LineCandidate(bool ignoreTrailingLetterSpacing); 126 126 127 void reset( InlineLayoutUnit contentLogicalLeft);127 void reset(); 128 128 129 129 struct InlineContent { … … 137 137 void appendTrailingLineBreak(const InlineItem& lineBreakItem) { m_trailingLineBreak = &lineBreakItem; } 138 138 void appendtrailingWordBreakOpportunity(const InlineItem& wordBreakItem) { m_trailingWordBreakOpportunity = &wordBreakItem; } 139 void reset( InlineLayoutUnit contentLogicalLeft);139 void reset(); 140 140 141 141 private: … … 203 203 } 204 204 205 inline void LineCandidate::InlineContent::reset( InlineLayoutUnit contentLogicalLeft)206 { 207 m_continuousContent.reset( contentLogicalLeft);205 inline void LineCandidate::InlineContent::reset() 206 { 207 m_continuousContent.reset(); 208 208 m_trailingLineBreak = { }; 209 209 m_trailingWordBreakOpportunity = { }; … … 223 223 } 224 224 225 inline void LineCandidate::reset( InlineLayoutUnit contentLogicalLeft)225 inline void LineCandidate::reset() 226 226 { 227 227 floatContent.reset(); 228 inlineContent.reset( contentLogicalLeft);228 inlineContent.reset(); 229 229 } 230 230 … … 455 455 { 456 456 ASSERT(currentInlineItemIndex < layoutRange.end); 457 lineCandidate.reset( currentLogicalRight);457 lineCandidate.reset(); 458 458 // 1. Simply add any overflow content from the previous line to the candidate content. It's always a text content. 459 459 // 2. Find the next soft wrap position or explicit line break. … … 608 608 auto availableWidth = this->availableWidth() - floatContent.intrusiveWidth(); 609 609 auto isLineConsideredEmpty = m_line.isConsideredEmpty() && !m_contentIsConstrainedByFloat; 610 auto lineStatus = InlineContentBreaker::LineStatus { availableWidth, m_line.trimmableTrailingWidth(), m_line.trailingSoftHyphenWidth(), m_line.isTrailingRunFullyTrimmable(), isLineConsideredEmpty };610 auto lineStatus = InlineContentBreaker::LineStatus { m_line.contentLogicalWidth(), availableWidth, m_line.trimmableTrailingWidth(), m_line.trailingSoftHyphenWidth(), m_line.isTrailingRunFullyTrimmable(), isLineConsideredEmpty }; 611 611 auto result = inlineContentBreaker.processInlineContent(continuousInlineContent, lineStatus); 612 612 if (result.lastWrapOpportunityItem)
Note: See TracChangeset
for help on using the changeset viewer.