Change Image Controls replacement to use selection and paste
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Apr 2014 21:54:23 +0000 (21:54 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Apr 2014 21:54:23 +0000 (21:54 +0000)
commit31310736b16de559b15d8f6d27dcdccb484b26d8
treed8db0735e4e5cbe9bedc19c1e253270517fe9f98
parent8f38045c9728d9b2db3395660bf3e9a7c17fd2a2
Change Image Controls replacement to use selection and paste
<rdar://problem/16302722> and https://bugs.webkit.org/show_bug.cgi?id=131992

Reviewed by Tim Horton.

Source/WebCore:
* WebCore.exp.in: Remove deleted symbol.

* html/shadow/mac/ImageControlsButtonElementMac.cpp:
(WebCore::ImageControlsButtonElementMac::defaultEventHandler):

* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::showImageControlsMenu): Select the image element
  before showing the menu.
(WebCore::ContextMenuController::replaceControlledImage): Deleted.
* page/ContextMenuController.h:

Source/WebKit/mac:
* Misc/WebSharingServicePickerController.mm:
(-[WebSharingServicePickerController sharingService:didShareItems:]): Write the
  replacement data to a special pasteboard, then replace the current selection from
  that pasteboard.

Source/WebKit2:
Add a "pasteboard override" mechanism which allows WebKit to keep pasteboard content local
to the WebProcess and access it there without having to message up to the UI process:
* WebProcess/WebCoreSupport/WebPasteboardOverrides.cpp: Added.
(WebKit::WebPasteboardOverrides::sharedPasteboardOverrides):
(WebKit::WebPasteboardOverrides::WebPasteboardOverrides):
(WebKit::WebPasteboardOverrides::addOverride):
(WebKit::WebPasteboardOverrides::removeOverride):
(WebKit::WebPasteboardOverrides::overriddenTypes):
(WebKit::WebPasteboardOverrides::getDataForOverride):
* WebProcess/WebCoreSupport/WebPasteboardOverrides.h: Added.

Change the pasteboard strategy to consult the pasteboard overrides before consulting the native pasteboard:
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::getTypes):
(WebKit::WebPlatformStrategies::bufferForType):

Add "replaceSelectionWithPasteboardData" which uses the new pasteboard overrides mechanism
and then has WebCore perform the replacement:
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::replaceSelectionPasteboardName):
(WebKit::WebPage::replaceSelectionWithPasteboardData):

* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::replaceSelectionWithPasteboardData):

* UIProcess/mac/WebContextMenuProxyMac.h:
(WebKit::WebContextMenuProxyMac::page):
* UIProcess/mac/WebContextMenuProxyMac.mm:
(-[WKSharingServicePickerDelegate sharingService:didShareItems:]): Use "replaceSelectionWithPasteboardData".
(WebKit::WebContextMenuProxyMac::WebContextMenuProxyMac):
(WebKit::WebContextMenuProxyMac::replaceControlledImage): Deleted.

Remain other remnants of "replaceControlledImage":
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::replaceControlledImage): Deleted.
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebContextMenu.cpp:
(WebKit::WebContextMenu::replaceControlledImage): Deleted.
* WebProcess/WebPage/WebContextMenu.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::replaceControlledImage): Deleted.

* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167956 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/html/shadow/mac/ImageControlsButtonElementMac.cpp
Source/WebCore/page/ContextMenuController.cpp
Source/WebCore/page/ContextMenuController.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Misc/WebSharingServicePickerController.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.h
Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm
Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/WebCoreSupport/WebPasteboardOverrides.cpp [new file with mode: 0644]
Source/WebKit2/WebProcess/WebCoreSupport/WebPasteboardOverrides.h [new file with mode: 0644]
Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp
Source/WebKit2/WebProcess/WebPage/WebContextMenu.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm