Changeset 279698 in webkit
- Timestamp:
- Jul 7, 2021, 6:35:44 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r279688 r279698 1 2021-07-07 Alan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] Add support for partially trimmed trailing whitespace 4 https://bugs.webkit.org/show_bug.cgi?id=227688 5 6 Reviewed by Antti Koivisto. 7 8 * TestExpectations: Progressions. 9 1 10 2021-07-07 Chris Dumez <cdumez@apple.com> 2 11 -
trunk/LayoutTests/TestExpectations
r279657 r279698 2645 2645 webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/white-space/line-edge-white-space-collapse-001.html [ ImageOnlyFailure ] 2646 2646 webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/white-space/trailing-ideographic-space-003.html [ ImageOnlyFailure ] 2647 webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-002.html [ ImageOnlyFailure ]2648 2647 webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/white-space/pre-wrap-014.html [ ImageOnlyFailure ] 2649 2648 webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/white-space/text-space-trim-trim-inner-001.xht [ ImageOnlyFailure ] … … 4385 4384 webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/white-space/white-space-pre-051.html [ ImageOnlyFailure ] 4386 4385 webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/white-space/white-space-pre-052.html [ ImageOnlyFailure ] 4387 webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-001.html [ ImageOnlyFailure ]4388 4386 webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/word-boundary/word-boundary-001.html [ ImageOnlyFailure ] 4389 4387 webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/word-boundary/word-boundary-002.html [ ImageOnlyFailure ] -
trunk/LayoutTests/platform/ios/fast/text/whitespace/pre-wrap-overflow-selection-expected.txt
r270150 r279698 22 22 RenderBlock {HR} at (0,198) size 784x2 [border: (1px inset #000000)] 23 23 RenderBlock {PRE} at (0,213) size 108x78 [border: (4px solid #0000FF)] 24 RenderText {#text} at (4,4) size 94x7025 text run at (4,4) width 86: "This text "24 RenderText {#text} at (4,4) size 100x70 25 text run at (4,4) width 100: "This text " 26 26 text run at (4,18) width 71: "will wrap" 27 27 text run at (74,18) width 1: " " -
trunk/Source/WebCore/ChangeLog
r279688 r279698 1 2021-07-07 Alan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] Add support for partially trimmed trailing whitespace 4 https://bugs.webkit.org/show_bug.cgi?id=227688 5 6 Reviewed by Antti Koivisto. 7 8 This patch fixes the case when as a result of the partially trimmed overflow content, 9 we don't need to conditionally hang the trailing end anymore. 10 11 https://drafts.csswg.org/css-text-3/#valdef-white-space-pre 12 "If white-space is set to pre-wrap, the UA must (unconditionally) 13 ... 14 It may also visually collapse the character advance widths of any that would otherwise overflow." 15 16 * layout/formattingContexts/inline/InlineLine.cpp: 17 (WebCore::Layout::Line::visuallyCollapsePreWrapOverflowContent): 18 (WebCore::Layout::Line::Run::removeTrailingWhitespace): 19 (WebCore::Layout::Line::Run::visuallyCollapseTrailingWhitespace): 20 * layout/formattingContexts/inline/InlineLine.h: 21 1 22 2021-07-07 Chris Dumez <cdumez@apple.com> 2 23 -
trunk/Source/WebCore/layout/formattingContexts/inline/InlineLine.cpp
r278185 r279698 145 145 // Let's just find the trailing pre-wrap whitespace content for now (e.g check if there are multiple trailing runs with 146 146 // different set of white-space values and decide if the in-between pre-wrap content should be collapsed as well.) 147 InlineLayoutUnit trimmedContentWidth = 0;147 auto trimmedContentWidth = InlineLayoutUnit { }; 148 148 for (auto& run : WTF::makeReversedRange(m_runs)) { 149 149 if (run.style().whiteSpace() != WhiteSpace::PreWrap) { … … 151 151 break; 152 152 } 153 auto preWrapVisuallyCollapsibleInlineItem = run.isInlineBoxStart() || run.isInlineBoxEnd() || run.hasTrailingWhitespace();154 if (! preWrapVisuallyCollapsibleInlineItem)153 auto visuallyCollapsibleInlineItem = run.isInlineBoxStart() || run.isInlineBoxEnd() || run.hasTrailingWhitespace(); 154 if (!visuallyCollapsibleInlineItem) 155 155 break; 156 156 ASSERT(!run.hasCollapsibleTrailingWhitespace()); 157 InlineLayoutUnit trimmableWidth ={ };157 auto trimmableWidth = InlineLayoutUnit { }; 158 158 if (run.isText()) { 159 159 // FIXME: We should always collapse the run at a glyph boundary as the spec indicates: "collapse the character advance widths of any that would otherwise overflow" 160 160 // and the trimmed width should be capped at std::min(run.trailingWhitespaceWidth(), overflowWidth) for text runs. Both FF and Chrome agree. 161 trimmableWidth = run.trailingWhitespaceWidth(); 162 run.visuallyCollapseTrailingWhitespace(); 161 trimmableWidth = run.visuallyCollapseTrailingWhitespace(overflowWidth); 163 162 } else { 164 163 trimmableWidth = run.logicalWidth(); … … 498 497 constexpr size_t trailingTrimmableContentLength = 1; 499 498 m_textContent->shrink(trailingTrimmableContentLength); 500 visuallyCollapseTrailingWhitespace(); 501 } 502 503 void Line::Run::visuallyCollapseTrailingWhitespace() 504 { 499 visuallyCollapseTrailingWhitespace(m_trailingWhitespaceWidth); 500 } 501 502 InlineLayoutUnit Line::Run::visuallyCollapseTrailingWhitespace(InlineLayoutUnit tryCollapsingThisMuchSpace) 503 { 504 ASSERT(hasTrailingWhitespace()); 505 505 // This is just a visual adjustment, the text length should remain the same. 506 shrinkHorizontally(m_trailingWhitespaceWidth); 507 m_trailingWhitespaceWidth = { }; 508 m_trailingWhitespaceType = TrailingWhitespace::None; 509 510 if (m_whitespaceIsExpansionOpportunity) { 511 ASSERT(m_expansionOpportunityCount); 512 m_expansionOpportunityCount--; 513 } 514 setExpansionBehavior(AllowLeftExpansion | AllowRightExpansion); 506 auto trimmedWidth = std::min(tryCollapsingThisMuchSpace, m_trailingWhitespaceWidth); 507 shrinkHorizontally(trimmedWidth); 508 m_trailingWhitespaceWidth -= trimmedWidth; 509 if (!m_trailingWhitespaceWidth) { 510 // We trimmed the trailing whitespace completely. 511 m_trailingWhitespaceType = TrailingWhitespace::None; 512 513 if (m_whitespaceIsExpansionOpportunity) { 514 ASSERT(m_expansionOpportunityCount); 515 m_expansionOpportunityCount--; 516 } 517 setExpansionBehavior(AllowLeftExpansion | AllowRightExpansion); 518 } 519 return trimmedWidth; 515 520 } 516 521 -
trunk/Source/WebCore/layout/formattingContexts/inline/InlineLine.h
r278244 r279698 110 110 TrailingWhitespace trailingWhitespaceType(const InlineTextItem&) const; 111 111 void removeTrailingWhitespace(); 112 void visuallyCollapseTrailingWhitespace();112 InlineLayoutUnit visuallyCollapseTrailingWhitespace(InlineLayoutUnit tryCollapsingThisMuchSpace); 113 113 114 114 bool hasTrailingLetterSpacing() const;
Note:
See TracChangeset
for help on using the changeset viewer.