Title: [133403] trunk
Revision
133403
Author
kbal...@webkit.org
Date
2012-11-03 15:52:04 -0700 (Sat, 03 Nov 2012)

Log Message

[Qt][WK2] setPlatformStrategies always asserts after r132744
https://bugs.webkit.org/show_bug.cgi?id=100838

Reviewed by Simon Hausmann.

Reland with build fix.

Source/WebCore:

The problem here is that we use QWebSettings::clearMemoryCaches, a WebKit1 API
from the injected bundle, which calls initializeWebCoreQt and it sets the platform
strategies to the one for WebKit1. We should stop using WebKit1 API's from WebKit2
code. In order to keep the behavior, this patch adds exported helpers to WebCore
that can be used from DumpRenderTree and WebKitTestRunner. This is the same idea
as WebCoreTestSupport but these helpers are specific to Qt. Technically we could
add it to the WebKit1 API for the time being, but my goal was to move in the direction
of removing the WebKit1 dependency from WebKitTestRunner. We only build the file
in non production mode.

Basically covered by all tests.

* Target.pri:
* WebCore.pri: We need to link against fontconfig (only in non-production mode) since
initializeTestFonts uses it.
* platform/qt/QtTestSupport.cpp: Added. I choose GPL license because code from qwebsettings.cpp
is also under that.
(WebKit):
(WebKit::QtTestSupport::clearMemoryCaches): This is basically a copy of QWebSettings::clearMemoryCaches
without calling initializeWebCoreQt.
(WebKit::QtTestSupport::initializeTestFonts): I moved this code here as well now that we have to expose
symbols from WebCore anyway. The advantage is that now we don't have to build it twice and we don't need
additional files to forward it from the directory of DumpRenderTree for WebKitTestRunner.
I added a call to FontCace::invalidate in the case when the font set has been changed so that it will do
the job even if we would stop clearing all caches between tests. Also moved the call to
QFontDatabase::removeAllApplicationFonts from callers to here.
* platform/qt/QtTestSupport.h:
(WebKit):
(QtTestSupport):

Tools:

Turned test runners to use the new QtTestSupport.

* DumpRenderTree/qt/DumpRenderTree.pro:
* DumpRenderTree/qt/DumpRenderTreeMain.cpp:
(main):
* DumpRenderTree/qt/DumpRenderTreeQt.cpp:
(WebCore::DumpRenderTree::open):
* DumpRenderTree/qt/QtInitializeTestFonts.h: Removed.
* MiniBrowser/qt/MiniBrowser.pro:
* QtTestBrowser/QtTestBrowser.pro:
* QtTestBrowser/qttestbrowser.cpp:
(LauncherApplication::handleUserOptions):
* WebKitTestRunner/InjectedBundle/Target.pri:
* WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp:
(WTR::activateFonts):
* WebKitTestRunner/InjectedBundle/qt/QtInitializeTestFonts.cpp: Removed.
* WebKitTestRunner/InjectedBundle/qt/QtInitializeTestFonts.h: Removed.
* WebKitTestRunner/InjectedBundle/qt/TestRunnerQt.cpp:
(WTR::TestRunner::platformInitialize):  Removed the comment from here
because it was just lying, apparently two times. First, it is not incorrect
to reinitialize our font set and clear font caches, it is what the tests
expect. Second, the use of QRawFont has nothing to do with the font cache.
* WebKitTestRunner/Target.pri:
* WebKitTestRunner/qt/main.cpp:
(main):

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (133402 => 133403)


--- trunk/Source/WebCore/ChangeLog	2012-11-03 22:36:29 UTC (rev 133402)
+++ trunk/Source/WebCore/ChangeLog	2012-11-03 22:52:04 UTC (rev 133403)
@@ -1,3 +1,42 @@
+2012-11-03  Balazs Kelemen  <kbal...@webkit.org>
+
+        [Qt][WK2] setPlatformStrategies always asserts after r132744
+        https://bugs.webkit.org/show_bug.cgi?id=100838
+
+        Reviewed by Simon Hausmann.
+
+        Reland with build fix.
+
+        The problem here is that we use QWebSettings::clearMemoryCaches, a WebKit1 API
+        from the injected bundle, which calls initializeWebCoreQt and it sets the platform
+        strategies to the one for WebKit1. We should stop using WebKit1 API's from WebKit2
+        code. In order to keep the behavior, this patch adds exported helpers to WebCore
+        that can be used from DumpRenderTree and WebKitTestRunner. This is the same idea
+        as WebCoreTestSupport but these helpers are specific to Qt. Technically we could
+        add it to the WebKit1 API for the time being, but my goal was to move in the direction
+        of removing the WebKit1 dependency from WebKitTestRunner. We only build the file
+        in non production mode.
+
+        Basically covered by all tests.
+
+        * Target.pri:
+        * WebCore.pri: We need to link against fontconfig (only in non-production mode) since
+        initializeTestFonts uses it.
+        * platform/qt/QtTestSupport.cpp: Added. I choose GPL license because code from qwebsettings.cpp
+        is also under that.
+        (WebKit):
+        (WebKit::QtTestSupport::clearMemoryCaches): This is basically a copy of QWebSettings::clearMemoryCaches
+        without calling initializeWebCoreQt.
+        (WebKit::QtTestSupport::initializeTestFonts): I moved this code here as well now that we have to expose
+        symbols from WebCore anyway. The advantage is that now we don't have to build it twice and we don't need
+        additional files to forward it from the directory of DumpRenderTree for WebKitTestRunner.
+        I added a call to FontCace::invalidate in the case when the font set has been changed so that it will do
+        the job even if we would stop clearing all caches between tests. Also moved the call to
+        QFontDatabase::removeAllApplicationFonts from callers to here.
+        * platform/qt/QtTestSupport.h:
+        (WebKit):
+        (QtTestSupport):
+
 2012-11-03  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r133397.

Modified: trunk/Source/WebCore/Target.pri (133402 => 133403)


--- trunk/Source/WebCore/Target.pri	2012-11-03 22:36:29 UTC (rev 133402)
+++ trunk/Source/WebCore/Target.pri	2012-11-03 22:52:04 UTC (rev 133403)
@@ -4075,6 +4075,11 @@
     }
 }
 
+if(build?(drt)|build?(wtr)) {
+    HEADERS += platform/qt/QtTestSupport.h
+    SOURCES += platform/qt/QtTestSupport.cpp
+}
+
 ALL_IN_ONE_SOURCES += \
     accessibility/AccessibilityAllInOne.cpp \
     inspector/InspectorAllInOne.cpp \

Modified: trunk/Source/WebCore/WebCore.pri (133402 => 133403)


--- trunk/Source/WebCore/WebCore.pri	2012-11-03 22:36:29 UTC (rev 133402)
+++ trunk/Source/WebCore/WebCore.pri	2012-11-03 22:52:04 UTC (rev 133403)
@@ -286,3 +286,5 @@
 
 enable_fast_mobile_scrolling: DEFINES += ENABLE_FAST_MOBILE_SCROLLING=1
 
+!production_build:have?(FONTCONFIG): PKGCONFIG += fontconfig
+

Copied: trunk/Source/WebCore/platform/qt/QtTestSupport.cpp (from rev 133402, trunk/Tools/DumpRenderTree/qt/QtInitializeTestFonts.cpp) (0 => 133403)


--- trunk/Source/WebCore/platform/qt/QtTestSupport.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/qt/QtTestSupport.cpp	2012-11-03 22:52:04 UTC (rev 133403)
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2012 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 "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 APPLE OR ITS 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 "config.h"
+#include "QtTestSupport.h"
+
+#include "CrossOriginPreflightResultCache.h"
+#include "FontCache.h"
+#include "MemoryCache.h"
+#include "PageCache.h"
+#include <QFontDatabase>
+
+#if HAVE(FONTCONFIG)
+#include <QByteArray>
+#include <QDir>
+#include <fontconfig/fontconfig.h>
+#endif
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void QtTestSupport::clearMemoryCaches()
+{
+    if (!memoryCache()->disabled()) {
+        memoryCache()->setDisabled(true);
+        memoryCache()->setDisabled(false);
+    }
+
+    int pageCapacity = WebCore::pageCache()->capacity();
+    WebCore::pageCache()->setCapacity(0);
+    WebCore::pageCache()->releaseAutoreleasedPagesNow();
+    WebCore::pageCache()->setCapacity(pageCapacity);
+
+    WebCore::fontCache()->invalidate();
+
+    WebCore::CrossOriginPreflightResultCache::shared().empty();
+}
+
+void QtTestSupport::initializeTestFonts()
+{
+#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);
+    if (appFontSet && numFonts >= 0 && appFontSet->nfont == numFonts)
+        return;
+
+    QByteArray fontDir = getenv("WEBKIT_TESTFONTS");
+    if (fontDir.isEmpty() || !QDir(QString::fromLatin1(fontDir)).exists()) {
+        qFatal("\n\n"
+            "----------------------------------------------------------------------\n"
+            "WEBKIT_TESTFONTS environment variable is not set correctly.\n"
+            "This variable has to point to the directory containing the fonts\n"
+            "you can clone from git://gitorious.org/qtwebkit/testfonts.git\n"
+            "----------------------------------------------------------------------\n"
+            );
+    }
+
+    QByteArray configFile = fontDir + "/fonts.conf";
+    FcConfig* config = FcConfigCreate();
+    if (!FcConfigParseAndLoad(config, reinterpret_cast<const FcChar8*>(configFile.constData()), FcTrue))
+        qFatal("Couldn't load font configuration file");
+    if (!FcConfigAppFontAddDir(config, reinterpret_cast<const FcChar8*>(fontDir.data())))
+        qFatal("Couldn't add font dir!");
+    FcConfigSetCurrent(config);
+
+    appFontSet = FcConfigGetFonts(config, FcSetApplication);
+    numFonts = appFontSet->nfont;
+
+    WebCore::fontCache()->invalidate();
+    QFontDatabase::removeAllApplicationFonts();
+#endif
+}
+
+}

Added: trunk/Source/WebCore/platform/qt/QtTestSupport.h (0 => 133403)


--- trunk/Source/WebCore/platform/qt/QtTestSupport.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/qt/QtTestSupport.h	2012-11-03 22:52:04 UTC (rev 133403)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2012 University of Szeged. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef QtTestSupport_h
+#define QtTestSupport_h
+
+#include <QtCore/qglobal.h>
+
+#if defined(BUILDING_WEBKIT)
+#define TESTSUPPORT_EXPORT Q_DECL_EXPORT
+#else
+#define TESTSUPPORT_EXPORT Q_DECL_IMPORT
+#endif
+
+// Helpers for test runners (DumpRenderTree and WebKitTestRunner).
+// This is living in WebCore for better code sharing, although
+// we expose it as (private) API, so it is part of the WebKit layer.
+
+namespace WebKit {
+
+namespace QtTestSupport {
+
+TESTSUPPORT_EXPORT void clearMemoryCaches();
+TESTSUPPORT_EXPORT void initializeTestFonts();
+
+}
+
+}
+
+#endif

Modified: trunk/Tools/ChangeLog (133402 => 133403)


--- trunk/Tools/ChangeLog	2012-11-03 22:36:29 UTC (rev 133402)
+++ trunk/Tools/ChangeLog	2012-11-03 22:52:04 UTC (rev 133403)
@@ -1,3 +1,38 @@
+2012-11-03  Balazs Kelemen  <kbal...@webkit.org>
+
+        [Qt][WK2] setPlatformStrategies always asserts after r132744
+        https://bugs.webkit.org/show_bug.cgi?id=100838
+
+        Reviewed by Simon Hausmann.
+
+        Reland with build fix.
+
+        Turned test runners to use the new QtTestSupport.
+
+        * DumpRenderTree/qt/DumpRenderTree.pro:
+        * DumpRenderTree/qt/DumpRenderTreeMain.cpp:
+        (main):
+        * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
+        (WebCore::DumpRenderTree::open):
+        * DumpRenderTree/qt/QtInitializeTestFonts.h: Removed.
+        * MiniBrowser/qt/MiniBrowser.pro:
+        * QtTestBrowser/QtTestBrowser.pro:
+        * QtTestBrowser/qttestbrowser.cpp:
+        (LauncherApplication::handleUserOptions):
+        * WebKitTestRunner/InjectedBundle/Target.pri:
+        * WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp:
+        (WTR::activateFonts):
+        * WebKitTestRunner/InjectedBundle/qt/QtInitializeTestFonts.cpp: Removed.
+        * WebKitTestRunner/InjectedBundle/qt/QtInitializeTestFonts.h: Removed.
+        * WebKitTestRunner/InjectedBundle/qt/TestRunnerQt.cpp:
+        (WTR::TestRunner::platformInitialize):  Removed the comment from here
+        because it was just lying, apparently two times. First, it is not incorrect
+        to reinitialize our font set and clear font caches, it is what the tests
+        expect. Second, the use of QRawFont has nothing to do with the font cache.
+        * WebKitTestRunner/Target.pri:
+        * WebKitTestRunner/qt/main.cpp:
+        (main):
+
 2012-11-03  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r133397.

Modified: trunk/Tools/DumpRenderTree/qt/DumpRenderTree.pro (133402 => 133403)


--- trunk/Tools/DumpRenderTree/qt/DumpRenderTree.pro	2012-11-03 22:36:29 UTC (rev 133402)
+++ trunk/Tools/DumpRenderTree/qt/DumpRenderTree.pro	2012-11-03 22:52:04 UTC (rev 133403)
@@ -14,6 +14,7 @@
 INCLUDEPATH += \
     $$PWD/ \
     $$PWD/.. \
+    $${ROOT_WEBKIT_DIR}/Source/WebCore/platform/qt \
     $${ROOT_WEBKIT_DIR}/Source/WebKit/qt/WebCoreSupport \
     $${ROOT_WEBKIT_DIR}/Source/WTF
 
@@ -21,8 +22,6 @@
 have?(QTPRINTSUPPORT): QT += printsupport
 macx: QT += xml
 
-have?(FONTCONFIG): PKGCONFIG += fontconfig
-
 HEADERS += \
     $$PWD/../WorkQueue.h \
     $$PWD/../DumpRenderTree.h \
@@ -32,7 +31,6 @@
     WorkQueueItemQt.h \
     TestRunnerQt.h \
     GCControllerQt.h \
-    QtInitializeTestFonts.h \
     testplugin.h
 
 SOURCES += \
@@ -44,7 +42,6 @@
     WorkQueueItemQt.cpp \
     TestRunnerQt.cpp \
     GCControllerQt.cpp \
-    QtInitializeTestFonts.cpp \
     testplugin.cpp \
     DumpRenderTreeMain.cpp
 

Modified: trunk/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp (133402 => 133403)


--- trunk/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp	2012-11-03 22:36:29 UTC (rev 133402)
+++ trunk/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp	2012-11-03 22:52:04 UTC (rev 133403)
@@ -29,8 +29,6 @@
 
 #include "DumpRenderTreeQt.h"
 
-#include "QtInitializeTestFonts.h"
-
 #include <qapplication.h>
 #include <qdebug.h>
 #include <qdir.h>
@@ -115,8 +113,6 @@
     if (suppressQtDebugOutput)
         qInstallMessageHandler(messageHandler);
 
-    WebKit::initializeTestFonts();
-
     QApplication::setStyle(new QWindowsStyle);
     QApplication::setDesktopSettingsAware(false);
 

Modified: trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp (133402 => 133403)


--- trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp	2012-11-03 22:36:29 UTC (rev 133402)
+++ trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp	2012-11-03 22:52:04 UTC (rev 133403)
@@ -36,9 +36,9 @@
 #include "DumpRenderTreeSupportQt.h"
 #include "EventSenderQt.h"
 #include "GCControllerQt.h"
+#include "QtTestSupport.h"
 #include "TestRunnerQt.h"
 #include "TextInputControllerQt.h"
-#include "QtInitializeTestFonts.h"
 #include "testplugin.h"
 #include "WorkQueue.h"
 
@@ -49,7 +49,6 @@
 #include <QFile>
 #include <QFileInfo>
 #include <QFocusEvent>
-#include <QFontDatabase>
 #include <QLabel>
 #include <QLocale>
 #include <QNetworkAccessManager>
@@ -623,10 +622,10 @@
     QFocusEvent ev(QEvent::FocusIn);
     m_page->event(&ev);
 
-    QWebSettings::clearMemoryCaches();
-    QFontDatabase::removeAllApplicationFonts();
-    WebKit::initializeTestFonts();
+    WebKit::QtTestSupport::clearMemoryCaches();
 
+    WebKit::QtTestSupport::initializeTestFonts();
+
     DumpRenderTreeSupportQt::dumpFrameLoader(url.toString().contains("loading/"));
     setTextOutputEnabled(true);
     m_page->mainFrame()->load(url);

Deleted: trunk/Tools/DumpRenderTree/qt/QtInitializeTestFonts.cpp (133402 => 133403)


--- trunk/Tools/DumpRenderTree/qt/QtInitializeTestFonts.cpp	2012-11-03 22:36:29 UTC (rev 133402)
+++ trunk/Tools/DumpRenderTree/qt/QtInitializeTestFonts.cpp	2012-11-03 22:52:04 UTC (rev 133403)
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
- *
- * 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.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE OR ITS 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 "config.h"
-
-#include "QtInitializeTestFonts.h"
-
-#if HAVE(FONTCONFIG)
-#include <QByteArray>
-#include <QDir>
-#include <fontconfig/fontconfig.h>
-#endif
-
-namespace WebKit {
-
-void initializeTestFonts()
-{
-#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);
-    if (appFontSet && numFonts >= 0 && appFontSet->nfont == numFonts)
-        return;
-
-    QByteArray fontDir = getenv("WEBKIT_TESTFONTS");
-    if (fontDir.isEmpty() || !QDir(QString::fromLatin1(fontDir)).exists()) {
-        qFatal("\n\n"
-                "----------------------------------------------------------------------\n"
-                "WEBKIT_TESTFONTS environment variable is not set correctly.\n"
-                "This variable has to point to the directory containing the fonts\n"
-                "you can clone from git://gitorious.org/qtwebkit/testfonts.git\n"
-                "----------------------------------------------------------------------\n"
-               );
-    }
-
-    QByteArray configFile = fontDir + "/fonts.conf";
-    FcConfig* config = FcConfigCreate();
-    if (!FcConfigParseAndLoad(config, reinterpret_cast<const FcChar8*>(configFile.constData()), FcTrue))
-        qFatal("Couldn't load font configuration file");
-    if (!FcConfigAppFontAddDir(config, reinterpret_cast<const FcChar8*>(fontDir.data())))
-        qFatal("Couldn't add font dir!");
-    FcConfigSetCurrent(config);
-
-    appFontSet = FcConfigGetFonts(config, FcSetApplication);
-    numFonts = appFontSet->nfont;
-#endif
-}
-
-}

Deleted: trunk/Tools/DumpRenderTree/qt/QtInitializeTestFonts.h (133402 => 133403)


--- trunk/Tools/DumpRenderTree/qt/QtInitializeTestFonts.h	2012-11-03 22:36:29 UTC (rev 133402)
+++ trunk/Tools/DumpRenderTree/qt/QtInitializeTestFonts.h	2012-11-03 22:52:04 UTC (rev 133403)
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
- *
- * 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.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE OR ITS 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.
- */
-
-#ifndef QtInitializeTestFonts_h
-#define QtInitializeTestFonts_h
-
-namespace WebKit {
-
-// Helper to share code between test font users.
-void initializeTestFonts();
-
-}
-
-#endif

Modified: trunk/Tools/MiniBrowser/qt/MiniBrowser.pro (133402 => 133403)


--- trunk/Tools/MiniBrowser/qt/MiniBrowser.pro	2012-11-03 22:36:29 UTC (rev 133402)
+++ trunk/Tools/MiniBrowser/qt/MiniBrowser.pro	2012-11-03 22:52:04 UTC (rev 133403)
@@ -9,10 +9,10 @@
 WEBKIT += wtf
 
 INCLUDEPATH += \
+    $${ROOT_WEBKIT_DIR}/Source/WebCore/platform/qt \
     $${ROOT_WEBKIT_DIR}/Tools/DumpRenderTree/qt/
 
 SOURCES += \
-    $${ROOT_WEBKIT_DIR}/Tools/DumpRenderTree/qt/QtInitializeTestFonts.cpp \
     BrowserWindow.cpp \
     main.cpp \
     MiniBrowserApplication.cpp \
@@ -20,7 +20,6 @@
     utils.cpp \
 
 HEADERS += \
-    $${ROOT_WEBKIT_DIR}/Tools/DumpRenderTree/qt/QtInitializeTestFonts.h \
     BrowserWindow.h \
     MiniBrowserApplication.h \
     UrlLoader.h \

Modified: trunk/Tools/QtTestBrowser/QtTestBrowser.pro (133402 => 133403)


--- trunk/Tools/QtTestBrowser/QtTestBrowser.pro	2012-11-03 22:36:29 UTC (rev 133402)
+++ trunk/Tools/QtTestBrowser/QtTestBrowser.pro	2012-11-03 22:52:04 UTC (rev 133403)
@@ -7,12 +7,12 @@
 TEMPLATE = app
 
 INCLUDEPATH += \
+    $${ROOT_WEBKIT_DIR}/Source/WebCore/platform/qt \
     $${ROOT_WEBKIT_DIR}/Source/WebKit/qt/WebCoreSupport \
     $${ROOT_WEBKIT_DIR}/Tools/DumpRenderTree/qt/ \
     $${ROOT_WEBKIT_DIR}/Source/WTF
 
 SOURCES += \
-    $${ROOT_WEBKIT_DIR}/Tools/DumpRenderTree/qt/QtInitializeTestFonts.cpp \
     locationedit.cpp \
     launcherwindow.cpp \
     qttestbrowser.cpp \
@@ -25,7 +25,6 @@
     cookiejar.cpp
 
 HEADERS += \
-    $${ROOT_WEBKIT_DIR}/Tools/DumpRenderTree/qt/QtInitializeTestFonts.h \
     locationedit.h \
     launcherwindow.h \
     mainwindow.h \

Modified: trunk/Tools/QtTestBrowser/qttestbrowser.cpp (133402 => 133403)


--- trunk/Tools/QtTestBrowser/qttestbrowser.cpp	2012-11-03 22:36:29 UTC (rev 133402)
+++ trunk/Tools/QtTestBrowser/qttestbrowser.cpp	2012-11-03 22:52:04 UTC (rev 133403)
@@ -31,7 +31,7 @@
  */
 
 #include "DumpRenderTreeSupportQt.h"
-#include "QtInitializeTestFonts.h"
+#include "QtTestSupport.h"
 #include "launcherwindow.h"
 #include "urlloader.h"
 
@@ -241,7 +241,7 @@
 #endif
 
     if (args.contains("-use-test-fonts"))
-        WebKit::initializeTestFonts();
+        WebKit::QtTestSupport::initializeTestFonts();
 
     if (args.contains("-print-loaded-urls"))
         windowOptions.printLoadedUrls = true;

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Target.pri (133402 => 133403)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Target.pri	2012-11-03 22:36:29 UTC (rev 133402)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Target.pri	2012-11-03 22:52:04 UTC (rev 133403)
@@ -28,7 +28,6 @@
     Bindings/JSWrapper.cpp \
     qt/ActivateFontsQt.cpp \
     qt/InjectedBundleQt.cpp \
-    qt/QtInitializeTestFonts.cpp \
     qt/TestRunnerQt.cpp
 
 # Adds the generated sources to SOURCES
@@ -46,7 +45,6 @@
     InjectedBundlePage.h \
     TestRunner.h \
     TextInputController.h \
-    qt/QtInitializeTestFonts.h
 
 DESTDIR = $${ROOT_BUILD_DIR}/lib
 
@@ -62,6 +60,7 @@
     $$PWD \
     $$PWD/.. \
     $$PWD/Bindings \
+    $${ROOT_WEBKIT_DIR}/Source/WebCore/platform/qt \
     $${ROOT_WEBKIT_DIR}/Source/WebCore/testing/js \
     $${ROOT_WEBKIT_DIR}/Source/WebKit/qt/WebCoreSupport
 

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp (133402 => 133403)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp	2012-11-03 22:36:29 UTC (rev 133402)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp	2012-11-03 22:52:04 UTC (rev 133403)
@@ -30,14 +30,14 @@
 #include "config.h"
 #include "ActivateFonts.h"
 #include "DumpRenderTreeSupportQt.h"
-#include "QtInitializeTestFonts.h"
+#include "QtTestSupport.h"
 #include <QCoreApplication>
 
 namespace WTR {
 
 void activateFonts()
 {
-    WebKit::initializeTestFonts();
+    WebKit::QtTestSupport::initializeTestFonts();
     QCoreApplication::setAttribute(Qt::AA_Use96Dpi, true);
 }
 

Deleted: trunk/Tools/WebKitTestRunner/InjectedBundle/qt/QtInitializeTestFonts.cpp (133402 => 133403)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/qt/QtInitializeTestFonts.cpp	2012-11-03 22:36:29 UTC (rev 133402)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/qt/QtInitializeTestFonts.cpp	2012-11-03 22:52:04 UTC (rev 133403)
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
- *
- * 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.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE OR ITS 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 "config.h"
-#include "../../../DumpRenderTree/qt/QtInitializeTestFonts.cpp"
-

Deleted: trunk/Tools/WebKitTestRunner/InjectedBundle/qt/QtInitializeTestFonts.h (133402 => 133403)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/qt/QtInitializeTestFonts.h	2012-11-03 22:36:29 UTC (rev 133402)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/qt/QtInitializeTestFonts.h	2012-11-03 22:52:04 UTC (rev 133403)
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
- *
- * 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.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE OR ITS 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 "../../../DumpRenderTree/qt/QtInitializeTestFonts.h"
-

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/qt/TestRunnerQt.cpp (133402 => 133403)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/qt/TestRunnerQt.cpp	2012-11-03 22:36:29 UTC (rev 133402)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/qt/TestRunnerQt.cpp	2012-11-03 22:52:04 UTC (rev 133403)
@@ -29,10 +29,12 @@
 
 #include "ActivateFonts.h"
 #include "InjectedBundle.h"
+#include "QtTestSupport.h"
 #include <QCoreApplication>
 #include <QDir>
 #include <QFontDatabase>
 #include <QObject>
+#include <QtCore/qglobal.h>
 #include <qwebsettings.h>
 
 namespace WTR {
@@ -59,13 +61,9 @@
 
 void TestRunner::platformInitialize()
 {
-    // Make WebKit2 mimic the behaviour of DumpRenderTree, which is incorrect,
-    // but tests are successfully passed. On the long run, Qt will move to QRawFont,
-    // which makes the use of QFontDatabase unnecessary.
-    // See https://bugs.webkit.org/show_bug.cgi?id=53427
-    QWebSettings::clearMemoryCaches();
-    QFontDatabase::removeAllApplicationFonts();
+    WebKit::QtTestSupport::clearMemoryCaches();
     activateFonts();
+
     QObject::connect(&m_waitToDumpWatchdogTimer, SIGNAL(timeout()), WatchdogTimerHelper::instance(), SLOT(timerFired()));
 }
 

Modified: trunk/Tools/WebKitTestRunner/Target.pri (133402 => 133403)


--- trunk/Tools/WebKitTestRunner/Target.pri	2012-11-03 22:36:29 UTC (rev 133402)
+++ trunk/Tools/WebKitTestRunner/Target.pri	2012-11-03 22:52:04 UTC (rev 133403)
@@ -8,7 +8,6 @@
 TARGET = WebKitTestRunner
 
 HEADERS += \
-    $${ROOT_WEBKIT_DIR}/Tools/DumpRenderTree/qt/QtInitializeTestFonts.h \
     EventSenderProxy.h \
     GeolocationProviderMock.h \
     PlatformWebView.h \
@@ -19,7 +18,6 @@
     WorkQueueManager.h
 
 SOURCES += \
-    $${ROOT_WEBKIT_DIR}/Tools/DumpRenderTree/qt/QtInitializeTestFonts.cpp \
     qt/main.cpp \
     qt/EventSenderProxyQt.cpp \
     qt/PlatformWebViewQt.cpp \
@@ -39,8 +37,6 @@
 
 DEFINES += USE_SYSTEM_MALLOC=1
 
-have?(FONTCONFIG): PKGCONFIG += fontconfig
-
 INCLUDEPATH += \
     $$PWD \
     $${ROOT_WEBKIT_DIR}/Tools/DumpRenderTree/qt

Modified: trunk/Tools/WebKitTestRunner/qt/main.cpp (133402 => 133403)


--- trunk/Tools/WebKitTestRunner/qt/main.cpp	2012-11-03 22:36:29 UTC (rev 133402)
+++ trunk/Tools/WebKitTestRunner/qt/main.cpp	2012-11-03 22:52:04 UTC (rev 133403)
@@ -26,7 +26,7 @@
 
 #include "config.h"
 
-#include "QtInitializeTestFonts.h"
+#include "QtTestSupport.h"
 #include "TestController.h"
 #include "qquickwebview_p.h"
 
@@ -119,7 +119,7 @@
 
     qputenv("QT_WEBKIT_THEME_NAME", "qstyle");
 
-    WebKit::initializeTestFonts();
+    WebKit::QtTestSupport::initializeTestFonts();
     QCoreApplication::setAttribute(Qt::AA_Use96Dpi, true);
 
     QQuickWebViewExperimental::setFlickableViewportEnabled(false);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to