-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REGRESSION(257749@main): Copying table in Confluence on Safari doesn'…
…t copy header rows https://bugs.webkit.org/show_bug.cgi?id=259091 Reviewed by Wenson Hsieh. Add a Confluence specific quirk to copy `-webkit-user-select: none` contents. * LayoutTests/editing/pasteboard/copy-content-with-user-select-none-quirks-expected.txt: Added. * LayoutTests/editing/pasteboard/copy-content-with-user-select-none-quirks.html: Added. * Source/WebCore/editing/Editor.cpp: (WebCore::Editor::selectedText const): (WebCore::Editor::selectedTextForDataTransfer const): * Source/WebCore/editing/cocoa/HTMLConverter.mm: (HTMLConverter::HTMLConverter): (HTMLConverter::_enterElement): (HTMLConverter::_processText): * Source/WebCore/editing/markup.cpp: (WebCore::StyledMarkupAccumulator::StyledMarkupAccumulator): * Source/WebCore/html/HTMLMetaElement.cpp: (WebCore::HTMLMetaElement::process): * Source/WebCore/page/DOMSelection.cpp: (WebCore::DOMSelection::toString const): * Source/WebCore/page/Quirks.h: (WebCore::Quirks::needsToCopyUserSelectNoneQuirk const): (WebCore::Quirks::setNeedsToCopyUserSelectNoneQuirk): * Tools/TestWebKitAPI/Tests/WebKitCocoa/CopyRTF.mm: (TEST): Canonical link: https://commits.webkit.org/265939@main
- Loading branch information
Showing
9 changed files
with
156 additions
and
7 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
LayoutTests/editing/pasteboard/copy-content-with-user-select-none-quirks-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
This tests copying excludes content with user-select: none. | ||
To manually test, copy "hello world foo bar" below then paste. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS getSelection().toString().includes("hello") is true | ||
PASS getSelection().toString().includes("world") is true | ||
PASS getSelection().toString().includes("WebKit") is true | ||
PASS getSelection().toString().includes("rocks") is true | ||
PASS getSelection().toString().includes("because") is true | ||
PASS getSelection().toString().includes("foo") is true | ||
PASS getSelection().toString().includes("bar") is true | ||
PASS event.clipboardData.getData("text/plain").includes("hello") is true | ||
PASS event.clipboardData.getData("text/plain").includes("world") is true | ||
PASS event.clipboardData.getData("text/plain").includes("WebKit") is true | ||
PASS event.clipboardData.getData("text/plain").includes("rocks") is true | ||
PASS event.clipboardData.getData("text/plain").includes("because") is true | ||
PASS event.clipboardData.getData("text/plain").includes("foo") is true | ||
PASS event.clipboardData.getData("text/plain").includes("bar") is true | ||
PASS event.clipboardData.getData("text/html").includes("hello") is true | ||
PASS event.clipboardData.getData("text/html").includes("world") is true | ||
PASS event.clipboardData.getData("text/html").includes("<i") is true | ||
PASS event.clipboardData.getData("text/html").includes("</i>") is true | ||
PASS event.clipboardData.getData("text/html").includes("WebKit") is true | ||
PASS event.clipboardData.getData("text/html").includes("<b ") is true | ||
PASS event.clipboardData.getData("text/html").includes("</b>") is true | ||
PASS event.clipboardData.getData("text/html").includes("rocks") is true | ||
PASS event.clipboardData.getData("text/html").includes("<q>") is true | ||
PASS event.clipboardData.getData("text/html").includes("</q>") is true | ||
PASS event.clipboardData.getData("text/html").includes("because") is true | ||
PASS event.clipboardData.getData("text/html").includes("<s>") is true | ||
PASS event.clipboardData.getData("text/html").includes("</s>") is true | ||
PASS event.clipboardData.getData("text/html").includes("<em>") is true | ||
PASS event.clipboardData.getData("text/html").includes("</em>") is true | ||
PASS event.clipboardData.getData("text/html").includes("foo") is true | ||
PASS event.clipboardData.getData("text/html").includes("bar") is true | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
hello world WebKit rocks because foo bar | ||
hello world WebKit rocks because foo bar | ||
|
71 changes: 71 additions & 0 deletions
71
LayoutTests/editing/pasteboard/copy-content-with-user-select-none-quirks.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta name="confluence-request-time" content="1689029750234"> | ||
</head> | ||
<body> | ||
<div id="source">hello <span style="-webkit-user-select: none; user-select: none;"><i>world </i><b style="-webkit-user-select: initial; | ||
user-select: initial;">WebKit <span style="-webkit-user-select: none; user-select: none;"><q>rocks </q></span></b><font color="green" style="-webkit-user-select: none; | ||
user-select: none;"><s>because </s></font></span><span inert><em>foo </em></span></span>bar</div> | ||
<div id="destination" contenteditable></div> | ||
<pre id="output"></pre> | ||
</body> | ||
<script src="../../resources/js-test.js"></script> | ||
<script> | ||
|
||
description(`This tests copying excludes content with user-select: none.<br> | ||
To manually test, copy "hello world foo bar" below then paste.`); | ||
|
||
jsTestIsAsync = true; | ||
getSelection().setBaseAndExtent(source, 0, source, source.childNodes.length); | ||
|
||
source.addEventListener("copy", () => { | ||
shouldBeTrue('getSelection().toString().includes("hello")'); | ||
shouldBeTrue('getSelection().toString().includes("world")'); | ||
shouldBeTrue('getSelection().toString().includes("WebKit")'); | ||
shouldBeTrue('getSelection().toString().includes("rocks")'); | ||
shouldBeTrue('getSelection().toString().includes("because")'); | ||
shouldBeTrue('getSelection().toString().includes("foo")'); | ||
shouldBeTrue('getSelection().toString().includes("bar")'); | ||
}); | ||
|
||
destination.addEventListener("paste", () => { | ||
shouldBeTrue('event.clipboardData.getData("text/plain").includes("hello")'); | ||
shouldBeTrue('event.clipboardData.getData("text/plain").includes("world")'); | ||
shouldBeTrue('event.clipboardData.getData("text/plain").includes("WebKit")'); | ||
shouldBeTrue('event.clipboardData.getData("text/plain").includes("rocks")'); | ||
shouldBeTrue('event.clipboardData.getData("text/plain").includes("because")'); | ||
shouldBeTrue('event.clipboardData.getData("text/plain").includes("foo")'); | ||
shouldBeTrue('event.clipboardData.getData("text/plain").includes("bar")'); | ||
shouldBeTrue('event.clipboardData.getData("text/html").includes("hello")'); | ||
shouldBeTrue('event.clipboardData.getData("text/html").includes("world")'); | ||
shouldBeTrue('event.clipboardData.getData("text/html").includes("<i")'); | ||
shouldBeTrue('event.clipboardData.getData("text/html").includes("</i>")'); | ||
shouldBeTrue('event.clipboardData.getData("text/html").includes("WebKit")'); | ||
shouldBeTrue('event.clipboardData.getData("text/html").includes("<b ")'); | ||
shouldBeTrue('event.clipboardData.getData("text/html").includes("</b>")'); | ||
shouldBeTrue('event.clipboardData.getData("text/html").includes("rocks")'); | ||
shouldBeTrue('event.clipboardData.getData("text/html").includes("<q>")'); | ||
shouldBeTrue('event.clipboardData.getData("text/html").includes("</q>")'); | ||
shouldBeTrue('event.clipboardData.getData("text/html").includes("because")'); | ||
shouldBeTrue('event.clipboardData.getData("text/html").includes("<s>")'); | ||
shouldBeTrue('event.clipboardData.getData("text/html").includes("</s>")'); | ||
shouldBeTrue('event.clipboardData.getData("text/html").includes("<em>")'); | ||
shouldBeTrue('event.clipboardData.getData("text/html").includes("</em>")'); | ||
shouldBeTrue('event.clipboardData.getData("text/html").includes("foo")'); | ||
shouldBeTrue('event.clipboardData.getData("text/html").includes("bar")'); | ||
finishJSTest(); | ||
}); | ||
|
||
if (window.testRunner) { | ||
testRunner.execCommand("Copy"); | ||
destination.focus(); | ||
testRunner.execCommand("Paste"); | ||
} else { | ||
source.addEventListener("copy", () => { | ||
setTimeout(() => destination.focus(), 0); | ||
}); | ||
} | ||
|
||
</script> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters