summaryrefslogtreecommitdiffstats
path: root/WebKit/gtk/webkit/webkitwebinspector.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2009-11-05 09:23:40 +0000
committerSteve Block <steveblock@google.com>2009-11-10 22:41:12 +0000
commitcac0f67c402d107cdb10971b95719e2ff9c7c76b (patch)
treed182c7f87211c6f201a5f038e332336493ebdbe7 /WebKit/gtk/webkit/webkitwebinspector.cpp
parent4b2ef0f288e7c6c4602f621b7a0e9feed304b70e (diff)
downloadexternal_webkit-cac0f67c402d107cdb10971b95719e2ff9c7c76b.zip
external_webkit-cac0f67c402d107cdb10971b95719e2ff9c7c76b.tar.gz
external_webkit-cac0f67c402d107cdb10971b95719e2ff9c7c76b.tar.bz2
Merge webkit.org at r50258 : Initial merge by git.
Change-Id: I1a9e1dc4ed654b69174ad52a4f031a07240f37b0
Diffstat (limited to 'WebKit/gtk/webkit/webkitwebinspector.cpp')
-rw-r--r--WebKit/gtk/webkit/webkitwebinspector.cpp76
1 files changed, 74 insertions, 2 deletions
diff --git a/WebKit/gtk/webkit/webkitwebinspector.cpp b/WebKit/gtk/webkit/webkitwebinspector.cpp
index 4e4f8de..ee2815c 100644
--- a/WebKit/gtk/webkit/webkitwebinspector.cpp
+++ b/WebKit/gtk/webkit/webkitwebinspector.cpp
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2008 Gustavo Noronha Silva
* Copyright (C) 2008, 2009 Holger Hans Peter Freyther
+ * Copyright (C) 2009 Collabora Ltd.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -19,11 +20,18 @@
*/
#include "config.h"
+#include "webkitwebinspector.h"
+#include "FocusController.h"
+#include "Frame.h"
#include <glib/gi18n-lib.h>
-#include "webkitwebinspector.h"
-#include "webkitmarshal.h"
+#include "HitTestRequest.h"
+#include "HitTestResult.h"
#include "InspectorClientGtk.h"
+#include "IntPoint.h"
+#include "Page.h"
+#include "RenderView.h"
+#include "webkitmarshal.h"
#include "webkitprivate.h"
/**
@@ -56,6 +64,7 @@
*/
using namespace WebKit;
+using namespace WebCore;
enum {
INSPECT_WEB_VIEW,
@@ -426,3 +435,66 @@ webkit_web_inspector_set_inspector_client(WebKitWebInspector* web_inspector, Web
priv->page = page;
}
+
+/**
+ * webkit_web_inspector_inspect_coordinates:
+ * @web_inspector: the #WebKitWebInspector that will do the inspection
+ * @x: the X coordinate of the node to be inspected
+ * @y: the Y coordinate of the node to be inspected
+ *
+ * Causes the Web Inspector to inspect the node that is located at the
+ * given coordinates of the widget. The coordinates should be relative
+ * to the #WebKitWebView widget, not to the scrollable content, and
+ * may be obtained from a #GdkEvent directly.
+ *
+ * This means @x, and @y being zero doesn't guarantee you will hit the
+ * left-most top corner of the content, since the contents may have
+ * been scrolled.
+ *
+ * Since: 1.1.17
+ */
+void webkit_web_inspector_inspect_coordinates(WebKitWebInspector* webInspector, gdouble x, gdouble y)
+{
+ g_return_if_fail(WEBKIT_IS_WEB_INSPECTOR(webInspector));
+ g_return_if_fail(x >= 0 && y >= 0);
+
+ WebKitWebInspectorPrivate* priv = webInspector->priv;
+
+ Frame* frame = priv->page->focusController()->focusedOrMainFrame();
+ FrameView* view = frame->view();
+
+ if (!view)
+ return;
+
+ HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active);
+ IntPoint documentPoint = view->windowToContents(IntPoint(static_cast<int>(x), static_cast<int>(y)));
+ HitTestResult result(documentPoint);
+
+ frame->contentRenderer()->layer()->hitTest(request, result);
+ priv->page->inspectorController()->inspect(result.innerNonSharedNode());
+}
+
+/**
+ * webkit_web_inspector_close:
+ * @web_inspector: the #WebKitWebInspector that will be closed
+ *
+ * Causes the Web Inspector to be closed.
+ *
+ * Since: 1.1.17
+ */
+void webkit_web_inspector_close(WebKitWebInspector* webInspector)
+{
+ g_return_if_fail(WEBKIT_IS_WEB_INSPECTOR(webInspector));
+
+ WebKitWebInspectorPrivate* priv = webInspector->priv;
+ priv->page->inspectorController()->close();
+}
+
+void webkit_web_inspector_execute_script(WebKitWebInspector* webInspector, long callId, const gchar* script)
+{
+ g_return_if_fail(WEBKIT_IS_WEB_INSPECTOR(webInspector));
+ g_return_if_fail(script);
+
+ WebKitWebInspectorPrivate* priv = webInspector->priv;
+ priv->page->inspectorController()->evaluateForTestInFrontend(callId, script);
+}