Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 6c20a290578699c2828d10eef0e625cd9f0e88b5
https://github.com/WebKit/WebKit/commit/6c20a290578699c2828d10eef0e625cd9f0e88b5
Author: Joanne Pan <[email protected]>
Date: 2026-03-12 (Thu, 12 Mar 2026)
Changed paths:
A LayoutTests/editing/pasteboard/copy-emoji-img-with-svg-source-expected.txt
A LayoutTests/editing/pasteboard/copy-emoji-img-with-svg-source.html
M Source/WebCore/editing/markup.cpp
M Tools/TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm
Log Message:
-----------
discord.com: copy paste post with emojis into gmail.com are not display
correctly
https://bugs.webkit.org/show_bug.cgi?id=309683
rdar://162708499
Reviewed by Ryosuke Niwa.
Previously, emoji SVG images were serialized as <img>
tags in the HTML clipboard. That required the paste target
to fetch the SVG from source origin.
Cross-origin resource policies (CORP) block these requests,
so the images were broken when pasted into Gmail.
In the case of just emoji with no surrounding text, it
was already working before this fix because it goes through
the writeImageToPasteboard() path instead, which puts the
direct raw image data on the clipboard.
Discord already puts the real emoji character in the alt
attribute, so the fix was checking <img>s with SVG sources
and emoji-only alt text during copy, and writing the Unicode
character directly into clipboard HTML.
Tests: editing/pasteboard/copy-emoji-img-with-svg-source.html
Tools/TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm
* LayoutTests/editing/pasteboard/copy-emoji-img-with-svg-source-expected.txt:
Added.
* LayoutTests/editing/pasteboard/copy-emoji-img-with-svg-source.html: Added.
* Source/WebCore/editing/markup.cpp:
(WebCore::containsOnlyEmoji):
(WebCore::StyledMarkupAccumulator::traverseNodesForSerialization):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm:
(TEST(CopyHTML, EmojiImgWithSVGSourceReplacedWithAltText)):
(TEST(CopyHTML, NonEmojiImgWithSVGSourcePreserved)):
(TEST(CopyHTML, EmojiImgWithNonSVGSourcePreserved)):
Canonical link: https://commits.webkit.org/309176@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications