Diff
Modified: trunk/Source/WebKit2/ChangeLog (95564 => 95565)
--- trunk/Source/WebKit2/ChangeLog 2011-09-20 20:13:15 UTC (rev 95564)
+++ trunk/Source/WebKit2/ChangeLog 2011-09-20 20:16:58 UTC (rev 95565)
@@ -1,3 +1,25 @@
+2011-09-20 Nayan Kumar K <[email protected]>
+
+ Added WKHitTestResult API's.
+
+ WKHitTestResult API's are added. These API's can be used to
+ get the hover'ed link/image/media URL as well as link lable and
+ title.
+ https://bugs.webkit.org/show_bug.cgi?id=68426
+
+ Reviewed by Anders Carlsson.
+
+ * GNUmakefile.am:
+ * Shared/API/c/WKHitTestResult.cpp: Copied from Source/WebKit2/UIProcess/API/C/WebKit2.h.
+ (WKHitTestResultGetTypeID):
+ (WKHitTestResultCopyAbsoluteImageURL):
+ (WKHitTestResultCopyAbsoluteLinkURL):
+ (WKHitTestResultCopyAbsoluteMediaURL):
+ (WKHitTestResultCopyLinkLabel):
+ (WKHitTestResultCopyLinkTitle):
+ * Shared/API/c/WKHitTestResult.h: Copied from Source/WebKit2/UIProcess/API/C/WebKit2.h.
+ * UIProcess/API/C/WebKit2.h:
+
2011-09-20 Alexis Menard <[email protected]>
[Qt][WK2] Add stubs for FULLSCREEN_API on Qt.
Modified: trunk/Source/WebKit2/GNUmakefile.am (95564 => 95565)
--- trunk/Source/WebKit2/GNUmakefile.am 2011-09-20 20:13:15 UTC (rev 95564)
+++ trunk/Source/WebKit2/GNUmakefile.am 2011-09-20 20:16:58 UTC (rev 95565)
@@ -13,6 +13,7 @@
$(WebKit2)/Shared/API/c/WKFindOptions.h \
$(WebKit2)/Shared/API/c/WKGeometry.h \
$(WebKit2)/Shared/API/c/WKGraphicsContext.h \
+ $(WebKit2)/Shared/API/c/WKHitTestResult.h \
$(WebKit2)/Shared/API/c/WKImage.h \
$(WebKit2)/Shared/API/c/WKMutableArray.h \
$(WebKit2)/Shared/API/c/WKMutableDictionary.h \
@@ -222,6 +223,8 @@
Source/WebKit2/Shared/API/c/WKGeometry.h \
Source/WebKit2/Shared/API/c/WKGraphicsContext.cpp \
Source/WebKit2/Shared/API/c/WKGraphicsContext.h \
+ Source/WebKit2/Shared/API/c/WKHitTestResult.cpp \
+ Source/WebKit2/Shared/API/c/WKHitTestResult.h \
Source/WebKit2/Shared/API/c/WKImage.cpp \
Source/WebKit2/Shared/API/c/WKImage.h \
Source/WebKit2/Shared/API/c/WKMutableArray.cpp \
Copied: trunk/Source/WebKit2/Shared/API/c/WKHitTestResult.cpp (from rev 95564, trunk/Source/WebKit2/UIProcess/API/C/WebKit2.h) (0 => 95565)
--- trunk/Source/WebKit2/Shared/API/c/WKHitTestResult.cpp (rev 0)
+++ trunk/Source/WebKit2/Shared/API/c/WKHitTestResult.cpp 2011-09-20 20:16:58 UTC (rev 95565)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, 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 "WKHitTestResult.h"
+
+#include "WKAPICast.h"
+#include "WebHitTestResult.h"
+
+using namespace WebKit;
+
+WKTypeID WKHitTestResultGetTypeID()
+{
+ return toAPI(WebHitTestResult::APIType);
+}
+
+WKURLRef WKHitTestResultCopyAbsoluteImageURL(WKHitTestResultRef hitTestResultRef)
+{
+ return toCopiedURLAPI(toImpl(hitTestResultRef)->absoluteImageURL());
+}
+
+WKURLRef WKHitTestResultCopyAbsoluteLinkURL(WKHitTestResultRef hitTestResultRef)
+{
+ return toCopiedURLAPI(toImpl(hitTestResultRef)->absoluteLinkURL());
+}
+
+WKURLRef WKHitTestResultCopyAbsoluteMediaURL(WKHitTestResultRef hitTestResultRef)
+{
+ return toCopiedURLAPI(toImpl(hitTestResultRef)->absoluteMediaURL());
+}
+
+WKStringRef WKHitTestResultCopyLinkLabel(WKHitTestResultRef hitTestResultRef)
+{
+ return toCopiedAPI(toImpl(hitTestResultRef)->linkLabel());
+}
+
+WKStringRef WKHitTestResultCopyLinkTitle(WKHitTestResultRef hitTestResultRef)
+{
+ return toCopiedAPI(toImpl(hitTestResultRef)->linkTitle());
+}
Copied: trunk/Source/WebKit2/Shared/API/c/WKHitTestResult.h (from rev 95564, trunk/Source/WebKit2/UIProcess/API/C/WebKit2.h) (0 => 95565)
--- trunk/Source/WebKit2/Shared/API/c/WKHitTestResult.h (rev 0)
+++ trunk/Source/WebKit2/Shared/API/c/WKHitTestResult.h 2011-09-20 20:16:58 UTC (rev 95565)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, 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.
+ */
+
+#ifndef WKHitTestResult_h
+#define WKHitTestResult_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKHitTestResultGetTypeID();
+
+WK_EXPORT WKURLRef WKHitTestResultCopyAbsoluteImageURL(WKHitTestResultRef hitTestResult);
+WK_EXPORT WKURLRef WKHitTestResultCopyAbsoluteLinkURL(WKHitTestResultRef hitTestResult);
+WK_EXPORT WKURLRef WKHitTestResultCopyAbsoluteMediaURL(WKHitTestResultRef hitTestResult);
+
+WK_EXPORT WKStringRef WKHitTestResultCopyLinkLabel(WKHitTestResultRef hitTestResult);
+WK_EXPORT WKStringRef WKHitTestResultCopyLinkTitle(WKHitTestResultRef hitTestResult);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKHitTestResult_h */
Modified: trunk/Source/WebKit2/UIProcess/API/C/WebKit2.h (95564 => 95565)
--- trunk/Source/WebKit2/UIProcess/API/C/WebKit2.h 2011-09-20 20:13:15 UTC (rev 95564)
+++ trunk/Source/WebKit2/UIProcess/API/C/WebKit2.h 2011-09-20 20:16:58 UTC (rev 95565)
@@ -43,6 +43,7 @@
#include <WebKit2/WKGeolocationPermissionRequest.h>
#include <WebKit2/WKGeolocationPosition.h>
#include <WebKit2/WKGraphicsContext.h>
+#include <WebKit2/WKHitTestResult.h>
#include <WebKit2/WKMutableArray.h>
#include <WebKit2/WKMutableDictionary.h>
#include <WebKit2/WKNavigationData.h>
Modified: trunk/Tools/ChangeLog (95564 => 95565)
--- trunk/Tools/ChangeLog 2011-09-20 20:13:15 UTC (rev 95564)
+++ trunk/Tools/ChangeLog 2011-09-20 20:16:58 UTC (rev 95565)
@@ -1,3 +1,16 @@
+2011-09-20 Nayan Kumar K <[email protected]>
+
+ Get hover'ed element URL from HitTest.
+
+ mouseDidMoveOverElement now gets the hover'ed element link using
+ WKHitTestResult API's.
+ https://bugs.webkit.org/show_bug.cgi?id=68426
+
+ Reviewed by Anders Carlsson.
+
+ * MiniBrowser/gtk/BrowserWindow.c:
+ (mouseDidMoveOverElement):
+
2011-09-20 Leandro Pereira <[email protected]>
Changelog class should have a method to return all entries
Modified: trunk/Tools/MiniBrowser/gtk/BrowserWindow.c (95564 => 95565)
--- trunk/Tools/MiniBrowser/gtk/BrowserWindow.c 2011-09-20 20:13:15 UTC (rev 95564)
+++ trunk/Tools/MiniBrowser/gtk/BrowserWindow.c 2011-09-20 20:16:58 UTC (rev 95565)
@@ -592,18 +592,16 @@
return returnValue;
}
-static void mouseDidMoveOverElement(WKPageRef page, WKEventModifiers modifiers, WKTypeRef userData, const void *clientInfo)
+static void mouseDidMoveOverElement(WKPageRef page, WKHitTestResultRef hitTestResult, WKEventModifiers modifiers, WKTypeRef userData, const void *clientInfo)
{
BrowserWindow *window = BROWSER_WINDOW(clientInfo);
gtk_statusbar_pop(GTK_STATUSBAR(window->statusBar), window->statusBarContextId);
- if (!userData)
+ WKURLRef linkUrlRef = WKHitTestResultCopyAbsoluteLinkURL(hitTestResult);
+ if (!linkUrlRef)
return;
- if (WKGetTypeID(userData) != WKURLGetTypeID())
- return;
-
- gchar *link = WKURLGetCString((WKURLRef)userData);
+ gchar *link = WKURLGetCString(linkUrlRef);
gtk_statusbar_push(GTK_STATUSBAR(window->statusBar), window->statusBarContextId, link);
g_free(link);
}