Title: [281259] trunk
Revision
281259
Author
[email protected]
Date
2021-08-19 13:02:53 -0700 (Thu, 19 Aug 2021)

Log Message

[LFC][IFC] Add support for overflow-wrap: anywhere
https://bugs.webkit.org/show_bug.cgi?id=227695

LayoutTests/imported/w3c:

Reviewed by Antti Koivisto.

* web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-span-002-expected.txt:
* web-platform-tests/css/css-text/parsing/overflow-wrap-computed-expected.txt:
* web-platform-tests/css/css-text/parsing/overflow-wrap-valid-expected.txt:
* web-platform-tests/css/css-text/parsing/word-wrap-computed-expected.txt:
* web-platform-tests/css/css-text/parsing/word-wrap-valid-expected.txt:

Source/WebCore:

Reviewed by Antti Koivisto.

Adjust the line breaking logic in IFC to support "overflow-wrap: anywhere".
>From the line breaking point of view, "anywhere" and "break-word" work the same way
(i.e. an unbreakable content can be broken at an arbitrary position if there are no other, previous break points in the line).

https://drafts.csswg.org/css-text-3/#overflow-wrap-property

* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator OverflowWrap const):
* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
* layout/formattingContexts/inline/InlineContentBreaker.cpp:
(WebCore::Layout::InlineContentBreaker::wordBreakBehavior const):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::breakWords const):
* rendering/style/RenderStyleConstants.cpp:
(WebCore::operator<<):
* rendering/style/RenderStyleConstants.h:
* rendering/style/StyleRareInheritedData.h:

LayoutTests:

Reviewed by Antti Koivisto.

* TestExpectations: Progressions.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (281258 => 281259)


--- trunk/LayoutTests/ChangeLog	2021-08-19 19:58:33 UTC (rev 281258)
+++ trunk/LayoutTests/ChangeLog	2021-08-19 20:02:53 UTC (rev 281259)
@@ -1,3 +1,12 @@
+2021-08-19  Alan Bujtas  <[email protected]>
+
+        [LFC][IFC] Add support for overflow-wrap: anywhere
+        https://bugs.webkit.org/show_bug.cgi?id=227695
+
+        Reviewed by Antti Koivisto.
+
+        * TestExpectations: Progressions.
+
 2021-08-19  Eric Hutchison  <[email protected]>
 
         [iOS 15 wk2] storage/indexeddb/dont-wedge-private.html is a flaky failure.

Modified: trunk/LayoutTests/TestExpectations (281258 => 281259)


--- trunk/LayoutTests/TestExpectations	2021-08-19 19:58:33 UTC (rev 281258)
+++ trunk/LayoutTests/TestExpectations	2021-08-19 20:02:53 UTC (rev 281259)
@@ -2734,16 +2734,11 @@
 webkit.org/b/186045 imported/w3c/web-platform-tests/css/css-animations/animation-delay-009.html [ ImageOnlyFailure Pass ]
 
 # overflow-wrap:anywhere feature is not implemented in legacy line layout.
-webkit.org/b/195345 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-001.html [ ImageOnlyFailure ]
 webkit.org/b/195345 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-003.html [ ImageOnlyFailure ]
-webkit.org/b/195345 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-005.html [ ImageOnlyFailure ]
-webkit.org/b/195345 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-span-001.html [ ImageOnlyFailure ]
 webkit.org/b/195345 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-min-content-size-001.html [ ImageOnlyFailure ]
 webkit.org/b/195345 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-min-content-size-002.html [ ImageOnlyFailure ]
 webkit.org/b/195345 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-min-content-size-003.html [ ImageOnlyFailure ]
-webkit.org/b/195345 imported/w3c/web-platform-tests/css/css-text/word-break/word-break-break-word-overflow-wrap-interactions.html [ ImageOnlyFailure ]
 webkit.org/b/195345 imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-006.html [ ImageOnlyFailure ]
-webkit.org/b/195345 imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-013.html [ ImageOnlyFailure ]
 
 webkit.org/b/197277 imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-008.html [ ImageOnlyFailure ]
 webkit.org/b/197277 imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-004.html [ ImageOnlyFailure ]
@@ -4394,15 +4389,6 @@
 webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/line-breaking/line-breaking-017.html [ ImageOnlyFailure ]
 webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/line-breaking/line-breaking-replaced-002.html [ ImageOnlyFailure ]
 webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-006.html [ ImageOnlyFailure ]
-webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-007.html [ ImageOnlyFailure ]
-webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-008.html [ ImageOnlyFailure ]
-webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-009.html [ ImageOnlyFailure ]
-webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-010.html [ ImageOnlyFailure ]
-webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-inline-001.html [ ImageOnlyFailure ]
-webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-inline-002.html [ ImageOnlyFailure ]
-webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-inline-003.html [ ImageOnlyFailure ]
-webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-inline-004.html [ ImageOnlyFailure ]
-webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-cluster-002.html [ ImageOnlyFailure ]
 webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-min-content-size-005.html [ ImageOnlyFailure ]
 webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-min-content-size-007.html [ ImageOnlyFailure ]
 webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-normal-keep-all-001.html [ ImageOnlyFailure ]
@@ -4467,10 +4453,6 @@
 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/break-spaces-before-first-char-018.html [ ImageOnlyFailure ]
-webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-with-overflow-wrap-006.html [ ImageOnlyFailure ]
-webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-with-overflow-wrap-008.html [ ImageOnlyFailure ]
-webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-with-overflow-wrap-010.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 ]

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (281258 => 281259)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-08-19 19:58:33 UTC (rev 281258)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-08-19 20:02:53 UTC (rev 281259)
@@ -1,3 +1,16 @@
+2021-08-19  Zalan Bujtas  <[email protected]>
+
+        [LFC][IFC] Add support for overflow-wrap: anywhere
+        https://bugs.webkit.org/show_bug.cgi?id=227695
+
+        Reviewed by Antti Koivisto.
+
+        * web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-span-002-expected.txt:
+        * web-platform-tests/css/css-text/parsing/overflow-wrap-computed-expected.txt:
+        * web-platform-tests/css/css-text/parsing/overflow-wrap-valid-expected.txt:
+        * web-platform-tests/css/css-text/parsing/word-wrap-computed-expected.txt:
+        * web-platform-tests/css/css-text/parsing/word-wrap-valid-expected.txt:
+
 2021-08-19  Tim Nguyen  <[email protected]>
 
         Re-import html/semantics/interactive-elements/the-dialog-element WPT - August 19th 2021

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-span-002-expected.txt (281258 => 281259)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-span-002-expected.txt	2021-08-19 19:58:33 UTC (rev 281258)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-span-002-expected.txt	2021-08-19 20:02:53 UTC (rev 281259)
@@ -1,6 +1,4 @@
 1234567890
 
-FAIL #container 1 assert_equals:
-<div id="container" data-expected-height="20">12345678<span>90</span></div>
-height expected 20 but got 10
+PASS #container 1
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/parsing/overflow-wrap-computed-expected.txt (281258 => 281259)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/parsing/overflow-wrap-computed-expected.txt	2021-08-19 19:58:33 UTC (rev 281258)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/parsing/overflow-wrap-computed-expected.txt	2021-08-19 20:02:53 UTC (rev 281259)
@@ -1,5 +1,5 @@
 
 PASS Property overflow-wrap value 'normal'
 PASS Property overflow-wrap value 'break-word'
-FAIL Property overflow-wrap value 'anywhere' assert_true: 'anywhere' is a supported value for overflow-wrap. expected true got false
+PASS Property overflow-wrap value 'anywhere'
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/parsing/overflow-wrap-valid-expected.txt (281258 => 281259)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/parsing/overflow-wrap-valid-expected.txt	2021-08-19 19:58:33 UTC (rev 281258)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/parsing/overflow-wrap-valid-expected.txt	2021-08-19 20:02:53 UTC (rev 281259)
@@ -1,5 +1,5 @@
 
 PASS e.style['overflow-wrap'] = "normal" should set the property value
 PASS e.style['overflow-wrap'] = "break-word" should set the property value
-FAIL e.style['overflow-wrap'] = "anywhere" should set the property value assert_not_equals: property should be set got disallowed value ""
+PASS e.style['overflow-wrap'] = "anywhere" should set the property value
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/parsing/word-wrap-computed-expected.txt (281258 => 281259)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/parsing/word-wrap-computed-expected.txt	2021-08-19 19:58:33 UTC (rev 281258)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/parsing/word-wrap-computed-expected.txt	2021-08-19 20:02:53 UTC (rev 281259)
@@ -1,5 +1,5 @@
 
 PASS Property word-wrap value 'normal'
 PASS Property word-wrap value 'break-word'
-FAIL Property word-wrap value 'anywhere' assert_true: 'anywhere' is a supported value for word-wrap. expected true got false
+PASS Property word-wrap value 'anywhere'
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/parsing/word-wrap-valid-expected.txt (281258 => 281259)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/parsing/word-wrap-valid-expected.txt	2021-08-19 19:58:33 UTC (rev 281258)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/parsing/word-wrap-valid-expected.txt	2021-08-19 20:02:53 UTC (rev 281259)
@@ -1,5 +1,5 @@
 
 PASS e.style['word-wrap'] = "normal" should set the property value
 PASS e.style['word-wrap'] = "break-word" should set the property value
-FAIL e.style['word-wrap'] = "anywhere" should set the property value assert_not_equals: property should be set got disallowed value ""
+PASS e.style['word-wrap'] = "anywhere" should set the property value
 

Modified: trunk/Source/WebCore/ChangeLog (281258 => 281259)


--- trunk/Source/WebCore/ChangeLog	2021-08-19 19:58:33 UTC (rev 281258)
+++ trunk/Source/WebCore/ChangeLog	2021-08-19 20:02:53 UTC (rev 281259)
@@ -1,3 +1,30 @@
+2021-08-19  Alan Bujtas  <[email protected]>
+
+        [LFC][IFC] Add support for overflow-wrap: anywhere
+        https://bugs.webkit.org/show_bug.cgi?id=227695
+
+        Reviewed by Antti Koivisto.
+
+        Adjust the line breaking logic in IFC to support "overflow-wrap: anywhere".
+        From the line breaking point of view, "anywhere" and "break-word" work the same way
+        (i.e. an unbreakable content can be broken at an arbitrary position if there are no other, previous break points in the line).
+
+        https://drafts.csswg.org/css-text-3/#overflow-wrap-property
+
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        (WebCore::CSSPrimitiveValue::operator OverflowWrap const):
+        * css/parser/CSSParserFastPaths.cpp:
+        (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
+        * layout/formattingContexts/inline/InlineContentBreaker.cpp:
+        (WebCore::Layout::InlineContentBreaker::wordBreakBehavior const):
+        * rendering/style/RenderStyle.h:
+        (WebCore::RenderStyle::breakWords const):
+        * rendering/style/RenderStyleConstants.cpp:
+        (WebCore::operator<<):
+        * rendering/style/RenderStyleConstants.h:
+        * rendering/style/StyleRareInheritedData.h:
+
 2021-08-19  Alex Christensen  <[email protected]>
 
         Remove more non-inclusive language from Source

Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (281258 => 281259)


--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2021-08-19 19:58:33 UTC (rev 281258)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2021-08-19 20:02:53 UTC (rev 281259)
@@ -2951,7 +2951,10 @@
     case OverflowWrap::Normal:
         m_value.valueID = CSSValueNormal;
         break;
-    case OverflowWrap::Break:
+    case OverflowWrap::Anywhere:
+        m_value.valueID = CSSValueAnywhere;
+        break;
+    case OverflowWrap::BreakWord:
         m_value.valueID = CSSValueBreakWord;
         break;
     }
@@ -2963,7 +2966,9 @@
 
     switch (m_value.valueID) {
     case CSSValueBreakWord:
-        return OverflowWrap::Break;
+        return OverflowWrap::BreakWord;
+    case CSSValueAnywhere:
+        return OverflowWrap::Anywhere;
     case CSSValueNormal:
         return OverflowWrap::Normal;
     default:

Modified: trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp (281258 => 281259)


--- trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp	2021-08-19 19:58:33 UTC (rev 281258)
+++ trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp	2021-08-19 20:02:53 UTC (rev 281259)
@@ -670,9 +670,9 @@
     // FIXME-NEWPARSER: Support?
     // case CSSPropertyOverflowAnchor:
     //    return valueID == CSSValueVisible || valueID == CSSValueNone || valueID == CSSValueAuto;
-    case CSSPropertyOverflowWrap: // normal | break-word
+    case CSSPropertyOverflowWrap: // normal | break-word | anywhere
     case CSSPropertyWordWrap:
-        return valueID == CSSValueNormal || valueID == CSSValueBreakWord;
+        return valueID == CSSValueNormal || valueID == CSSValueBreakWord || valueID == CSSValueAnywhere;
     case CSSPropertyOverflowX: // visible | hidden | scroll | auto | overlay (overlay is a synonym for auto)
         if (context.overflowClipEnabled && valueID == CSSValueClip)
             return true;

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp (281258 => 281259)


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp	2021-08-19 19:58:33 UTC (rev 281258)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp	2021-08-19 20:02:53 UTC (rev 281259)
@@ -417,8 +417,8 @@
         breakRules.add({ WordBreakRule::AtArbitraryPosition });
         return breakRules;
     }
-    // OverflowWrap::Break: An otherwise unbreakable sequence of characters may be broken at an arbitrary point if there are no otherwise-acceptable break points in the line.
-    if (style.overflowWrap() == OverflowWrap::Break && !hasWrapOpportunityAtPreviousPosition) {
+    // OverflowWrap::BreakWord/Anywhere An otherwise unbreakable sequence of characters may be broken at an arbitrary point if there are no otherwise-acceptable break points in the line.
+    if ((style.overflowWrap() == OverflowWrap::BreakWord || style.overflowWrap() == OverflowWrap::Anywhere) && !hasWrapOpportunityAtPreviousPosition) {
         breakRules.add({ WordBreakRule::AtArbitraryPosition });
         return breakRules;
     }

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (281258 => 281259)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2021-08-19 19:58:33 UTC (rev 281258)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2021-08-19 20:02:53 UTC (rev 281259)
@@ -2188,7 +2188,7 @@
 
 inline bool RenderStyle::breakWords() const
 {
-    return wordBreak() == WordBreak::BreakWord || overflowWrap() == OverflowWrap::Break;
+    return wordBreak() == WordBreak::BreakWord || overflowWrap() == OverflowWrap::BreakWord || overflowWrap() == OverflowWrap::Anywhere;
 }
 
 inline bool RenderStyle::hasInlineColumnAxis() const

Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.cpp (281258 => 281259)


--- trunk/Source/WebCore/rendering/style/RenderStyleConstants.cpp	2021-08-19 19:58:33 UTC (rev 281258)
+++ trunk/Source/WebCore/rendering/style/RenderStyleConstants.cpp	2021-08-19 20:02:53 UTC (rev 281259)
@@ -821,7 +821,8 @@
 {
     switch (overflowWrap) {
     case OverflowWrap::Normal: ts << "normal"; break;
-    case OverflowWrap::Break: ts << "break"; break;
+    case OverflowWrap::BreakWord: ts << "break-word"; break;
+    case OverflowWrap::Anywhere: ts << "anywhere"; break;
     }
     return ts;
 }

Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.h (281258 => 281259)


--- trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2021-08-19 19:58:33 UTC (rev 281258)
+++ trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2021-08-19 20:02:53 UTC (rev 281259)
@@ -552,7 +552,8 @@
 
 enum class OverflowWrap : uint8_t {
     Normal,
-    Break
+    BreakWord,
+    Anywhere
 };
 
 enum class NBSPMode : uint8_t {

Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h (281258 => 281259)


--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h	2021-08-19 19:58:33 UTC (rev 281258)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h	2021-08-19 20:02:53 UTC (rev 281259)
@@ -109,7 +109,7 @@
     unsigned textSecurity : 2; // TextSecurity
     unsigned userModify : 2; // UserModify (editing)
     unsigned wordBreak : 2; // WordBreak
-    unsigned overflowWrap : 1; // OverflowWrap
+    unsigned overflowWrap : 2; // OverflowWrap
     unsigned nbspMode : 1; // NBSPMode
     unsigned lineBreak : 3; // LineBreak
     unsigned userSelect : 2; // UserSelect
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to