Diff
Modified: trunk/Source/WebKit2/ChangeLog (167939 => 167940)
--- trunk/Source/WebKit2/ChangeLog 2014-04-29 16:50:26 UTC (rev 167939)
+++ trunk/Source/WebKit2/ChangeLog 2014-04-29 16:56:36 UTC (rev 167940)
@@ -1,3 +1,29 @@
+2014-04-28 Andy Estes <aes...@apple.com>
+
+ [iOS] Introduce -didNotHandleTapAsClickAtPoint: to WKUIDelegatePrivate
+ https://bugs.webkit.org/show_bug.cgi?id=132316
+
+ Reviewed by Darin Adler.
+
+ One WebKit2 client is interested to know if a tap was not handled by an element that responds to clicks.
+ Introduce a new, private WKUIDelegate method telling it that a tap at a location was not handled as a click on
+ an element.
+
+ * UIProcess/API/APIUIClient.h:
+ (API::UIClient::didNotHandleTapAsClick):
+ * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
+ * UIProcess/Cocoa/UIDelegate.h:
+ * UIProcess/Cocoa/UIDelegate.mm:
+ (WebKit::UIDelegate::setDelegate):
+ (WebKit::UIDelegate::UIClient::didNotHandleTapAsClick):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * UIProcess/ios/WebPageProxyIOS.mm:
+ (WebKit::WebPageProxy::didNotHandleTapAsClick):
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::handleTap): Sent Messages::WebPageProxy::DidNotHandleTapAsClick if the tap wasn't handled, no
+ node responded to the click event, or the responding node wasn't an element.
+
2014-04-29 Zan Dobersek <zdober...@igalia.com>
[GTK][WK2] Avoid Vector copies in WebViewBaseInputMethodFilter::setPreedit()
Modified: trunk/Source/WebKit2/UIProcess/API/APIUIClient.h (167939 => 167940)
--- trunk/Source/WebKit2/UIProcess/API/APIUIClient.h 2014-04-29 16:50:26 UTC (rev 167939)
+++ trunk/Source/WebKit2/UIProcess/API/APIUIClient.h 2014-04-29 16:56:36 UTC (rev 167940)
@@ -135,6 +135,7 @@
#if PLATFORM(IOS)
virtual RetainPtr<NSArray> actionsForElement(_WKActivatedElementInfo *, RetainPtr<NSArray> defaultActions) { return std::move(defaultActions); }
+ virtual void didNotHandleTapAsClick(const WebCore::IntPoint&) { }
#endif
};
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h (167939 => 167940)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h 2014-04-29 16:50:26 UTC (rev 167939)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h 2014-04-29 16:56:36 UTC (rev 167940)
@@ -35,6 +35,7 @@
#if TARGET_OS_IPHONE
- (NSArray *)_webView:(WKWebView *)webView actionsForElement:(_WKActivatedElementInfo *)element defaultActions:(NSArray *)defaultActions;
+- (void)_webView:(WKWebView *)webView didNotHandleTapAsClickAtPoint:(CGPoint)point;
#endif
@end
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h (167939 => 167940)
--- trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h 2014-04-29 16:50:26 UTC (rev 167939)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h 2014-04-29 16:56:36 UTC (rev 167940)
@@ -64,6 +64,7 @@
virtual void runJavaScriptPrompt(WebKit::WebPageProxy*, const WTF::String&, const WTF::String&, WebKit::WebFrameProxy*, std::function<void (const WTF::String&)> completionHandler) override;
#if PLATFORM(IOS)
virtual RetainPtr<NSArray> actionsForElement(_WKActivatedElementInfo *, RetainPtr<NSArray> defaultActions) override;
+ virtual void didNotHandleTapAsClick(const WebCore::IntPoint&) override;
#endif
UIDelegate& m_uiDelegate;
@@ -79,6 +80,7 @@
bool webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler : 1;
#if PLATFORM(IOS)
bool webViewActionsForElementDefaultActions : 1;
+ bool webViewDidNotHandleTapAsClickAtPoint : 1;
#endif
} m_delegateMethods;
};
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm (167939 => 167940)
--- trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm 2014-04-29 16:50:26 UTC (rev 167939)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm 2014-04-29 16:56:36 UTC (rev 167940)
@@ -67,6 +67,7 @@
m_delegateMethods.webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:completionHandler:)];
#if PLATFORM(IOS)
m_delegateMethods.webViewActionsForElementDefaultActions = [delegate respondsToSelector:@selector(_webView:actionsForElement:defaultActions:)];
+ m_delegateMethods.webViewDidNotHandleTapAsClickAtPoint = [delegate respondsToSelector:@selector(_webView:didNotHandleTapAsClickAtPoint:)];
#endif
}
@@ -175,6 +176,18 @@
return [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView actionsForElement:elementInfo defaultActions:defaultActions.get()];
}
+
+void UIDelegate::UIClient::didNotHandleTapAsClick(const WebCore::IntPoint& point)
+{
+ if (!m_uiDelegate.m_delegateMethods.webViewDidNotHandleTapAsClickAtPoint)
+ return;
+
+ auto delegate = m_uiDelegate.m_delegate.get();
+ if (!delegate)
+ return;
+
+ [static_cast<id <WKUIDelegatePrivate>>(delegate) _webView:m_uiDelegate.m_webView didNotHandleTapAsClickAtPoint:point];
+}
#endif
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (167939 => 167940)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2014-04-29 16:50:26 UTC (rev 167939)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2014-04-29 16:56:36 UTC (rev 167940)
@@ -614,6 +614,7 @@
void applicationWillResignActive();
void applicationDidBecomeActive();
void zoomToRect(WebCore::FloatRect, double minimumScale, double maximumScale);
+ void didNotHandleTapAsClick(const WebCore::IntPoint&);
#endif
const EditorState& editorState() const { return m_editorState; }
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (167939 => 167940)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2014-04-29 16:50:26 UTC (rev 167939)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2014-04-29 16:56:36 UTC (rev 167940)
@@ -169,6 +169,7 @@
DidUpdateBlockSelectionWithTouch(uint32_t touch, uint32_t flags, float growThreshold, float shrinkThreshold)
ShowPlaybackTargetPicker(bool hasVideo, WebCore::IntRect elementRect)
ZoomToRect(WebCore::FloatRect rect, double minimumScale, double maximumScale)
+ DidNotHandleTapAsClick(WebCore::IntPoint point)
#endif
#if PLATFORM(GTK)
PrintFinishedCallback(WebCore::ResourceError error, uint64_t callbackID)
Modified: trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (167939 => 167940)
--- trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm 2014-04-29 16:50:26 UTC (rev 167939)
+++ trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm 2014-04-29 16:56:36 UTC (rev 167940)
@@ -28,6 +28,7 @@
#if PLATFORM(IOS)
+#import "APIUIClient.h"
#import "DataReference.h"
#import "EditingRange.h"
#import "NativeWebKeyboardEvent.h"
@@ -580,6 +581,11 @@
m_pageClient.zoomToRect(rect, minimumScale, maximumScale);
}
+void WebPageProxy::didNotHandleTapAsClick(const WebCore::IntPoint& point)
+{
+ m_uiClient->didNotHandleTapAsClick(point);
+}
+
#if USE(QUICK_LOOK)
void WebPageProxy::didStartLoadForQuickLookDocumentInMainFrame(const String& fileName, const String& uti)
Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (167939 => 167940)
--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2014-04-29 16:50:26 UTC (rev 167939)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2014-04-29 16:56:36 UTC (rev 167940)
@@ -322,7 +322,7 @@
{
Frame& mainframe = m_page->mainFrame();
FloatPoint adjustedPoint;
- mainframe.nodeRespondingToClickEvents(point, adjustedPoint);
+ Node* nodeRespondingToClick = mainframe.nodeRespondingToClickEvents(point, adjustedPoint);
IntPoint roundedAdjustedPoint = roundedIntPoint(adjustedPoint);
WKBeginObservingContentChanges(true);
@@ -336,9 +336,10 @@
RefPtr<Element> oldFocusedElement = oldFocusedFrame ? oldFocusedFrame->document()->focusedElement() : nullptr;
m_userIsInteracting = true;
+ bool tapWasHandled = false;
m_lastInteractionLocation = roundedAdjustedPoint;
- mainframe.eventHandler().handleMousePressEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MousePressed, 1, false, false, false, false, 0));
- mainframe.eventHandler().handleMouseReleaseEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MouseReleased, 1, false, false, false, false, 0));
+ tapWasHandled |= mainframe.eventHandler().handleMousePressEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MousePressed, 1, false, false, false, false, 0));
+ tapWasHandled |= mainframe.eventHandler().handleMouseReleaseEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MouseReleased, 1, false, false, false, false, 0));
RefPtr<Frame> newFocusedFrame = m_page->focusController().focusedFrame();
RefPtr<Element> newFocusedElement = newFocusedFrame ? newFocusedFrame->document()->focusedElement() : nullptr;
@@ -351,6 +352,9 @@
elementDidFocus(newFocusedElement.get());
m_userIsInteracting = false;
+
+ if (!tapWasHandled || !nodeRespondingToClick || !nodeRespondingToClick->isElementNode())
+ send(Messages::WebPageProxy::DidNotHandleTapAsClick(point));
}
void WebPage::tapHighlightAtPosition(uint64_t requestID, const FloatPoint& position)