REGRESSION(r198177): Cannot paste an image when the pasteboard format is mime type.
authorenrica@apple.com <enrica@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 11 Jun 2016 00:21:16 +0000 (00:21 +0000)
committerenrica@apple.com <enrica@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 11 Jun 2016 00:21:16 +0000 (00:21 +0000)
commit8fa5092e970f7db5a006cd8623f8bda20b475130
tree4173b543797b9d65f44c76532c39ee2633b415b9
parent1be11224b7df5a11c201e4aa4fabaabb849ba5e4
REGRESSION(r198177): Cannot paste an image when the pasteboard format is mime type.
https://bugs.webkit.org/show_bug.cgi?id=158590
rdar://problem/25471371

Reviewed by Darin Adler.

Source/WebCore:

When creating a fragment from an image resource, the resource needs to
be added to the document loader before setting the src attribute to the
image element, otherwise loading is triggered and the loading fails.
In r198177 the order of the operations was changed causing the bug.
This patch adds support to test the scenario where the image in the pasteboard
is available only as mime type (not WebArchive or RTFD), a situation that occurs
more frequently on iOS.

Test: editing/pasteboard/image-in-iframe.html

* editing/ios/EditorIOS.mm:
(WebCore::Editor::createFragmentForImageResourceAndAddResource):
* editing/mac/EditorMac.mm:
(WebCore::Editor::WebContentReader::readWebArchive):
(WebCore::Editor::WebContentReader::readRTFD):
(WebCore::Editor::WebContentReader::readRTF):
(WebCore::Editor::createFragmentForImageResourceAndAddResource):
* page/Settings.cpp:
(WebCore::Settings::setImagesEnabled):
(WebCore::Settings::setPreferMimeTypeForImages):
(WebCore::Settings::setForcePendingWebGLPolicy):
* page/Settings.h:
(WebCore::Settings::areImagesEnabled):
(WebCore::Settings::preferMimeTypeForImages):
(WebCore::Settings::arePluginsEnabled):
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::Backup::restoreTo):
(WebCore::InternalSettings::setLangAttributeAwareFormControlUIEnabled):
(WebCore::InternalSettings::setPreferMimeTypeForImages):
(WebCore::InternalSettings::setImagesEnabled):
* testing/InternalSettings.h:
* testing/InternalSettings.idl:

LayoutTests:

* editing/pasteboard/image-in-iframe-expected.txt: Added.
* editing/pasteboard/image-in-iframe.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201956 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/editing/pasteboard/image-in-iframe-expected.txt [new file with mode: 0644]
LayoutTests/editing/pasteboard/image-in-iframe.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/editing/ios/EditorIOS.mm
Source/WebCore/editing/mac/EditorMac.mm
Source/WebCore/page/Settings.cpp
Source/WebCore/page/Settings.h
Source/WebCore/testing/InternalSettings.cpp
Source/WebCore/testing/InternalSettings.h
Source/WebCore/testing/InternalSettings.idl