Skip to content
  • enrica@apple.com's avatar
    WebKit2: provide new bundle APIs to allow bundle clients to be notified of pasteboard access. · 7eb1d5bc
    enrica@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=108396.
    <rdar://problem/12920461>
    
    Source/WebCore: 
    
    Reviewed by Alexey Proskuryakov.
    
    Adds support in WebCore to new EditorClient methods to support the modified
    client bundle API in WebKit2.
    
    * WebCore.exp.in:
    * editing/Editor.cpp:
    (WebCore::Editor::cut): Added call to willWriteSelectionToPasteboard.
    (WebCore::Editor::copy): Ditto.
    (WebCore::Editor::willWriteSelectionToPasteboard): Added.
    * editing/Editor.h:
    * loader/EmptyClients.h: Added empty client implementation
    for the new methods.
    (WebCore::EmptyEditorClient::willWriteSelectionToPasteboard):
    (WebCore::EmptyEditorClient::getClientPasteboardDataForRange):
    * page/EditorClient.h:
    * platform/mac/PasteboardMac.mm:
    (WebCore::Pasteboard::writeSelectionForTypes): Added call to getClientPasteboardDataForRange.
    
    Source/WebKit/blackberry: 
    
    Reviewed by Alexey Proskuryakov.
    
    Adds stub implementation for WebKit of the new EditorClient methods.
    
    * WebCoreSupport/EditorClientBlackBerry.cpp:
    (WebCore::EditorClientBlackBerry::willWriteSelectionToPasteboard):
    (WebCore::EditorClientBlackBerry::getClientPasteboardDataForRange):
    * WebCoreSupport/EditorClientBlackBerry.h:
    
    Source/WebKit/chromium: 
    
    Reviewed by Alexey Proskuryakov.
    
    Adds stub implementation for WebKit of the new EditorClient methods.
    
    * src/EditorClientImpl.cpp:
    (WebKit::EditorClientImpl::willWriteSelectionToPasteboard):
    (WebKit::EditorClientImpl::getClientPasteboardDataForRange):
    * src/EditorClientImpl.h:
    
    Source/WebKit/efl: 
    
    Reviewed by Alexey Proskuryakov.
    
    Adds stub implementation for WebKit of the new EditorClient methods.
    
    * WebCoreSupport/EditorClientEfl.cpp:
    (WebCore::EditorClientEfl::willWriteSelectionToPasteboard):
    (WebCore::EditorClientEfl::getClientPasteboardDataForRange):
    * WebCoreSupport/EditorClientEfl.h:
    
    Source/WebKit/gtk: 
    
    Reviewed by Alexey Proskuryakov.
    
    Adds stub implementation for WebKit of the new EditorClient methods.
    
    * WebCoreSupport/EditorClientGtk.cpp:
    (WebKit::EditorClient::willWriteSelectionToPasteboard):
    (WebKit::EditorClient::getClientPasteboardDataForRange):
    * WebCoreSupport/EditorClientGtk.h:
    
    Source/WebKit/mac: 
    
    Reviewed by Alexey Proskuryakov.
    
    Adds stub implementation for WebKit of the new EditorClient methods.
    
    * WebCoreSupport/WebEditorClient.h:
    * WebCoreSupport/WebEditorClient.mm:
    (WebEditorClient::willWriteSelectionToPasteboard):
    (WebEditorClient::getClientPasteboardDataForRange):
    
    Source/WebKit/qt: 
    
    Reviewed by Alexey Proskuryakov.
    
    Adds stub implementation for WebKit of the new EditorClient methods.
    
    * WebCoreSupport/EditorClientQt.cpp:
    (WebCore::EditorClientQt::willWriteSelectionToPasteboard):
    (WebCore::EditorClientQt::getClientPasteboardDataForRange):
    * WebCoreSupport/EditorClientQt.h:
    
    Source/WebKit/win: 
    
    Reviewed by Alexey Proskuryakov.
    
    Adds stub implementation for WebKit of the new EditorClient methods.
    
    * WebCoreSupport/WebEditorClient.cpp:
    (WebEditorClient::willWriteSelectionToPasteboard):
    (WebEditorClient::getClientPasteboardDataForRange):
    * WebCoreSupport/WebEditorClient.h:
    
    Source/WebKit/wince: 
    
    Reviewed by Alexey Proskuryakov.
    
    Adds stub implementation for WebKit of the new EditorClient methods.
    
    * WebCoreSupport/EditorClientWinCE.cpp:
    (WebKit::EditorClientWinCE::willWriteSelectionToPasteboard):
    (WebKit::EditorClientWinCE::getClientPasteboardDataForRange):
    * WebCoreSupport/EditorClientWinCE.h:
    
    Source/WebKit/wx: 
    
    Reviewed by Alexey Proskuryakov.
    
    Adds stub implementation for WebKit of the new EditorClient methods.
    
    * WebKitSupport/EditorClientWx.cpp:
    (WebCore::EditorClientWx::willWriteSelectionToPasteboard):
    (WebCore::EditorClientWx::getClientPasteboardDataForRange):
    * WebKitSupport/EditorClientWx.h:
    
    Source/WebKit2: 
    
    Reviewed by Alexey Proskuryakov.
    
    This patch adds new bundle client API to receive notifications
    relative the pasteboard activity. There are 2 new API added to
    InjectedBundleEditorClient, to receive notification before and
    after the pasteboard content is added and one API to provide
    additional content to add to the pasteboard.
    In order to create content to add to the pasteboard, WKWebArchiveRef
    and WKWebArchiveResourcesRef have been added to the set of API level
    object.
    This work is a joint effort with Sam Weinig who contributed the
    support for WKWebArchiveRef, WKWebArchiveResourcesRef and related
    files. Sam is the author of the first chunk of changes listed below.
            
    * Shared/API/c/WKBase.h:
    * Shared/API/c/WKSharedAPICast.h:
    * Shared/API/c/mac/WKWebArchive.cpp: Added.
    (WKWebArchiveGetTypeID):
    (WKWebArchiveCreate):
    (WKWebArchiveCreateWithData):
    (WKWebArchiveCreateFromRange):
    (WKWebArchiveCopyMainResource):
    (WKWebArchiveCopySubresources):
    (WKWebArchiveCopySubframeArchives):
    (WKWebArchiveCopyData):
    * Shared/API/c/mac/WKWebArchive.h: Added.
    * Shared/API/c/mac/WKWebArchiveResource.cpp: Added.
    (WKWebArchiveResourceGetTypeID):
    (WKWebArchiveResourceCreate):
    (WKWebArchiveResourceCopyData):
    (WKWebArchiveResourceCopyURL):
    (WKWebArchiveResourceCopyMIMEType):
    (WKWebArchiveResourceCopyTextEncoding):
    * Shared/API/c/mac/WKWebArchiveResource.h: Added.
    * Shared/APIObject.h:
    * Shared/WebArchive.cpp: Added.
    (WebKit::WebArchive::create):
    (WebKit::WebArchive::WebArchive):
    (WebKit::WebArchive::~WebArchive):
    (WebKit::WebArchive::mainResource):
    (WebKit::WebArchive::subresources):
    (WebKit::WebArchive::subframeArchives):
    (WebKit::releaseCFData):
    (WebKit::WebArchive::data):
    (WebKit::WebArchive::coreLegacyWebArchive):
    * Shared/WebArchive.h: Added.
    (WebKit::WebArchive::type):
    * Shared/WebArchiveResource.cpp: Added.
    (WebKit::WebArchiveResource::create):
    (WebKit::WebArchiveResource::WebArchiveResource):
    (WebKit::WebArchiveResource::~WebArchiveResource):
    (WebKit::releaseCFData):
    (WebKit::WebArchiveResource::data):
    (WebKit::WebArchiveResource::URL):
    (WebKit::WebArchiveResource::MIMEType):
    (WebKit::WebArchiveResource::textEncoding):
    (WebKit::WebArchiveResource::coreArchiveResource):
    * Shared/WebArchiveResource.h: Added.
    (WebKit::WebArchiveResource::type):
    * WebKit2.xcodeproj/project.pbxproj:
            
    * Shared/APIClientTraits.cpp: Added versioning to InjectedBundlePageEditorClient.
    * Shared/APIClientTraits.h:
    * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
    * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
    (WebKit::InjectedBundlePageEditorClient::willWriteToPasteboard): Added.
    (WebKit::InjectedBundlePageEditorClient::getPasteboardDataForRange): Added.
    (WebKit::InjectedBundlePageEditorClient::didWriteToPasteboard): Added.
    * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h:
    * WebProcess/WebCoreSupport/WebEditorClient.cpp:
    (WebKit::WebEditorClient::didWriteSelectionToPasteboard):
    (WebKit::WebEditorClient::willWriteSelectionToPasteboard):
    (WebKit::WebEditorClient::getClientPasteboardDataForRange):
    * WebProcess/WebCoreSupport/WebEditorClient.h:
    
    Tools: 
    
    Reviewed by Alexey Proskuryakov.
            
    Adding new WebKit2 test with relevant bundle, to test the new APIs.
    
    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
    * TestWebKitAPI/Tests/WebKit2/PasteboardNotifications.mm: Added.
    (TestWebKitAPI::didReceiveMessageFromInjectedBundle):
    (TestWebKitAPI::setInjectedBundleClient):
    * TestWebKitAPI/Tests/WebKit2/PasteboardNotifications_Bundle.cpp: Added.
    (PasteboardNotificationsTest):
    (TestWebKitAPI::willWriteToPasteboard):
    (TestWebKitAPI::getPasteboardDataForRange):
    (TestWebKitAPI::didWriteToPasteboard):
    (TestWebKitAPI::PasteboardNotificationsTest::PasteboardNotificationsTest):
    (TestWebKitAPI::PasteboardNotificationsTest::didCreatePage):
    * TestWebKitAPI/Tests/WebKit2/execCopy.html: Added.
    * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: Updated to reflect
    changes in InjectedBundleEditorClient.
    (WTR::InjectedBundlePage::InjectedBundlePage):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@141473 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    7eb1d5bc