Changeset 209307 in webkit
- Timestamp:
- Dec 3, 2016 3:49:32 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r209304 r209307 1 2016-12-03 Dan Bernstein <mitz@apple.com> 2 3 [Cocoa] Expose InjectedBundlePageEditorClient via the Objective-C bundle SPI 4 https://bugs.webkit.org/show_bug.cgi?id=165276 5 <rdar://problem/29467040> 6 7 Reviewed by Darin Adler. 8 9 * platform/ios/PlatformPasteboardIOS.mm: 10 (WebCore::PlatformPasteboard::write): Make sure to put the client data on the pasteboard, 11 like we do on macOS. 12 1 13 2016-12-03 Dave Hyatt <hyatt@apple.com> 2 14 -
trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm
r205516 r209307 131 131 RetainPtr<NSDictionary> representations = adoptNS([[NSMutableDictionary alloc] init]); 132 132 133 ASSERT(content.clientTypes.size() == content.clientData.size()); 134 for (size_t i = 0, size = content.clientTypes.size(); i < size; ++i) 135 [representations setValue:content.clientData[i]->createNSData().get() forKey:content.clientTypes[i]]; 136 133 137 if (content.dataInWebArchiveFormat) { 134 138 [representations setValue:(NSData *)content.dataInWebArchiveFormat->createNSData().get() forKey:WebArchivePboardType]; -
trunk/Source/WebKit2/ChangeLog
r209294 r209307 1 2016-12-03 Dan Bernstein <mitz@apple.com> 2 3 [Cocoa] Expose InjectedBundlePageEditorClient via the Objective-C bundle SPI 4 https://bugs.webkit.org/show_bug.cgi?id=165276 5 <rdar://problem/29467040> 6 7 Reviewed by Darin Adler. 8 9 Test: TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegate.mm 10 11 * Shared/Cocoa/APIObject.mm: 12 (API::Object::newObject): Wrap InjectedBundleRangeHandle in WKWebProcessPlugInRangeHandle. 13 14 * WebKit2.xcodeproj/project.pbxproj: Added references to new files, making 15 WKWebProcessPlugInEditingDelegate.h and WKWebProcessPlugInRangeHandle.h private headers. 16 17 * WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h: Added. An base class 18 based on InjectedBundlePageEditorClient. 19 (API::InjectedBundle::EditorClient::~EditorClient): 20 (API::InjectedBundle::EditorClient::shouldBeginEditing): 21 (API::InjectedBundle::EditorClient::shouldEndEditing): 22 (API::InjectedBundle::EditorClient::shouldInsertNode): 23 (API::InjectedBundle::EditorClient::shouldInsertText): 24 (API::InjectedBundle::EditorClient::shouldDeleteRange): 25 (API::InjectedBundle::EditorClient::shouldChangeSelectedRange): 26 (API::InjectedBundle::EditorClient::shouldApplyStyle): 27 (API::InjectedBundle::EditorClient::didBeginEditing): 28 (API::InjectedBundle::EditorClient::didEndEditing): 29 (API::InjectedBundle::EditorClient::didChange): 30 (API::InjectedBundle::EditorClient::didChangeSelection): 31 (API::InjectedBundle::EditorClient::willWriteToPasteboard): 32 (API::InjectedBundle::EditorClient::getPasteboardDataForRange): 33 (API::InjectedBundle::EditorClient::didWriteToPasteboard): 34 35 * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h: Added. Declares 36 the new delegate protocol, currently comprising three methods corresponding to 37 willWriteToPasteboard, getPasteboardDataForRange, and didWriteToPasteboard. 38 39 * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h: 40 * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm: 41 (-[WKWebProcessPlugInFrame jsRangeForRangeHandle:inWorld:]): Added. Gets the JS wrapper for 42 the specified range handle. 43 44 * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h: Added. 45 * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm: Added. 46 (-[WKWebProcessPlugInRangeHandle dealloc]): Call the InjectedBundleRangeHandle destructor. 47 (+[WKWebProcessPlugInRangeHandle rangeHandleWithJSValue:inContext:]): Get or create an 48 InjectedBundleRangeHandle for the specified object. 49 (-[WKWebProcessPlugInRangeHandle frame]): Return the range’s owner document’s frame. 50 (-[WKWebProcessPlugInRangeHandle _rangeHandle]): Return the InjectedBundleRangeHandle. 51 (-[WKWebProcessPlugInRangeHandle _apiObject]): Ditto. 52 53 * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandleInternal.h: Added. 54 (WebKit::wrapper): 55 56 * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: 57 (WKBundlePageSetEditorClient): Updated for WebPage change. 58 59 * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: 60 (-[WKWebProcessPlugInBrowserContextController _editingDelegate]): Added. Returns the 61 delegate. 62 (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]): Added. Defines a 63 Client class, which derives from API::InjectedBundle::EditorClient, and invokes the 64 delegate methods. Instantiates a Client and sets it on the WebPage. 65 66 * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h: 67 Declared new _editingDelegate property. 68 69 * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp: 70 (WebKit::InjectedBundleRangeHandle::document): Added. Returns an InjectedBundleNodeHandle 71 for the range’s owner document. 72 * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h: 73 74 * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp: 75 (WebKit::InjectedBundlePageEditorClient::InjectedBundlePageEditorClient): Added. Calls 76 initialize(). 77 (WebKit::InjectedBundlePageEditorClient::shouldBeginEditing): Updated for type change. 78 (WebKit::InjectedBundlePageEditorClient::shouldEndEditing): Ditto. 79 (WebKit::InjectedBundlePageEditorClient::shouldInsertNode): Ditto. 80 (WebKit::InjectedBundlePageEditorClient::shouldInsertText): Ditto. 81 (WebKit::InjectedBundlePageEditorClient::shouldDeleteRange): Ditto. 82 (WebKit::InjectedBundlePageEditorClient::shouldChangeSelectedRange): Ditto. 83 (WebKit::InjectedBundlePageEditorClient::shouldApplyStyle): Ditto. 84 (WebKit::InjectedBundlePageEditorClient::didBeginEditing): Ditto. 85 (WebKit::InjectedBundlePageEditorClient::didEndEditing): Ditto. 86 (WebKit::InjectedBundlePageEditorClient::didChange): Ditto. 87 (WebKit::InjectedBundlePageEditorClient::didChangeSelection): Ditto. 88 (WebKit::InjectedBundlePageEditorClient::willWriteToPasteboard): Ditto. 89 (WebKit::InjectedBundlePageEditorClient::getPasteboardDataForRange): Ditto. 90 (WebKit::InjectedBundlePageEditorClient::didWriteToPasteboard): Ditto. 91 * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h: Now derives from 92 API::InjectedBundle::EditorClient. 93 94 * WebProcess/WebCoreSupport/WebEditorClient.cpp: 95 (WebKit::WebEditorClient::shouldDeleteRange): Ditto. 96 (WebKit::WebEditorClient::shouldBeginEditing): Ditto. 97 (WebKit::WebEditorClient::shouldEndEditing): Ditto. 98 (WebKit::WebEditorClient::shouldInsertNode): Ditto. 99 (WebKit::WebEditorClient::shouldInsertText): Ditto. 100 (WebKit::WebEditorClient::shouldChangeSelectedRange): Ditto. 101 (WebKit::WebEditorClient::shouldApplyStyle): Ditto. 102 (WebKit::WebEditorClient::didBeginEditing): Ditto. 103 (WebKit::WebEditorClient::respondToChangedContents): Ditto. 104 (WebKit::WebEditorClient::respondToChangedSelection): Ditto. 105 (WebKit::WebEditorClient::didEndEditing): Ditto. 106 (WebKit::WebEditorClient::didWriteSelectionToPasteboard): Ditto. 107 (WebKit::WebEditorClient::willWriteSelectionToPasteboard): Ditto. 108 (WebKit::WebEditorClient::getClientPasteboardDataForRange): Ditto. 109 110 * WebProcess/WebPage/WebPage.cpp: 111 (WebKit::WebPage::WebPage): Initialize m_editorClient. 112 (WebKit::WebPage::setInjectedBundleEditorClient): Replaces 113 initializeInjectedBundleEditorClient and just sets m_editorClient. 114 (WebKit::WebPage::close): Resets m_editorClient. 115 116 * WebProcess/WebPage/WebPage.h: Changed m_editorClient to a unique_ptr. 117 1 118 2016-12-02 Said Abou-Hallawa <sabouhallawa@apple.com> 2 119 -
trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm
r204614 r209307 60 60 #import "WKWebProcessPlugInNodeHandleInternal.h" 61 61 #import "WKWebProcessPlugInPageGroupInternal.h" 62 #import "WKWebProcessPlugInRangeHandleInternal.h" 62 63 #import "WKWebProcessPlugInScriptWorldInternal.h" 63 64 #import "WKWebsiteDataRecordInternal.h" … … 285 286 break; 286 287 288 case Type::BundleRangeHandle: 289 wrapper = [WKWebProcessPlugInRangeHandle alloc]; 290 break; 291 287 292 case Type::BundleScriptWorld: 288 293 wrapper = [WKWebProcessPlugInScriptWorld alloc]; -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r209102 r209307 788 788 3743925818BC4C60001C8675 /* WKUIDelegatePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 3743925718BC4C60001C8675 /* WKUIDelegatePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 789 789 374436881820E7240049579F /* WKObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 374436871820E7240049579F /* WKObject.mm */; }; 790 3749421A1DF1F9FF0033C19F /* WKWebProcessPlugInRangeHandle.mm in Sources */ = {isa = PBXBuildFile; fileRef = 374942181DF1F9FF0033C19F /* WKWebProcessPlugInRangeHandle.mm */; }; 791 3749421B1DF1F9FF0033C19F /* WKWebProcessPlugInRangeHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 374942191DF1F9FF0033C19F /* WKWebProcessPlugInRangeHandle.h */; settings = {ATTRIBUTES = (Private, ); }; }; 792 3749421D1DF1FAB90033C19F /* WKWebProcessPlugInRangeHandleInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 3749421C1DF1FAB90033C19F /* WKWebProcessPlugInRangeHandleInternal.h */; }; 790 793 3754D5451B3A29FD003A4C7F /* NSInvocationSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 3754D5441B3A29FD003A4C7F /* NSInvocationSPI.h */; }; 791 794 375E0E131D66432700EFEC2C /* WKNSNumber.mm in Sources */ = {isa = PBXBuildFile; fileRef = 375E0E111D66432700EFEC2C /* WKNSNumber.mm */; }; … … 805 808 37716A5A195B910500EE8B1B /* ProcessAssertion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37716A59195B910500EE8B1B /* ProcessAssertion.cpp */; }; 806 809 377216B81A4E6BE000DCA718 /* _WKRenderingProgressEvents.h in Headers */ = {isa = PBXBuildFile; fileRef = 377216B71A4E6BE000DCA718 /* _WKRenderingProgressEvents.h */; settings = {ATTRIBUTES = (Private, ); }; }; 810 3775122F1DF0DC8B008A351C /* WKWebProcessPlugInEditingDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 3775122E1DF0DC8B008A351C /* WKWebProcessPlugInEditingDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 811 377512311DF0DEE2008A351C /* APIInjectedBundleEditorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 377512301DF0DEE2008A351C /* APIInjectedBundleEditorClient.h */; }; 807 812 377EAD4517E2C51A002D193D /* WKDeclarationSpecifiers.h in Headers */ = {isa = PBXBuildFile; fileRef = 377EAD4417E2C51A002D193D /* WKDeclarationSpecifiers.h */; settings = {ATTRIBUTES = (Private, ); }; }; 808 813 377EAD4817E2C77B002D193D /* WKUserContentInjectedFrames.h in Headers */ = {isa = PBXBuildFile; fileRef = 377EAD4617E2C77B002D193D /* WKUserContentInjectedFrames.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 2862 2867 3743925718BC4C60001C8675 /* WKUIDelegatePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUIDelegatePrivate.h; sourceTree = "<group>"; }; 2863 2868 374436871820E7240049579F /* WKObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKObject.mm; sourceTree = "<group>"; }; 2869 374942181DF1F9FF0033C19F /* WKWebProcessPlugInRangeHandle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebProcessPlugInRangeHandle.mm; sourceTree = "<group>"; }; 2870 374942191DF1F9FF0033C19F /* WKWebProcessPlugInRangeHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessPlugInRangeHandle.h; sourceTree = "<group>"; }; 2871 3749421C1DF1FAB90033C19F /* WKWebProcessPlugInRangeHandleInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessPlugInRangeHandleInternal.h; sourceTree = "<group>"; }; 2864 2872 3754D5441B3A29FD003A4C7F /* NSInvocationSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSInvocationSPI.h; sourceTree = "<group>"; }; 2865 2873 375E0E111D66432700EFEC2C /* WKNSNumber.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNSNumber.mm; sourceTree = "<group>"; }; … … 2876 2884 37716A59195B910500EE8B1B /* ProcessAssertion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProcessAssertion.cpp; sourceTree = "<group>"; }; 2877 2885 377216B71A4E6BE000DCA718 /* _WKRenderingProgressEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKRenderingProgressEvents.h; sourceTree = "<group>"; }; 2886 3775122E1DF0DC8B008A351C /* WKWebProcessPlugInEditingDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessPlugInEditingDelegate.h; sourceTree = "<group>"; }; 2887 377512301DF0DEE2008A351C /* APIInjectedBundleEditorClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIInjectedBundleEditorClient.h; sourceTree = "<group>"; }; 2878 2888 377EAD4417E2C51A002D193D /* WKDeclarationSpecifiers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDeclarationSpecifiers.h; sourceTree = "<group>"; }; 2879 2889 377EAD4617E2C77B002D193D /* WKUserContentInjectedFrames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserContentInjectedFrames.h; sourceTree = "<group>"; }; … … 4956 4966 1AA2E56518D77508003814BD /* WKWebProcessBundleParameters.h */, 4957 4967 1AA2E56418D77508003814BD /* WKWebProcessBundleParameters.mm */, 4968 3775122E1DF0DC8B008A351C /* WKWebProcessPlugInEditingDelegate.h */, 4958 4969 3795789B18AD4F1100B9ED2E /* WKWebProcessPlugInFormDelegatePrivate.h */, 4959 4970 1F0181691858DC1500F92884 /* WKWebProcessPlugInFrame.h */, … … 4971 4982 1FB00AC5185F76460019142E /* WKWebProcessPlugInPageGroup.mm */, 4972 4983 1FB00AC6185F76460019142E /* WKWebProcessPlugInPageGroupInternal.h */, 4984 374942191DF1F9FF0033C19F /* WKWebProcessPlugInRangeHandle.h */, 4985 374942181DF1F9FF0033C19F /* WKWebProcessPlugInRangeHandle.mm */, 4986 3749421C1DF1FAB90033C19F /* WKWebProcessPlugInRangeHandleInternal.h */, 4973 4987 1F0181721858DC1600F92884 /* WKWebProcessPlugInScriptWorld.h */, 4974 4988 1F0181731858DC1600F92884 /* WKWebProcessPlugInScriptWorld.mm */, … … 6661 6675 1F0181681858DC1500F92884 /* Cocoa */, 6662 6676 BC989D4516181691000D46D3 /* mac */, 6677 377512301DF0DEE2008A351C /* APIInjectedBundleEditorClient.h */, 6663 6678 076E884F1A13CBC6005E90FC /* APIInjectedBundlePageContextMenuClient.h */, 6664 6679 ); … … 7790 7805 832AE2521BE2E8CD00FAAE10 /* NetworkCacheSpeculativeLoadManager.h in Headers */, 7791 7806 834B25121A842C8700CFB150 /* NetworkCacheStatistics.h in Headers */, 7807 377512311DF0DEE2008A351C /* APIInjectedBundleEditorClient.h in Headers */, 7792 7808 E4436ECF1A0D040B00EAD204 /* NetworkCacheStorage.h in Headers */, 7793 7809 8310428B1BD6B66F00A715E4 /* NetworkCacheSubresourcesEntry.h in Headers */, … … 8017 8033 BC1BE1E012D54A410004A228 /* WebGeolocationClient.h in Headers */, 8018 8034 BC0E5FE512D697160012A72A /* WebGeolocationManager.h in Headers */, 8035 3749421B1DF1F9FF0033C19F /* WKWebProcessPlugInRangeHandle.h in Headers */, 8019 8036 BC0E606212D6BA910012A72A /* WebGeolocationManagerMessages.h in Headers */, 8020 8037 BC54CACB12D64291005C67B0 /* WebGeolocationManagerProxy.h in Headers */, … … 8066 8083 BC032D8F10F437A00058C15A /* WebPage.h in Headers */, 8067 8084 8372DB291A67562800C697C5 /* WebPageDiagnosticLoggingClient.h in Headers */, 8085 3775122F1DF0DC8B008A351C /* WKWebProcessPlugInEditingDelegate.h in Headers */, 8068 8086 BC7B6206129A0A6700D174A4 /* WebPageGroup.h in Headers */, 8069 8087 BC7B625212A43C9600D174A4 /* WebPageGroupData.h in Headers */, … … 8126 8144 51032F19180F73BB00961BB7 /* WebToDatabaseProcessConnection.h in Headers */, 8127 8145 BCA0EF7F12331E78007D3CFB /* WebUndoStep.h in Headers */, 8146 3749421D1DF1FAB90033C19F /* WKWebProcessPlugInRangeHandleInternal.h in Headers */, 8128 8147 1AAF08AE1926936700B6390C /* WebUserContentController.h in Headers */, 8129 8148 7C065F2C1C8CD95F00C2D950 /* WebUserContentControllerDataTypes.h in Headers */, … … 9771 9790 0FCB4E5118BBE044000FCFC9 /* WKGeolocationProviderIOSObjCSecurityOrigin.mm in Sources */, 9772 9791 0F174AA7142AAC610039250F /* WKGeometry.cpp in Sources */, 9792 3749421A1DF1F9FF0033C19F /* WKWebProcessPlugInRangeHandle.mm in Sources */, 9773 9793 B62E7310143047A60069EC35 /* WKHitTestResult.cpp in Sources */, 9774 9794 83EE575B1DB7D61100C74C50 /* WebValidationMessageClient.cpp in Sources */, -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h
r205559 r209307 35 35 @class WKWebProcessPlugInHitTestResult; 36 36 @class WKWebProcessPlugInNodeHandle; 37 @class WKWebProcessPlugInRangeHandle; 37 38 @class WKWebProcessPlugInScriptWorld; 38 39 … … 54 55 - (WKWebProcessPlugInHitTestResult *)hitTest:(CGPoint)point; 55 56 - (JSValue *)jsNodeForNodeHandle:(WKWebProcessPlugInNodeHandle *)nodeHandle inWorld:(WKWebProcessPlugInScriptWorld *)world; 57 - (JSValue *)jsRangeForRangeHandle:(WKWebProcessPlugInRangeHandle *)rangeHandle inWorld:(WKWebProcessPlugInScriptWorld *)world WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 56 58 57 59 @end -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm
r202242 r209307 34 34 #import "WKWebProcessPlugInHitTestResultInternal.h" 35 35 #import "WKWebProcessPlugInNodeHandleInternal.h" 36 #import "WKWebProcessPlugInRangeHandleInternal.h" 36 37 #import "WKWebProcessPlugInScriptWorldInternal.h" 37 38 #import "WebProcess.h" … … 79 80 { 80 81 JSValueRef valueRef = _frame->jsWrapperForWorld(&[nodeHandle _nodeHandle], &[world _scriptWorld]); 82 return [JSValue valueWithJSValueRef:valueRef inContext:[self jsContextForWorld:world]]; 83 } 84 85 - (JSValue *)jsRangeForRangeHandle:(WKWebProcessPlugInRangeHandle *)rangeHandle inWorld:(WKWebProcessPlugInScriptWorld *)world 86 { 87 JSValueRef valueRef = _frame->jsWrapperForWorld(&[rangeHandle _rangeHandle], &[world _scriptWorld]); 81 88 return [JSValue valueWithJSValueRef:valueRef inContext:[self jsContextForWorld:world]]; 82 89 } -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
r208985 r209307 34 34 #include "InjectedBundleBackForwardList.h" 35 35 #include "InjectedBundleNodeHandle.h" 36 #include "InjectedBundlePageEditorClient.h" 36 37 #include "InjectedBundlePageFormClient.h" 37 38 #include "InjectedBundlePageUIClient.h" … … 84 85 void WKBundlePageSetEditorClient(WKBundlePageRef pageRef, WKBundlePageEditorClientBase* wkClient) 85 86 { 86 toImpl(pageRef)-> initializeInjectedBundleEditorClient(wkClient);87 toImpl(pageRef)->setInjectedBundleEditorClient(wkClient ? std::make_unique<InjectedBundlePageEditorClient>(*wkClient) : std::make_unique<API::InjectedBundle::EditorClient>()); 87 88 } 88 89 -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm
r208431 r209307 45 45 #import "WKStringCF.h" 46 46 #import "WKURLRequestNS.h" 47 #import "WKWebProcessPlugInEditingDelegate.h" 47 48 #import "WKWebProcessPlugInFrameInternal.h" 48 49 #import "WKWebProcessPlugInInternal.h" … … 51 52 #import "WKWebProcessPlugInNodeHandleInternal.h" 52 53 #import "WKWebProcessPlugInPageGroupInternal.h" 54 #import "WKWebProcessPlugInRangeHandleInternal.h" 53 55 #import "WKWebProcessPlugInScriptWorldInternal.h" 54 56 #import "WeakObjCPtr.h" … … 75 77 WeakObjCPtr<id <WKWebProcessPlugInLoadDelegate>> _loadDelegate; 76 78 WeakObjCPtr<id <WKWebProcessPlugInFormDelegatePrivate>> _formDelegate; 79 WeakObjCPtr<id <WKWebProcessPlugInEditingDelegate>> _editingDelegate; 77 80 78 81 RetainPtr<_WKRemoteObjectRegistry> _remoteObjectRegistry; … … 566 569 } 567 570 571 - (id <WKWebProcessPlugInEditingDelegate>)_editingDelegate 572 { 573 return _editingDelegate.getAutoreleased(); 574 } 575 576 - (void)_setEditingDelegate:(id <WKWebProcessPlugInEditingDelegate>)editingDelegate 577 { 578 _editingDelegate = editingDelegate; 579 580 class Client final : public API::InjectedBundle::EditorClient { 581 public: 582 explicit Client(WKWebProcessPlugInBrowserContextController *controller) 583 : m_controller { controller } 584 , m_delegateMethods { m_controller->_editingDelegate.get() } 585 { 586 } 587 588 private: 589 void willWriteToPasteboard(WebKit::WebPage&, WebCore::Range* range) final 590 { 591 if (!m_delegateMethods.willWriteToPasteboard) 592 return; 593 594 [m_controller->_editingDelegate.get() _webProcessPlugInBrowserContextController:m_controller willWriteRangeToPasteboard:wrapper(*InjectedBundleRangeHandle::getOrCreate(range).get())]; 595 } 596 597 void getPasteboardDataForRange(WebKit::WebPage&, WebCore::Range* range, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer>>& pasteboardData) final 598 { 599 if (!m_delegateMethods.getPasteboardDataForRange) 600 return; 601 602 auto dataByType = [m_controller->_editingDelegate.get() _webProcessPlugInBrowserContextController:m_controller pasteboardDataForRange:wrapper(*InjectedBundleRangeHandle::getOrCreate(range).get())]; 603 for (NSString *type in dataByType) { 604 pasteboardTypes.append(type); 605 pasteboardData.append(SharedBuffer::wrapNSData(dataByType[type])); 606 }; 607 } 608 609 void didWriteToPasteboard(WebKit::WebPage&) final 610 { 611 if (!m_delegateMethods.didWriteToPasteboard) 612 return; 613 614 [m_controller->_editingDelegate.get() _webProcessPlugInBrowserContextControllerDidWriteToPasteboard:m_controller]; 615 } 616 617 WKWebProcessPlugInBrowserContextController *m_controller; 618 const struct DelegateMethods { 619 DelegateMethods(RetainPtr<id <WKWebProcessPlugInEditingDelegate>> delegate) 620 : willWriteToPasteboard([delegate respondsToSelector:@selector(_webProcessPlugInBrowserContextController:willWriteRangeToPasteboard:)]) 621 , getPasteboardDataForRange([delegate respondsToSelector:@selector(_webProcessPlugInBrowserContextController:pasteboardDataForRange:)]) 622 , didWriteToPasteboard([delegate respondsToSelector:@selector(_webProcessPlugInBrowserContextControllerDidWriteToPasteboard:)]) 623 { 624 } 625 626 bool willWriteToPasteboard; 627 bool getPasteboardDataForRange; 628 bool didWriteToPasteboard; 629 } m_delegateMethods; 630 }; 631 632 if (editingDelegate) 633 _page->setInjectedBundleEditorClient(std::make_unique<Client>(self)); 634 else 635 _page->setInjectedBundleEditorClient(nullptr); 636 } 637 568 638 - (BOOL)_defersLoading 569 639 { -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h
r168646 r209307 32 32 @class WKBrowsingContextHandle; 33 33 @class _WKRemoteObjectRegistry; 34 @protocol WKWebProcessPlugInEditingDelegate; 34 35 @protocol WKWebProcessPlugInFormDelegatePrivate; 35 36 … … 43 44 44 45 @property (weak, setter=_setFormDelegate:) id <WKWebProcessPlugInFormDelegatePrivate> _formDelegate; 46 @property (weak, setter=_setEditingDelegate:) id <WKWebProcessPlugInEditingDelegate> _editingDelegate WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 45 47 46 48 @property (nonatomic, setter=_setDefersLoading:) BOOL _defersLoading; -
trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp
r208371 r209307 27 27 #include "InjectedBundleRangeHandle.h" 28 28 29 #include "InjectedBundleNodeHandle.h" 29 30 #include "ShareableBitmap.h" 30 31 #include "WebImage.h" … … 97 98 } 98 99 100 Ref<InjectedBundleNodeHandle> InjectedBundleRangeHandle::document() 101 { 102 return InjectedBundleNodeHandle::getOrCreate(m_range->ownerDocument()); 103 } 104 99 105 WebCore::IntRect InjectedBundleRangeHandle::boundingRectInWindowCoordinates() const 100 106 { -
trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h
r185637 r209307 40 40 namespace WebKit { 41 41 42 class InjectedBundleNodeHandle; 42 43 class InjectedBundleScriptWorld; 43 44 class WebImage; … … 49 50 50 51 virtual ~InjectedBundleRangeHandle(); 52 53 Ref<InjectedBundleNodeHandle> document(); 51 54 52 55 WebCore::IntRect boundingRectInWindowCoordinates() const; -
trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp
r177671 r209307 42 42 namespace WebKit { 43 43 44 bool InjectedBundlePageEditorClient::shouldBeginEditing(WebPage* page, Range* range) 44 InjectedBundlePageEditorClient::InjectedBundlePageEditorClient(const WKBundlePageEditorClientBase& client) 45 { 46 initialize(&client); 47 } 48 49 bool InjectedBundlePageEditorClient::shouldBeginEditing(WebPage& page, Range* range) 45 50 { 46 51 if (m_client.shouldBeginEditing) { 47 52 RefPtr<InjectedBundleRangeHandle> rangeHandle = InjectedBundleRangeHandle::getOrCreate(range); 48 return m_client.shouldBeginEditing(toAPI( page), toAPI(rangeHandle.get()), m_client.base.clientInfo);53 return m_client.shouldBeginEditing(toAPI(&page), toAPI(rangeHandle.get()), m_client.base.clientInfo); 49 54 } 50 55 return true; 51 56 } 52 57 53 bool InjectedBundlePageEditorClient::shouldEndEditing(WebPage *page, Range* range)58 bool InjectedBundlePageEditorClient::shouldEndEditing(WebPage& page, Range* range) 54 59 { 55 60 if (m_client.shouldEndEditing) { 56 61 RefPtr<InjectedBundleRangeHandle> rangeHandle = InjectedBundleRangeHandle::getOrCreate(range); 57 return m_client.shouldEndEditing(toAPI( page), toAPI(rangeHandle.get()), m_client.base.clientInfo);62 return m_client.shouldEndEditing(toAPI(&page), toAPI(rangeHandle.get()), m_client.base.clientInfo); 58 63 } 59 64 return true; 60 65 } 61 66 62 bool InjectedBundlePageEditorClient::shouldInsertNode(WebPage *page, Node* node, Range* rangeToReplace, EditorInsertAction action)67 bool InjectedBundlePageEditorClient::shouldInsertNode(WebPage& page, Node* node, Range* rangeToReplace, EditorInsertAction action) 63 68 { 64 69 if (m_client.shouldInsertNode) { 65 70 RefPtr<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::getOrCreate(node); 66 71 RefPtr<InjectedBundleRangeHandle> rangeToReplaceHandle = InjectedBundleRangeHandle::getOrCreate(rangeToReplace); 67 return m_client.shouldInsertNode(toAPI( page), toAPI(nodeHandle.get()), toAPI(rangeToReplaceHandle.get()), toAPI(action), m_client.base.clientInfo);72 return m_client.shouldInsertNode(toAPI(&page), toAPI(nodeHandle.get()), toAPI(rangeToReplaceHandle.get()), toAPI(action), m_client.base.clientInfo); 68 73 } 69 74 return true; 70 75 } 71 76 72 bool InjectedBundlePageEditorClient::shouldInsertText(WebPage *page, StringImpl* text, Range* rangeToReplace, EditorInsertAction action)77 bool InjectedBundlePageEditorClient::shouldInsertText(WebPage& page, StringImpl* text, Range* rangeToReplace, EditorInsertAction action) 73 78 { 74 79 if (m_client.shouldInsertText) { 75 80 RefPtr<InjectedBundleRangeHandle> rangeToReplaceHandle = InjectedBundleRangeHandle::getOrCreate(rangeToReplace); 76 return m_client.shouldInsertText(toAPI( page), toAPI(text), toAPI(rangeToReplaceHandle.get()), toAPI(action), m_client.base.clientInfo);81 return m_client.shouldInsertText(toAPI(&page), toAPI(text), toAPI(rangeToReplaceHandle.get()), toAPI(action), m_client.base.clientInfo); 77 82 } 78 83 return true; 79 84 } 80 85 81 bool InjectedBundlePageEditorClient::shouldDeleteRange(WebPage *page, Range* range)86 bool InjectedBundlePageEditorClient::shouldDeleteRange(WebPage& page, Range* range) 82 87 { 83 88 if (m_client.shouldDeleteRange) { 84 89 RefPtr<InjectedBundleRangeHandle> rangeHandle = InjectedBundleRangeHandle::getOrCreate(range); 85 return m_client.shouldDeleteRange(toAPI( page), toAPI(rangeHandle.get()), m_client.base.clientInfo);90 return m_client.shouldDeleteRange(toAPI(&page), toAPI(rangeHandle.get()), m_client.base.clientInfo); 86 91 } 87 92 return true; 88 93 } 89 94 90 bool InjectedBundlePageEditorClient::shouldChangeSelectedRange(WebPage *page, Range* fromRange, Range* toRange, EAffinity affinity, bool stillSelecting)95 bool InjectedBundlePageEditorClient::shouldChangeSelectedRange(WebPage& page, Range* fromRange, Range* toRange, EAffinity affinity, bool stillSelecting) 91 96 { 92 97 if (m_client.shouldChangeSelectedRange) { 93 98 RefPtr<InjectedBundleRangeHandle> fromRangeHandle = InjectedBundleRangeHandle::getOrCreate(fromRange); 94 99 RefPtr<InjectedBundleRangeHandle> toRangeHandle = InjectedBundleRangeHandle::getOrCreate(toRange); 95 return m_client.shouldChangeSelectedRange(toAPI( page), toAPI(fromRangeHandle.get()), toAPI(toRangeHandle.get()), toAPI(affinity), stillSelecting, m_client.base.clientInfo);100 return m_client.shouldChangeSelectedRange(toAPI(&page), toAPI(fromRangeHandle.get()), toAPI(toRangeHandle.get()), toAPI(affinity), stillSelecting, m_client.base.clientInfo); 96 101 } 97 102 return true; 98 103 } 99 104 100 bool InjectedBundlePageEditorClient::shouldApplyStyle(WebPage *page, CSSStyleDeclaration* style, Range* range)105 bool InjectedBundlePageEditorClient::shouldApplyStyle(WebPage& page, CSSStyleDeclaration* style, Range* range) 101 106 { 102 107 if (m_client.shouldApplyStyle) { 103 108 RefPtr<InjectedBundleCSSStyleDeclarationHandle> styleHandle = InjectedBundleCSSStyleDeclarationHandle::getOrCreate(style); 104 109 RefPtr<InjectedBundleRangeHandle> rangeHandle = InjectedBundleRangeHandle::getOrCreate(range); 105 return m_client.shouldApplyStyle(toAPI( page), toAPI(styleHandle.get()), toAPI(rangeHandle.get()), m_client.base.clientInfo);110 return m_client.shouldApplyStyle(toAPI(&page), toAPI(styleHandle.get()), toAPI(rangeHandle.get()), m_client.base.clientInfo); 106 111 } 107 112 return true; 108 113 } 109 114 110 void InjectedBundlePageEditorClient::didBeginEditing(WebPage *page, StringImpl* notificationName)115 void InjectedBundlePageEditorClient::didBeginEditing(WebPage& page, StringImpl* notificationName) 111 116 { 112 117 if (m_client.didBeginEditing) 113 m_client.didBeginEditing(toAPI( page), toAPI(notificationName), m_client.base.clientInfo);118 m_client.didBeginEditing(toAPI(&page), toAPI(notificationName), m_client.base.clientInfo); 114 119 } 115 120 116 void InjectedBundlePageEditorClient::didEndEditing(WebPage *page, StringImpl* notificationName)121 void InjectedBundlePageEditorClient::didEndEditing(WebPage& page, StringImpl* notificationName) 117 122 { 118 123 if (m_client.didEndEditing) 119 m_client.didEndEditing(toAPI( page), toAPI(notificationName), m_client.base.clientInfo);124 m_client.didEndEditing(toAPI(&page), toAPI(notificationName), m_client.base.clientInfo); 120 125 } 121 126 122 void InjectedBundlePageEditorClient::didChange(WebPage *page, StringImpl* notificationName)127 void InjectedBundlePageEditorClient::didChange(WebPage& page, StringImpl* notificationName) 123 128 { 124 129 if (m_client.didChange) 125 m_client.didChange(toAPI( page), toAPI(notificationName), m_client.base.clientInfo);130 m_client.didChange(toAPI(&page), toAPI(notificationName), m_client.base.clientInfo); 126 131 } 127 132 128 void InjectedBundlePageEditorClient::didChangeSelection(WebPage *page, StringImpl* notificationName)133 void InjectedBundlePageEditorClient::didChangeSelection(WebPage& page, StringImpl* notificationName) 129 134 { 130 135 if (m_client.didChangeSelection) 131 m_client.didChangeSelection(toAPI( page), toAPI(notificationName), m_client.base.clientInfo);136 m_client.didChangeSelection(toAPI(&page), toAPI(notificationName), m_client.base.clientInfo); 132 137 } 133 138 134 void InjectedBundlePageEditorClient::willWriteToPasteboard(WebPage *page, Range* range)139 void InjectedBundlePageEditorClient::willWriteToPasteboard(WebPage& page, Range* range) 135 140 { 136 141 if (m_client.willWriteToPasteboard) { 137 142 RefPtr<InjectedBundleRangeHandle> rangeHandle = InjectedBundleRangeHandle::getOrCreate(range); 138 m_client.willWriteToPasteboard(toAPI( page), toAPI(rangeHandle.get()), m_client.base.clientInfo);143 m_client.willWriteToPasteboard(toAPI(&page), toAPI(rangeHandle.get()), m_client.base.clientInfo); 139 144 } 140 145 } 141 146 142 void InjectedBundlePageEditorClient::getPasteboardDataForRange(WebPage *page, Range* range, Vector<String>& pasteboardTypes, Vector<RefPtr<SharedBuffer>>& pasteboardData)147 void InjectedBundlePageEditorClient::getPasteboardDataForRange(WebPage& page, Range* range, Vector<String>& pasteboardTypes, Vector<RefPtr<SharedBuffer>>& pasteboardData) 143 148 { 144 149 if (m_client.getPasteboardDataForRange) { … … 146 151 WKArrayRef types = 0; 147 152 WKArrayRef data = 0; 148 m_client.getPasteboardDataForRange(toAPI( page), toAPI(rangeHandle.get()), &types, &data, m_client.base.clientInfo);153 m_client.getPasteboardDataForRange(toAPI(&page), toAPI(rangeHandle.get()), &types, &data, m_client.base.clientInfo); 149 154 RefPtr<API::Array> typesArray = adoptRef(toImpl(types)); 150 155 RefPtr<API::Array> dataArray = adoptRef(toImpl(data)); … … 168 173 } 169 174 170 void InjectedBundlePageEditorClient::didWriteToPasteboard(WebPage *page)175 void InjectedBundlePageEditorClient::didWriteToPasteboard(WebPage& page) 171 176 { 172 177 if (m_client.didWriteToPasteboard) 173 m_client.didWriteToPasteboard(toAPI( page), m_client.base.clientInfo);178 m_client.didWriteToPasteboard(toAPI(&page), m_client.base.clientInfo); 174 179 } 175 180 -
trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h
r171743 r209307 1 1 /* 2 * Copyright (C) 2010 Apple Inc. All rights reserved.2 * Copyright (C) 2010, 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #ifndef InjectedBundlePageEditorClient_h 27 #define InjectedBundlePageEditorClient_h 26 #pragma once 28 27 29 28 #include "APIClient.h" 30 #include "WKBundlePage.h" 31 #include <WebCore/EditorInsertAction.h> 32 #include <WebCore/SharedBuffer.h> 33 #include <WebCore/TextAffinity.h> 34 #include <wtf/Forward.h> 29 #include "APIInjectedBundleEditorClient.h" 30 #include "WKBundlePageEditorClient.h" 35 31 36 32 namespace API { … … 51 47 class WebPage; 52 48 53 class InjectedBundlePageEditorClient : public API::Client<WKBundlePageEditorClientBase>{49 class InjectedBundlePageEditorClient final : public API::Client<WKBundlePageEditorClientBase>, public API::InjectedBundle::EditorClient { 54 50 public: 55 bool shouldBeginEditing(WebPage*, WebCore::Range*); 56 bool shouldEndEditing(WebPage*, WebCore::Range*); 57 bool shouldInsertNode(WebPage*, WebCore::Node*, WebCore::Range* rangeToReplace, WebCore::EditorInsertAction); 58 bool shouldInsertText(WebPage*, StringImpl*, WebCore::Range* rangeToReplace, WebCore::EditorInsertAction); 59 bool shouldDeleteRange(WebPage*, WebCore::Range*); 60 bool shouldChangeSelectedRange(WebPage*, WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity affinity, bool stillSelecting); 61 bool shouldApplyStyle(WebPage*, WebCore::CSSStyleDeclaration*, WebCore::Range*); 62 void didBeginEditing(WebPage*, StringImpl* notificationName); 63 void didEndEditing(WebPage*, StringImpl* notificationName); 64 void didChange(WebPage*, StringImpl* notificationName); 65 void didChangeSelection(WebPage*, StringImpl* notificationName); 66 void willWriteToPasteboard(WebPage*, WebCore::Range*); 67 void getPasteboardDataForRange(WebPage*, WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer>>& pasteboardData); 68 void didWriteToPasteboard(WebPage*); 51 explicit InjectedBundlePageEditorClient(const WKBundlePageEditorClientBase&); 52 53 private: 54 bool shouldBeginEditing(WebPage&, WebCore::Range*) final; 55 bool shouldEndEditing(WebPage&, WebCore::Range*) final; 56 bool shouldInsertNode(WebPage&, WebCore::Node*, WebCore::Range* rangeToReplace, WebCore::EditorInsertAction) final; 57 bool shouldInsertText(WebPage&, StringImpl*, WebCore::Range* rangeToReplace, WebCore::EditorInsertAction) final; 58 bool shouldDeleteRange(WebPage&, WebCore::Range*) final; 59 bool shouldChangeSelectedRange(WebPage&, WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity, bool stillSelecting) final; 60 bool shouldApplyStyle(WebPage&, WebCore::CSSStyleDeclaration*, WebCore::Range*) final; 61 void didBeginEditing(WebPage&, StringImpl* notificationName) final; 62 void didEndEditing(WebPage&, StringImpl* notificationName) final; 63 void didChange(WebPage&, StringImpl* notificationName) final; 64 void didChangeSelection(WebPage&, StringImpl* notificationName) final; 65 void willWriteToPasteboard(WebPage&, WebCore::Range*) final; 66 void getPasteboardDataForRange(WebPage&, WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer>>& pasteboardData) final; 67 void didWriteToPasteboard(WebPage&) final; 69 68 }; 70 69 71 70 } // namespace WebKit 72 73 #endif // InjectedBundlePageEditorClient_h -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
r208406 r209307 73 73 bool WebEditorClient::shouldDeleteRange(Range* range) 74 74 { 75 bool result = m_page->injectedBundleEditorClient().shouldDeleteRange( m_page, range);75 bool result = m_page->injectedBundleEditorClient().shouldDeleteRange(*m_page, range); 76 76 notImplemented(); 77 77 return result; … … 116 116 bool WebEditorClient::shouldBeginEditing(Range* range) 117 117 { 118 bool result = m_page->injectedBundleEditorClient().shouldBeginEditing( m_page, range);118 bool result = m_page->injectedBundleEditorClient().shouldBeginEditing(*m_page, range); 119 119 notImplemented(); 120 120 return result; … … 123 123 bool WebEditorClient::shouldEndEditing(Range* range) 124 124 { 125 bool result = m_page->injectedBundleEditorClient().shouldEndEditing( m_page, range);125 bool result = m_page->injectedBundleEditorClient().shouldEndEditing(*m_page, range); 126 126 notImplemented(); 127 127 return result; … … 130 130 bool WebEditorClient::shouldInsertNode(Node* node, Range* rangeToReplace, EditorInsertAction action) 131 131 { 132 bool result = m_page->injectedBundleEditorClient().shouldInsertNode( m_page, node, rangeToReplace, action);132 bool result = m_page->injectedBundleEditorClient().shouldInsertNode(*m_page, node, rangeToReplace, action); 133 133 notImplemented(); 134 134 return result; … … 137 137 bool WebEditorClient::shouldInsertText(const String& text, Range* rangeToReplace, EditorInsertAction action) 138 138 { 139 bool result = m_page->injectedBundleEditorClient().shouldInsertText( m_page, text.impl(), rangeToReplace, action);139 bool result = m_page->injectedBundleEditorClient().shouldInsertText(*m_page, text.impl(), rangeToReplace, action); 140 140 notImplemented(); 141 141 return result; … … 144 144 bool WebEditorClient::shouldChangeSelectedRange(Range* fromRange, Range* toRange, EAffinity affinity, bool stillSelecting) 145 145 { 146 bool result = m_page->injectedBundleEditorClient().shouldChangeSelectedRange( m_page, fromRange, toRange, affinity, stillSelecting);146 bool result = m_page->injectedBundleEditorClient().shouldChangeSelectedRange(*m_page, fromRange, toRange, affinity, stillSelecting); 147 147 notImplemented(); 148 148 return result; … … 152 152 { 153 153 Ref<MutableStyleProperties> mutableStyle(style->isMutable() ? Ref<MutableStyleProperties>(static_cast<MutableStyleProperties&>(*style)) : style->mutableCopy()); 154 bool result = m_page->injectedBundleEditorClient().shouldApplyStyle( m_page, mutableStyle->ensureCSSStyleDeclaration(), range);154 bool result = m_page->injectedBundleEditorClient().shouldApplyStyle(*m_page, mutableStyle->ensureCSSStyleDeclaration(), range); 155 155 notImplemented(); 156 156 return result; … … 172 172 // FIXME: What good is a notification name, if it's always the same? 173 173 static NeverDestroyed<String> WebViewDidBeginEditingNotification(ASCIILiteral("WebViewDidBeginEditingNotification")); 174 m_page->injectedBundleEditorClient().didBeginEditing( m_page, WebViewDidBeginEditingNotification.get().impl());174 m_page->injectedBundleEditorClient().didBeginEditing(*m_page, WebViewDidBeginEditingNotification.get().impl()); 175 175 notImplemented(); 176 176 } … … 179 179 { 180 180 static NeverDestroyed<String> WebViewDidChangeNotification(ASCIILiteral("WebViewDidChangeNotification")); 181 m_page->injectedBundleEditorClient().didChange( m_page, WebViewDidChangeNotification.get().impl());181 m_page->injectedBundleEditorClient().didChange(*m_page, WebViewDidChangeNotification.get().impl()); 182 182 notImplemented(); 183 183 } … … 186 186 { 187 187 static NeverDestroyed<String> WebViewDidChangeSelectionNotification(ASCIILiteral("WebViewDidChangeSelectionNotification")); 188 m_page->injectedBundleEditorClient().didChangeSelection( m_page, WebViewDidChangeSelectionNotification.get().impl());188 m_page->injectedBundleEditorClient().didChangeSelection(*m_page, WebViewDidChangeSelectionNotification.get().impl()); 189 189 if (!frame) 190 190 return; … … 220 220 { 221 221 static NeverDestroyed<String> WebViewDidEndEditingNotification(ASCIILiteral("WebViewDidEndEditingNotification")); 222 m_page->injectedBundleEditorClient().didEndEditing( m_page, WebViewDidEndEditingNotification.get().impl());222 m_page->injectedBundleEditorClient().didEndEditing(*m_page, WebViewDidEndEditingNotification.get().impl()); 223 223 notImplemented(); 224 224 } … … 226 226 void WebEditorClient::didWriteSelectionToPasteboard() 227 227 { 228 m_page->injectedBundleEditorClient().didWriteToPasteboard( m_page);228 m_page->injectedBundleEditorClient().didWriteToPasteboard(*m_page); 229 229 } 230 230 231 231 void WebEditorClient::willWriteSelectionToPasteboard(Range* range) 232 232 { 233 m_page->injectedBundleEditorClient().willWriteToPasteboard( m_page, range);233 m_page->injectedBundleEditorClient().willWriteToPasteboard(*m_page, range); 234 234 } 235 235 236 236 void WebEditorClient::getClientPasteboardDataForRange(Range* range, Vector<String>& pasteboardTypes, Vector<RefPtr<SharedBuffer>>& pasteboardData) 237 237 { 238 m_page->injectedBundleEditorClient().getPasteboardDataForRange( m_page, range, pasteboardTypes, pasteboardData);238 m_page->injectedBundleEditorClient().getPasteboardDataForRange(*m_page, range, pasteboardTypes, pasteboardData); 239 239 } 240 240 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r209230 r209307 305 305 , m_contextMenuClient(std::make_unique<API::InjectedBundle::PageContextMenuClient>()) 306 306 #endif 307 , m_editorClient { std::make_unique<API::InjectedBundle::EditorClient>() } 307 308 , m_formClient(std::make_unique<API::InjectedBundle::FormClient>()) 308 309 , m_uiClient(std::make_unique<API::InjectedBundle::PageUIClient>()) … … 620 621 #endif 621 622 622 void WebPage::initializeInjectedBundleEditorClient(WKBundlePageEditorClientBase* client) 623 { 624 m_editorClient.initialize(client); 623 void WebPage::setInjectedBundleEditorClient(std::unique_ptr<API::InjectedBundle::EditorClient> editorClient) 624 { 625 if (!editorClient) { 626 m_editorClient = std::make_unique<API::InjectedBundle::EditorClient>(); 627 return; 628 } 629 630 m_editorClient = WTFMove(editorClient); 625 631 } 626 632 … … 1060 1066 m_contextMenuClient = std::make_unique<API::InjectedBundle::PageContextMenuClient>(); 1061 1067 #endif 1062 m_editorClient .initialize(0);1068 m_editorClient = std::make_unique<API::InjectedBundle::EditorClient>(); 1063 1069 m_formClient = std::make_unique<API::InjectedBundle::FormClient>(); 1064 1070 m_loaderClient.initialize(0); -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r209102 r209307 26 26 #pragma once 27 27 28 #include "APIInjectedBundleEditorClient.h" 28 29 #include "APIInjectedBundleFormClient.h" 29 30 #include "APIInjectedBundlePageContextMenuClient.h" … … 36 37 #include "ImageOptions.h" 37 38 #include "InjectedBundlePageDiagnosticLoggingClient.h" 38 #include "InjectedBundlePageEditorClient.h"39 39 #include "InjectedBundlePageFullScreenClient.h" 40 40 #include "InjectedBundlePageLoaderClient.h" … … 323 323 void setInjectedBundleContextMenuClient(std::unique_ptr<API::InjectedBundle::PageContextMenuClient>); 324 324 #endif 325 void initializeInjectedBundleEditorClient(WKBundlePageEditorClientBase*);325 void setInjectedBundleEditorClient(std::unique_ptr<API::InjectedBundle::EditorClient>); 326 326 void setInjectedBundleFormClient(std::unique_ptr<API::InjectedBundle::FormClient>); 327 327 void initializeInjectedBundleLoaderClient(WKBundlePageLoaderClientBase*); … … 337 337 API::InjectedBundle::PageContextMenuClient& injectedBundleContextMenuClient() { return *m_contextMenuClient.get(); } 338 338 #endif 339 InjectedBundlePageEditorClient& injectedBundleEditorClient() { return m_editorClient; }339 API::InjectedBundle::EditorClient& injectedBundleEditorClient() { return *m_editorClient.get(); } 340 340 API::InjectedBundle::FormClient& injectedBundleFormClient() { return *m_formClient.get(); } 341 341 InjectedBundlePageLoaderClient& injectedBundleLoaderClient() { return m_loaderClient; } … … 1338 1338 std::unique_ptr<API::InjectedBundle::PageContextMenuClient> m_contextMenuClient; 1339 1339 #endif 1340 InjectedBundlePageEditorClientm_editorClient;1340 std::unique_ptr<API::InjectedBundle::EditorClient> m_editorClient; 1341 1341 std::unique_ptr<API::InjectedBundle::FormClient> m_formClient; 1342 1342 InjectedBundlePageLoaderClient m_loaderClient; -
trunk/Tools/ChangeLog
r209288 r209307 1 2016-12-03 Dan Bernstein <mitz@apple.com> 2 3 [Cocoa] Expose InjectedBundlePageEditorClient via the Objective-C bundle SPI 4 https://bugs.webkit.org/show_bug.cgi?id=165276 5 <rdar://problem/29467040> 6 7 Reviewed by Darin Adler. 8 9 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 10 * TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegate.mm: Added. 11 (-[BundleEditingDelegateRemoteObject willWriteToPasteboard:]): 12 (-[BundleEditingDelegateRemoteObject didWriteToPasteboard]): 13 (TEST): 14 * TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegatePlugIn.mm: Added. 15 (-[BundleEditingDelegatePlugIn webProcessPlugIn:didCreateBrowserContextController:]): 16 (-[BundleEditingDelegatePlugIn _webProcessPlugInBrowserContextController:willWriteRangeToPasteboard:]): 17 (-[BundleEditingDelegatePlugIn _webProcessPlugInBrowserContextController:pasteboardDataForRange:]): 18 (-[BundleEditingDelegatePlugIn _webProcessPlugInBrowserContextControllerDidWriteToPasteboard:]): 19 * TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegateProtocol.h: Added. 20 1 21 2016-12-02 Andy Estes <aestes@apple.com> 2 22 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r208963 r209307 92 92 33DC89141419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33DC89131419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp */; }; 93 93 33E79E06137B5FD900E32D99 /* mouse-move-listener.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */; }; 94 374B7A601DF36EEE00ACCB6C /* BundleEditingDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 374B7A5E1DF36EEE00ACCB6C /* BundleEditingDelegate.mm */; }; 95 374B7A611DF371CF00ACCB6C /* BundleEditingDelegatePlugIn.mm in Sources */ = {isa = PBXBuildFile; fileRef = 374B7A5F1DF36EEE00ACCB6C /* BundleEditingDelegatePlugIn.mm */; }; 94 96 375E0E171D66674400EFEC2C /* WKNSNumber.mm in Sources */ = {isa = PBXBuildFile; fileRef = 375E0E151D66674400EFEC2C /* WKNSNumber.mm */; }; 95 97 376C8C061D6E197C007D2BB9 /* FrameHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 376C8C041D6E197C007D2BB9 /* FrameHandle.cpp */; }; … … 859 861 33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "mouse-move-listener.html"; sourceTree = "<group>"; }; 860 862 3722C8681461E03E00C45D00 /* RenderedImageFromDOMRange.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RenderedImageFromDOMRange.mm; sourceTree = "<group>"; }; 863 374B7A5E1DF36EEE00ACCB6C /* BundleEditingDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BundleEditingDelegate.mm; sourceTree = "<group>"; }; 864 374B7A5F1DF36EEE00ACCB6C /* BundleEditingDelegatePlugIn.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BundleEditingDelegatePlugIn.mm; sourceTree = "<group>"; }; 865 374B7A621DF3734C00ACCB6C /* BundleEditingDelegateProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BundleEditingDelegateProtocol.h; sourceTree = "<group>"; }; 861 866 3751AF7A169518F800764319 /* DOMNodeFromJSObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMNodeFromJSObject.mm; sourceTree = "<group>"; }; 862 867 375E0E151D66674400EFEC2C /* WKNSNumber.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNSNumber.mm; sourceTree = "<group>"; }; … … 1414 1419 2DE71AFD1D49C0BD00904094 /* AnimatedResize.mm */, 1415 1420 2DD355351BD08378005DF4A7 /* AutoLayoutIntegration.mm */, 1421 374B7A5E1DF36EEE00ACCB6C /* BundleEditingDelegate.mm */, 1422 374B7A5F1DF36EEE00ACCB6C /* BundleEditingDelegatePlugIn.mm */, 1423 374B7A621DF3734C00ACCB6C /* BundleEditingDelegateProtocol.h */, 1416 1424 A13EBBAC1B87436F00097110 /* BundleParameters.mm */, 1417 1425 A13EBBAE1B87436F00097110 /* BundleParametersPlugIn.mm */, … … 2387 2395 7CCE7EE41A411AE600447C4C /* AboutBlankLoad.cpp in Sources */, 2388 2396 7CCE7EB31A411A7E00447C4C /* AcceptsFirstMouse.mm in Sources */, 2397 374B7A601DF36EEE00ACCB6C /* BundleEditingDelegate.mm in Sources */, 2389 2398 5C0BF8951DD599CD00B00328 /* NavigatorLanguage.mm in Sources */, 2390 2399 A1DF74321C41B65800A2F4D0 /* AlwaysRevalidatedURLSchemes.mm in Sources */, … … 2654 2663 1A4F81CF1BDFFD53004E672E /* RemoteObjectRegistryPlugIn.mm in Sources */, 2655 2664 7C882E091C80C630006BF731 /* UserContentWorldPlugIn.mm in Sources */, 2665 374B7A611DF371CF00ACCB6C /* BundleEditingDelegatePlugIn.mm in Sources */, 2656 2666 7C83E03D1D0A60D600FEBCF3 /* UtilitiesCocoa.mm in Sources */, 2657 2667 A13EBBAA1B87428D00097110 /* WebProcessPlugIn.mm in Sources */,
Note: See TracChangeset
for help on using the changeset viewer.