[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15.1-1-1425-g03b254a

Gustavo Noronha Silva kov at debian.org
Fri Oct 30 11:51:21 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 6950e12c73f37740bc166cee31fa6819bf6c62ba
Author: kov at webkit.org <kov at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 28 22:56:58 2009 +0000

    LayoutTests
    
            Reviewed by Jan Alonzo.
    
            [GTK] API to start inspector for a WebView
            https://bugs.webkit.org/show_bug.cgi?id=22551
    
            Unskip inspector tests that we are now able to run.
    
            * platform/gtk/Skipped:
    WebKit/gtk
    
            Reviewed by Jan Alonzo.
    
            [GTK] API to start inspector for a WebView
            https://bugs.webkit.org/show_bug.cgi?id=22551
    
            Provide a simple, coordinates-based API to start the inspector.
    
            * WebCoreSupport/InspectorClientGtk.cpp:
            (WebKit::InspectorClient::createPage): Use files from the source
            tree when running from the top of the source directory.
            (WebKit::InspectorClient::localizedStringsURL): Ditto.
            * webkit/webkitprivate.h:
            * webkit/webkitwebinspector.cpp:
            (webkit_web_inspector_inspect_coordinates):
            (webkit_web_inspector_close):
            (webkit_web_inspector_execute_script):
            * webkit/webkitwebinspector.h:
    
    WebKitTools
    
            Reviewed by Jan Alonzo.
    
            [GTK] API to start inspector for a WebView
            https://bugs.webkit.org/show_bug.cgi?id=22551
    
            Use the new inspector API to implement the LayoutTestController
            interfaces used to test the inspector.
    
            * DumpRenderTree/gtk/DumpRenderTree.cpp:
            (webInspectorInspectWebView):
            (createWebView):
            * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
            (LayoutTestController::showWebInspector):
            (LayoutTestController::closeWebInspector):
            (LayoutTestController::evaluateInWebInspector):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50245 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
index fef07c1..78f5543 100644
--- a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
@@ -97,9 +97,17 @@ Page* InspectorClient::createPage()
     g_signal_connect(m_webView, "destroy",
                      G_CALLBACK(notifyWebViewDestroyed), (gpointer)this);
 
-    gchar* inspectorURI = g_filename_to_uri(DATA_DIR"/webkit-1.0/webinspector/inspector.html", NULL, NULL);
-    webkit_web_view_load_uri(m_webView, inspectorURI);
-    g_free(inspectorURI);
+    GOwnPtr<gchar> inspectorURI;
+
+    // Make the Web Inspector work when running tests
+    if (g_file_test("WebCore/inspector/front-end/inspector.html", G_FILE_TEST_EXISTS)) {
+        GOwnPtr<gchar> currentDirectory(g_get_current_dir());
+        GOwnPtr<gchar> fullPath(g_strdup_printf("%s/WebCore/inspector/front-end/inspector.html", currentDirectory.get()));
+        inspectorURI.set(g_filename_to_uri(fullPath.get(), NULL, NULL));
+    } else
+        inspectorURI.set(g_filename_to_uri(DATA_DIR"/webkit-1.0/webinspector/inspector.html", NULL, NULL));
+
+    webkit_web_view_load_uri(m_webView, inspectorURI.get());
 
     gtk_widget_show(GTK_WIDGET(m_webView));
 
@@ -108,8 +116,18 @@ Page* InspectorClient::createPage()
 
 String InspectorClient::localizedStringsURL()
 {
+    GOwnPtr<gchar> URL;
+
+    // Make the Web Inspector work when running tests
+    if (g_file_test("WebCore/English.lproj/localizedStrings.js", G_FILE_TEST_EXISTS)) {
+        GOwnPtr<gchar> currentDirectory(g_get_current_dir());
+        GOwnPtr<gchar> fullPath(g_strdup_printf("%s/WebCore/English.lproj/localizedStrings.js", currentDirectory.get()));
+        URL.set(g_filename_to_uri(fullPath.get(), NULL, NULL));
+    } else
+        URL.set(g_filename_to_uri(DATA_DIR"/webkit-1.0/webinspector/localizedStrings.js", NULL, NULL));
+
     // FIXME: support l10n of localizedStrings.js
-    return String::fromUTF8(g_filename_to_uri(DATA_DIR"/webkit-1.0/webinspector/localizedStrings.js", NULL, NULL));
+    return String::fromUTF8(URL.get());
 }
 
 String InspectorClient::hiddenPanels()
diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h
index 44dac04..a559c3d 100644
--- a/WebKit/gtk/webkit/webkitprivate.h
+++ b/WebKit/gtk/webkit/webkitprivate.h
@@ -224,6 +224,10 @@ extern "C" {
     void
     webkit_web_inspector_set_inspected_uri(WebKitWebInspector* web_inspector, const gchar* inspected_uri);
 
+    WEBKIT_API void
+    webkit_web_inspector_execute_script(WebKitWebInspector* inspector, long callId, const gchar* script);
+
+
     WebKitWebWindowFeatures*
     webkit_web_window_features_new_from_core_features (const WebCore::WindowFeatures& features);
 
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);
+}
diff --git a/WebKit/gtk/webkit/webkitwebinspector.h b/WebKit/gtk/webkit/webkitwebinspector.h
index 9010e26..94fd806 100644
--- a/WebKit/gtk/webkit/webkitwebinspector.h
+++ b/WebKit/gtk/webkit/webkitwebinspector.h
@@ -60,6 +60,12 @@ webkit_web_inspector_get_web_view(WebKitWebInspector* web_inspector);
 WEBKIT_API const gchar*
 webkit_web_inspector_get_inspected_uri(WebKitWebInspector* web_inspector);
 
+WEBKIT_API void
+webkit_web_inspector_inspect_coordinates(WebKitWebInspector* web_inspector, gdouble x, gdouble y);
+
+WEBKIT_API void
+webkit_web_inspector_close(WebKitWebInspector* webInspector);
+
 G_END_DECLS
 
 #endif /* webkitwebinspector_h */

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list