Title: [284680] trunk
- Revision
- 284680
- Author
- [email protected]
- Date
- 2021-10-22 07:31:05 -0700 (Fri, 22 Oct 2021)
Log Message
[LFC][IFC] Add missing isAtSoftWrapOpportunity check when between two whitespace inline items
https://bugs.webkit.org/show_bug.cgi?id=232055
Reviewed by Antti Koivisto.
Source/WebCore:
Due to the isWrappingAllowed checks in isAtSoftWrapOpportunity() to speed up line breaking,
we may end up with adjacent whitespace content with different wrapping styles (embedded in separate inline boxes).
e.g. <span style="white-space: no-wrap">XXX </span><span style="white-space: normal"> X</span
Test: fast/inline/white-space-nowrap-and-normal-inline-box.html
* layout/formattingContexts/inline/InlineContentBreaker.cpp:
(WebCore::Layout::isVisuallyEmptyWhitespaceContent):
* layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::isAtSoftWrapOpportunity):
LayoutTests:
* fast/inline/white-space-nowrap-and-normal-inline-box-expected.html: Added.
* fast/inline/white-space-nowrap-and-normal-inline-box.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (284679 => 284680)
--- trunk/LayoutTests/ChangeLog 2021-10-22 13:48:45 UTC (rev 284679)
+++ trunk/LayoutTests/ChangeLog 2021-10-22 14:31:05 UTC (rev 284680)
@@ -1,5 +1,15 @@
2021-10-22 Alan Bujtas <[email protected]>
+ [LFC][IFC] Add missing isAtSoftWrapOpportunity check when between two whitespace inline items
+ https://bugs.webkit.org/show_bug.cgi?id=232055
+
+ Reviewed by Antti Koivisto.
+
+ * fast/inline/white-space-nowrap-and-normal-inline-box-expected.html: Added.
+ * fast/inline/white-space-nowrap-and-normal-inline-box.html: Added.
+
+2021-10-22 Alan Bujtas <[email protected]>
+
FontCascade::widthForSimpleText fails to produce matching measured width for monospace font
https://bugs.webkit.org/show_bug.cgi?id=232104
<rdar://83991027>
Added: trunk/LayoutTests/fast/inline/white-space-nowrap-and-normal-inline-box-expected.html (0 => 284680)
--- trunk/LayoutTests/fast/inline/white-space-nowrap-and-normal-inline-box-expected.html (rev 0)
+++ trunk/LayoutTests/fast/inline/white-space-nowrap-and-normal-inline-box-expected.html 2021-10-22 14:31:05 UTC (rev 284680)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<style>
+div {
+ font: 20px/1 Ahem;
+ width: 200px;
+ color: green;
+ background-color: green;
+}
+</style>
+<div><br><br></div>
Added: trunk/LayoutTests/fast/inline/white-space-nowrap-and-normal-inline-box.html (0 => 284680)
--- trunk/LayoutTests/fast/inline/white-space-nowrap-and-normal-inline-box.html (rev 0)
+++ trunk/LayoutTests/fast/inline/white-space-nowrap-and-normal-inline-box.html 2021-10-22 14:31:05 UTC (rev 284680)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+
+#red {
+ position: absolute;
+ z-index: -1;
+ background: red;
+ color: transparent;
+}
+
+.test {
+ width: 200px;
+ color: green;
+ background-color: green;
+}
+.normal {
+ white-space: normal;
+}
+.nowrap {
+ white-space: nowrap;
+}
+</style>
+<!-- white-space: normal allows wrapping at the overflowing whitespace content -->
+<div id=red>XXXXXXXXXX<br>X</div>
+<div class="test nowrap"><span class="nowrap">XXXXXXXXXX </span><span class="normal"> </span> X</span></div>
Modified: trunk/Source/WebCore/ChangeLog (284679 => 284680)
--- trunk/Source/WebCore/ChangeLog 2021-10-22 13:48:45 UTC (rev 284679)
+++ trunk/Source/WebCore/ChangeLog 2021-10-22 14:31:05 UTC (rev 284680)
@@ -1,5 +1,23 @@
2021-10-22 Alan Bujtas <[email protected]>
+ [LFC][IFC] Add missing isAtSoftWrapOpportunity check when between two whitespace inline items
+ https://bugs.webkit.org/show_bug.cgi?id=232055
+
+ Reviewed by Antti Koivisto.
+
+ Due to the isWrappingAllowed checks in isAtSoftWrapOpportunity() to speed up line breaking,
+ we may end up with adjacent whitespace content with different wrapping styles (embedded in separate inline boxes).
+ e.g. <span style="white-space: no-wrap">XXX </span><span style="white-space: normal"> X</span
+
+ Test: fast/inline/white-space-nowrap-and-normal-inline-box.html
+
+ * layout/formattingContexts/inline/InlineContentBreaker.cpp:
+ (WebCore::Layout::isVisuallyEmptyWhitespaceContent):
+ * layout/formattingContexts/inline/InlineLineBuilder.cpp:
+ (WebCore::Layout::isAtSoftWrapOpportunity):
+
+2021-10-22 Alan Bujtas <[email protected]>
+
[LFC][IFC] Add support for checking leading collapsible whitespace in InlineContentBreaker::processOverflowingContent
https://bugs.webkit.org/show_bug.cgi?id=232091
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp (284679 => 284680)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp 2021-10-22 13:48:45 UTC (rev 284679)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp 2021-10-22 14:31:05 UTC (rev 284680)
@@ -92,12 +92,16 @@
if (current.isText() && next.isText()) {
auto& currentInlineTextItem = downcast<InlineTextItem>(current);
auto& nextInlineTextItem = downcast<InlineTextItem>(next);
+ if (currentInlineTextItem.isWhitespace() && nextInlineTextItem.isWhitespace()) {
+ // <span> </span><span> </span>. Depending on the styles, there may or may not be a soft wrap opportunity between these 2 whitespace content.
+ return TextUtil::isWrappingAllowed(currentInlineTextItem.style()) || TextUtil::isWrappingAllowed(nextInlineTextItem.style());
+ }
if (currentInlineTextItem.isWhitespace()) {
- // [ ][text] : after [whitespace] position is a soft wrap opportunity.
+ // " <span>text</span>" : after [whitespace] position is a soft wrap opportunity.
return TextUtil::isWrappingAllowed(currentInlineTextItem.style());
}
if (nextInlineTextItem.isWhitespace()) {
- // [text][ ] (<span>text</span> )
+ // "<span>text</span> "
// white-space: break-spaces: line breaking opportunity exists after every preserved white space character, but not before.
return TextUtil::isWrappingAllowed(nextInlineTextItem.style()) && nextInlineTextItem.style().whiteSpace() != WhiteSpace::BreakSpaces;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes