[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

mrobinson at webkit.org mrobinson at webkit.org
Wed Dec 22 13:04:13 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 49cb2834cc078bf879d6eee78f82ea16874158eb
Author: mrobinson at webkit.org <mrobinson at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Sep 6 16:14:36 2010 +0000

    2010-09-06  Martin Robinson  <mrobinson at igalia.com>
    
            Reviewed by Xan Lopez.
    
            [GTK] Small code cleanup in DumpRenderTreeGtk.cpp
            https://bugs.webkit.org/show_bug.cgi?id=45213
    
            * DumpRenderTree/gtk/DumpRenderTree.cpp:
            (initializeFonts): Made this function do nothing for non-X11 platforms, so we don't
            have to surround the invocation with #ifdefs.
            (useLongRunningServerMode): Added.
            (runTestingServerLoop): Added.
            (initializeGlobalsFromCommandLineOptions): Added.
            (runTest): Removed ifdefs.
            (main): Use new helper functions.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66834 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index c5449ba..eb13a21 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -2,6 +2,22 @@
 
         Reviewed by Xan Lopez.
 
+        [GTK] Small code cleanup in DumpRenderTreeGtk.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=45213
+
+        * DumpRenderTree/gtk/DumpRenderTree.cpp:
+        (initializeFonts): Made this function do nothing for non-X11 platforms, so we don't
+        have to surround the invocation with #ifdefs.
+        (useLongRunningServerMode): Added.
+        (runTestingServerLoop): Added.
+        (initializeGlobalsFromCommandLineOptions): Added.
+        (runTest): Removed ifdefs.
+        (main): Use new helper functions.
+
+2010-09-06  Martin Robinson  <mrobinson at igalia.com>
+
+        Reviewed by Xan Lopez.
+
         [GTK] EventSender should support modifier keys with mouseDown and mouseUp events
         https://bugs.webkit.org/show_bug.cgi?id=45235
 
diff --git a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
index bd9c0c9..af2e403 100644
--- a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
@@ -96,6 +96,8 @@ static WebKitWebHistoryItem* prevTestBFItem = NULL;
 
 const unsigned historyItemIndent = 8;
 
+static void runTest(const string& testPathOrURL);
+
 static bool shouldLogFrameLoadDelegates(const string& pathOrURL)
 {
     return pathOrURL.find("loading/") != string::npos;
@@ -128,11 +130,13 @@ static void appendString(gchar*& target, gchar* string)
     g_free(oldString);
 }
 
-#if PLATFORM(X11)
 static void initializeFonts()
 {
+#if PLATFORM(X11)
     static int numFonts = -1;
 
+    FcInit();
+
     // Some tests may add or remove fonts via the @font-face rule.
     // If that happens, font config should be re-created to suppress any unwanted change.
     FcFontSet* appFontSet = FcConfigGetFonts(0, FcSetApplication);
@@ -160,8 +164,8 @@ static void initializeFonts()
 
     appFontSet = FcConfigGetFonts(config, FcSetApplication);
     numFonts = appFontSet->nfont;
-}
 #endif
+}
 
 static gchar* dumpFramesAsText(WebKitWebFrame* frame)
 {
@@ -357,6 +361,50 @@ static void resetDefaultsToConsistentValues()
     setlocale(LC_ALL, "");
 }
 
+static bool useLongRunningServerMode(int argc, char *argv[])
+{
+    // This assumes you've already called getopt_long
+    return (argc == optind+1 && !strcmp(argv[optind], "-"));
+}
+
+static void runTestingServerLoop()
+{
+    // When DumpRenderTree runs in server mode, we just wait around for file names
+    // to be passed to us and read each in turn, passing the results back to the client
+    char filenameBuffer[2048];
+    while (fgets(filenameBuffer, sizeof(filenameBuffer), stdin)) {
+        char* newLineCharacter = strchr(filenameBuffer, '\n');
+        if (newLineCharacter)
+            *newLineCharacter = '\0';
+
+        if (!strlen(filenameBuffer))
+            continue;
+
+        runTest(filenameBuffer);
+    }
+}
+
+static void initializeGlobalsFromCommandLineOptions(int argc, char *argv[])
+{
+    struct option options[] = {
+        {"notree", no_argument, &dumpTree, false},
+        {"pixel-tests", no_argument, &dumpPixels, true},
+        {"tree", no_argument, &dumpTree, true},
+        {NULL, 0, NULL, 0}
+    };
+    
+    int option;
+    while ((option = getopt_long(argc, (char * const *)argv, "", options, NULL)) != -1) {
+        switch (option) {
+        case '?': // unknown or ambiguous option
+        case ':': // missing argument
+            exit(1);
+            break;
+        }
+    }
+}
+
+
 void dump()
 {
     invalidateAnyPreviousWaitToDumpWatchdog();
@@ -516,9 +564,7 @@ static void runTest(const string& testPathOrURL)
     if (prevTestBFItem)
         g_object_ref(prevTestBFItem);
 
-#if PLATFORM(X11)
     initializeFonts();
-#endif
 
     // Focus the web view before loading the test to avoid focusing problems
     gtk_widget_grab_focus(GTK_WIDGET(webView));
@@ -941,26 +987,8 @@ int main(int argc, char* argv[])
     // We squelch all debug messages sent to the logger.
     g_log_set_default_handler(logHandler, 0);
 
-#if PLATFORM(X11)
-    FcInit();
+    initializeGlobalsFromCommandLineOptions(argc, argv);
     initializeFonts();
-#endif
-
-    struct option options[] = {
-        {"notree", no_argument, &dumpTree, false},
-        {"pixel-tests", no_argument, &dumpPixels, true},
-        {"tree", no_argument, &dumpTree, true},
-        {NULL, 0, NULL, 0}
-    };
-
-    int option;
-    while ((option = getopt_long(argc, (char* const*)argv, "", options, NULL)) != -1)
-        switch (option) {
-            case '?':   // unknown or ambiguous option
-            case ':':   // missing argument
-                exit(1);
-                break;
-        }
 
     window = gtk_window_new(GTK_WINDOW_POPUP);
     container = GTK_WIDGET(gtk_scrolled_window_new(NULL, NULL));
@@ -980,19 +1008,9 @@ int main(int argc, char* argv[])
     gcController = new GCController();
     axController = new AccessibilityController();
 
-    if (argc == optind+1 && strcmp(argv[optind], "-") == 0) {
-        char filenameBuffer[2048];
+    if (useLongRunningServerMode(argc, argv)) {
         printSeparators = true;
-        while (fgets(filenameBuffer, sizeof(filenameBuffer), stdin)) {
-            char* newLineCharacter = strchr(filenameBuffer, '\n');
-            if (newLineCharacter)
-                *newLineCharacter = '\0';
-
-            if (strlen(filenameBuffer) == 0)
-                continue;
-
-            runTest(filenameBuffer);
-        }
+        runTestingServerLoop();
     } else {
         printSeparators = (optind < argc-1 || (dumpPixels && dumpTree));
         for (int i = optind; i != argc; ++i)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list