Skip to content

Consolidate -webkit-text-decoration and text-decoration shorthands - #48158

Merged
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
vitorroriz:eng/Consolidate-webkit-text-decoration-and-text-decoration-shorthands
Aug 9, 2025
Merged

webkit-commit-queue merged 1 commit into
WebKit:mainfrom
vitorroriz:eng/Consolidate-webkit-text-decoration-and-text-decoration-shorthands

Conversation

@vitorroriz

@vitorroriz vitorroriz commented Jul 17, 2025 •

Copy link
Copy Markdown
Contributor

4dc830e

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

9d9273e

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe   🛠 win ✅ 🛠 ios-apple
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug   🧪 wpe-wk2   🧪 win-tests ✅ 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🛠 wpe-cairo
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2   🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress   🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🧪 vision-wk2   🧪 mac-intel-wk2   🛠 playstation
✅ 🛠 tv ✅ 🛠 mac-safer-cpp ⏳ 🛠 jsc-armv7
  🛠 tv-sim ⏳ 🧪 jsc-armv7-tests
✅ 🛠 watch
  🛠 watch-sim

@vitorroriz vitorroriz self-assigned this Jul 17, 2025
@vitorroriz vitorroriz added the Text For bugs in text layout and rendering, including international text support. label Jul 17, 2025
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jul 17, 2025
Comment thread Source/WebCore/css/CSSProperties.json Resolved
@vitorroriz vitorroriz removed the merging-blocked Applied to prevent a change from being merged label Jul 18, 2025
@vitorroriz
vitorroriz force-pushed the eng/Consolidate-webkit-text-decoration-and-text-decoration-shorthands branch from 257f477 to f4135c4 Compare July 18, 2025 00:35
@vitorroriz vitorroriz added merging-blocked Applied to prevent a change from being merged no-failure-limits Disable layout test failure limits on a pull-request and removed merging-blocked Applied to prevent a change from being merged labels Jul 18, 2025
@vitorroriz
vitorroriz force-pushed the eng/Consolidate-webkit-text-decoration-and-text-decoration-shorthands branch from f4135c4 to ab206ad Compare July 19, 2025 23:53
@vitorroriz
vitorroriz force-pushed the eng/Consolidate-webkit-text-decoration-and-text-decoration-shorthands branch from ab206ad to d0dcf0c Compare July 20, 2025 00:00
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jul 20, 2025
@vitorroriz vitorroriz removed the merging-blocked Applied to prevent a change from being merged label Jul 24, 2025
@vitorroriz
vitorroriz force-pushed the eng/Consolidate-webkit-text-decoration-and-text-decoration-shorthands branch from d0dcf0c to 0db8ec8 Compare July 24, 2025 03:43
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jul 24, 2025
@vitorroriz vitorroriz removed the merging-blocked Applied to prevent a change from being merged label Jul 29, 2025
@vitorroriz
vitorroriz force-pushed the eng/Consolidate-webkit-text-decoration-and-text-decoration-shorthands branch from 0db8ec8 to 708ec3a Compare July 29, 2025 07:41
@webkit-early-warning-system

Copy link
Copy Markdown
Collaborator

Starting EWS tests for 708ec3a. Live statuses available at the PR page, #48158

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jul 29, 2025
@vitorroriz vitorroriz removed the merging-blocked Applied to prevent a change from being merged label Jul 29, 2025
@vitorroriz
vitorroriz force-pushed the eng/Consolidate-webkit-text-decoration-and-text-decoration-shorthands branch from 708ec3a to 0e7e0e0 Compare July 29, 2025 14:50
@webkit-early-warning-system

Copy link
Copy Markdown
Collaborator

Starting EWS tests for 0e7e0e0. Live statuses available at the PR page, #48158

@vitorroriz
vitorroriz marked this pull request as ready for review August 7, 2025 18:29
@vitorroriz
vitorroriz requested a review from rniwa as a code owner August 7, 2025 18:29
@vitorroriz
vitorroriz requested a review from mdubet August 7, 2025 18:29
@vitorroriz
vitorroriz force-pushed the eng/Consolidate-webkit-text-decoration-and-text-decoration-shorthands branch from bdaa042 to a5cd440 Compare August 7, 2025 18:44
@vitorroriz
vitorroriz force-pushed the eng/Consolidate-webkit-text-decoration-and-text-decoration-shorthands branch from a5cd440 to c545f14 Compare August 7, 2025 19:50
@vitorroriz
vitorroriz force-pushed the eng/Consolidate-webkit-text-decoration-and-text-decoration-shorthands branch from c545f14 to 84dcb32 Compare August 7, 2025 21:17
Comment thread Source/WebCore/editing/EditingStyle.cpp Resolved
Comment thread Source/WebCore/editing/EditingStyle.cpp Resolved
Comment thread Source/WebCore/editing/EditingStyle.cpp Resolved
Comment thread Source/WebCore/editing/EditingStyle.cpp Resolved
Comment thread Source/WebCore/editing/EditingStyle.cpp Resolved
@vitorroriz
vitorroriz force-pushed the eng/Consolidate-webkit-text-decoration-and-text-decoration-shorthands branch from 84dcb32 to e92d1d6 Compare August 8, 2025 22:04
@vitorroriz
vitorroriz force-pushed the eng/Consolidate-webkit-text-decoration-and-text-decoration-shorthands branch from e92d1d6 to b14cfa8 Compare August 8, 2025 22:29
@vitorroriz
vitorroriz requested a review from nt1m August 8, 2025 22:40
@vitorroriz
vitorroriz force-pushed the eng/Consolidate-webkit-text-decoration-and-text-decoration-shorthands branch from b14cfa8 to a0b09b9 Compare August 8, 2025 23:23

@nt1m nt1m left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the various places you call cssText, CSS::defaultSerializationContext() was replaced with { }. Are they both the same?

@vitorroriz vitorroriz added safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks and removed safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks labels Aug 9, 2025
@vitorroriz
vitorroriz force-pushed the eng/Consolidate-webkit-text-decoration-and-text-decoration-shorthands branch from a0b09b9 to 9d9273e Compare August 9, 2025 00:08
@vitorroriz vitorroriz added the safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks label Aug 9, 2025
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):
- WebKit#6466
* Matthieu Dubet (@mdubet)
- WebKit#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
@webkit-commit-queue

Copy link
Copy Markdown
Collaborator

Committed 298456@main (4dc830e): https://commits.webkit.org/298456@main

Reviewed commits have been landed. Closing PR #48158 and removing active labels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Text For bugs in text layout and rendering, including international text support.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants