Skip to content
Permalink
Browse files
[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.


Canonical link: https://commits.webkit.org/240694@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281259 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
alanbujtas committed Aug 19, 2021
1 parent 607c7b0 commit 6ed0b8b3e00e59aa24ef24296de726e2f4dc4b8b
@@ -1,3 +1,12 @@
2021-08-19 Alan Bujtas <zalan@apple.com>

[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 <ehutchison@apple.com>

[iOS 15 wk2] storage/indexeddb/dont-wedge-private.html is a flaky failure.
@@ -2734,16 +2734,11 @@ webkit.org/b/186045 imported/w3c/web-platform-tests/css/css-animations/animation
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/l
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/text-transform/
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 ]
@@ -1,3 +1,16 @@
2021-08-19 Zalan Bujtas <zalan@apple.com>

[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 <ntim@apple.com>

Re-import html/semantics/interactive-elements/the-dialog-element WPT - August 19th 2021
@@ -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

@@ -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'

@@ -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

@@ -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'

@@ -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

@@ -1,3 +1,30 @@
2021-08-19 Alan Bujtas <zalan@apple.com>

[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 <achristensen@webkit.org>

Remove more non-inclusive language from Source
@@ -2951,7 +2951,10 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(OverflowWrap e)
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 @@ template<> inline CSSPrimitiveValue::operator OverflowWrap() const

switch (m_value.valueID) {
case CSSValueBreakWord:
return OverflowWrap::Break;
return OverflowWrap::BreakWord;
case CSSValueAnywhere:
return OverflowWrap::Anywhere;
case CSSValueNormal:
return OverflowWrap::Normal;
default:
@@ -670,9 +670,9 @@ bool CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyID propertyId
// 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;
@@ -417,8 +417,8 @@ OptionSet<InlineContentBreaker::WordBreakRule> InlineContentBreaker::wordBreakBe
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;
}
@@ -2188,7 +2188,7 @@ inline bool RenderStyle::breakOnlyAfterWhiteSpace() const

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
@@ -821,7 +821,8 @@ TextStream& operator<<(TextStream& ts, OverflowWrap overflowWrap)
{
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;
}
@@ -552,7 +552,8 @@ enum class WordBreak : uint8_t {

enum class OverflowWrap : uint8_t {
Normal,
Break
BreakWord,
Anywhere
};

enum class NBSPMode : uint8_t {
@@ -109,7 +109,7 @@ class StyleRareInheritedData : public RefCounted<StyleRareInheritedData> {
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

0 comments on commit 6ed0b8b

Please sign in to comment.