Title: [124808] trunk
Revision
124808
Author
[email protected]
Date
2012-08-06 16:05:15 -0700 (Mon, 06 Aug 2012)

Log Message

[Qt] Default sizes for input-text and text-area are different when running DRT/WTR
https://bugs.webkit.org/show_bug.cgi?id=91990

Patch by Luciano Wolf <[email protected]> on 2012-08-06
Reviewed by Kenneth Rohde Christiansen.

Source/WebKit2:

WTR wasn't using the proper font types provided by testfonts directory.
The same approach as DRT was applied and now it takes info from QFont to
update the store variable.

* UIProcess/qt/WebPreferencesQt.cpp:
(WebKit::setStringValueIfInUserDefaults):
(WebKit):
(WebKit::WebPreferences::platformInitializeStore):

Tools:

Initializing TestFonts information into WTR binary. Doing it
later leads to wrong font names usage (Dejavu Serif instead
of Liberation Serif).

* WebKitTestRunner/Target.pri:
* WebKitTestRunner/qt/main.cpp:
(main):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (124807 => 124808)


--- trunk/Source/WebKit2/ChangeLog	2012-08-06 23:03:55 UTC (rev 124807)
+++ trunk/Source/WebKit2/ChangeLog	2012-08-06 23:05:15 UTC (rev 124808)
@@ -1,3 +1,19 @@
+2012-08-06  Luciano Wolf  <[email protected]>
+
+        [Qt] Default sizes for input-text and text-area are different when running DRT/WTR
+        https://bugs.webkit.org/show_bug.cgi?id=91990
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        WTR wasn't using the proper font types provided by testfonts directory.
+        The same approach as DRT was applied and now it takes info from QFont to
+        update the store variable.
+
+        * UIProcess/qt/WebPreferencesQt.cpp:
+        (WebKit::setStringValueIfInUserDefaults):
+        (WebKit):
+        (WebKit::WebPreferences::platformInitializeStore):
+
 2012-08-06  No'am Rosenthal  <[email protected]>
 
         [Qt] Use GraphicsLayerAnimation in LayerTreeCoordinator

Modified: trunk/Source/WebKit2/UIProcess/qt/WebPreferencesQt.cpp (124807 => 124808)


--- trunk/Source/WebKit2/UIProcess/qt/WebPreferencesQt.cpp	2012-08-06 23:03:55 UTC (rev 124807)
+++ trunk/Source/WebKit2/UIProcess/qt/WebPreferencesQt.cpp	2012-08-06 23:05:15 UTC (rev 124808)
@@ -25,11 +25,39 @@
 
 #include "config.h"
 #include "WebPreferences.h"
+#include <QFont>
 
 namespace WebKit {
 
+static void setStringValueIfInUserDefaults(const String& baseKey, WebPreferencesStore& store, const QHash<String, QFont::StyleHint> qFontHint)
+{
+    // Use same approach as DumpRenderTree does - get font info from QFont.
+    static QFont defaultFont;
+    defaultFont.setStyleHint(qFontHint[baseKey]);
+    store.setStringValueForKey(baseKey, defaultFont.defaultFamily());
+}
+
 void WebPreferences::platformInitializeStore()
 {
+    if (!m_identifier)
+        return;
+
+    QHash <String, QFont::StyleHint> qFontHint;
+
+    qFontHint["StandardFontFamily"] = QFont::Serif;
+    qFontHint["CursiveFontFamily"] = QFont::Cursive;
+    qFontHint["FantasyFontFamily"] = QFont::Fantasy;
+    qFontHint["FixedFontFamily"] = QFont::Monospace;
+    qFontHint["SansSerifFontFamily"] = QFont::SansSerif;
+    qFontHint["SerifFontFamily"] = QFont::Serif;
+    qFontHint["PictographFontFamily"] = QFont::Serif;
+
+#define INITIALIZE_FONT_PREFERENCES(KeyUpper, KeyLower, TypeName, Type, DefaultValue) \
+    set##TypeName##ValueIfInUserDefaults(WebPreferencesKey::KeyLower##Key(), m_store, qFontHint);
+
+    FOR_EACH_WEBKIT_FONT_FAMILY_PREFERENCE(INITIALIZE_FONT_PREFERENCES)
+
+#undef INITIALIZE_FONT_PREFERENCES
 }
 
 void WebPreferences::platformUpdateStringValueForKey(const String&, const String&)

Modified: trunk/Tools/ChangeLog (124807 => 124808)


--- trunk/Tools/ChangeLog	2012-08-06 23:03:55 UTC (rev 124807)
+++ trunk/Tools/ChangeLog	2012-08-06 23:05:15 UTC (rev 124808)
@@ -1,3 +1,18 @@
+2012-08-06  Luciano Wolf  <[email protected]>
+
+        [Qt] Default sizes for input-text and text-area are different when running DRT/WTR
+        https://bugs.webkit.org/show_bug.cgi?id=91990
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Initializing TestFonts information into WTR binary. Doing it 
+        later leads to wrong font names usage (Dejavu Serif instead
+        of Liberation Serif).
+
+        * WebKitTestRunner/Target.pri:
+        * WebKitTestRunner/qt/main.cpp:
+        (main):
+
 2012-08-06  Jeff Timanus  <[email protected]>
 
         Add twiz@{chromium|google}.org to the set of non-committer contributors.

Modified: trunk/Tools/WebKitTestRunner/Target.pri (124807 => 124808)


--- trunk/Tools/WebKitTestRunner/Target.pri	2012-08-06 23:03:55 UTC (rev 124807)
+++ trunk/Tools/WebKitTestRunner/Target.pri	2012-08-06 23:05:15 UTC (rev 124808)
@@ -8,6 +8,7 @@
 TARGET = WebKitTestRunner
 
 HEADERS += \
+    $${ROOT_WEBKIT_DIR}/Tools/DumpRenderTree/qt/QtInitializeTestFonts.h \
     EventSenderProxy.h \
     PlatformWebView.h \
     StringFunctions.h \
@@ -15,6 +16,7 @@
     TestInvocation.h
 
 SOURCES += \
+    $${ROOT_WEBKIT_DIR}/Tools/DumpRenderTree/qt/QtInitializeTestFonts.cpp \
     qt/main.cpp \
     qt/EventSenderProxyQt.cpp \
     qt/PlatformWebViewQt.cpp \
@@ -31,6 +33,11 @@
 
 DEFINES += USE_SYSTEM_MALLOC=1
 
+contains(DEFINES, HAVE_FONTCONFIG=1): PKGCONFIG += fontconfig
+
+INCLUDEPATH += \
+    $${ROOT_WEBKIT_DIR}/Tools/DumpRenderTree/qt
+
 PREFIX_HEADER = WebKitTestRunnerPrefix.h
 *-g++*:QMAKE_CXXFLAGS += "-include $$PREFIX_HEADER"
 *-clang*:QMAKE_CXXFLAGS += "-include $$PREFIX_HEADER"

Modified: trunk/Tools/WebKitTestRunner/qt/main.cpp (124807 => 124808)


--- trunk/Tools/WebKitTestRunner/qt/main.cpp	2012-08-06 23:03:55 UTC (rev 124807)
+++ trunk/Tools/WebKitTestRunner/qt/main.cpp	2012-08-06 23:05:15 UTC (rev 124808)
@@ -26,6 +26,7 @@
 
 #include "config.h"
 
+#include "QtInitializeTestFonts.h"
 #include "TestController.h"
 #include "qquickwebview_p.h"
 
@@ -118,6 +119,9 @@
 
     qputenv("QT_WEBKIT_THEME_NAME", "qstyle");
 
+    WebKit::initializeTestFonts();
+    QCoreApplication::setAttribute(Qt::AA_Use96Dpi, true);
+
     QQuickWebViewExperimental::setFlickableViewportEnabled(false);
     QApplication app(argc, argv);
     Launcher launcher(argc, argv);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to