Diff
Modified: branches/safari-600.3-branch/Source/WebKit2/ChangeLog (175566 => 175567)
--- branches/safari-600.3-branch/Source/WebKit2/ChangeLog 2014-11-04 20:09:00 UTC (rev 175566)
+++ branches/safari-600.3-branch/Source/WebKit2/ChangeLog 2014-11-04 20:20:38 UTC (rev 175567)
@@ -20,6 +20,67 @@
2014-11-04 Dana Burkart <dburk...@apple.com>
+ Merge r175444. <rdar://problem/18830771>
+
+ 2014-10-31 Sam Weinig <s...@webkit.org>
+
+ Add bundle SPI to customize the action menu
+ <rdar://problem/18830771>
+ https://bugs.webkit.org/show_bug.cgi?id=138271
+
+ Reviewed by Anders Carlsson.
+
+ - Adds a new function to the WKBundlePageContextMenuClient that allows the client to pass construct
+ user data in the bundle that can be available when customizing the menu in -[WKView _actionMenuItemsForHitTestResult...].
+ - Changes the signature of -[WKView _actionMenuItemsForHitTestResult...] to add userData.
+ - Makes the actual hit test result available in the second invocation of -[WKView _actionMenuItemsForHitTestResult...]
+ by serializing it in the ActionMenuHitTestResult.
+
+ * Shared/mac/ActionMenuHitTestResult.h:
+ * Shared/mac/ActionMenuHitTestResult.mm:
+ (WebKit::ActionMenuHitTestResult::encode):
+ (WebKit::ActionMenuHitTestResult::decode):
+ Adds the WebHitTestResult and the original hit test request location.
+
+ * UIProcess/API/Cocoa/WKViewPrivate.h:
+ Adds a new version of _actionMenuItemsForHitTestResult that passes userData along.
+
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView _didPerformActionMenuHitTest:userData:]):
+ (-[WKView _actionMenuItemsForHitTestResult:withType:defaultActionMenuItems:userData:]):
+ * UIProcess/API/mac/WKViewInternal.h:
+ * UIProcess/PageClient.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::didPerformActionMenuHitTest):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * UIProcess/mac/PageClientImpl.h:
+ * UIProcess/mac/PageClientImpl.mm:
+ (WebKit::PageClientImpl::didPerformActionMenuHitTest):
+ Pipe the user data through to the WKView.
+
+ * UIProcess/mac/WKActionMenuController.h:
+ * UIProcess/mac/WKActionMenuController.mm:
+ (-[WKActionMenuController prepareForMenu:withEvent:]):
+ (-[WKActionMenuController didPerformActionMenuHitTest:userData:]):
+ (-[WKActionMenuController menuNeedsUpdate:]):
+ (-[WKActionMenuController _updateActionMenuItemsForStage:]):
+ Differentiate between the two times _updateActionMenuItems was called via a new stage parameter,
+ (it is called once in prepareForMenu, and once in menuNeedsUpdate). Use the last mouse move hit
+ test result in the prepareForMenu case (as we don't have a real result yet), and the hit result
+ passed in via didPerformActionMenuHitTest in the menuNeedsUpdate case (assuming we didn't time out)
+ waiting on the web process.
+
+ * WebProcess/InjectedBundle/API/c/WKBundlePageContextMenuClient.h:
+ * WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp:
+ (WebKit::InjectedBundlePageContextMenuClient::prepareForActionMenu):
+ * WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h:
+ * WebProcess/WebPage/mac/WebPageMac.mm:
+ (WebKit::WebPage::performActionMenuHitTestAtLocation):
+ Adds new bundle SPI to collect user data to pass to the -[WKView _actionMenuItemsForHitTestResult...] method.
+
+2014-11-04 Dana Burkart <dburk...@apple.com>
+
Merge r175428. <rdar://problem/18841709>
2014-10-31 Tim Horton <timothy_hor...@apple.com>
Modified: branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.h (175566 => 175567)
--- branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.h 2014-11-04 20:09:00 UTC (rev 175566)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.h 2014-11-04 20:20:38 UTC (rev 175567)
@@ -27,6 +27,7 @@
#define ActionMenuHitTestResult_h
#include "ShareableBitmap.h"
+#include "WebHitTestResult.h"
#include <WebCore/FloatRect.h>
OBJC_CLASS DDActionContext;
@@ -42,6 +43,9 @@
void encode(IPC::ArgumentEncoder&) const;
static bool decode(IPC::ArgumentDecoder&, ActionMenuHitTestResult&);
+ WebCore::FloatPoint hitTestLocationInViewCooordinates;
+ WebHitTestResult::Data hitTestResult;
+
RefPtr<ShareableBitmap> image;
RetainPtr<DDActionContext> actionContext;
Modified: branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.mm (175566 => 175567)
--- branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.mm 2014-11-04 20:09:00 UTC (rev 175566)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.mm 2014-11-04 20:20:38 UTC (rev 175567)
@@ -36,6 +36,9 @@
void ActionMenuHitTestResult::encode(IPC::ArgumentEncoder& encoder) const
{
+ encoder << hitTestLocationInViewCooordinates;
+ encoder << hitTestResult;
+
ShareableBitmap::Handle handle;
// FIXME: We should consider sharing the raw original resource data so that metadata and whatnot are preserved.
@@ -61,6 +64,12 @@
bool ActionMenuHitTestResult::decode(IPC::ArgumentDecoder& decoder, ActionMenuHitTestResult& actionMenuHitTestResult)
{
+ if (!decoder.decode(actionMenuHitTestResult.hitTestLocationInViewCooordinates))
+ return false;
+
+ if (!decoder.decode(actionMenuHitTestResult.hitTestResult))
+ return false;
+
ShareableBitmap::Handle handle;
if (!decoder.decode(handle))
return false;
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h (175566 => 175567)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h 2014-11-04 20:09:00 UTC (rev 175566)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h 2014-11-04 20:20:38 UTC (rev 175567)
@@ -118,7 +118,7 @@
- (void)_setDidMoveSwipeSnapshotCallback:(void(^)(CGRect swipeSnapshotRectInWindowCoordinates))callback;
- (NSArray *)_actionMenuItemsForHitTestResult:(WKHitTestResultRef)hitTestResult withType:(_WKActionMenuType)type defaultActionMenuItems:(NSArray *)defaultMenuItems;
-
+- (NSArray *)_actionMenuItemsForHitTestResult:(WKHitTestResultRef)hitTestResult withType:(_WKActionMenuType)type defaultActionMenuItems:(NSArray *)defaultMenuItems userData:(WKTypeRef)userData;
#endif
@end
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm (175566 => 175567)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm 2014-11-04 20:09:00 UTC (rev 175566)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm 2014-11-04 20:20:38 UTC (rev 175567)
@@ -3658,9 +3658,9 @@
[_data->_actionMenuController didCloseMenu:menu withEvent:event];
}
-- (void)_didPerformActionMenuHitTest:(const ActionMenuHitTestResult&)hitTestResult
+- (void)_didPerformActionMenuHitTest:(const ActionMenuHitTestResult&)hitTestResult userData:(API::Object*)userData
{
- [_data->_actionMenuController didPerformActionMenuHitTest:hitTestResult];
+ [_data->_actionMenuController didPerformActionMenuHitTest:hitTestResult userData:userData];
}
#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
@@ -4138,6 +4138,11 @@
return defaultMenuItems;
}
+- (NSArray *)_actionMenuItemsForHitTestResult:(WKHitTestResultRef)hitTestResult withType:(_WKActionMenuType)type defaultActionMenuItems:(NSArray *)defaultMenuItems userData:(WKTypeRef)userData
+{
+ return [self _actionMenuItemsForHitTestResult:hitTestResult withType:type defaultActionMenuItems:defaultMenuItems];
+}
+
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
- (void)_setAutomaticallyAdjustsContentInsets:(BOOL)automaticallyAdjustsContentInsets
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h (175566 => 175567)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h 2014-11-04 20:09:00 UTC (rev 175566)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h 2014-11-04 20:20:38 UTC (rev 175567)
@@ -126,7 +126,7 @@
- (void)_closeFullScreenWindowController;
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-- (void)_didPerformActionMenuHitTest:(const WebKit::ActionMenuHitTestResult&)hitTestResult;
+- (void)_didPerformActionMenuHitTest:(const WebKit::ActionMenuHitTestResult&)hitTestResult userData:(API::Object*)userData;
#endif
@end
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/PageClient.h (175566 => 175567)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/PageClient.h 2014-11-04 20:09:00 UTC (rev 175566)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/PageClient.h 2014-11-04 20:20:38 UTC (rev 175567)
@@ -310,7 +310,7 @@
virtual void didFinishLoadForMainFrame() = 0;
virtual void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType) = 0;
- virtual void didPerformActionMenuHitTest(const ActionMenuHitTestResult&) = 0;
+ virtual void didPerformActionMenuHitTest(const ActionMenuHitTestResult&, API::Object*) = 0;
};
} // namespace WebKit
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp (175566 => 175567)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp 2014-11-04 20:09:00 UTC (rev 175566)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp 2014-11-04 20:20:38 UTC (rev 175567)
@@ -5205,9 +5205,14 @@
m_process->send(Messages::WebPage::SelectLookupTextAtLocation(point), m_pageID);
}
-void WebPageProxy::didPerformActionMenuHitTest(const ActionMenuHitTestResult& result)
+void WebPageProxy::didPerformActionMenuHitTest(const ActionMenuHitTestResult& result, IPC::MessageDecoder& decoder)
{
- m_pageClient.didPerformActionMenuHitTest(result);
+ RefPtr<API::Object> userData;
+ WebContextUserMessageDecoder messageDecoder(userData, process());
+ if (!decoder.decode(messageDecoder))
+ return;
+
+ m_pageClient.didPerformActionMenuHitTest(result, userData.get());
}
} // namespace WebKit
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.h (175566 => 175567)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.h 2014-11-04 20:09:00 UTC (rev 175566)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.h 2014-11-04 20:20:38 UTC (rev 175567)
@@ -1295,7 +1295,7 @@
void viewDidLeaveWindow();
void viewDidEnterWindow();
- void didPerformActionMenuHitTest(const ActionMenuHitTestResult&);
+ void didPerformActionMenuHitTest(const ActionMenuHitTestResult&, IPC::MessageDecoder&);
PageClient& m_pageClient;
std::unique_ptr<API::LoaderClient> m_loaderClient;
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in (175566 => 175567)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2014-11-04 20:09:00 UTC (rev 175566)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2014-11-04 20:20:38 UTC (rev 175567)
@@ -410,5 +410,5 @@
ContentFilterDidBlockLoadForFrame(WebCore::ContentFilter contentFilter, uint64_t frameID)
#endif
- DidPerformActionMenuHitTest(WebKit::ActionMenuHitTestResult result)
+ DidPerformActionMenuHitTest(WebKit::ActionMenuHitTestResult result, WebKit::InjectedBundleUserMessageEncoder userData) Variadic
}
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.h (175566 => 175567)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.h 2014-11-04 20:09:00 UTC (rev 175566)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.h 2014-11-04 20:20:38 UTC (rev 175567)
@@ -186,7 +186,7 @@
virtual void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType) override;
virtual void removeNavigationGestureSnapshot() override;
- virtual void didPerformActionMenuHitTest(const ActionMenuHitTestResult&) override;
+ virtual void didPerformActionMenuHitTest(const ActionMenuHitTestResult&, API::Object*) override;
WKView *m_wkView;
WKWebView *m_webView;
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (175566 => 175567)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.mm 2014-11-04 20:09:00 UTC (rev 175566)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.mm 2014-11-04 20:20:38 UTC (rev 175567)
@@ -750,10 +750,10 @@
return [windowContentLayer convertRect:layer.bounds fromLayer:layer];
}
-void PageClientImpl::didPerformActionMenuHitTest(const ActionMenuHitTestResult& result)
+void PageClientImpl::didPerformActionMenuHitTest(const ActionMenuHitTestResult& result, API::Object* userData)
{
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
- [m_wkView _didPerformActionMenuHitTest:result];
+ [m_wkView _didPerformActionMenuHitTest:result userData:userData];
#endif
}
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.h (175566 => 175567)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.h 2014-11-04 20:09:00 UTC (rev 175566)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.h 2014-11-04 20:20:38 UTC (rev 175567)
@@ -53,6 +53,7 @@
WebKit::ActionMenuState _state;
WebKit::ActionMenuHitTestResult _hitTestResult;
+ RefPtr<API::Object> _userData;
_WKActionMenuType _type;
RetainPtr<NSSharingServicePicker> _sharingServicePicker;
}
@@ -64,7 +65,7 @@
- (void)willOpenMenu:(NSMenu *)menu withEvent:(NSEvent *)event;
- (void)didCloseMenu:(NSMenu *)menu withEvent:(NSEvent *)event;
-- (void)didPerformActionMenuHitTest:(const WebKit::ActionMenuHitTestResult&)hitTestResult;
+- (void)didPerformActionMenuHitTest:(const WebKit::ActionMenuHitTestResult&)hitTestResult userData:(API::Object*)userData;
@end
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm (175566 => 175567)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm 2014-11-04 20:09:00 UTC (rev 175566)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm 2014-11-04 20:20:38 UTC (rev 175567)
@@ -46,6 +46,11 @@
#import <WebCore/SoftLinking.h>
#import <WebCore/URL.h>
+enum class MenuUpdateStage {
+ PrepareForMenu,
+ MenuNeedsUpdate
+};
+
// FIXME: This should move into an SPI header if it stays.
@class QLPreviewBubble;
@interface NSObject (WKQLPreviewBubbleDetails)
@@ -64,7 +69,7 @@
using namespace WebKit;
@interface WKActionMenuController () <NSSharingServiceDelegate, NSSharingServicePickerDelegate>
-- (void)_updateActionMenuItems;
+- (void)_updateActionMenuItemsForStage:(MenuUpdateStage)stage;
- (BOOL)_canAddImageToPhotos;
@end
@@ -102,7 +107,7 @@
_page->performActionMenuHitTestAtLocation([_wkView convertPoint:event.locationInWindow fromView:nil]);
_state = ActionMenuState::Pending;
- [self _updateActionMenuItems];
+ [self _updateActionMenuItemsForStage:MenuUpdateStage::PrepareForMenu];
}
- (void)willOpenMenu:(NSMenu *)menu withEvent:(NSEvent *)event
@@ -131,11 +136,12 @@
_sharingServicePicker = nil;
}
-- (void)didPerformActionMenuHitTest:(const ActionMenuHitTestResult&)hitTestResult
+- (void)didPerformActionMenuHitTest:(const ActionMenuHitTestResult&)hitTestResult userData:(API::Object*)userData
{
// FIXME: This needs to use the WebKit2 callback mechanism to avoid out-of-order replies.
_state = ActionMenuState::Ready;
_hitTestResult = hitTestResult;
+ _userData = userData;
}
#pragma mark Link actions
@@ -342,7 +348,7 @@
connection->waitForAndDispatchImmediately<Messages::WebPageProxy::DidPerformActionMenuHitTest>(_page->pageID(), std::chrono::milliseconds(500));
}
- [self _updateActionMenuItems];
+ [self _updateActionMenuItemsForStage:MenuUpdateStage::MenuNeedsUpdate];
}
#pragma mark NSSharingServicePickerDelegate implementation
@@ -484,15 +490,28 @@
return _state != ActionMenuState::Ready ? @[ [NSMenuItem separatorItem] ] : @[ ];
}
-- (void)_updateActionMenuItems
+- (void)_updateActionMenuItemsForStage:(MenuUpdateStage)stage
{
[_wkView.actionMenu removeAllItems];
NSArray *menuItems = [self _defaultMenuItems];
+ RefPtr<WebHitTestResult> hitTestResult;
+ switch (stage) {
+ case MenuUpdateStage::PrepareForMenu:
+ hitTestResult = _page->activeActionMenuHitTestResult();
+ break;
+ case MenuUpdateStage::MenuNeedsUpdate:
+ if (_state == ActionMenuState::Ready)
+ hitTestResult = WebHitTestResult::create(_hitTestResult.hitTestResult);
+ else
+ hitTestResult = _page->activeActionMenuHitTestResult();
+ break;
+ }
+
if ([_wkView respondsToSelector:@selector(_actionMenuItemsForHitTestResult:defaultActionMenuItems:)])
- menuItems = [_wkView _actionMenuItemsForHitTestResult:toAPI(_page->activeActionMenuHitTestResult()) defaultActionMenuItems:menuItems];
+ menuItems = [_wkView _actionMenuItemsForHitTestResult:toAPI(hitTestResult.get()) defaultActionMenuItems:menuItems];
else
- menuItems = [_wkView _actionMenuItemsForHitTestResult:toAPI(_page->activeActionMenuHitTestResult()) withType:_type defaultActionMenuItems:menuItems];
+ menuItems = [_wkView _actionMenuItemsForHitTestResult:toAPI(hitTestResult.get()) withType:_type defaultActionMenuItems:menuItems userData:toAPI(_userData.get())];
for (NSMenuItem *item in menuItems)
[_wkView.actionMenu addItem:item];
Modified: branches/safari-600.3-branch/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageContextMenuClient.h (175566 => 175567)
--- branches/safari-600.3-branch/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageContextMenuClient.h 2014-11-04 20:09:00 UTC (rev 175566)
+++ branches/safari-600.3-branch/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageContextMenuClient.h 2014-11-04 20:20:38 UTC (rev 175567)
@@ -29,6 +29,7 @@
#include <WebKit/WKBase.h>
typedef void (*WKBundlePageGetContextMenuFromDefaultContextMenuCallback)(WKBundlePageRef page, WKBundleHitTestResultRef hitTestResult, WKArrayRef defaultMenu, WKArrayRef* newMenu, WKTypeRef* userData, const void* clientInfo);
+typedef void (*WKBundlePagePrepareForActionMenuCallback)(WKBundlePageRef page, WKBundleHitTestResultRef hitTestResult, WKTypeRef* userData, const void* clientInfo);
typedef struct WKBundlePageContextMenuClientBase {
int version;
@@ -38,10 +39,16 @@
typedef struct WKBundlePageContextMenuClientV0 {
WKBundlePageContextMenuClientBase base;
- // Version 0.
WKBundlePageGetContextMenuFromDefaultContextMenuCallback getContextMenuFromDefaultMenu;
} WKBundlePageContextMenuClientV0;
+typedef struct WKBundlePageContextMenuClientV1 {
+ WKBundlePageContextMenuClientBase base;
+
+ WKBundlePageGetContextMenuFromDefaultContextMenuCallback getContextMenuFromDefaultMenu;
+ WKBundlePagePrepareForActionMenuCallback prepareForActionMenu;
+} WKBundlePageContextMenuClientV1;
+
enum { kWKBundlePageContextMenuClientCurrentVersion WK_ENUM_DEPRECATED("Use an explicit version number instead") = 0 };
typedef struct WKBundlePageContextMenuClient {
int version;
Modified: branches/safari-600.3-branch/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp (175566 => 175567)
--- branches/safari-600.3-branch/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp 2014-11-04 20:09:00 UTC (rev 175566)
+++ branches/safari-600.3-branch/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp 2014-11-04 20:20:38 UTC (rev 175567)
@@ -76,5 +76,15 @@
return true;
}
+void InjectedBundlePageContextMenuClient::prepareForActionMenu(WebPage* page, InjectedBundleHitTestResult* hitTestResult, RefPtr<API::Object>& userData)
+{
+ if (!m_client.prepareForActionMenu)
+ return;
+
+ WKTypeRef userDataToPass = nullptr;
+ m_client.prepareForActionMenu(toAPI(page), toAPI(hitTestResult), &userDataToPass, m_client.base.clientInfo);
+ userData = adoptRef(toImpl(userDataToPass));
+}
+
} // namespace WebKit
#endif // ENABLE(CONTEXT_MENUS)
Modified: branches/safari-600.3-branch/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h (175566 => 175567)
--- branches/safari-600.3-branch/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h 2014-11-04 20:09:00 UTC (rev 175566)
+++ branches/safari-600.3-branch/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h 2014-11-04 20:20:38 UTC (rev 175567)
@@ -36,7 +36,7 @@
class Object;
template<> struct ClientTraits<WKBundlePageContextMenuClientBase> {
- typedef std::tuple<WKBundlePageContextMenuClientV0> Versions;
+ typedef std::tuple<WKBundlePageContextMenuClientV0, WKBundlePageContextMenuClientV1> Versions;
};
}
@@ -53,6 +53,7 @@
class InjectedBundlePageContextMenuClient : public API::Client<WKBundlePageContextMenuClientBase> {
public:
bool getCustomMenuFromDefaultItems(WebPage*, InjectedBundleHitTestResult*, const Vector<WebContextMenuItemData>& defaultMenu, Vector<WebContextMenuItemData>& newMenu, RefPtr<API::Object>& userData);
+ void prepareForActionMenu(WebPage*, InjectedBundleHitTestResult*, RefPtr<API::Object>& userData);
};
} // namespace WebKit
Modified: branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (175566 => 175567)
--- branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm 2014-11-04 20:09:00 UTC (rev 175566)
+++ branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm 2014-11-04 20:20:38 UTC (rev 175567)
@@ -34,6 +34,8 @@
#import "DictionaryPopupInfo.h"
#import "EditingRange.h"
#import "EditorState.h"
+#import "InjectedBundleHitTestResult.h"
+#import "InjectedBundleUserMessageCoders.h"
#import "PDFKitImports.h"
#import "PageBanner.h"
#import "PluginView.h"
@@ -1129,7 +1131,7 @@
MainFrame& mainFrame = corePage()->mainFrame();
if (!mainFrame.view() || !mainFrame.view()->renderView()) {
- send(Messages::WebPageProxy::DidPerformActionMenuHitTest(ActionMenuHitTestResult()));
+ send(Messages::WebPageProxy::DidPerformActionMenuHitTest(ActionMenuHitTestResult(), InjectedBundleUserMessageEncoder(nullptr)));
return;
}
@@ -1142,6 +1144,8 @@
mainRenderView.hitTest(request, hitTestResult);
ActionMenuHitTestResult actionMenuResult;
+ actionMenuResult.hitTestLocationInViewCooordinates = locationInViewCooordinates;
+ actionMenuResult.hitTestResult = WebHitTestResult::Data(hitTestResult);
if (Image* image = hitTestResult.image()) {
actionMenuResult.image = ShareableBitmap::createShareable(IntSize(image->size()), ShareableBitmap::SupportsAlpha);
@@ -1155,8 +1159,12 @@
actionMenuResult.actionContext = scanForDataDetectedItems(hitTestResult, actionBoundingBox);
actionMenuResult.actionBoundingBox = actionBoundingBox;
}
-
- send(Messages::WebPageProxy::DidPerformActionMenuHitTest(actionMenuResult));
+
+ RefPtr<API::Object> userData;
+ RefPtr<InjectedBundleHitTestResult> injectedBundleHitTestResult = InjectedBundleHitTestResult::create(hitTestResult);
+ injectedBundleContextMenuClient().prepareForActionMenu(this, injectedBundleHitTestResult.get(), userData);
+
+ send(Messages::WebPageProxy::DidPerformActionMenuHitTest(actionMenuResult, InjectedBundleUserMessageEncoder(userData.get())));
}
void WebPage::selectLookupTextAtLocation(FloatPoint locationInWindowCooordinates)