[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

kov at webkit.org kov at webkit.org
Wed Apr 7 23:13:45 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit ef359e7b997215d94a178b1257ab17e596ca6bce
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/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 304e447..f39c4b1 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,5 +1,16 @@
 2009-10-28  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
 
+        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:
+
+2009-10-28  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
+
         Reviewed by Xan Lopez.
 
         [GTK] Fails new test fast/js/navigator-language.html
diff --git a/LayoutTests/platform/gtk/Skipped b/LayoutTests/platform/gtk/Skipped
index 55923b1..ab77a48 100644
--- a/LayoutTests/platform/gtk/Skipped
+++ b/LayoutTests/platform/gtk/Skipped
@@ -3571,15 +3571,6 @@ http/tests/webarchive/test-css-url-encoding-utf-8.html
 http/tests/webarchive/test-css-url-encoding.html
 http/tests/webarchive/test-preload-resources.html
 
-# Tests in inspector/ directory
-#   Tests failing
-inspector/console-dir.html
-inspector/console-dirxml.html
-inspector/console-format.html
-inspector/console-tests.html
-inspector/elements-panel-structure.html
-inspector/evaluate-in-frontend.html
-
 # Tests in media/ directory
 #   Tests failing
 media/video-controls-transformed.html
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index 9a155fd..62aa3da 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,23 @@
+2009-10-28  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
+
+        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:
+
 2009-10-27  Shinichiro Hamaji  <hamaji at chromium.org>
 
         Reviewed by Darin Adler.
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 0be0c04..088175f 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 */
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 4aea52b..e10ac8a 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,21 @@
+2009-10-28  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
+
+        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):
+
 2009-10-28  Shinichiro Hamaji  <hamaji at chromium.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
index cf86b30..4ed6e36 100644
--- a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
@@ -708,6 +708,11 @@ static void databaseQuotaExceeded(WebKitWebView* view, WebKitWebFrame* frame, We
 
 static WebKitWebView* webViewCreate(WebKitWebView*, WebKitWebFrame*);
 
+static WebKitWebView* webInspectorInspectWebView(WebKitWebInspector*, gpointer data)
+{
+    return WEBKIT_WEB_VIEW(webkit_web_view_new());
+}
+
 static WebKitWebView* createWebView()
 {
     WebKitWebView* view = WEBKIT_WEB_VIEW(webkit_web_view_new());
@@ -732,6 +737,9 @@ static WebKitWebView* createWebView()
                      "signal::database-quota-exceeded", databaseQuotaExceeded, 0,
                      NULL);
 
+    WebKitWebInspector* inspector = webkit_web_view_get_inspector(view);
+    g_signal_connect(inspector, "inspect-web-view", G_CALLBACK(webInspectorInspectWebView), 0);
+
     return view;
 }
 
diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
index fd41391..631fc31 100644
--- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
@@ -3,6 +3,7 @@
  * Copyright (C) 2007 Eric Seidel <eric at webkit.org>
  * Copyright (C) 2008 Nuanti Ltd.
  * Copyright (C) 2009 Jan Michael Alonzo <jmalonzo at gmail.com>
+ * Copyright (C) 2009 Collabora Ltd.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -53,6 +54,7 @@ void webkit_application_cache_set_maximum_size(unsigned long long size);
 unsigned int webkit_worker_thread_count(void);
 void webkit_white_list_access_from_origin(const gchar* sourceOrigin, const gchar* destinationProtocol, const gchar* destinationHost, bool allowDestinationSubdomains);
 gchar* webkit_web_frame_counter_value_for_element_by_id(WebKitWebFrame* frame, const gchar* id);
+void webkit_web_inspector_execute_script(WebKitWebInspector* inspector, long callId, const gchar* script);
 }
 
 static gchar* copyWebSettingKey(gchar* preferenceKey)
@@ -486,17 +488,32 @@ void LayoutTestController::addUserStyleSheet(JSStringRef source)
 
 void LayoutTestController::showWebInspector()
 {
-    // FIXME: Implement this.
+    WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
+    WebKitWebSettings* webSettings = webkit_web_view_get_settings(webView);
+    WebKitWebInspector* inspector = webkit_web_view_get_inspector(webView);
+
+    g_object_set(webSettings, "enable-developer-extras", TRUE, NULL);
+    webkit_web_inspector_inspect_coordinates(inspector, 0, 0);
 }
 
 void LayoutTestController::closeWebInspector()
 {
-    // FIXME: Implement this.
+    WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
+    WebKitWebSettings* webSettings = webkit_web_view_get_settings(webView);
+    WebKitWebInspector* inspector = webkit_web_view_get_inspector(webView);
+
+    webkit_web_inspector_close(inspector);
+    g_object_set(webSettings, "enable-developer-extras", FALSE, NULL);
 }
 
 void LayoutTestController::evaluateInWebInspector(long callId, JSStringRef script)
 {
-    // FIXME: Implement this.
+    WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
+    WebKitWebInspector* inspector = webkit_web_view_get_inspector(webView);
+    char* scriptString = JSStringCopyUTF8CString(script);
+
+    webkit_web_inspector_execute_script(inspector, callId, scriptString);
+    g_free(scriptString);
 }
 
 void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list