Changeset 283486 in webkit
- Timestamp:
- Oct 3, 2021, 9:34:43 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/layout/formattingContexts/inline/InlineLine.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r283481 r283486 1 2021-10-03 Alan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] Do not take hanging whitespace sequence into account while finding expansion opportunities 4 https://bugs.webkit.org/show_bug.cgi?id=231132 5 6 Reviewed by Antti Koivisto. 7 8 * TestExpectations: 9 1 10 2021-10-03 Alan Bujtas <zalan@apple.com> 2 11 -
trunk/LayoutTests/TestExpectations
r283481 r283486 4448 4448 webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/white-space/seg-break-transformation-019.html [ ImageOnlyFailure ] 4449 4449 webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/white-space/textarea-pre-wrap-012.html [ ImageOnlyFailure ] 4450 webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/white-space/textarea-pre-wrap-014.html [ ImageOnlyFailure ]4451 4450 webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/white-space/trailing-other-space-separators-001.html [ ImageOnlyFailure ] 4452 4451 webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/white-space/trailing-other-space-separators-002.html [ ImageOnlyFailure ] -
trunk/Source/WebCore/ChangeLog
r283485 r283486 1 1 2021-10-03 Alan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] Do not take hanging whitespace sequence into account while finding expansion opportunities 4 https://bugs.webkit.org/show_bug.cgi?id=231132 5 6 Reviewed by Antti Koivisto. 7 8 Ignore hanging whitespace for expansion opportunities. 9 This patch fixes imported/w3c/web-platform-tests/css/css-text/white-space/textarea-pre-wrap-014.html 10 11 * layout/formattingContexts/inline/InlineLine.cpp: 12 (WebCore::Layout::Line::applyRunExpansion): 13 14 2021-10-03 Zalan Bujtas <zalan@apple.com> 2 15 3 16 [LFC][IFC] HangingTrailingContent should cache width/length -
trunk/Source/WebCore/layout/formattingContexts/inline/InlineLine.cpp
r283485 r283486 80 80 if (m_runs.isEmpty() || m_runs.last().isLineBreak()) 81 81 return; 82 // Anything to distribute? 83 auto spaceToDistribute = horizontalAvailableSpace - contentLogicalWidth(); 82 // A hanging glyph is still enclosed inside its parent inline box and still participates in text justification: 83 // its character advance is just not measured when determining how much content fits on the line, how much the line’s contents 84 // need to be expanded or compressed for justification, or how to position the content within the line box for text alignment. 85 auto spaceToDistribute = horizontalAvailableSpace - contentLogicalWidth() + m_hangingTrailingContent.width(); 84 86 if (spaceToDistribute <= 0) 85 87 return; 86 87 88 // Collect and distribute the expansion opportunities. 88 89 size_t lineExpansionOpportunities = 0; … … 93 94 // Line start behaves as if we had an expansion here (i.e. fist runs should not start with allowing left expansion). 94 95 auto runIsAfterExpansion = true; 96 auto hangingTrailingContentLength = m_hangingTrailingContent.length(); 95 97 for (size_t runIndex = 0; runIndex < m_runs.size(); ++runIndex) { 96 98 auto& run = m_runs[runIndex]; … … 98 100 size_t expansionOpportunitiesInRun = 0; 99 101 100 if (run.isText() && !TextUtil::shouldPreserveSpacesAndTabs(run.layoutBox())) { 102 // FIXME: Check why we don't apply expansion when whitespace is preserved. 103 if (run.isText() && (!TextUtil::shouldPreserveSpacesAndTabs(run.layoutBox()) || hangingTrailingContentLength)) { 101 104 if (run.hasTextCombine()) 102 105 expansionBehavior = ForbidLeftExpansion | ForbidRightExpansion; 103 106 else { 104 107 expansionBehavior = (runIsAfterExpansion ? ForbidLeftExpansion : AllowLeftExpansion) | AllowRightExpansion; 105 std::tie(expansionOpportunitiesInRun, runIsAfterExpansion) = FontCascade::expansionOpportunityCount(StringView(downcast<InlineTextBox>(run.layoutBox()).content()).substring(run.textContent()->start, run.textContent()->length), run.inlineDirection(), expansionBehavior); 108 auto& textContent = *run.textContent(); 109 // Trailing hanging whitespace sequence is ignored when computing the expansion opportunities. 110 auto hangingTrailingContentInCurrentRun = std::min(textContent.length, hangingTrailingContentLength); 111 auto length = textContent.length - hangingTrailingContentInCurrentRun; 112 hangingTrailingContentLength -= hangingTrailingContentInCurrentRun; 113 std::tie(expansionOpportunitiesInRun, runIsAfterExpansion) = FontCascade::expansionOpportunityCount(StringView(downcast<InlineTextBox>(run.layoutBox()).content()).substring(textContent.start, length), run.inlineDirection(), expansionBehavior); 106 114 } 107 115 } else if (run.isBox())
Note:
See TracChangeset
for help on using the changeset viewer.