Title: [102776] trunk/Tools
Revision
102776
Author
[email protected]
Date
2011-12-14 07:55:25 -0800 (Wed, 14 Dec 2011)

Log Message

[Qt] Test fonts are not used with Qt5
https://bugs.webkit.org/show_bug.cgi?id=72513

Patch by Balazs Kelemen <[email protected]> on 2011-12-14
Reviewed by Simon Hausmann.

Don't depend on Q_WS_X11 anymore since it's not the Qt5
way to detect the platform. Make the guards depend
on our own configtest for fontconfig. For Qt4 we can still
use the preassumption that we have it on Linux.

* DumpRenderTree/qt/DumpRenderTree.pro:
* DumpRenderTree/qt/DumpRenderTreeQt.cpp:
(WebCore::DumpRenderTree::open):
(WebCore::DumpRenderTree::initializeFonts):
* DumpRenderTree/qt/DumpRenderTreeQt.h:
* DumpRenderTree/qt/main.cpp:
(main): Additionally remove a nonsense piece of code that was
trying to reset the font settings - which is not necessary -
after we have already returned from main.
* WebKitTestRunner/InjectedBundle/Target.pri:
* WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp:
(WTR::activateFonts):
* WebKitTestRunner/Target.pri: Remove unnecessary fontconfig linkage
from WTR. It is not needed. We set up the fonts via the injected bundle.
* qmake/config.tests/fontconfig/fontconfig.cpp: Added.
(main):
* qmake/config.tests/fontconfig/fontconfig.pro: Added.
* qmake/mkspecs/features/features.prf:
* qmake/sync.profile:

Modified Paths

Added Paths

Diff

Modified: trunk/Tools/ChangeLog (102775 => 102776)


--- trunk/Tools/ChangeLog	2011-12-14 15:33:21 UTC (rev 102775)
+++ trunk/Tools/ChangeLog	2011-12-14 15:55:25 UTC (rev 102776)
@@ -1,3 +1,35 @@
+2011-12-14  Balazs Kelemen  <[email protected]>
+
+        [Qt] Test fonts are not used with Qt5
+        https://bugs.webkit.org/show_bug.cgi?id=72513
+
+        Reviewed by Simon Hausmann.
+
+        Don't depend on Q_WS_X11 anymore since it's not the Qt5
+        way to detect the platform. Make the guards depend
+        on our own configtest for fontconfig. For Qt4 we can still
+        use the preassumption that we have it on Linux.
+
+        * DumpRenderTree/qt/DumpRenderTree.pro:
+        * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
+        (WebCore::DumpRenderTree::open):
+        (WebCore::DumpRenderTree::initializeFonts):
+        * DumpRenderTree/qt/DumpRenderTreeQt.h:
+        * DumpRenderTree/qt/main.cpp:
+        (main): Additionally remove a nonsense piece of code that was
+        trying to reset the font settings - which is not necessary -
+        after we have already returned from main.
+        * WebKitTestRunner/InjectedBundle/Target.pri:
+        * WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp:
+        (WTR::activateFonts):
+        * WebKitTestRunner/Target.pri: Remove unnecessary fontconfig linkage
+        from WTR. It is not needed. We set up the fonts via the injected bundle.
+        * qmake/config.tests/fontconfig/fontconfig.cpp: Added.
+        (main):
+        * qmake/config.tests/fontconfig/fontconfig.pro: Added.
+        * qmake/mkspecs/features/features.prf:
+        * qmake/sync.profile:
+
 2011-12-14  Tor Arne Vestbø  <[email protected]>
 
         [Qt] Don't add WebCoreSupport and WebKit APIs to include WebCore's include path

Modified: trunk/Tools/DumpRenderTree/qt/DumpRenderTree.pro (102775 => 102776)


--- trunk/Tools/DumpRenderTree/qt/DumpRenderTree.pro	2011-12-14 15:33:21 UTC (rev 102775)
+++ trunk/Tools/DumpRenderTree/qt/DumpRenderTree.pro	2011-12-14 15:55:25 UTC (rev 102776)
@@ -26,6 +26,10 @@
 macx: QT += xml
 haveQt(5): QT += widgets printsupport
 
+contains(config_test_fontconfig, yes) {
+    PKGCONFIG += fontconfig
+}
+
 HEADERS += \
     $$PWD/../WorkQueue.h \
     DumpRenderTreeQt.h \

Modified: trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp (102775 => 102776)


--- trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp	2011-12-14 15:33:21 UTC (rev 102775)
+++ trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp	2011-12-14 15:55:25 UTC (rev 102776)
@@ -68,7 +68,7 @@
 #include <QtUiTools/QUiLoader>
 #endif
 
-#ifdef Q_WS_X11
+#if HAVE(FONTCONFIG)
 #include <fontconfig/fontconfig.h>
 #endif
 
@@ -628,9 +628,7 @@
 #if !(QT_VERSION <= QT_VERSION_CHECK(4, 6, 2))
     QFontDatabase::removeAllApplicationFonts();
 #endif
-#if defined(Q_WS_X11)
     initializeFonts();
-#endif
 
     DumpRenderTreeSupportQt::dumpFrameLoader(url.toString().contains("loading/"));
     setTextOutputEnabled(true);
@@ -1142,11 +1140,13 @@
     return pages;
 }
 
-#if defined(Q_WS_X11)
 void DumpRenderTree::initializeFonts()
 {
+#if HAVE(FONTCONFIG)
     static int numFonts = -1;
 
+    FcInit();
+
     // Some test cases may add or remove application fonts (via @font-face).
     // Make sure to re-initialize the font set if necessary.
     FcFontSet* appFontSet = FcConfigGetFonts(0, FcSetApplication);
@@ -1179,7 +1179,7 @@
 
     appFontSet = FcConfigGetFonts(config, FcSetApplication);
     numFonts = appFontSet->nfont;
+#endif
 }
-#endif
 
 }

Modified: trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h (102775 => 102776)


--- trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h	2011-12-14 15:33:21 UTC (rev 102775)
+++ trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h	2011-12-14 15:55:25 UTC (rev 102776)
@@ -102,9 +102,8 @@
     WebPage *webPage() const { return m_page; }
     QList<WebPage*> getAllPages() const;
 
-#if defined(Q_WS_X11)
     static void initializeFonts();
-#endif
+
     void processArgsLine(const QStringList&);
     void setRedirectOutputFileName(const QString& fileName) { m_redirectOutputFileName = fileName; }
     void setRedirectErrorFileName(const QString& fileName) { m_redirectErrorFileName = fileName; }

Modified: trunk/Tools/DumpRenderTree/qt/main.cpp (102775 => 102776)


--- trunk/Tools/DumpRenderTree/qt/main.cpp	2011-12-14 15:33:21 UTC (rev 102775)
+++ trunk/Tools/DumpRenderTree/qt/main.cpp	2011-12-14 15:55:25 UTC (rev 102776)
@@ -43,7 +43,6 @@
 
 #ifdef Q_WS_X11
 #include <qx11info_x11.h>
-#include <fontconfig/fontconfig.h>
 #endif
 
 #ifdef Q_OS_WIN
@@ -150,10 +149,7 @@
     if (suppressQtDebugOutput)
         qInstallMsgHandler(messageHandler);
 
-#ifdef Q_WS_X11
-    FcInit();
     WebCore::DumpRenderTree::initializeFonts();
-#endif
 
     QApplication::setGraphicsSystem("raster");
     QApplication::setStyle(new QWindowsStyle);
@@ -250,8 +246,4 @@
         dumper.processArgsLine(args);
     }
     return app.exec();
-
-#ifdef Q_WS_X11
-    FcConfigSetCurrent(0);
-#endif
 }

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Target.pri (102775 => 102776)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Target.pri	2011-12-14 15:33:21 UTC (rev 102775)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Target.pri	2011-12-14 15:55:25 UTC (rev 102776)
@@ -59,6 +59,10 @@
 
 CONFIG += plugin qtwebkit
 
+contains(config_test_fontconfig, yes) {
+    PKGCONFIG += fontconfig
+}
+
 INCLUDEPATH += \
     $$PWD/.. \
     $$PWD/Bindings \

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp (102775 => 102776)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp	2011-12-14 15:33:21 UTC (rev 102775)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp	2011-12-14 15:55:25 UTC (rev 102776)
@@ -37,8 +37,7 @@
 #include <QWidget>
 #include <QWindowsStyle>
 
-#ifdef Q_WS_X11
-#include <QX11Info>
+#if HAVE(FONTCONFIG)
 #include <fontconfig/fontconfig.h>
 #endif
 
@@ -48,7 +47,7 @@
 
 void activateFonts()
 {
-#if defined(Q_WS_X11)
+#if HAVE(FONTCONFIG)
     FcInit();
 
     static int numFonts = -1;

Modified: trunk/Tools/WebKitTestRunner/Target.pri (102775 => 102776)


--- trunk/Tools/WebKitTestRunner/Target.pri	2011-12-14 15:33:21 UTC (rev 102775)
+++ trunk/Tools/WebKitTestRunner/Target.pri	2011-12-14 15:55:25 UTC (rev 102776)
@@ -34,8 +34,6 @@
 
 CONFIG += qtwebkit
 
-!embedded: PKGCONFIG += fontconfig
-
 DEFINES += USE_SYSTEM_MALLOC=1
 
 PREFIX_HEADER = WebKitTestRunnerPrefix.h

Added: trunk/Tools/qmake/config.tests/fontconfig/fontconfig.cpp (0 => 102776)


--- trunk/Tools/qmake/config.tests/fontconfig/fontconfig.cpp	                        (rev 0)
+++ trunk/Tools/qmake/config.tests/fontconfig/fontconfig.cpp	2011-12-14 15:55:25 UTC (rev 102776)
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2011 University of Szeged. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <fontconfig/fontconfig.h>
+
+int main(int, char**)
+{
+    FcInit();
+}

Added: trunk/Tools/qmake/config.tests/fontconfig/fontconfig.pro (0 => 102776)


--- trunk/Tools/qmake/config.tests/fontconfig/fontconfig.pro	                        (rev 0)
+++ trunk/Tools/qmake/config.tests/fontconfig/fontconfig.pro	2011-12-14 15:55:25 UTC (rev 102776)
@@ -0,0 +1,4 @@
+CONFIG -= qt
+SOURCES = fontconfig.cpp
+CONFIG += link_pkgconfig
+PKGCONFIG += fontconfig

Modified: trunk/Tools/qmake/mkspecs/features/features.prf (102775 => 102776)


--- trunk/Tools/qmake/mkspecs/features/features.prf	2011-12-14 15:33:21 UTC (rev 102775)
+++ trunk/Tools/qmake/mkspecs/features/features.prf	2011-12-14 15:55:25 UTC (rev 102776)
@@ -45,6 +45,11 @@
     DEFINES += ENABLE_SVG_FONTS=0
 }
 
+# We need fontconfig to set up the test fonts for DumpRenderTree and WebKitTestRunner.
+haveQt(5):contains(config_test_fontconfig, yes)|haveQt(4):unix:!mac {
+    DEFINES += HAVE_FONTCONFIG=1
+}
+
 !contains(DEFINES, ENABLE_JAVASCRIPT_DEBUGGER=.): DEFINES += ENABLE_JAVASCRIPT_DEBUGGER=1
 !contains(DEFINES, ENABLE_GAMEPAD=.): DEFINES += ENABLE_GAMEPAD=0
 !contains(DEFINES, ENABLE_SQL_DATABASE=.): DEFINES += ENABLE_SQL_DATABASE=1

Modified: trunk/Tools/qmake/sync.profile (102775 => 102776)


--- trunk/Tools/qmake/sync.profile	2011-12-14 15:33:21 UTC (rev 102775)
+++ trunk/Tools/qmake/sync.profile	2011-12-14 15:55:25 UTC (rev 102776)
@@ -1,3 +1,4 @@
 # This file is only used for config tests
 %configtests = (
+    fontconfig => {},
 );
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to