[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 3eb2f325c9418125a79de21484c0e5d4e7cbbb30..d3fbc682ff2522a64b1f7b413bd83ad0e54d2044 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 6de64a08b5ec72c728d100badaafc5d84e43c384..40569cd7bbe2fa50938243b1117b9ea55ad971b3 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 8c4041647d719b62b996d19c2998bf075ad960a1..67c79b87a9f6623e6d02c8132a6887baa0441c57 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 e6840d2cd5fd9998285bb212c7313b59e901b84e..0ff18b083ce165305cb04e4abc0bbf378b2860dc 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 704904bd89635d1efd59a7b099a4831ffb64740b..bfb970cd4203b8d27adf116c8f66e7cc9e4033ea 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 b872b3072f5d2919a3bacc91de0055a112922cfe..e864ea7d968cc388c215bdc749c861d9295aa367 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 59cc7968620478f19c9f5800a856edfa69d494df..9bd7c29879403d5add46e0380047a04fa3508c5e 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 fec61ac17fc41e2b63a9392ec52da68f5078493f..ae381d36d5748ca65de70b69c3cbbfe023982dbd 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 181ef9f0b29ce6098b18bd6403e1ecab18e03b44..d29512afd50b8c8a7d3940a4edebf1bc22211568 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 7bc3f645902e335a945d4b91fa313afe71ac4b08..c42bce75215e077513d9a6d3458e5b93fc07cc47 100644 (file)
@@ -4,7 +4,7 @@ _ZN3WTF10fastMallocEj;
 _ZN3WTF11fastReallocEPvj;
 _ZN3WTF8fastFreeEPv;
 _ZN3WTF10fastCallocEjj;
-
+_ZN24DumpRenderTreeSupportGtk*;
 local:
 _Z*;
 cti*;