Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Source/WebCore:
[Mac] Write WebArchive to the pasteboard when copying image in WebKit https://bugs.webkit.org/show_bug.cgi?id=163100 Reviewed by Darin Adler. Write WebArchive to the pasteboard when copying image in WebKit. This fixes pasting such images to a content editable field in WebKit because Web archives take priority over RTFD when reading from the pasteboard in WebKit. Using RTFD when pasting the image in WebKit was causing issues because: 1. The pasted image would not be displayed because our RTFD import code is buggy. 2. The pasted image URL was a webkit-fake-url:// 3. Formatting associated to the image (e.g. inline style) would be lost No new tests, unskipped existing test on WebKit2. * editing/Editor.h: * editing/mac/EditorMac.mm: (WebCore::Editor::imageInWebArchiveFormat): (WebCore::Editor::writeImageToPasteboard): * platform/Pasteboard.h: * platform/mac/PasteboardMac.mm: (WebCore::writableTypesForImage): (WebCore::Pasteboard::write): (WebCore::Pasteboard::Pasteboard): Deleted. (WebCore::Pasteboard::createForCopyAndPaste): Deleted. LayoutTests: [Mac] Write HTML to the pasteboard when copying image in WebKit https://bugs.webkit.org/show_bug.cgi?id=163100 Reviewed by Darin Adler. Convert editing/pasteboard/copy-standalone-image.html into a ref test and unskip on WebKit2 now that it passes there as well. Before this patch, the test would fail on WebKit2 (the pasted image would not be displayed). * editing/pasteboard/copy-standalone-image-expected.html: Added. * editing/pasteboard/copy-standalone-image.html: * platform/gtk/editing/pasteboard/copy-standalone-image-expected.png: Removed. * platform/gtk/editing/pasteboard/copy-standalone-image-expected.txt: Removed. * platform/ios-simulator-wk2/editing/pasteboard/copy-standalone-image-expected.png: Removed. * platform/ios-simulator/editing/pasteboard/copy-standalone-image-expected.txt: Removed. * platform/mac/editing/pasteboard/copy-standalone-image-expected.png: Removed. * platform/mac/editing/pasteboard/copy-standalone-image-expected.txt: Removed. * platform/win/editing/pasteboard/copy-standalone-image-expected.txt: Removed. * platform/wk2/TestExpectations: Canonical link: https://commits.webkit.org/181013@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206965 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
with
94 additions
and 161 deletions.
- +23 −0 LayoutTests/ChangeLog
- +15 −0 LayoutTests/editing/pasteboard/copy-standalone-image-expected.html
- +4 −20 LayoutTests/editing/pasteboard/copy-standalone-image.html
- BIN LayoutTests/platform/gtk/editing/pasteboard/copy-standalone-image-expected.png
- +0 −32 LayoutTests/platform/gtk/editing/pasteboard/copy-standalone-image-expected.txt
- BIN LayoutTests/platform/ios-simulator-wk2/editing/pasteboard/copy-standalone-image-expected.png
- +0 −32 LayoutTests/platform/ios-simulator/editing/pasteboard/copy-standalone-image-expected.txt
- BIN LayoutTests/platform/mac/editing/pasteboard/copy-standalone-image-expected.png
- +0 −32 LayoutTests/platform/mac/editing/pasteboard/copy-standalone-image-expected.txt
- +0 −32 LayoutTests/platform/win/editing/pasteboard/copy-standalone-image-expected.txt
- +0 −3 LayoutTests/platform/wk2/TestExpectations
- +31 −0 Source/WebCore/ChangeLog
- +1 −0 Source/WebCore/editing/Editor.h
- +9 −0 Source/WebCore/editing/mac/EditorMac.mm
- +3 −0 Source/WebCore/platform/Pasteboard.h
- +8 −10 Source/WebCore/platform/mac/PasteboardMac.mm
There are no files selected for viewing
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
@@ -0,0 +1,15 @@ | ||
<html> | ||
<body> | ||
<p>This is an automatic test of copying an image document.</p> | ||
<p>To perform this test manually, click once in the image frame, choose Edit -> Copy | ||
then click in the red box and paste the image. If the image pastes successfully the | ||
test is passed.</p> | ||
|
||
<iframe name="imageframe" src="../resources/abe.png"></iframe> | ||
|
||
<div id="dest" contenteditable="true"><img src="../resources/abe.png" style="-webkit-user-select:none;"></div> | ||
<script> | ||
frames['imageframe'].focus(); | ||
</script> | ||
</body> | ||
</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
@@ -1,41 +1,25 @@ | ||
<html> | ||
<head> | ||
<script> | ||
function editingTest() { | ||
frames['imageframe'].document.execCommand("Copy"); | ||
|
||
var s = window.getSelection(); | ||
var e = document.getElementById("dest"); | ||
s.setPosition(e, 0); | ||
document.execCommand("Paste"); | ||
frames['imageframe'].focus(); | ||
} | ||
</script> | ||
</head> | ||
<body> | ||
<p>This is an automatic test of copying an image document.</p> | ||
<p>To perform this test manually, click once in the image frame, choose Edit -> Copy | ||
then click in the red box and paste the image. If the image pastes successfully the | ||
test is passed.</p> | ||
|
||
<iframe name="imageframe" src="../resources/abe.png" onload="editingTest()"></iframe> | ||
|
||
<div id="dest" contenteditable="true"></div> | ||
</body> | ||
</html> |
Deleted file not rendered
Deleted file not rendered
Deleted file not rendered
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