Title: [123237] trunk/Tools
Revision
123237
Author
[email protected]
Date
2012-07-20 11:05:33 -0700 (Fri, 20 Jul 2012)

Log Message

[Qt] Make WTR use the same color palette as DRT
https://bugs.webkit.org/show_bug.cgi?id=91870

Reviewed by Noam Rosenthal.

Make sure that WebKitTestRunner and DumpRenderTree use the same palette: the
standard from QWindowsStyle.

* WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp:
(WTR::activateFonts): Moved code to platformInitialize since setting style is not
exactly font related.
* WebKitTestRunner/InjectedBundle/qt/InjectedBundleQt.cpp:
(WTR::InjectedBundle::platformInitialize): Force the usage of the style's
palette.  Because at this point QApplication was already instantiated, the
default palette was already initialized to be the system one, so we need to
explicitly set the palette to be the standard from style. This is not needed in
DRT because there we set the style before instantiating QApplication.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (123236 => 123237)


--- trunk/Tools/ChangeLog	2012-07-20 18:02:17 UTC (rev 123236)
+++ trunk/Tools/ChangeLog	2012-07-20 18:05:33 UTC (rev 123237)
@@ -1,3 +1,23 @@
+2012-07-20  Caio Marcelo de Oliveira Filho  <[email protected]>
+
+        [Qt] Make WTR use the same color palette as DRT
+        https://bugs.webkit.org/show_bug.cgi?id=91870
+
+        Reviewed by Noam Rosenthal.
+
+        Make sure that WebKitTestRunner and DumpRenderTree use the same palette: the
+        standard from QWindowsStyle.
+
+        * WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp:
+        (WTR::activateFonts): Moved code to platformInitialize since setting style is not
+        exactly font related.
+        * WebKitTestRunner/InjectedBundle/qt/InjectedBundleQt.cpp:
+        (WTR::InjectedBundle::platformInitialize): Force the usage of the style's
+        palette.  Because at this point QApplication was already instantiated, the
+        default palette was already initialized to be the system one, so we need to
+        explicitly set the palette to be the standard from style. This is not needed in
+        DRT because there we set the style before instantiating QApplication.
+
 2012-07-20  Tony Chang  <[email protected]>
 
         Baseline align text in the flakiness dashboard toolbar

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp (123236 => 123237)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp	2012-07-20 18:02:17 UTC (rev 123236)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp	2012-07-20 18:05:33 UTC (rev 123237)
@@ -31,16 +31,13 @@
 #include "ActivateFonts.h"
 #include "DumpRenderTreeSupportQt.h"
 #include "QtInitializeTestFonts.h"
+#include <QCoreApplication>
 
-#include <QApplication>
-#include <QWindowsStyle>
-
 namespace WTR {
 
 void activateFonts()
 {
     WebKit::initializeTestFonts();
-    QApplication::setStyle(new QWindowsStyle);
     QCoreApplication::setAttribute(Qt::AA_Use96Dpi, true);
 }
 

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/qt/InjectedBundleQt.cpp (123236 => 123237)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/qt/InjectedBundleQt.cpp	2012-07-20 18:02:17 UTC (rev 123236)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/qt/InjectedBundleQt.cpp	2012-07-20 18:05:33 UTC (rev 123237)
@@ -26,8 +26,9 @@
 
 #include "config.h"
 #include "InjectedBundle.h"
+#include <QApplication>
 #include <QByteArray>
-#include <QtGlobal>
+#include <QWindowsStyle>
 #include <stdio.h>
 #include <stdlib.h>
 #include <wtf/AlwaysInline.h>
@@ -69,6 +70,12 @@
 
 void InjectedBundle::platformInitialize(WKTypeRef)
 {
+    QWindowsStyle* styleForTests = new QWindowsStyle;
+    QApplication::setStyle(styleForTests);
+    // Force Qt to use the style's standard palette, instead of platform default palette. This is needed
+    // because we are setting the style after QApplication is instantiated.
+    QApplication::setPalette(styleForTests->standardPalette());
+
     if (qgetenv("QT_WEBKIT2_DEBUG") == "1")
         return;
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to