summaryrefslogtreecommitdiffstats
path: root/WebKit/gtk/webkit/webkitwebinspector.cpp
diff options
context:
space:
mode:
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);
+}