Changeset 141473 in webkit


Ignore:
Timestamp:
Jan 31, 2013 1:14:58 PM (11 years ago)
Author:
enrica@apple.com
Message:

WebKit2: provide new bundle APIs to allow bundle clients to be notified of pasteboard access.
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):

Location:
trunk
Files:
11 added
49 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r141468 r141473  
     12013-01-31  Enrica Casucci  <enrica@apple.com>
     2
     3        WebKit2: provide new bundle APIs to allow bundle clients to be notified of pasteboard access.
     4        https://bugs.webkit.org/show_bug.cgi?id=108396.
     5        <rdar://problem/12920461>
     6
     7        Reviewed by Alexey Proskuryakov.
     8
     9        Adds support in WebCore to new EditorClient methods to support the modified
     10        client bundle API in WebKit2.
     11
     12        * WebCore.exp.in:
     13        * editing/Editor.cpp:
     14        (WebCore::Editor::cut): Added call to willWriteSelectionToPasteboard.
     15        (WebCore::Editor::copy): Ditto.
     16        (WebCore::Editor::willWriteSelectionToPasteboard): Added.
     17        * editing/Editor.h:
     18        * loader/EmptyClients.h: Added empty client implementation
     19        for the new methods.
     20        (WebCore::EmptyEditorClient::willWriteSelectionToPasteboard):
     21        (WebCore::EmptyEditorClient::getClientPasteboardDataForRange):
     22        * page/EditorClient.h:
     23        * platform/mac/PasteboardMac.mm:
     24        (WebCore::Pasteboard::writeSelectionForTypes): Added call to getClientPasteboardDataForRange.
     25
    1262013-01-31  David Kilzer  <ddkilzer@apple.com>
    227
  • trunk/Source/WebCore/WebCore.exp.in

    r141196 r141473  
    188188__ZN7WebCore12SharedBuffer10wrapCFDataEPK8__CFData
    189189__ZN7WebCore12SharedBuffer10wrapNSDataEP6NSData
     190__ZN7WebCore12SharedBuffer12createCFDataEv
    190191__ZN7WebCore12SharedBuffer12createNSDataEv
    191192__ZN7WebCore12SharedBuffer24createWithContentsOfFileERKN3WTF6StringE
  • trunk/Source/WebCore/editing/Editor.cpp

    r141429 r141473  
    983983    }
    984984    RefPtr<Range> selection = selectedRange();
     985    willWriteSelectionToPasteboard(selection);
    985986    if (shouldDeleteRange(selection.get())) {
    986987        updateMarkersForWordsAffectedByEditing(true);
     
    10041005    }
    10051006
     1007    willWriteSelectionToPasteboard(selectedRange());
    10061008    if (enclosingTextFormControl(m_frame->selection()->start())) {
    10071009        Pasteboard::generalPasteboard()->writePlainText(selectedText(),
     
    12741276    if (client())
    12751277        client()->didEndEditing();
     1278}
     1279
     1280void Editor::willWriteSelectionToPasteboard(PassRefPtr<Range> range)
     1281{
     1282    if (client())
     1283        client()->willWriteSelectionToPasteboard(range.get());
    12761284}
    12771285
  • trunk/Source/WebCore/editing/Editor.h

    r139796 r141473  
    274274    void didBeginEditing();
    275275    void didEndEditing();
     276    void willWriteSelectionToPasteboard(PassRefPtr<Range>);
    276277    void didWriteSelectionToPasteboard();
    277278   
  • trunk/Source/WebCore/loader/EmptyClients.h

    r139078 r141473  
    442442    virtual void respondToChangedSelection(Frame*) { }
    443443    virtual void didEndEditing() { }
     444    virtual void willWriteSelectionToPasteboard(Range*) { }
    444445    virtual void didWriteSelectionToPasteboard() { }
     446    virtual void getClientPasteboardDataForRange(Range*, Vector<String>&, Vector<RefPtr<SharedBuffer> >&) { }
    445447    virtual void didSetSelectionTypesForPasteboard() { }
    446448
  • trunk/Source/WebCore/page/EditorClient.h

    r127862 r141473  
    5353class Node;
    5454class Range;
     55class SharedBuffer;
    5556class SpellChecker;
    5657class StylePropertySet;
     
    9091    virtual void respondToChangedSelection(Frame*) = 0;
    9192    virtual void didEndEditing() = 0;
     93    virtual void willWriteSelectionToPasteboard(Range*) = 0;
    9294    virtual void didWriteSelectionToPasteboard() = 0;
     95    virtual void getClientPasteboardDataForRange(Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<SharedBuffer> >& pasteboardData) = 0;
    9396    virtual void didSetSelectionTypesForPasteboard() = 0;
    9497   
  • trunk/Source/WebCore/platform/mac/PasteboardMac.mm

    r139111 r141473  
    183183        attributedString = [converter.get() attributedString];
    184184   
    185     const Vector<String> types = !pasteboardTypes.isEmpty() ? pasteboardTypes : selectionPasteboardTypes(canSmartCopyOrDelete, [attributedString containsAttachments]);
     185    Vector<String> types = !pasteboardTypes.isEmpty() ? pasteboardTypes : selectionPasteboardTypes(canSmartCopyOrDelete, [attributedString containsAttachments]);
     186
     187    Vector<String> clientTypes;
     188    Vector<RefPtr<SharedBuffer> > clientData;
     189    frame->editor()->client()->getClientPasteboardDataForRange(frame->editor()->selectedRange().get(), clientTypes, clientData);
     190    types.append(clientTypes);
     191
    186192    platformStrategies()->pasteboardStrategy()->setTypes(types, m_pasteboardName);
    187193    frame->editor()->client()->didSetSelectionTypesForPasteboard();
    188    
     194
     195    for (size_t i = 0; i < clientTypes.size(); ++i)
     196        platformStrategies()->pasteboardStrategy()->setBufferForType(clientData[i], clientTypes[i], m_pasteboardName);
     197
    189198    // Put HTML on the pasteboard.
    190199    if (types.contains(WebArchivePboardType))
  • trunk/Source/WebKit/blackberry/ChangeLog

    r141284 r141473  
     12013-01-31  Enrica Casucci  <enrica@apple.com>
     2
     3        WebKit2: provide new bundle APIs to allow bundle clients to be notified of pasteboard access.
     4        https://bugs.webkit.org/show_bug.cgi?id=108396.
     5        <rdar://problem/12920461>
     6
     7        Reviewed by Alexey Proskuryakov.
     8
     9        Adds stub implementation for WebKit of the new EditorClient methods.
     10
     11        * WebCoreSupport/EditorClientBlackBerry.cpp:
     12        (WebCore::EditorClientBlackBerry::willWriteSelectionToPasteboard):
     13        (WebCore::EditorClientBlackBerry::getClientPasteboardDataForRange):
     14        * WebCoreSupport/EditorClientBlackBerry.h:
     15
    1162013-01-30  Ed Baker  <edbaker@rim.com>
    217
  • trunk/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp

    r138839 r141473  
    250250
    251251void EditorClientBlackBerry::didWriteSelectionToPasteboard()
     252{
     253    notImplemented();
     254}
     255
     256void EditorClientBlackBerry::willWriteSelectionToPasteboard(WebCore::Range*)
     257{
     258    notImplemented();
     259}
     260
     261void EditorClientBlackBerry::getClientPasteboardDataForRange(WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer> >& pasteboardData)
    252262{
    253263    notImplemented();
  • trunk/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.h

    r123809 r141473  
    6060    virtual void respondToSelectionAppearanceChange();
    6161    virtual void didEndEditing();
     62    virtual void willWriteSelectionToPasteboard(WebCore::Range*);
    6263    virtual void didWriteSelectionToPasteboard();
     64    virtual void getClientPasteboardDataForRange(WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer> >& pasteboardData);
    6365    virtual void didSetSelectionTypesForPasteboard();
    6466    virtual void registerUndoStep(PassRefPtr<UndoStep>);
  • trunk/Source/WebKit/chromium/ChangeLog

    r141470 r141473  
     12013-01-31  Enrica Casucci  <enrica@apple.com>
     2
     3        WebKit2: provide new bundle APIs to allow bundle clients to be notified of pasteboard access.
     4        https://bugs.webkit.org/show_bug.cgi?id=108396.
     5        <rdar://problem/12920461>
     6
     7        Reviewed by Alexey Proskuryakov.
     8
     9        Adds stub implementation for WebKit of the new EditorClient methods.
     10
     11        * src/EditorClientImpl.cpp:
     12        (WebKit::EditorClientImpl::willWriteSelectionToPasteboard):
     13        (WebKit::EditorClientImpl::getClientPasteboardDataForRange):
     14        * src/EditorClientImpl.h:
     15
    1162013-01-31  Chris Hopman  <cjhopman@chromium.org>
    217
  • trunk/Source/WebKit/chromium/src/EditorClientImpl.cpp

    r138220 r141473  
    287287
    288288void EditorClientImpl::didWriteSelectionToPasteboard()
     289{
     290}
     291
     292void EditorClientImpl::willWriteSelectionToPasteboard(WebCore::Range*)
     293{
     294}
     295
     296void EditorClientImpl::getClientPasteboardDataForRange(WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer> >& pasteboardData)
    289297{
    290298}
  • trunk/Source/WebKit/chromium/src/EditorClientImpl.h

    r127862 r141473  
    7676    virtual void respondToChangedSelection(WebCore::Frame*);
    7777    virtual void didEndEditing();
     78    virtual void willWriteSelectionToPasteboard(WebCore::Range*);
    7879    virtual void didWriteSelectionToPasteboard();
     80    virtual void getClientPasteboardDataForRange(WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer> >& pasteboardData);
    7981    virtual void didSetSelectionTypesForPasteboard();
    8082    virtual void registerUndoStep(PassRefPtr<WebCore::UndoStep>);
  • trunk/Source/WebKit/efl/ChangeLog

    r141439 r141473  
     12013-01-31  Enrica Casucci  <enrica@apple.com>
     2
     3        WebKit2: provide new bundle APIs to allow bundle clients to be notified of pasteboard access.
     4        https://bugs.webkit.org/show_bug.cgi?id=108396.
     5        <rdar://problem/12920461>
     6
     7        Reviewed by Alexey Proskuryakov.
     8
     9        Adds stub implementation for WebKit of the new EditorClient methods.
     10
     11        * WebCoreSupport/EditorClientEfl.cpp:
     12        (WebCore::EditorClientEfl::willWriteSelectionToPasteboard):
     13        (WebCore::EditorClientEfl::getClientPasteboardDataForRange):
     14        * WebCoreSupport/EditorClientEfl.h:
     15
    1162013-01-31  Christophe Dumez  <dchris@gmail.com>
    217
  • trunk/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp

    r129212 r141473  
    171171{
    172172    notImplemented();
     173}
     174
     175void EditorClientEfl::willWriteSelectionToPasteboard(WebCore::Range*)
     176{
     177}
     178
     179void EditorClientEfl::getClientPasteboardDataForRange(WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer> >& pasteboardData)
     180{
    173181}
    174182
  • trunk/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h

    r141387 r141473  
    109109    virtual void respondToChangedSelection(Frame*);
    110110    virtual void didEndEditing();
     111    virtual void willWriteSelectionToPasteboard(WebCore::Range*);
    111112    virtual void didWriteSelectionToPasteboard();
     113    virtual void getClientPasteboardDataForRange(WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer> >& pasteboardData);
    112114    virtual void didSetSelectionTypesForPasteboard();
    113115
  • trunk/Source/WebKit/gtk/ChangeLog

    r141238 r141473  
     12013-01-31  Enrica Casucci  <enrica@apple.com>
     2
     3        WebKit2: provide new bundle APIs to allow bundle clients to be notified of pasteboard access.
     4        https://bugs.webkit.org/show_bug.cgi?id=108396.
     5        <rdar://problem/12920461>
     6
     7        Reviewed by Alexey Proskuryakov.
     8
     9        Adds stub implementation for WebKit of the new EditorClient methods.
     10
     11        * WebCoreSupport/EditorClientGtk.cpp:
     12        (WebKit::EditorClient::willWriteSelectionToPasteboard):
     13        (WebKit::EditorClient::getClientPasteboardDataForRange):
     14        * WebCoreSupport/EditorClientGtk.h:
     15
    1162013-01-30  Huang Dongsung  <luxtella@company100.net>
    217
  • trunk/Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp

    r140336 r141473  
    282282}
    283283
     284void EditorClient::willWriteSelectionToPasteboard(WebCore::Range*)
     285{
     286}
     287
     288void EditorClient::getClientPasteboardDataForRange(WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer> >& pasteboardData)
     289{
     290}
     291
    284292void EditorClient::didSetSelectionTypesForPasteboard()
    285293{
  • trunk/Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.h

    r129750 r141473  
    9999        virtual void respondToChangedSelection(WebCore::Frame*);
    100100        virtual void didEndEditing();
     101        virtual void willWriteSelectionToPasteboard(WebCore::Range*);
    101102        virtual void didWriteSelectionToPasteboard();
     103        virtual void getClientPasteboardDataForRange(WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer> >& pasteboardData);
    102104        virtual void didSetSelectionTypesForPasteboard();
    103105
  • trunk/Source/WebKit/mac/ChangeLog

    r141447 r141473  
     12013-01-31  Enrica Casucci  <enrica@apple.com>
     2
     3        WebKit2: provide new bundle APIs to allow bundle clients to be notified of pasteboard access.
     4        https://bugs.webkit.org/show_bug.cgi?id=108396.
     5        <rdar://problem/12920461>
     6
     7        Reviewed by Alexey Proskuryakov.
     8
     9        Adds stub implementation for WebKit of the new EditorClient methods.
     10
     11        * WebCoreSupport/WebEditorClient.h:
     12        * WebCoreSupport/WebEditorClient.mm:
     13        (WebEditorClient::willWriteSelectionToPasteboard):
     14        (WebEditorClient::getClientPasteboardDataForRange):
     15
    1162013-01-31  Brady Eidson  <beidson@apple.com>
    217
  • trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h

    r119687 r141473  
    6868    virtual void didBeginEditing() OVERRIDE;
    6969    virtual void didEndEditing() OVERRIDE;
     70    virtual void willWriteSelectionToPasteboard(WebCore::Range*) OVERRIDE;
    7071    virtual void didWriteSelectionToPasteboard() OVERRIDE;
     72    virtual void getClientPasteboardDataForRange(WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer> >& pasteboardData) OVERRIDE;
    7173    virtual void didSetSelectionTypesForPasteboard() OVERRIDE;
    7274
  • trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm

    r127757 r141473  
    310310{
    311311    [[m_webView _editingDelegateForwarder] webView:m_webView didWriteSelectionToPasteboard:[NSPasteboard generalPasteboard]];
     312}
     313
     314void WebEditorClient::willWriteSelectionToPasteboard(WebCore::Range*)
     315{
     316    // Not implemented WebKit, only WebKit2.
     317}
     318
     319void WebEditorClient::getClientPasteboardDataForRange(WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer> >& pasteboardData)
     320{
     321    // Not implemented WebKit, only WebKit2.
    312322}
    313323
  • trunk/Source/WebKit/qt/ChangeLog

    r141268 r141473  
     12013-01-31  Enrica Casucci  <enrica@apple.com>
     2
     3        WebKit2: provide new bundle APIs to allow bundle clients to be notified of pasteboard access.
     4        https://bugs.webkit.org/show_bug.cgi?id=108396.
     5        <rdar://problem/12920461>
     6
     7        Reviewed by Alexey Proskuryakov.
     8
     9        Adds stub implementation for WebKit of the new EditorClient methods.
     10
     11        * WebCoreSupport/EditorClientQt.cpp:
     12        (WebCore::EditorClientQt::willWriteSelectionToPasteboard):
     13        (WebCore::EditorClientQt::getClientPasteboardDataForRange):
     14        * WebCoreSupport/EditorClientQt.h:
     15
    1162013-01-30  Allan Sandfeld Jensen  <allan.jensen@digia.com>
    217
  • trunk/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp

    r135515 r141473  
    234234}
    235235
     236void EditorClientQt::willWriteSelectionToPasteboard(Range*)
     237{
     238}
     239
     240void EditorClientQt::getClientPasteboardDataForRange(Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<SharedBuffer> >& pasteboardData)
     241{
     242}
     243
    236244void EditorClientQt::didSetSelectionTypesForPasteboard()
    237245{
  • trunk/Source/WebKit/qt/WebCoreSupport/EditorClientQt.h

    r135515 r141473  
    7474    virtual void respondToChangedSelection(Frame*);
    7575    virtual void didEndEditing();
     76    virtual void willWriteSelectionToPasteboard(Range*);
    7677    virtual void didWriteSelectionToPasteboard();
     78    virtual void getClientPasteboardDataForRange(Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer> >& pasteboardData);
    7779    virtual void didSetSelectionTypesForPasteboard();
    7880   
  • trunk/Source/WebKit/win/ChangeLog

    r141196 r141473  
     12013-01-31  Enrica Casucci  <enrica@apple.com>
     2
     3        WebKit2: provide new bundle APIs to allow bundle clients to be notified of pasteboard access.
     4        https://bugs.webkit.org/show_bug.cgi?id=108396.
     5        <rdar://problem/12920461>
     6
     7        Reviewed by Alexey Proskuryakov.
     8
     9        Adds stub implementation for WebKit of the new EditorClient methods.
     10
     11        * WebCoreSupport/WebEditorClient.cpp:
     12        (WebEditorClient::willWriteSelectionToPasteboard):
     13        (WebEditorClient::getClientPasteboardDataForRange):
     14        * WebCoreSupport/WebEditorClient.h:
     15
    1162013-01-29  Shinya Kawanaka  <shinyak@chromium.org>
    217
  • trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.cpp

    r128988 r141473  
    224224
    225225void WebEditorClient::didWriteSelectionToPasteboard()
     226{
     227    notImplemented();
     228}
     229
     230void WebEditorClient::willWriteSelectionToPasteboard(WebCore::Range*)
     231{
     232    notImplemented();
     233}
     234
     235void WebEditorClient::getClientPasteboardDataForRange(WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer> >& pasteboardData)
    226236{
    227237    notImplemented();
  • trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.h

    r119192 r141473  
    5656    virtual void didBeginEditing();
    5757    virtual void didEndEditing();
     58    virtual void willWriteSelectionToPasteboard(WebCore::Range*);
    5859    virtual void didWriteSelectionToPasteboard();
     60    virtual void getClientPasteboardDataForRange(WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer> >& pasteboardData);
    5961    virtual void didSetSelectionTypesForPasteboard();
    6062
  • trunk/Source/WebKit/wince/ChangeLog

    r140909 r141473  
     12013-01-31  Enrica Casucci  <enrica@apple.com>
     2
     3        WebKit2: provide new bundle APIs to allow bundle clients to be notified of pasteboard access.
     4        https://bugs.webkit.org/show_bug.cgi?id=108396.
     5        <rdar://problem/12920461>
     6
     7        Reviewed by Alexey Proskuryakov.
     8
     9        Adds stub implementation for WebKit of the new EditorClient methods.
     10
     11        * WebCoreSupport/EditorClientWinCE.cpp:
     12        (WebKit::EditorClientWinCE::willWriteSelectionToPasteboard):
     13        (WebKit::EditorClientWinCE::getClientPasteboardDataForRange):
     14        * WebCoreSupport/EditorClientWinCE.h:
     15
    1162013-01-24  Patrick Gansterer  <paroga@webkit.org>
    217
  • trunk/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.cpp

    r117470 r141473  
    136136
    137137void EditorClientWinCE::didWriteSelectionToPasteboard()
     138{
     139    notImplemented();
     140}
     141
     142void EditorClientWinCE::willWriteSelectionToPasteboard(WebCore::Range*)
     143{
     144    notImplemented();
     145}
     146
     147void EditorClientWinCE::getClientPasteboardDataForRange(WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer> >& pasteboardData)
    138148{
    139149    notImplemented();
  • trunk/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.h

    r119192 r141473  
    6464    virtual void respondToChangedSelection(WebCore::Frame*);
    6565    virtual void didEndEditing();
     66    virtual void willWriteSelectionToPasteboard(WebCore::Range*);
    6667    virtual void didWriteSelectionToPasteboard();
     68    virtual void getClientPasteboardDataForRange(WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer> >& pasteboardData);
    6769    virtual void didSetSelectionTypesForPasteboard();
    6870
  • trunk/Source/WebKit/wx/ChangeLog

    r140718 r141473  
     12013-01-31  Enrica Casucci  <enrica@apple.com>
     2
     3        WebKit2: provide new bundle APIs to allow bundle clients to be notified of pasteboard access.
     4        https://bugs.webkit.org/show_bug.cgi?id=108396.
     5        <rdar://problem/12920461>
     6
     7        Reviewed by Alexey Proskuryakov.
     8
     9        Adds stub implementation for WebKit of the new EditorClient methods.
     10
     11        * WebKitSupport/EditorClientWx.cpp:
     12        (WebCore::EditorClientWx::willWriteSelectionToPasteboard):
     13        (WebCore::EditorClientWx::getClientPasteboardDataForRange):
     14        * WebKitSupport/EditorClientWx.h:
     15
    1162013-01-24  Mark Hahnenberg  <mhahnenberg@apple.com>
    217
  • trunk/Source/WebKit/wx/WebKitSupport/EditorClientWx.cpp

    r127757 r141473  
    274274}
    275275
     276void EditorClientWx::willWriteSelectionToPasteboard(WebCore::Range*)
     277{
     278    notImplemented();
     279}
     280
     281void EditorClientWx::getClientPasteboardDataForRange(WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer> >& pasteboardData)
     282{
     283    notImplemented();
     284}
     285
    276286void EditorClientWx::didSetSelectionTypesForPasteboard()
    277287{
  • trunk/Source/WebKit/wx/WebKitSupport/EditorClientWx.h

    r119192 r141473  
    7676    virtual void respondToChangedSelection(Frame*);
    7777    virtual void didEndEditing();
     78    virtual void willWriteSelectionToPasteboard(WebCore::Range*);
    7879    virtual void didWriteSelectionToPasteboard();
     80    virtual void getClientPasteboardDataForRange(WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer> >& pasteboardData);
    7981    virtual void didSetSelectionTypesForPasteboard();
    8082
  • trunk/Source/WebKit2/ChangeLog

    r141472 r141473  
     12013-01-31  Enrica Casucci  <enrica@apple.com>
     2
     3        WebKit2: provide new bundle APIs to allow bundle clients to be notified of pasteboard access.
     4        https://bugs.webkit.org/show_bug.cgi?id=108396.
     5        <rdar://problem/12920461>
     6
     7        Reviewed by Alexey Proskuryakov.
     8
     9        This patch adds new bundle client API to receive notifications
     10        relative the pasteboard activity. There are 2 new API added to
     11        InjectedBundleEditorClient, to receive notification before and
     12        after the pasteboard content is added and one API to provide
     13        additional content to add to the pasteboard.
     14        In order to create content to add to the pasteboard, WKWebArchiveRef
     15        and WKWebArchiveResourcesRef have been added to the set of API level
     16        object.
     17        This work is a joint effort with Sam Weinig who contributed the
     18        support for WKWebArchiveRef, WKWebArchiveResourcesRef and related
     19        files. Sam is the author of the first chunk of changes listed below.
     20       
     21        * Shared/API/c/WKBase.h:
     22        * Shared/API/c/WKSharedAPICast.h:
     23        * Shared/API/c/mac/WKWebArchive.cpp: Added.
     24        (WKWebArchiveGetTypeID):
     25        (WKWebArchiveCreate):
     26        (WKWebArchiveCreateWithData):
     27        (WKWebArchiveCreateFromRange):
     28        (WKWebArchiveCopyMainResource):
     29        (WKWebArchiveCopySubresources):
     30        (WKWebArchiveCopySubframeArchives):
     31        (WKWebArchiveCopyData):
     32        * Shared/API/c/mac/WKWebArchive.h: Added.
     33        * Shared/API/c/mac/WKWebArchiveResource.cpp: Added.
     34        (WKWebArchiveResourceGetTypeID):
     35        (WKWebArchiveResourceCreate):
     36        (WKWebArchiveResourceCopyData):
     37        (WKWebArchiveResourceCopyURL):
     38        (WKWebArchiveResourceCopyMIMEType):
     39        (WKWebArchiveResourceCopyTextEncoding):
     40        * Shared/API/c/mac/WKWebArchiveResource.h: Added.
     41        * Shared/APIObject.h:
     42        * Shared/WebArchive.cpp: Added.
     43        (WebKit::WebArchive::create):
     44        (WebKit::WebArchive::WebArchive):
     45        (WebKit::WebArchive::~WebArchive):
     46        (WebKit::WebArchive::mainResource):
     47        (WebKit::WebArchive::subresources):
     48        (WebKit::WebArchive::subframeArchives):
     49        (WebKit::releaseCFData):
     50        (WebKit::WebArchive::data):
     51        (WebKit::WebArchive::coreLegacyWebArchive):
     52        * Shared/WebArchive.h: Added.
     53        (WebKit::WebArchive::type):
     54        * Shared/WebArchiveResource.cpp: Added.
     55        (WebKit::WebArchiveResource::create):
     56        (WebKit::WebArchiveResource::WebArchiveResource):
     57        (WebKit::WebArchiveResource::~WebArchiveResource):
     58        (WebKit::releaseCFData):
     59        (WebKit::WebArchiveResource::data):
     60        (WebKit::WebArchiveResource::URL):
     61        (WebKit::WebArchiveResource::MIMEType):
     62        (WebKit::WebArchiveResource::textEncoding):
     63        (WebKit::WebArchiveResource::coreArchiveResource):
     64        * Shared/WebArchiveResource.h: Added.
     65        (WebKit::WebArchiveResource::type):
     66        * WebKit2.xcodeproj/project.pbxproj:
     67       
     68        * Shared/APIClientTraits.cpp: Added versioning to InjectedBundlePageEditorClient.
     69        * Shared/APIClientTraits.h:
     70        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
     71        * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
     72        (WebKit::InjectedBundlePageEditorClient::willWriteToPasteboard): Added.
     73        (WebKit::InjectedBundlePageEditorClient::getPasteboardDataForRange): Added.
     74        (WebKit::InjectedBundlePageEditorClient::didWriteToPasteboard): Added.
     75        * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h:
     76        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
     77        (WebKit::WebEditorClient::didWriteSelectionToPasteboard):
     78        (WebKit::WebEditorClient::willWriteSelectionToPasteboard):
     79        (WebKit::WebEditorClient::getClientPasteboardDataForRange):
     80        * WebProcess/WebCoreSupport/WebEditorClient.h:
     81
    1822013-01-31  Anders Carlsson  <andersca@apple.com>
    283
  • trunk/Source/WebKit2/Shared/API/c/WKBase.h

    r141448 r141473  
    7979typedef const struct OpaqueWKURLResponse* WKURLResponseRef;
    8080typedef const struct OpaqueWKUserContentURLPattern* WKUserContentURLPatternRef;
     81typedef const struct OpaqueWKWebArchive* WKWebArchiveRef;
     82typedef const struct OpaqueWKWebArchiveResource* WKWebArchiveResourceRef;
    8183
    8284enum WKUserContentInjectedFrames {
  • trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h

    r141010 r141473  
    6363class MutableArray;
    6464class MutableDictionary;
     65class WebArchive;
     66class WebArchiveResource;
    6567class WebCertificateInfo;
    6668class WebConnection;
     
    110112WK_ADD_API_MAPPING(WKURLResponseRef, WebURLResponse)
    111113WK_ADD_API_MAPPING(WKUserContentURLPatternRef, WebUserContentURLPattern)
     114
     115#if PLATFORM(MAC)
     116WK_ADD_API_MAPPING(WKWebArchiveRef, WebArchive)
     117WK_ADD_API_MAPPING(WKWebArchiveResourceRef, WebArchiveResource)
     118#endif
    112119
    113120template<typename ImplType, typename APIType = typename ImplTypeInfo<ImplType*>::APIType>
  • trunk/Source/WebKit2/Shared/APIClientTraits.cpp

    r141448 r141473  
    7878};
    7979
     80const size_t APIClientTraits<WKBundlePageEditorClient>::interfaceSizesByVersion[] = {
     81    offsetof(WKBundlePageEditorClient, willWriteToPasteboard),
     82    sizeof(WKBundlePageEditorClient)
     83};
     84
    8085const size_t APIClientTraits<WKBundlePageUIClient>::interfaceSizesByVersion[] = {
    8186    offsetof(WKBundlePageUIClient, didReachApplicationCacheOriginQuota),
  • trunk/Source/WebKit2/Shared/APIClientTraits.h

    r129810 r141473  
    7676};
    7777
     78template<> struct APIClientTraits<WKBundlePageEditorClient> {
     79    static const size_t interfaceSizesByVersion[2];
     80};
     81
    7882template<> struct APIClientTraits<WKContextInjectedBundleClient> {
    7983    static const size_t interfaceSizesByVersion[2];
  • trunk/Source/WebKit2/Shared/APIObject.h

    r141448 r141473  
    5858        TypeURLResponse,
    5959        TypeUserContentURLPattern,
     60        TypeWebArchive,
     61        TypeWebArchiveResource,
    6062
    6163        // Base numeric types
  • trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r141472 r141473  
    10241024                C574A58112E66681002DFE98 /* PasteboardTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = C574A57F12E66681002DFE98 /* PasteboardTypes.h */; };
    10251025                C574A58212E66681002DFE98 /* PasteboardTypes.mm in Sources */ = {isa = PBXBuildFile; fileRef = C574A58012E66681002DFE98 /* PasteboardTypes.mm */; };
     1026                C5E1AFE816B20B67006CC1F2 /* WKWebArchive.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC329DA516ACE5A900316DE2 /* WKWebArchive.cpp */; };
     1027                C5E1AFE916B20B75006CC1F2 /* WKWebArchive.h in Headers */ = {isa = PBXBuildFile; fileRef = BC329DA616ACE5A900316DE2 /* WKWebArchive.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1028                C5E1AFEA16B20B7B006CC1F2 /* WKWebArchiveResource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC329DA916ACE5BF00316DE2 /* WKWebArchiveResource.cpp */; };
     1029                C5E1AFEB16B20B7E006CC1F2 /* WKWebArchiveResource.h in Headers */ = {isa = PBXBuildFile; fileRef = BC329DAA16ACE5C000316DE2 /* WKWebArchiveResource.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1030                C5E1AFEC16B21012006CC1F2 /* WebArchive.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC329D9916ACCE9900316DE2 /* WebArchive.cpp */; };
     1031                C5E1AFED16B21017006CC1F2 /* WebArchive.h in Headers */ = {isa = PBXBuildFile; fileRef = BC329D9A16ACCE9900316DE2 /* WebArchive.h */; };
     1032                C5E1AFEE16B21025006CC1F2 /* WebArchiveResource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC329D9E16ACD47800316DE2 /* WebArchiveResource.cpp */; };
     1033                C5E1AFEF16B21029006CC1F2 /* WebArchiveResource.h in Headers */ = {isa = PBXBuildFile; fileRef = BC329D9F16ACD47800316DE2 /* WebArchiveResource.h */; };
    10261034                CD5C66A0134B9D38004FE2A8 /* InjectedBundlePageFullScreenClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD5C669E134B9D36004FE2A8 /* InjectedBundlePageFullScreenClient.cpp */; };
    10271035                CD5C66A1134B9D38004FE2A8 /* InjectedBundlePageFullScreenClient.h in Headers */ = {isa = PBXBuildFile; fileRef = CD5C669F134B9D37004FE2A8 /* InjectedBundlePageFullScreenClient.h */; };
     
    20232031                BC306822125A6B9400E71278 /* WebProcessCreationParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcessCreationParameters.h; sourceTree = "<group>"; };
    20242032                BC306823125A6B9400E71278 /* WebProcessCreationParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebProcessCreationParameters.cpp; sourceTree = "<group>"; };
     2033                BC329D9916ACCE9900316DE2 /* WebArchive.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebArchive.cpp; sourceTree = "<group>"; };
     2034                BC329D9A16ACCE9900316DE2 /* WebArchive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebArchive.h; sourceTree = "<group>"; };
     2035                BC329D9E16ACD47800316DE2 /* WebArchiveResource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebArchiveResource.cpp; sourceTree = "<group>"; };
     2036                BC329D9F16ACD47800316DE2 /* WebArchiveResource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebArchiveResource.h; sourceTree = "<group>"; };
     2037                BC329DA516ACE5A900316DE2 /* WKWebArchive.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKWebArchive.cpp; sourceTree = "<group>"; };
     2038                BC329DA616ACE5A900316DE2 /* WKWebArchive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebArchive.h; sourceTree = "<group>"; };
     2039                BC329DA916ACE5BF00316DE2 /* WKWebArchiveResource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKWebArchiveResource.cpp; sourceTree = "<group>"; };
     2040                BC329DAA16ACE5C000316DE2 /* WKWebArchiveResource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebArchiveResource.h; sourceTree = "<group>"; };
    20252041                BC33DD671238464600360F3F /* WebNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNumber.h; sourceTree = "<group>"; };
    20262042                BC33E0CF12408E8600360F3F /* InjectedBundleRangeHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleRangeHandle.h; sourceTree = "<group>"; };
     
    29822998                                1A0F29C9120B37160053D1B9 /* VisitedLinkTable.cpp */,
    29832999                                1A0F29CA120B37160053D1B9 /* VisitedLinkTable.h */,
     3000                                BC329D9916ACCE9900316DE2 /* WebArchive.cpp */,
     3001                                BC329D9A16ACCE9900316DE2 /* WebArchive.h */,
     3002                                BC329D9E16ACD47800316DE2 /* WebArchiveResource.cpp */,
     3003                                BC329D9F16ACD47800316DE2 /* WebArchiveResource.h */,
    29843004                                518D2CAB12D5153B003BB93B /* WebBackForwardListItem.cpp */,
    29853005                                518D2CAC12D5153B003BB93B /* WebBackForwardListItem.h */,
     
    41454165                                BC407625124FF0400068F20A /* WKURLResponseNS.h */,
    41464166                                BC407626124FF0400068F20A /* WKURLResponseNS.mm */,
     4167                                BC329DA516ACE5A900316DE2 /* WKWebArchive.cpp */,
     4168                                BC329DA616ACE5A900316DE2 /* WKWebArchive.h */,
     4169                                BC329DA916ACE5BF00316DE2 /* WKWebArchiveResource.cpp */,
     4170                                BC329DAA16ACE5C000316DE2 /* WKWebArchiveResource.h */,
    41474171                        );
    41484172                        path = mac;
     
    53205344                                519B4FF516A9EA970066874D /* SchedulableLoader.h in Headers */,
    53215345                                E1E552C516AE065F004ED653 /* SandboxInitializationParameters.h in Headers */,
     5346                                C5E1AFE916B20B75006CC1F2 /* WKWebArchive.h in Headers */,
     5347                                C5E1AFEB16B20B7E006CC1F2 /* WKWebArchiveResource.h in Headers */,
     5348                                C5E1AFED16B21017006CC1F2 /* WebArchive.h in Headers */,
     5349                                C5E1AFEF16B21029006CC1F2 /* WebArchiveResource.h in Headers */,
    53225350                                1AAC4DE716B1CBF6009425E3 /* WebKeyValueStorageManager.h in Headers */,
    53235351                                1AD3306F16B1D991004F60E7 /* StorageAreaProxy.h in Headers */,
     
    64306458                                519B4FF416A9EA970066874D /* SchedulableLoader.cpp in Sources */,
    64316459                                E1E552C416AE065F004ED653 /* SandboxInitialiationParametersMac.mm in Sources */,
     6460                                C5E1AFE816B20B67006CC1F2 /* WKWebArchive.cpp in Sources */,
     6461                                C5E1AFEA16B20B7B006CC1F2 /* WKWebArchiveResource.cpp in Sources */,
     6462                                C5E1AFEC16B21012006CC1F2 /* WebArchive.cpp in Sources */,
     6463                                C5E1AFEE16B21025006CC1F2 /* WebArchiveResource.cpp in Sources */,
    64326464                                1AAC4DE616B1CBF6009425E3 /* WebKeyValueStorageManager.cpp in Sources */,
    64336465                                1AD3306E16B1D991004F60E7 /* StorageAreaProxy.cpp in Sources */,
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h

    r141448 r141473  
    293293typedef bool (*WKBundlePageShouldApplyStyle)(WKBundlePageRef page, WKBundleCSSStyleDeclarationRef style, WKBundleRangeHandleRef range, const void* clientInfo);
    294294typedef void (*WKBundlePageEditingNotification)(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo);
     295typedef void (*WKBundlePageWillWriteToPasteboard)(WKBundlePageRef page, WKBundleRangeHandleRef range,  const void* clientInfo);
     296typedef void (*WKBundlePageGetPasteboardDataForRange)(WKBundlePageRef page, WKBundleRangeHandleRef range, WKArrayRef* pasteboardTypes, WKArrayRef* pasteboardData, const void* clientInfo);
     297typedef void (*WKBundlePageDidWriteToPasteboard)(WKBundlePageRef page, const void* clientInfo);
    295298
    296299struct WKBundlePageEditorClient {
     
    308311    WKBundlePageEditingNotification                                     didChange;
    309312    WKBundlePageEditingNotification                                     didChangeSelection;
     313    // Version 1.
     314    WKBundlePageWillWriteToPasteboard                                   willWriteToPasteboard;
     315    WKBundlePageGetPasteboardDataForRange                               getPasteboardDataForRange;
     316    WKBundlePageDidWriteToPasteboard                                    didWriteToPasteboard;
    310317};
    311318typedef struct WKBundlePageEditorClient WKBundlePageEditorClient;
    312319
    313 enum { kWKBundlePageEditorClientCurrentVersion = 0 };
     320enum { kWKBundlePageEditorClientCurrentVersion = 1 };
    314321
    315322// Form client
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp

    r95901 r141473  
    2727#include "InjectedBundlePageEditorClient.h"
    2828
     29#include "ImmutableArray.h"
    2930#include "InjectedBundleNodeHandle.h"
    3031#include "InjectedBundleRangeHandle.h"
    3132#include "WKAPICast.h"
    3233#include "WKBundleAPICast.h"
     34#include "WKString.h"
     35#include "WebData.h"
    3336#include <wtf/text/WTFString.h>
    3437
     
    126129}
    127130
     131void InjectedBundlePageEditorClient::willWriteToPasteboard(WebPage* page, Range* range)
     132{
     133    if (m_client.willWriteToPasteboard) {
     134        RefPtr<InjectedBundleRangeHandle> rangeHandle = InjectedBundleRangeHandle::getOrCreate(range);
     135        m_client.willWriteToPasteboard(toAPI(page), toAPI(rangeHandle.get()), m_client.clientInfo);
     136    }
     137}
     138
     139void InjectedBundlePageEditorClient::getPasteboardDataForRange(WebPage* page, Range* range, Vector<String>& pasteboardTypes, Vector<RefPtr<SharedBuffer> >& pasteboardData)
     140{
     141    if (m_client.getPasteboardDataForRange) {
     142        RefPtr<InjectedBundleRangeHandle> rangeHandle = InjectedBundleRangeHandle::getOrCreate(range);
     143        WKArrayRef types = 0;
     144        WKArrayRef data = 0;
     145        m_client.getPasteboardDataForRange(toAPI(page), toAPI(rangeHandle.get()), &types, &data, m_client.clientInfo);
     146        RefPtr<ImmutableArray> typesArray = adoptRef(toImpl(types));
     147        RefPtr<ImmutableArray> dataArray = adoptRef(toImpl(data));
     148
     149        pasteboardTypes.clear();
     150        pasteboardData.clear();
     151
     152        if (!typesArray || !dataArray)
     153            return;
     154
     155        ASSERT(typesArray->size() == dataArray->size());
     156
     157        size_t size = typesArray->size();
     158        for (size_t i = 0; i < size; ++i) {
     159            WebString* type = typesArray->at<WebString>(i);
     160            if (type)
     161                pasteboardTypes.append(type->string());
     162        }
     163
     164        size = dataArray->size();
     165        for (size_t i = 0; i < size; ++i) {
     166            WebData* item = dataArray->at<WebData>(i);
     167            if (item) {
     168                RefPtr<SharedBuffer> buffer = SharedBuffer::create(item->bytes(), item->size());
     169                pasteboardData.append(buffer);
     170            }
     171        }
     172    }
     173}
     174
     175void InjectedBundlePageEditorClient::didWriteToPasteboard(WebPage* page)
     176{
     177    if (m_client.didWriteToPasteboard)
     178        m_client.didWriteToPasteboard(toAPI(page), m_client.clientInfo);
     179}
     180
    128181} // namespace WebKit
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h

    r95901 r141473  
    3030#include "WKBundlePage.h"
    3131#include <WebCore/EditorInsertAction.h>
     32#include <WebCore/SharedBuffer.h>
    3233#include <WebCore/TextAffinity.h>
    3334#include <wtf/Forward.h>
     
    3738    class Node;
    3839    class Range;
     40    class SharedBuffer;
    3941}
    4042
     
    5759    void didChange(WebPage*, StringImpl* notificationName);
    5860    void didChangeSelection(WebPage*, StringImpl* notificationName);
     61    void willWriteToPasteboard(WebPage*, WebCore::Range*);
     62    void getPasteboardDataForRange(WebPage*, WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer> >& pasteboardData);
     63    void didWriteToPasteboard(WebPage*);
    5964};
    6065
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp

    r139023 r141473  
    221221void WebEditorClient::didWriteSelectionToPasteboard()
    222222{
    223     notImplemented();
     223    m_page->injectedBundleEditorClient().didWriteToPasteboard(m_page);
     224}
     225
     226void WebEditorClient::willWriteSelectionToPasteboard(Range* range)
     227{
     228    m_page->injectedBundleEditorClient().willWriteToPasteboard(m_page, range);
     229}
     230
     231void WebEditorClient::getClientPasteboardDataForRange(Range* range, Vector<String>& pasteboardTypes, Vector<RefPtr<SharedBuffer> >& pasteboardData)
     232{
     233    m_page->injectedBundleEditorClient().getPasteboardDataForRange(m_page, range, pasteboardTypes, pasteboardData);
    224234}
    225235
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h

    r141387 r141473  
    6868    virtual void respondToChangedSelection(WebCore::Frame*) OVERRIDE;
    6969    virtual void didEndEditing() OVERRIDE;
     70    virtual void willWriteSelectionToPasteboard(WebCore::Range*) OVERRIDE;
    7071    virtual void didWriteSelectionToPasteboard() OVERRIDE;
     72    virtual void getClientPasteboardDataForRange(WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer> >& pasteboardData) OVERRIDE;
    7173    virtual void didSetSelectionTypesForPasteboard() OVERRIDE;
    7274   
  • trunk/Tools/ChangeLog

    r141471 r141473  
     12013-01-31  Enrica Casucci  <enrica@apple.com>
     2
     3        WebKit2: provide new bundle APIs to allow bundle clients to be notified of pasteboard access.
     4        https://bugs.webkit.org/show_bug.cgi?id=108396.
     5        <rdar://problem/12920461>
     6
     7        Reviewed by Alexey Proskuryakov.
     8       
     9        Adding new WebKit2 test with relevant bundle, to test the new APIs.
     10
     11        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     12        * TestWebKitAPI/Tests/WebKit2/PasteboardNotifications.mm: Added.
     13        (TestWebKitAPI::didReceiveMessageFromInjectedBundle):
     14        (TestWebKitAPI::setInjectedBundleClient):
     15        * TestWebKitAPI/Tests/WebKit2/PasteboardNotifications_Bundle.cpp: Added.
     16        (PasteboardNotificationsTest):
     17        (TestWebKitAPI::willWriteToPasteboard):
     18        (TestWebKitAPI::getPasteboardDataForRange):
     19        (TestWebKitAPI::didWriteToPasteboard):
     20        (TestWebKitAPI::PasteboardNotificationsTest::PasteboardNotificationsTest):
     21        (TestWebKitAPI::PasteboardNotificationsTest::didCreatePage):
     22        * TestWebKitAPI/Tests/WebKit2/execCopy.html: Added.
     23        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: Updated to reflect
     24        changes in InjectedBundleEditorClient.
     25        (WTR::InjectedBundlePage::InjectedBundlePage):
     26
    1272013-01-31  Rouslan Solomakhin  <rouslan@chromium.org>
    228
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r141011 r141473  
    184184                C540F776152E4DA000A40C8C /* SimplifyMarkup.mm in Sources */ = {isa = PBXBuildFile; fileRef = C540F775152E4DA000A40C8C /* SimplifyMarkup.mm */; };
    185185                C540F784152E5A9A00A40C8C /* verboseMarkup.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = C540F783152E5A7800A40C8C /* verboseMarkup.html */; };
     186                C54237F016B8955800E638FC /* PasteboardNotifications.mm in Sources */ = {isa = PBXBuildFile; fileRef = C54237EE16B8955800E638FC /* PasteboardNotifications.mm */; };
     187                C54237F116B8957D00E638FC /* PasteboardNotifications_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C54237ED16B8955800E638FC /* PasteboardNotifications_Bundle.cpp */; };
     188                C5E1AFFE16B221F1006CC1F2 /* execCopy.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = C5E1AFFD16B22179006CC1F2 /* execCopy.html */; };
    186189                CD5497B415857F0C00B5BC30 /* MediaTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD5497B315857F0C00B5BC30 /* MediaTime.cpp */; };
    187190                E1220DA0155B25480013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1220D9F155B25480013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.mm */; };
     
    227230                        dstSubfolderSpec = 7;
    228231                        files = (
     232                                C5E1AFFE16B221F1006CC1F2 /* execCopy.html in Copy Resources */,
    229233                                1A9E52C913E65EF4006917F5 /* 18-characters.html in Copy Resources */,
    230234                                379028B914FAC24C007E6B43 /* acceptsFirstMouse.html in Copy Resources */,
     
    457461                C540F775152E4DA000A40C8C /* SimplifyMarkup.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SimplifyMarkup.mm; sourceTree = "<group>"; };
    458462                C540F783152E5A7800A40C8C /* verboseMarkup.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = verboseMarkup.html; sourceTree = "<group>"; };
     463                C54237ED16B8955800E638FC /* PasteboardNotifications_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PasteboardNotifications_Bundle.cpp; sourceTree = "<group>"; };
     464                C54237EE16B8955800E638FC /* PasteboardNotifications.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PasteboardNotifications.mm; sourceTree = "<group>"; };
     465                C5E1AFFD16B22179006CC1F2 /* execCopy.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = execCopy.html; sourceTree = "<group>"; };
    459466                CD5497B315857F0C00B5BC30 /* MediaTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MediaTime.cpp; path = WTF/MediaTime.cpp; sourceTree = "<group>"; };
    460467                E1220D9F155B25480013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MemoryCacheDisableWithinResourceLoadDelegate.mm; sourceTree = "<group>"; };
     
    656663                                52E5CE4514D21E9D003B2BD8 /* ParentFrame.cpp */,
    657664                                52E5CE4814D21EAB003B2BD8 /* ParentFrame_Bundle.cpp */,
     665                                C54237EE16B8955800E638FC /* PasteboardNotifications.mm */,
     666                                C54237ED16B8955800E638FC /* PasteboardNotifications_Bundle.cpp */,
    658667                                333B9CE11277F23100FEFCE3 /* PreventEmptyUserAgent.cpp */,
    659668                                F6FDDDD214241AD4004F1729 /* PrivateBrowsingPushStateNoHistoryCallback.cpp */,
     
    717726                                C045F9461385C2F800C0F3CD /* 18-characters.html */,
    718727                                76E182DE15475A8300F1FADD /* auto-submitting-form.html */,
     728                                C5E1AFFD16B22179006CC1F2 /* execCopy.html */,
    719729                                BC2D004A12A9FEB300E732A3 /* file-with-anchor.html */,
    720730                                1A02C84B125D4A5E00E3F4BD /* find.html */,
     
    10751085                                BC9099941256ACF100083756 /* WKStringJSString.cpp in Sources */,
    10761086                                265AF55015D1E48A00B0CB4A /* WTFString.cpp in Sources */,
     1087                                C54237F016B8955800E638FC /* PasteboardNotifications.mm in Sources */,
    10771088                        );
    10781089                        runOnlyForDeploymentPostprocessing = 0;
     
    11101121                                76E182DD1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp in Sources */,
    11111122                                BC901E331492AF390074A667 /* WKConnection_Bundle.cpp in Sources */,
     1123                                C54237F116B8957D00E638FC /* PasteboardNotifications_Bundle.cpp in Sources */,
    11121124                        );
    11131125                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp

    r141448 r141473  
    389389        didEndEditing,
    390390        didChange,
    391         didChangeSelection
     391        didChangeSelection,
     392        0, /* willWriteToPasteboard */
     393        0, /* getPasteboardDataForRange */
     394        0  /* didWriteToPasteboard */
    392395    };
    393396    WKBundlePageSetEditorClient(m_page, &editorClient);
Note: See TracChangeset for help on using the changeset viewer.