[GTK] Implement DumpRenderTreeSupportGtk (similarly to DumpRenderTreeSupportQt idea)
authortonikitoo@webkit.org <tonikitoo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Oct 2010 05:22:23 +0000 (05:22 +0000)
committertonikitoo@webkit.org <tonikitoo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Oct 2010 05:22:23 +0000 (05:22 +0000)
https://bugs.webkit.org/show_bug.cgi?id=48199

Reviewed by Martin Robinson.
Patch by Antonio Gomes <agomes@rim.com>

.:

* GNUmakefile.am: Added WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp|h to GTK+'s build system;
* autotools/symbols.filter: Added DumpRenderTreeSupportGtk symbols to symbols.filter so they do not get
  filtered and get visible by DRT.

WebKit/gtk:

Implemented an initial version of the DumpRenderTreeSupportGtk class.
The main idea is that it groups together the bodies of many LayoutTestController
methods, so they can directly access WebCore features. This way we eliminate the
need of adding APIs to WebKitGTK just to expand its test coverage through DRT.

The DumpRenderTreeSupportGtk class so far includes a getter and setter for the WebKitTabToLinksPreferenceKey
property as a sample implementation. Also it makes it possible to unskip fast/events/tab-focus-anchor.html and
to fix stderr messages from all 22 spatial-navigation tests in fast/events/spatial-navigation.

* WebCoreSupport/ChromeClientGtk.cpp:
(WebKit::ChromeClient::tabsToLinks):
* WebCoreSupport/DumpRenderTreeSupportGtk.cpp: Added.
(DumpRenderTreeSupportGtk::DumpRenderTreeSupportGtk):
(DumpRenderTreeSupportGtk::~DumpRenderTreeSupportGtk):
(DumpRenderTreeSupportGtk::setDumpRenderTreeModeEnabled):
(DumpRenderTreeSupportGtk::dumpRenderTreeModeEnabled): Getter to the WebKitTabToLinksPreferenceKey property.
(DumpRenderTreeSupportGtk::setLinksIncludedInFocusChain): Setter to the WebKitTabToLinksPreferenceKey property.
(DumpRenderTreeSupportGtk::linksIncludedInFocusChain):
* WebCoreSupport/DumpRenderTreeSupportGtk.h: Added.

WebKitTools:

Implements support to WebKitTabToLinksPreferenceKey through LayoutTestController::overridePreference.
The corresponding DumpRenderTreeSupportGtk method is called in the DRT context only.

* DumpRenderTree/gtk/DumpRenderTree.cpp:
(resetDefaultsToConsistentValues):
(createWebView):
* DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
(LayoutTestController::overridePreference):

LayoutTests:

* platform/gtk/Skipped: Unskiped fast/events/tab-focus-anchor.html.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@70609 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
ChangeLog
GNUmakefile.am
LayoutTests/ChangeLog
LayoutTests/platform/gtk/Skipped
WebKit/gtk/ChangeLog
WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp [new file with mode: 0644]
WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h [new file with mode: 0644]
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
autotools/symbols.filter

index 3eb2f32..d3fbc68 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2010-10-26  Antonio Gomes  <agomes@rim.com>
+
+        Reviewed by Martin Robinson.
+
+        [GTK] Implement DumpRenderTreeSupportGtk (similarly to DumpRenderTreeSupportQt idea)
+        https://bugs.webkit.org/show_bug.cgi?id=48199
+
+        * GNUmakefile.am: Added WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp|h to GTK+'s build system;
+        * autotools/symbols.filter: Added DumpRenderTreeSupportGtk symbols to symbols.filter so they do not get
+          filtered and get visible by DRT.
+
 2010-10-24  Anders Bakken  <agbakken@gmail.com>
 
         Reviewed by Simon Hausmann.
index 6de64a0..40569cd 100644 (file)
@@ -362,6 +362,8 @@ webkitgtk_sources += \
        WebKit/gtk/WebCoreSupport/EditorClientGtk.h \
        WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp \
        WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h \
+       WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp \
+       WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h \
        WebKit/gtk/WebCoreSupport/FrameNetworkingContextGtk.h \
        WebKit/gtk/WebCoreSupport/FullscreenVideoController.cpp \
        WebKit/gtk/WebCoreSupport/FullscreenVideoController.h \
index 8c40416..67c79b8 100644 (file)
@@ -1,3 +1,12 @@
+2010-10-26  Antonio Gomes  <agomes@rim.com>
+
+        Reviewed by Martin Robinson.
+
+        [GTK] Implement DumpRenderTreeSupportGtk (similarly to DumpRenderTreeSupportQt idea)
+        https://bugs.webkit.org/show_bug.cgi?id=48199
+
+        * platform/gtk/Skipped: Unskiped fast/events/tab-focus-anchor.html.
+
 2010-10-26  MORITA Hajime  <morrita@google.com>
 
         Reviewed by Tony Chang.
index e6840d2..0ff18b0 100644 (file)
@@ -4654,7 +4654,6 @@ webarchive/test-xml-stylesheet.xml
 # Tests that failed because we don't have an eventSender implementation
 editing/input/scroll-viewport-page-up-down.html
 fast/events/popup-when-select-change.html
-fast/events/tab-focus-anchor.html
 http/tests/misc/slow-loading-mask.html
 http/tests/plugins/plugin-document-has-focus.html
 
index 704904b..bfb970c 100644 (file)
@@ -1,3 +1,30 @@
+2010-10-26  Antonio Gomes  <agomes@rim.com>
+
+        Reviewed by Martin Robinson.
+
+        [GTK] Implement DumpRenderTreeSupportGtk (similarly to DumpRenderTreeSupportQt idea)
+        https://bugs.webkit.org/show_bug.cgi?id=48199
+
+        Implemented an initial version of the DumpRenderTreeSupportGtk class.
+        The main idea is that it groups together the bodies of many LayoutTestController
+        methods, so they can directly access WebCore features. This way we eliminate the
+        need of adding APIs to WebKitGTK just to expand its test coverage through DRT.
+
+        The DumpRenderTreeSupportGtk class so far includes a getter and setter for the WebKitTabToLinksPreferenceKey
+        property as a sample implementation. Also it makes it possible to unskip fast/events/tab-focus-anchor.html and
+        to fix stderr messages from all 22 spatial-navigation tests in fast/events/spatial-navigation.
+
+        * WebCoreSupport/ChromeClientGtk.cpp:
+        (WebKit::ChromeClient::tabsToLinks):
+        * WebCoreSupport/DumpRenderTreeSupportGtk.cpp: Added.
+        (DumpRenderTreeSupportGtk::DumpRenderTreeSupportGtk):
+        (DumpRenderTreeSupportGtk::~DumpRenderTreeSupportGtk):
+        (DumpRenderTreeSupportGtk::setDumpRenderTreeModeEnabled):
+        (DumpRenderTreeSupportGtk::dumpRenderTreeModeEnabled): Getter to the WebKitTabToLinksPreferenceKey property.
+        (DumpRenderTreeSupportGtk::setLinksIncludedInFocusChain): Setter to the WebKitTabToLinksPreferenceKey property.
+        (DumpRenderTreeSupportGtk::linksIncludedInFocusChain):
+        * WebCoreSupport/DumpRenderTreeSupportGtk.h: Added.
+
 2010-10-26  Jenn Braithwaite  <jennb@chromium.org>
 
         Reviewed by Dmitry Titov.
index b872b30..e864ea7 100644 (file)
@@ -25,6 +25,7 @@
 #include "ChromeClientGtk.h"
 
 #include "Console.h"
+#include "DumpRenderTreeSupportGtk.h"
 #include "FileSystem.h"
 #include "FileChooser.h"
 #include "FloatRect.h"
@@ -331,6 +332,9 @@ bool ChromeClient::shouldInterruptJavaScript()
 
 bool ChromeClient::tabsToLinks() const
 {
+    if (DumpRenderTreeSupportGtk::dumpRenderTreeModeEnabled())
+        return DumpRenderTreeSupportGtk::linksIncludedInFocusChain();
+
     return true;
 }
 
diff --git a/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp b/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp
new file mode 100644 (file)
index 0000000..8296206
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ *  Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "config.h"
+#include "DumpRenderTreeSupportGtk.h"
+
+#include "webkitwebview.h"
+#include "webkitprivate.h"
+
+using namespace WebCore;
+
+bool DumpRenderTreeSupportGtk::s_drtRun = false;
+bool DumpRenderTreeSupportGtk::s_linksIncludedInTabChain = true;
+
+DumpRenderTreeSupportGtk::DumpRenderTreeSupportGtk()
+{
+}
+
+DumpRenderTreeSupportGtk::~DumpRenderTreeSupportGtk()
+{
+}
+
+void DumpRenderTreeSupportGtk::setDumpRenderTreeModeEnabled(bool enabled)
+{
+    s_drtRun = enabled;
+}
+
+bool DumpRenderTreeSupportGtk::dumpRenderTreeModeEnabled()
+{
+    return s_drtRun;
+}
+void DumpRenderTreeSupportGtk::setLinksIncludedInFocusChain(bool enabled)
+{
+    s_linksIncludedInTabChain = enabled;
+}
+
+bool DumpRenderTreeSupportGtk::linksIncludedInFocusChain()
+{
+    return s_linksIncludedInTabChain;
+}
+
diff --git a/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h b/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h
new file mode 100644 (file)
index 0000000..5b494ff
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ *  Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef DumpRenderTreeSupportGtk_h
+#define DumpRenderTreeSupportGtk_h
+
+class DumpRenderTreeSupportGtk {
+
+public:
+    DumpRenderTreeSupportGtk();
+    ~DumpRenderTreeSupportGtk();
+
+    static void setDumpRenderTreeModeEnabled(bool);
+    static bool dumpRenderTreeModeEnabled();
+
+    static void setLinksIncludedInFocusChain(bool);
+    static bool linksIncludedInFocusChain();
+
+private:
+    static bool s_drtRun;
+    static bool s_linksIncludedInTabChain;
+};
+
+#endif
index 59cc796..9bd7c29 100644 (file)
@@ -1,3 +1,19 @@
+2010-10-26  Antonio Gomes  <agomes@rim.com>
+
+        Reviewed by Martin Robinson.
+
+        [GTK] Implement DumpRenderTreeSupportGtk (similarly to DumpRenderTreeSupportQt idea)
+        https://bugs.webkit.org/show_bug.cgi?id=48199
+
+        Implements support to WebKitTabToLinksPreferenceKey through LayoutTestController::overridePreference.
+        The corresponding DumpRenderTreeSupportGtk method is called in the DRT context only.
+
+        * DumpRenderTree/gtk/DumpRenderTree.cpp:
+        (resetDefaultsToConsistentValues):
+        (createWebView):
+        * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
+        (LayoutTestController::overridePreference):
+
 2010-10-26  Ariya Hidayat  <ariya@sencha.com>
 
         Unreviewed, change the order of my emails for bugzilla autocompletion.
index fec61ac..ae381d3 100644 (file)
@@ -38,6 +38,7 @@
 #include "GOwnPtr.h"
 #include "LayoutTestController.h"
 #include "PixelDumpSupport.h"
+#include "WebCoreSupport/DumpRenderTreeSupportGtk.h"
 #include "WorkQueue.h"
 #include "WorkQueueItem.h"
 #include <JavaScriptCore/JavaScript.h>
@@ -443,6 +444,8 @@ static void resetDefaultsToConsistentValues()
 #endif
 
     setlocale(LC_ALL, "");
+
+    DumpRenderTreeSupportGtk::setLinksIncludedInFocusChain(true);
 }
 
 static bool useLongRunningServerMode(int argc, char *argv[])
@@ -994,6 +997,8 @@ static WebKitWebView* createWebView()
 {
     WebKitWebView* view = WEBKIT_WEB_VIEW(webkit_web_view_new());
 
+    DumpRenderTreeSupportGtk::setDumpRenderTreeModeEnabled(true);
+
     // From bug 11756: Use a frame group name for all WebViews created by
     // DumpRenderTree to allow testing of cross-page frame lookup.
     webkit_web_view_set_group_name(view, "org.webkit.gtk.DumpRenderTree");
index 181ef9f..d29512a 100644 (file)
@@ -33,6 +33,7 @@
 #include "config.h"
 #include "LayoutTestController.h"
 
+#include "../../../WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h"
 #include "DumpRenderTree.h"
 #include "WorkQueue.h"
 #include "WorkQueueItem.h"
@@ -683,10 +684,13 @@ void LayoutTestController::overridePreference(JSStringRef key, JSStringRef value
     else if (g_str_equal(originalName.get(), "WebKitUsesPageCachePreferenceKey"))
         propertyName = "enable-page-cache";
     else if (g_str_equal(originalName.get(), "WebKitPluginsEnabled"))
-         propertyName = "enable-plugins";
+        propertyName = "enable-plugins";
     else if (g_str_equal(originalName.get(), "WebKitHyperlinkAuditingEnabled"))
-         propertyName = "enable-hyperlink-auditing";
-    else {
+        propertyName = "enable-hyperlink-auditing";
+    else if (g_str_equal(originalName.get(), "WebKitTabToLinksPreferenceKey")) {
+        DumpRenderTreeSupportGtk::setLinksIncludedInFocusChain(!g_ascii_strcasecmp(valueAsString.get(), "true") || !g_ascii_strcasecmp(valueAsString.get(), "1"));
+        return;
+    } else {
         fprintf(stderr, "LayoutTestController::overridePreference tried to override "
                 "unknown preference '%s'.\n", originalName.get());
         return;
index 7bc3f64..c42bce7 100644 (file)
@@ -4,7 +4,7 @@ _ZN3WTF10fastMallocEj;
 _ZN3WTF11fastReallocEPvj;
 _ZN3WTF8fastFreeEPv;
 _ZN3WTF10fastCallocEjj;
-
+_ZN24DumpRenderTreeSupportGtk*;
 local:
 _Z*;
 cti*;