Skip to content

CSS text-transform should not affect plain text copy#60830

Open
vitorroriz wants to merge 1 commit intoWebKit:mainfrom
vitorroriz:eng/text-transform-shouldn-t-apply-when-copying-text
Open

CSS text-transform should not affect plain text copy#60830
vitorroriz wants to merge 1 commit intoWebKit:mainfrom
vitorroriz:eng/text-transform-shouldn-t-apply-when-copying-text

Conversation

@vitorroriz
Copy link
Contributor

@vitorroriz vitorroriz commented Mar 18, 2026

ef56b4b

CSS text-transform should not affect plain text copy
https://bugs.webkit.org/show_bug.cgi?id=43202
rdar://27247825

Reviewed by NOBODY (OOPS!).

When copying text to the clipboard, use the original DOM text instead of the
transformed text so that CSS text-transform does not leak into the pasted
result. This is guarded by the CopyPlainTextWithoutTextTransformEnabled
setting and avoids text-security content to prevent leaking secured text.

* LayoutTests/imported/w3c/web-platform-tests/editing/other/paste_text_with_text_transform-expected.txt:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/editing/TextIterator.cpp:
(WebCore::TextIterator::emitText):

ef56b4b

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 loading 🛠 mac-apple
✅ 🧪 webkitperl ❌ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe ✅ 🛠 vision-apple
❌ 🧪 ios-wk2-wpt ✅ 🧪 api-mac-debug ✅ 🛠 gtk3-libwebrtc
✅ 🛠 🧪 jsc ✅ 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 🧪 jsc-debug-arm64 ✅ 🛠 ios-safer-cpp ❌ 🧪 mac-wk2 ❌ 🧪 gtk-wk2
✅ 🛠 vision ❌ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🧪 vision-wk2 ❌ 🧪 mac-intel-wk2 ✅ 🛠 jsc-armv7
✅ 🛠 tv ✅ 🛠 mac-safer-cpp ✅ 🧪 jsc-armv7-tests
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@vitorroriz vitorroriz requested a review from rniwa as a code owner March 18, 2026 03:01
@vitorroriz vitorroriz self-assigned this Mar 18, 2026
@vitorroriz vitorroriz added the CSS Cascading Style Sheets implementation label Mar 18, 2026
@vitorroriz vitorroriz force-pushed the eng/text-transform-shouldn-t-apply-when-copying-text branch from 4a47e30 to 0c1c160 Compare March 18, 2026 03:03
@vitorroriz vitorroriz force-pushed the eng/text-transform-shouldn-t-apply-when-copying-text branch from 0c1c160 to eacf15d Compare March 18, 2026 03:07
https://bugs.webkit.org/show_bug.cgi?id=43202
rdar://27247825

Reviewed by NOBODY (OOPS!).

When copying text to the clipboard, use the original DOM text instead of the
transformed text so that CSS text-transform does not leak into the pasted
result. This is guarded by the CopyPlainTextWithoutTextTransformEnabled
setting and avoids text-security content to prevent leaking secured text.

* LayoutTests/imported/w3c/web-platform-tests/editing/other/paste_text_with_text_transform-expected.txt:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/editing/TextIterator.cpp:
(WebCore::TextIterator::emitText):
@vitorroriz vitorroriz force-pushed the eng/text-transform-shouldn-t-apply-when-copying-text branch from eacf15d to ef56b4b Compare March 18, 2026 03:19
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 18, 2026
@rniwa
Copy link
Member

rniwa commented Mar 18, 2026

It's unclear to me that we want to do this. End-user doesn't care if text was transformed or not. They want to copy the text they see on screen.

@pepelsbey
Copy link

I'm an end user and I do care:

https://pepelsbey.dev/articles/uppercase-copy-paste/

@rniwa
Copy link
Member

rniwa commented Mar 18, 2026

FWIW, the current behavior is intentional per https://bugs.webkit.org/show_bug.cgi?id=3429.

@aardrian
Copy link

I'm an end user and I do care:

https://adrianroselli.com/2012/06/copying-content-styled-with-text.html

Copy link
Contributor

@aproskuryakov aproskuryakov left a comment

Choose a reason for hiding this comment

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

Why are we doing this? This is purely user hostile, and I don't think that spec compliance is a good enough reason to make user hostile changes.

@ericwbailey
Copy link

It's unclear to me that we want to do this. End-user doesn't care if text was transformed or not. They want to copy the text they see on screen.

Can you substantiate this claim?

@rniwa
Copy link
Member

rniwa commented Mar 18, 2026

It's unclear to me that we want to do this. End-user doesn't care if text was transformed or not. They want to copy the text they see on screen.

Can you substantiate this claim?

Mozilla had a bug filed about this behavior: https://bugzilla.mozilla.org/show_bug.cgi?id=35148

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

Labels

CSS Cascading Style Sheets implementation merging-blocked Applied to prevent a change from being merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants