Skip to content

Commit 4dc830e

Browse files
committed
Consolidate -webkit-text-decoration and text-decoration shorthands
rdar://156011594 https://bugs.webkit.org/show_bug.cgi?id=296097 Reviewed by Ryosuke Niwa and Tim Nguyen. Currently, text-decoration can only handle text-decoration-line values, effectively making it a "alias" for it, while -webkit-text-decoration can handle only 3 of text-decoration longhands. We are consolidating behavior here, making -webkit-text-decoration an alias for text-decoration. The property will be the shorthand for all 4 longhands: - text-decoration-line - text-decoration-thickness - text-decoration-style - text-decoration-color We need to rebase a bunch of editing-related tests. Since text-decoration was effectively working as an alias to text-decoration-line, this behavior was assumed in EditingStyle. The changes here won't really change how things look from a user's point of view, but in some cases we will serialize, for example, inline style, "text-decoration: underline" as "text-decoration-line: underline", which actually make us more aligned with other engine implementations. While implementing this, I've realized there is a bug when propagating isCurrentColor for the animation style. This also affect other shorthands, like text-emphasis. So we are rebasing the animation tests here and aiming to intestigate it at: https://bugs.webkit.org/show_bug.cgi?id=296914 This is based on the previous attempts from: * Oriol Brufau (@Loirooriol): - https://commits.webkit.org/248000@main (reverted) * Tim Nguyen (@nt1m): - #6466 * Matthieu Dubet (@mdubet) - #23121 * LayoutTests/TestExpectations: * LayoutTests/editing/deleting/delete-line-break-before-underlined-content-expected.txt: * LayoutTests/editing/deleting/delete-line-break-before-underlined-content-live-range-expected.txt: * LayoutTests/editing/deleting/deleting-line-break-preserves-underline-color-expected.txt: * LayoutTests/editing/deleting/deleting-line-break-preserves-underline-color-live-range-expected.txt: * LayoutTests/editing/deleting/merge-div-from-span-with-style-expected.txt: * LayoutTests/editing/deleting/merge-div-from-span-with-style-live-range-expected.txt: * LayoutTests/editing/deleting/merge-paragraph-from-span-with-multiple-text-decoration-expected.txt: * LayoutTests/editing/deleting/merge-paragraph-from-span-with-multiple-text-decoration-live-range-expected.txt: * LayoutTests/editing/deleting/merge-paragraph-from-span-with-style-expected.txt: * LayoutTests/editing/deleting/merge-paragraph-from-span-with-style-live-range-expected.txt: * LayoutTests/editing/execCommand/inline-style-after-indentoutdent-expected.txt: * LayoutTests/editing/execCommand/inline-style-after-indentoutdent.html: * LayoutTests/editing/execCommand/toggle-mixed-text-decorations-expected.txt: * LayoutTests/editing/execCommand/toggle-mixed-text-decorations.html: * LayoutTests/editing/pasteboard/insert-text-decoration-expected.txt: * LayoutTests/editing/pasteboard/insert-u-with-text-decoration-none-expected.txt: * LayoutTests/editing/pasteboard/preserve-underline-color-expected.txt: * LayoutTests/editing/style/push-down-implicit-styles-mac-expected.txt: * LayoutTests/editing/style/push-down-implicit-styles-mac.html: * LayoutTests/editing/style/push-down-inline-styles-expected.txt: * LayoutTests/editing/style/push-down-inline-styles.html: * LayoutTests/fast/css/style-enumerate-properties-expected.txt: * LayoutTests/fast/css/style-enumerate-properties.html: * LayoutTests/fast/events/input-events-paste-rich-datatransfer-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/first-letter-allowed-properties-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/first-line-allowed-properties-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-text-decor/parsing/text-decoration-computed-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-text-decor/parsing/text-decoration-shorthand-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-text-decor/parsing/text-decoration-valid-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/text-decoration-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/editing/run/delete_3001-4000-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/editing/run/forwarddelete_3001-4000-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/editing/run/multitest_8001-9000-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/editing/run/strikethrough_1-1000-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/editing/run/strikethrough_1001-2000-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/editing/run/strikethrough_2001-last-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/editing/run/underline_1-1000-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/editing/run/underline_1001-2000-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/editing/run/underline_2001-last-expected.txt: * LayoutTests/platform/glib/fast/events/input-events-paste-rich-datatransfer-expected.txt: * Source/WebCore/css/CSSProperties.json: * Source/WebCore/css/ShorthandSerializer.cpp: (WebCore::ShorthandSerializer::serialize): * Source/WebCore/css/StyleProperties.cpp: (WebCore::canUseShorthandForLonghand): * Source/WebCore/css/html.css: (abbr[title], acronym[title]): * Source/WebCore/css/parser/CSSPropertyParserCustom.h: (WebCore::CSS::PropertyParserCustom::consumeSingleShorthand): Deleted. * Source/WebCore/editing/EditingStyle.cpp: (WebCore::EditingStyle::init): (WebCore::EditingStyle::styleWithResolvedTextDecorations const): (WebCore::EditingStyle::collapseTextDecorationProperties): (WebCore::EditingStyle::conflictsWithInlineStyleOfElement const): (WebCore::EditingStyle::mergeStyle): (WebCore::EditingStyle::removeStyleFromRulesAndContext): (WebCore::EditingStyle::removeEquivalentProperties): (WebCore::reconcileTextDecorationProperties): (WebCore::StyleChange::StyleChange): (WebCore::setTextDecorationProperty): (WebCore::StyleChange::extractTextStyles): * Source/WebCore/editing/ReplaceSelectionCommand.cpp: (WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline): * Source/WebCore/editing/markup.cpp: (WebCore::serializePreservingVisualAppearanceInternal): * Source/WebCore/style/StyleExtractorCustom.h: (WebCore::Style::isDefaultOrIgnorableTextDecorationLine): (WebCore::Style::ExtractorCustom::extractTextDecorationShorthand): (WebCore::Style::ExtractorCustom::extractTextDecorationShorthandSerialization): Canonical link: https://commits.webkit.org/298456@main
1 parent 98ce31a commit 4dc830e

File tree

62 files changed

+342
-245
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+342
-245
lines changed

LayoutTests/TestExpectations

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3634,6 +3634,14 @@ imported/w3c/web-platform-tests/css/css-pseudo/target-text-009.html [ ImageOnlyF
36343634
imported/w3c/web-platform-tests/css/css-pseudo/target-text-dynamic-004.html [ ImageOnlyFailure ]
36353635
imported/w3c/web-platform-tests/css/css-pseudo/selection-background-painting-order.html [ ImageOnlyFailure ]
36363636

3637+
# We failed to text-decorate for pseudo selectors (This has always failed, we were just not able to render the expected correctly)
3638+
imported/w3c/web-platform-tests/css/css-pseudo/highlight-painting-003.html [ ImageOnlyFailure ]
3639+
imported/w3c/web-platform-tests/css/css-pseudo/highlight-painting-004.html [ ImageOnlyFailure ]
3640+
imported/w3c/web-platform-tests/css/css-pseudo/selection-originating-decoration-color.html [ ImageOnlyFailure ]
3641+
imported/w3c/web-platform-tests/css/css-highlight-api/painting/invalidation/css-highlight-invalidation-001.html [ ImageOnlyFailure ]
3642+
imported/w3c/web-platform-tests/css/css-highlight-api/painting/css-highlight-painting-underline-offset-001.html [ ImageOnlyFailure ]
3643+
3644+
36373645
webkit.org/b/177799,webkit.org/b/290781 accessibility/table-detection.html [ Pass Failure Timeout ]
36383646

36393647
webkit.org/b/291984 [ Debug ] accessibility/roles-computedRoleString.html [ Timeout ]
@@ -7774,6 +7782,7 @@ imported/w3c/web-platform-tests/css/css-viewport/zoom/min-height.html [ ImageOnl
77747782
imported/w3c/web-platform-tests/css/css-viewport/zoom/min-width.html [ ImageOnlyFailure ]
77757783
imported/w3c/web-platform-tests/css/css-viewport/zoom/right.html [ ImageOnlyFailure ]
77767784
imported/w3c/web-platform-tests/css/css-viewport/zoom/top.html [ ImageOnlyFailure ]
7785+
imported/w3c/web-platform-tests/css/css-viewport/zoom/text-underline-offset.html [ ImageOnlyFailure ]
77777786

77787787
# has-slotted is not implemeneted - https://bugs.webkit.org/show_bug.cgi?id=280608
77797788
imported/w3c/web-platform-tests/css/css-scoping/has-slotted-001.html [ ImageOnlyFailure ]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
This tests for a bug where underlined content would lose its underliningwhen deleting the line break before the paragraph that contained it.
22
| "This shouldn't be underlined.<#selection-caret>"
33
| <span>
4-
| style="text-decoration: underline;"
4+
| style="text-decoration-line: underline;"
55
| "This should be underlined."
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
This tests for a bug where underlined content would lose its underliningwhen deleting the line break before the paragraph that contained it.
22
| "This shouldn't be underlined.<#selection-caret>"
33
| <span>
4-
| style="text-decoration: underline;"
4+
| style="text-decoration-line: underline;"
55
| "This should be underlined."

LayoutTests/editing/deleting/deleting-line-break-preserves-underline-color-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ After:
1313
| <div>
1414
| "This should not be underlined.<#selection-caret>"
1515
| <span>
16-
| style="color: red; text-decoration: underline;"
16+
| style="color: red; text-decoration-line: underline;"
1717
| "This should be underlined."

LayoutTests/editing/deleting/deleting-line-break-preserves-underline-color-live-range-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ After:
1313
| <div>
1414
| "This should not be underlined.<#selection-caret>"
1515
| <span>
16-
| style="color: red; text-decoration: underline;"
16+
| style="color: red; text-decoration-line: underline;"
1717
| "This should be underlined."

LayoutTests/editing/deleting/merge-div-from-span-with-style-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ The test passes if "bar" contatins the yellow background and it's underlined.
44
| <div>
55
| "foo<#selection-caret>"
66
| <span>
7-
| style="background-color: yellow; text-decoration: underline;"
7+
| style="background-color: yellow; text-decoration-line: underline;"
88
| "bar"

LayoutTests/editing/deleting/merge-div-from-span-with-style-live-range-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ The test passes if "bar" contatins the yellow background and it's underlined.
44
| <div>
55
| "foo<#selection-caret>"
66
| <span>
7-
| style="background-color: yellow; text-decoration: underline;"
7+
| style="background-color: yellow; text-decoration-line: underline;"
88
| "bar"

LayoutTests/editing/deleting/merge-paragraph-from-span-with-multiple-text-decoration-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ The test passes if the "bar" has underline, overline and line through.
44
| <p>
55
| "foo<#selection-caret>"
66
| <span>
7-
| style="text-decoration: underline overline line-through;"
7+
| style="text-decoration-line: underline overline line-through;"
88
| "bar"

LayoutTests/editing/deleting/merge-paragraph-from-span-with-multiple-text-decoration-live-range-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ The test passes if the "bar" has underline, overline and line through.
44
| <p>
55
| "foo<#selection-caret>"
66
| <span>
7-
| style="text-decoration: underline overline line-through;"
7+
| style="text-decoration-line: underline overline line-through;"
88
| "bar"

LayoutTests/editing/deleting/merge-paragraph-from-span-with-style-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ The test passes if "bar" contatins the yellow background and it's underlined.
44
| <p>
55
| "foo<#selection-caret>"
66
| <span>
7-
| style="background-color: yellow; text-decoration: underline;"
7+
| style="background-color: yellow; text-decoration-line: underline;"
88
| "bar"

0 commit comments

Comments
 (0)