Add bundle API for hit-testing
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 20 Oct 2012 06:05:14 +0000 (06:05 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 20 Oct 2012 06:05:14 +0000 (06:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=99907

Reviewed by Sam Weinig.

Source/WebKit2:

Test: TestWebKitAPI/Tests/WebKit2/InjectedBundleFrameHitTest.cpp

* WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
(WKBundleFrameCreateHitTestResult): Added this wrapper.
* WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h:
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::hitTest): Added. Hit tests at the given point, ignoring clipping.
* WebProcess/WebPage/WebFrame.h:
(WebFrame): Declared hitTest.

Tools:

Added an API test for WKBundleFrameCreateHitTest().

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Added InjectedBundleFrameHitTest.cpp,
InjectedBundleFrameHitTest_bundle.cpp, and link-with-title.html.

* TestWebKitAPI/Tests/WebKit2/InjectedBundleFrameHitTest.cpp: Added.
(TestWebKitAPI::didReceiveMessageFromInjectedBundle): Checks that the message contains the
title of the link in link-with-title.html.
(TestWebKitAPI::setInjectedBundleClient):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2/InjectedBundleFrameHitTest_Bundle.cpp: Added.
(TestWebKitAPI::InjectedBundleFrameHitTestTest::InjectedBundleFrameHitTestTest):
(TestWebKitAPI::didFinishLoadForFrameCallback): Hit tests at (50, 50) and sends the link title
from the result back to the UI process.
(TestWebKitAPI::InjectedBundleFrameHitTestTest::didCreatePage):
(TestWebKitAPI::InjectedBundleFrameHitTestTest::frameLoadFinished):
* TestWebKitAPI/Tests/WebKit2/link-with-title.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@131979 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h
Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
Source/WebKit2/WebProcess/WebPage/WebFrame.h
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleFrameHitTest.cpp [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleFrameHitTest_Bundle.cpp [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKit2/link-with-title.html [new file with mode: 0644]

index afdad16..e4193c3 100644 (file)
@@ -1,3 +1,20 @@
+2012-10-19  Dan Bernstein  <mitz@apple.com>
+
+        Add bundle API for hit-testing
+        https://bugs.webkit.org/show_bug.cgi?id=99907
+
+        Reviewed by Sam Weinig.
+
+        Test: TestWebKitAPI/Tests/WebKit2/InjectedBundleFrameHitTest.cpp
+
+        * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
+        (WKBundleFrameCreateHitTestResult): Added this wrapper.
+        * WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h:
+        * WebProcess/WebPage/WebFrame.cpp:
+        (WebKit::WebFrame::hitTest): Added. Hit tests at the given point, ignoring clipping.
+        * WebProcess/WebPage/WebFrame.h:
+        (WebFrame): Declared hitTest.
+
 2012-10-19  Jinwoo Song  <jinwoo7.song@samsung.com>
 
         [EFL][WK2] Add API unit tests for scaling
index fe6d79e..24188ff 100644 (file)
@@ -27,6 +27,7 @@
 #include "WKBundleFrame.h"
 #include "WKBundleFramePrivate.h"
 
+#include "InjectedBundleHitTestResult.h"
 #include "WKAPICast.h"
 #include "WKBundleAPICast.h"
 #include "WKData.h"
@@ -280,3 +281,8 @@ bool WKBundleFrameCallShouldCloseOnWebView(WKBundleFrameRef frameRef)
 
     return coreFrame->loader()->shouldClose();
 }
+
+WKBundleHitTestResultRef WKBundleFrameCreateHitTestResult(WKBundleFrameRef frameRef, WKPoint point)
+{
+    return toAPI(toImpl(frameRef)->hitTest(toIntPoint(point)).leakRef());
+}
index b471044..d2286ff 100644 (file)
@@ -55,6 +55,8 @@ WK_EXPORT bool WKBundleFrameContainsAnyFormElements(WKBundleFrameRef frame);
 WK_EXPORT void WKBundleFrameSetTextDirection(WKBundleFrameRef frame, WKStringRef);
 WK_EXPORT bool WKBundleFrameCallShouldCloseOnWebView(WKBundleFrameRef frame);
 
+WK_EXPORT WKBundleHitTestResultRef WKBundleFrameCreateHitTestResult(WKBundleFrameRef frame, WKPoint point);
+
 #ifdef __cplusplus
 }
 #endif
index 8ae9ef0..6840914 100644 (file)
@@ -27,6 +27,7 @@
 #include "WebFrame.h"
 
 #include "DownloadManager.h"
+#include "InjectedBundleHitTestResult.h"
 #include "InjectedBundleNodeHandle.h"
 #include "InjectedBundleRangeHandle.h"
 #include "InjectedBundleScriptWorld.h"
@@ -617,6 +618,14 @@ bool WebFrame::hasVerticalScrollbar() const
     return view->verticalScrollbar();
 }
 
+PassRefPtr<InjectedBundleHitTestResult> WebFrame::hitTest(const IntPoint point) const
+{
+    if (!m_coreFrame)
+        return 0;
+
+    return InjectedBundleHitTestResult::create(m_coreFrame->eventHandler()->hitTestResultAtPoint(point, false, true));
+}
+
 bool WebFrame::getDocumentBackgroundColor(double* red, double* green, double* blue, double* alpha)
 {
     if (!m_coreFrame)
index 6691dce..a719e24 100644 (file)
@@ -42,6 +42,7 @@
 namespace WebCore {
 class Frame;
 class HTMLFrameOwnerElement;
+class IntPoint;
 class IntRect;
 #if ENABLE(WEB_INTENTS)
 class Intent;
@@ -51,6 +52,7 @@ class KURL;
 
 namespace WebKit {
 
+class InjectedBundleHitTestResult;
 class InjectedBundleNodeHandle;
 class InjectedBundleRangeHandle;
 class InjectedBundleScriptWorld;
@@ -111,6 +113,7 @@ public:
     WebCore::IntSize scrollOffset() const;
     bool hasHorizontalScrollbar() const;
     bool hasVerticalScrollbar() const;
+    PassRefPtr<InjectedBundleHitTestResult> hitTest(const WebCore::IntPoint) const;
     bool getDocumentBackgroundColor(double* red, double* green, double* blue, double* alpha);
     bool containsAnyFormElements() const;
     void stopLoading();
index 336cd1b..7da0867 100644 (file)
@@ -1,3 +1,28 @@
+2012-10-19  Dan Bernstein  <mitz@apple.com>
+
+        Add bundle API for hit-testing
+        https://bugs.webkit.org/show_bug.cgi?id=99907
+
+        Reviewed by Sam Weinig.
+
+        Added an API test for WKBundleFrameCreateHitTest().
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Added InjectedBundleFrameHitTest.cpp,
+        InjectedBundleFrameHitTest_bundle.cpp, and link-with-title.html.
+
+        * TestWebKitAPI/Tests/WebKit2/InjectedBundleFrameHitTest.cpp: Added.
+        (TestWebKitAPI::didReceiveMessageFromInjectedBundle): Checks that the message contains the
+        title of the link in link-with-title.html.
+        (TestWebKitAPI::setInjectedBundleClient):
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/WebKit2/InjectedBundleFrameHitTest_Bundle.cpp: Added.
+        (TestWebKitAPI::InjectedBundleFrameHitTestTest::InjectedBundleFrameHitTestTest):
+        (TestWebKitAPI::didFinishLoadForFrameCallback): Hit tests at (50, 50) and sends the link title
+        from the result back to the UI process.
+        (TestWebKitAPI::InjectedBundleFrameHitTestTest::didCreatePage):
+        (TestWebKitAPI::InjectedBundleFrameHitTestTest::frameLoadFinished):
+        * TestWebKitAPI/Tests/WebKit2/link-with-title.html: Added.
+
 2012-10-19  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r131944.
index 77eee84..973a6d0 100644 (file)
@@ -42,6 +42,9 @@
                37200B9213A16230007A4FAD /* VectorReverse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37200B9113A16230007A4FAD /* VectorReverse.cpp */; };
                3722C8691461E03E00C45D00 /* RenderedImageFromDOMRange.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3722C8681461E03E00C45D00 /* RenderedImageFromDOMRange.mm */; };
                3776BC63150946BC0043A66D /* DeviceScaleFactorInDashboardRegions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3776BC62150946BC0043A66D /* DeviceScaleFactorInDashboardRegions.mm */; };
+               378E64731632646D00B6C676 /* InjectedBundleFrameHitTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 378E64711632646D00B6C676 /* InjectedBundleFrameHitTest.cpp */; };
+               378E64771632655E00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 378E64751632655D00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp */; };
+               378E64791632707400B6C676 /* link-with-title.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 378E647816326FDF00B6C676 /* link-with-title.html */; };
                379028B614FABD92007E6B43 /* AcceptsFirstMouse.mm in Sources */ = {isa = PBXBuildFile; fileRef = 379028B514FABD92007E6B43 /* AcceptsFirstMouse.mm */; };
                379028B914FAC24C007E6B43 /* acceptsFirstMouse.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 379028B814FABE49007E6B43 /* acceptsFirstMouse.html */; };
                3799AD3A14120A43005EB0C6 /* StringByEvaluatingJavaScriptFromString.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3799AD3914120A43005EB0C6 /* StringByEvaluatingJavaScriptFromString.mm */; };
                                33DC8912141955FE00747EF7 /* simple-iframe.html in Copy Resources */,
                                1A9E52C913E65EF4006917F5 /* 18-characters.html in Copy Resources */,
                                C07E6CB213FD73930038B22B /* devicePixelRatio.html in Copy Resources */,
+                               378E64791632707400B6C676 /* link-with-title.html in Copy Resources */,
                                9361002914DC95A70061379D /* lots-of-iframes.html in Copy Resources */,
                                93AF4ED11506F130007FD57E /* lots-of-images.html in Copy Resources */,
                                930AD402150698D00067970F /* lots-of-text.html in Copy Resources */,
                37200B9113A16230007A4FAD /* VectorReverse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VectorReverse.cpp; path = WTF/VectorReverse.cpp; sourceTree = "<group>"; };
                3722C8681461E03E00C45D00 /* RenderedImageFromDOMRange.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RenderedImageFromDOMRange.mm; sourceTree = "<group>"; };
                3776BC62150946BC0043A66D /* DeviceScaleFactorInDashboardRegions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DeviceScaleFactorInDashboardRegions.mm; sourceTree = "<group>"; };
+               378E64711632646D00B6C676 /* InjectedBundleFrameHitTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleFrameHitTest.cpp; sourceTree = "<group>"; };
+               378E64751632655D00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleFrameHitTest_Bundle.cpp; sourceTree = "<group>"; };
+               378E647816326FDF00B6C676 /* link-with-title.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "link-with-title.html"; sourceTree = "<group>"; };
                379028B514FABD92007E6B43 /* AcceptsFirstMouse.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AcceptsFirstMouse.mm; sourceTree = "<group>"; };
                379028B814FABE49007E6B43 /* acceptsFirstMouse.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = acceptsFirstMouse.html; sourceTree = "<group>"; };
                3799AD3914120A43005EB0C6 /* StringByEvaluatingJavaScriptFromString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringByEvaluatingJavaScriptFromString.mm; sourceTree = "<group>"; };
                                4BFDFFA61314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp */,
                                BC575AAC126E83B9006F0F12 /* InjectedBundleBasic.cpp */,
                                BC575AAF126E83C8006F0F12 /* InjectedBundleBasic_Bundle.cpp */,
+                               378E64711632646D00B6C676 /* InjectedBundleFrameHitTest.cpp */,
+                               378E64751632655D00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp */,
                                F660AA1215A619C8003A1243 /* InjectedBundleInitializationUserDataCallbackWins.cpp */,
                                F660AA1415A61ABF003A1243 /* InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp */,
                                52CB47401448FB9300873995 /* LoadAlternateHTMLStringWithNonDirectoryURL.cpp */,
                        isa = PBXGroup;
                        children = (
                                C045F9461385C2F800C0F3CD /* 18-characters.html */,
+                               76E182DE15475A8300F1FADD /* auto-submitting-form.html */,
                                BC2D004A12A9FEB300E732A3 /* file-with-anchor.html */,
                                1A02C84B125D4A5E00E3F4BD /* find.html */,
                                BCBD372E125ABBE600D2C29F /* icon.png */,
+                               378E647816326FDF00B6C676 /* link-with-title.html */,
                                9361002814DC957B0061379D /* lots-of-iframes.html */,
                                93AF4ECF1506F123007FD57E /* lots-of-images.html */,
                                930AD401150698B30067970F /* lots-of-text.html */,
                                BCAA485514A021640088FAC4 /* simple-tall.html */,
                                BC909778125571AB00083756 /* simple.html */,
                                C02B7882126615410026BF0F /* spacebar-scrolling.html */,
-                               76E182DE15475A8300F1FADD /* auto-submitting-form.html */,
                        );
                        name = Resources;
                        sourceTree = "<group>";
                                9318778915EEC57700A9CCE3 /* NewFirstVisuallyNonEmptyLayoutForImages.cpp in Sources */,
                                2943BE86161DFEB800999E3D /* UserContentTest.mm in Sources */,
                                4F4D2C0E1626FE2700320FE1 /* MemoryInstrumentationTest.cpp in Sources */,
+                               378E64731632646D00B6C676 /* InjectedBundleFrameHitTest.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                F6F49C6B15545CA70007F39D /* DOMWindowExtensionNoCache_Bundle.cpp in Sources */,
                                F660AA1115A5F631003A1243 /* GetInjectedBundleInitializationUserDataCallback_Bundle.cpp in Sources */,
                                F660AA1515A61ABF003A1243 /* InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp in Sources */,
+                               378E64771632655E00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleFrameHitTest.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleFrameHitTest.cpp
new file mode 100644 (file)
index 0000000..9320801
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PlatformUtilities.h"
+#include "PlatformWebView.h"
+#include <WebKit2/WKRetainPtr.h>
+
+namespace TestWebKitAPI {
+
+static bool done;
+
+static void didReceiveMessageFromInjectedBundle(WKContextRef context, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo)
+{
+    if (WKStringIsEqualToUTF8CString(messageName, "InjectedBundleFrameHitTestDone")) {
+        done = true;
+        WKStringRef linkTitle = (WKStringRef)messageBody;
+        EXPECT_WK_STREQ("HitTestLinkTitle", linkTitle);
+    }
+}
+
+static void setInjectedBundleClient(WKContextRef context)
+{
+    WKContextInjectedBundleClient injectedBundleClient;
+    memset(&injectedBundleClient, 0, sizeof(injectedBundleClient));
+    injectedBundleClient.version = 0;
+    injectedBundleClient.clientInfo = 0;
+    injectedBundleClient.didReceiveMessageFromInjectedBundle = didReceiveMessageFromInjectedBundle;
+    WKContextSetInjectedBundleClient(context, &injectedBundleClient);
+}
+
+TEST(WebKit2, InjectedBundleFrameHitTest)
+{
+    WKRetainPtr<WKContextRef> context(AdoptWK, Util::createContextForInjectedBundleTest("InjectedBundleFrameHitTestTest"));
+    
+    setInjectedBundleClient(context.get());
+
+    PlatformWebView webView(context.get());
+
+    WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("link-with-title", "html")).get());
+
+    Util::run(&done);
+}
+
+} // namespace TestWebKitAPI
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleFrameHitTest_Bundle.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleFrameHitTest_Bundle.cpp
new file mode 100644 (file)
index 0000000..ddaeec1
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "InjectedBundleTest.h"
+#include "PlatformUtilities.h"
+#include <WebKit2/WKBundle.h>
+#include <WebKit2/WKBundleFramePrivate.h>
+#include <WebKit2/WKBundleHitTestResult.h>
+#include <WebKit2/WKBundlePage.h>
+#include <WebKit2/WKRetainPtr.h>
+
+namespace TestWebKitAPI {
+
+class InjectedBundleFrameHitTestTest : public InjectedBundleTest {
+public:
+    InjectedBundleFrameHitTestTest(const std::string& identifier)
+        : InjectedBundleTest(identifier)
+    {
+    }
+
+    virtual void didCreatePage(WKBundleRef, WKBundlePageRef) OVERRIDE;
+    void frameLoadFinished(WKBundleFrameRef);
+
+    WKBundleRef m_bundle;
+};
+
+static InjectedBundleTest::Register<InjectedBundleFrameHitTestTest> registrar("InjectedBundleFrameHitTestTest");
+
+static void didFinishLoadForFrameCallback(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo)
+{
+    ((InjectedBundleFrameHitTestTest*)clientInfo)->frameLoadFinished(frame);
+}
+
+void InjectedBundleFrameHitTestTest::didCreatePage(WKBundleRef bundle, WKBundlePageRef page)
+{
+    m_bundle = bundle;
+
+    WKBundlePageLoaderClient pageLoaderClient;
+    memset(&pageLoaderClient, 0, sizeof(pageLoaderClient));
+    
+    pageLoaderClient.version = 1;
+    pageLoaderClient.clientInfo = this;
+    pageLoaderClient.didFinishLoadForFrame = didFinishLoadForFrameCallback;
+
+    WKBundlePageSetPageLoaderClient(page, &pageLoaderClient);
+}
+
+void InjectedBundleFrameHitTestTest::frameLoadFinished(WKBundleFrameRef frame)
+{
+    WKBundleHitTestResultRef hitTestResult = WKBundleFrameCreateHitTestResult(frame, WKPointMake(50, 50));
+    WKRetainPtr<WKStringRef> linkTitle(AdoptWK, WKBundleHitTestResultCopyLinkTitle(hitTestResult));
+    WKBundlePostMessage(m_bundle, Util::toWK("InjectedBundleFrameHitTestDone").get(), linkTitle.get());
+}
+
+} // namespace TestWebKitAPI
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/link-with-title.html b/Tools/TestWebKitAPI/Tests/WebKit2/link-with-title.html
new file mode 100644 (file)
index 0000000..971ed28
--- /dev/null
@@ -0,0 +1,5 @@
+<html>
+    <body>
+        <a  href="#" style="display: block; height: 100%;" title="HitTestLinkTitle"></a>
+    </body>
+</html>