Title: [283481] trunk
- Revision
- 283481
- Author
- [email protected]
- Date
- 2021-10-03 14:57:12 -0700 (Sun, 03 Oct 2021)
Log Message
Incorrect preferred width computation when trimmable leading whitespace is present
https://bugs.webkit.org/show_bug.cgi?id=231139
Reviewed by Antti Koivisto.
Source/WebCore:
stripFrontSpaces should be reset to the default value whenever we are at the beginning of the line, while computing the preferred trimmed width.
This is already done for line break boxes (<br>) but not when the force line break comes from a text content with
preserved linebreak ("\n").
See WPT progressions.
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):
* rendering/RenderText.cpp:
(WebCore::RenderText::trimmedPreferredWidths):
* rendering/RenderText.h:
LayoutTests:
* TestExpectations: IFC already supports these cases. Preferred width computation produced an incorrect shrink-fit width.
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (283480 => 283481)
--- trunk/LayoutTests/ChangeLog 2021-10-03 21:29:19 UTC (rev 283480)
+++ trunk/LayoutTests/ChangeLog 2021-10-03 21:57:12 UTC (rev 283481)
@@ -1,3 +1,12 @@
+2021-10-03 Alan Bujtas <[email protected]>
+
+ Incorrect preferred width computation when trimmable leading whitespace is present
+ https://bugs.webkit.org/show_bug.cgi?id=231139
+
+ Reviewed by Antti Koivisto.
+
+ * TestExpectations: IFC already supports these cases. Preferred width computation produced an incorrect shrink-fit width.
+
2021-10-03 Simon Fraser <[email protected]>
REGRESSION (r283335): rubber-banding no longer locks to an axis
Modified: trunk/LayoutTests/TestExpectations (283480 => 283481)
--- trunk/LayoutTests/TestExpectations 2021-10-03 21:29:19 UTC (rev 283480)
+++ trunk/LayoutTests/TestExpectations 2021-10-03 21:57:12 UTC (rev 283481)
@@ -4442,12 +4442,8 @@
webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/text-transform/text-transform-multiple-001.html [ ImageOnlyFailure ]
webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/text-transform/text-transform-upperlower-016.html [ ImageOnlyFailure ]
webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/text-transform/text-transform-upperlower-044.html [ ImageOnlyFailure ]
-webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-051.html [ ImageOnlyFailure ]
-webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-052.html [ ImageOnlyFailure ]
webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-015.html [ ImageOnlyFailure ]
webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/white-space/eol-spaces-bidi-001.html [ ImageOnlyFailure ]
-webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/white-space/pre-wrap-051.html [ ImageOnlyFailure ]
-webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/white-space/pre-wrap-052.html [ ImageOnlyFailure ]
webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/white-space/seg-break-transformation-018.html [ ImageOnlyFailure ]
webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/white-space/seg-break-transformation-019.html [ ImageOnlyFailure ]
webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/white-space/textarea-pre-wrap-012.html [ ImageOnlyFailure ]
@@ -4457,8 +4453,6 @@
webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/white-space/trailing-other-space-separators-003.html [ ImageOnlyFailure ]
webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/white-space/trailing-other-space-separators-004.html [ ImageOnlyFailure ]
webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/white-space/trailing-space-align-start.tentative.html [ ImageOnlyFailure ]
-webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/white-space/white-space-pre-051.html [ ImageOnlyFailure ]
-webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/white-space/white-space-pre-052.html [ ImageOnlyFailure ]
webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/word-boundary/word-boundary-001.html [ ImageOnlyFailure ]
webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/word-boundary/word-boundary-002.html [ ImageOnlyFailure ]
webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/word-boundary/word-boundary-003.html [ ImageOnlyFailure ]
Modified: trunk/Source/WebCore/ChangeLog (283480 => 283481)
--- trunk/Source/WebCore/ChangeLog 2021-10-03 21:29:19 UTC (rev 283480)
+++ trunk/Source/WebCore/ChangeLog 2021-10-03 21:57:12 UTC (rev 283481)
@@ -1,5 +1,24 @@
2021-10-03 Alan Bujtas <[email protected]>
+ Incorrect preferred width computation when trimmable leading whitespace is present
+ https://bugs.webkit.org/show_bug.cgi?id=231139
+
+ Reviewed by Antti Koivisto.
+
+ stripFrontSpaces should be reset to the default value whenever we are at the beginning of the line, while computing the preferred trimmed width.
+ This is already done for line break boxes (<br>) but not when the force line break comes from a text content with
+ preserved linebreak ("\n").
+
+ See WPT progressions.
+
+ * rendering/RenderBlockFlow.cpp:
+ (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):
+ * rendering/RenderText.cpp:
+ (WebCore::RenderText::trimmedPreferredWidths):
+ * rendering/RenderText.h:
+
+2021-10-03 Alan Bujtas <[email protected]>
+
[LFC][IFC] Line functions can compute the "extra horizontal space"
https://bugs.webkit.org/show_bug.cgi?id=231127
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (283480 => 283481)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2021-10-03 21:29:19 UTC (rev 283480)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2021-10-03 21:57:12 UTC (rev 283481)
@@ -4551,6 +4551,9 @@
inlineMax = widths.endMax;
addedTextIndent = true;
addedStartPunctuationHang = true;
+ if (widths.endsWithBreak)
+ stripFrontSpaces = true;
+
} else
inlineMax += std::max<float>(0, childMax);
}
Modified: trunk/Source/WebCore/rendering/RenderText.cpp (283480 => 283481)
--- trunk/Source/WebCore/rendering/RenderText.cpp 2021-10-03 21:29:19 UTC (rev 283480)
+++ trunk/Source/WebCore/rendering/RenderText.cpp 2021-10-03 21:57:12 UTC (rev 283481)
@@ -815,6 +815,7 @@
widths.hasBreakableChar = m_hasBreakableChar;
widths.hasBreak = m_hasBreak;
+ widths.endsWithBreak = m_hasBreak && text()[length - 1] == '\n';
if (text()[0] == ' ' || (text()[0] == '\n' && !style.preserveNewline()) || text()[0] == '\t') {
auto& font = style.fontCascade(); // FIXME: This ignores first-line.
Modified: trunk/Source/WebCore/rendering/RenderText.h (283480 => 283481)
--- trunk/Source/WebCore/rendering/RenderText.h 2021-10-03 21:29:19 UTC (rev 283480)
+++ trunk/Source/WebCore/rendering/RenderText.h 2021-10-03 21:57:12 UTC (rev 283481)
@@ -107,6 +107,7 @@
bool endWS { false };
bool hasBreakableChar { false };
bool hasBreak { false };
+ bool endsWithBreak { false };
};
Widths trimmedPreferredWidths(float leadWidth, bool& stripFrontSpaces);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes