[Qt][WK2] setPlatformStrategies always asserts after r132744
authorBalazs Kelemen <kbalazs@webkit.org>
Sun, 4 Nov 2012 14:07:02 +0000 (14:07 +0000)
committerBalazs Kelemen <kbalazs@webkit.org>
Sun, 4 Nov 2012 14:07:02 +0000 (14:07 +0000)
commit7addea773f19c86de2fefef5f00cdedf84e4cb94
tree9fcab354dc189bef1c35ac236368fb727ad91db3
parent6aea357493c77588b01dddf82d80f15ec50ea281
[Qt][WK2] setPlatformStrategies always asserts after r132744
https://bugs.webkit.org/show_bug.cgi?id=100838

Reviewed by Simon Hausmann.

Reland with build fixes.

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):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@133421 268f45cc-cd09-0410-ab3c-d52691b4dbfc
22 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Target.pri
Source/WebCore/WebCore.pri
Source/WebCore/platform/qt/QtTestSupport.cpp [new file with mode: 0644]
Source/WebCore/platform/qt/QtTestSupport.h [new file with mode: 0644]
Tools/ChangeLog
Tools/DumpRenderTree/qt/DumpRenderTree.pro
Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp
Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
Tools/DumpRenderTree/qt/QtInitializeTestFonts.cpp [deleted file]
Tools/DumpRenderTree/qt/QtInitializeTestFonts.h [deleted file]
Tools/MiniBrowser/qt/MiniBrowser.pro
Tools/MiniBrowser/qt/MiniBrowserApplication.cpp
Tools/QtTestBrowser/QtTestBrowser.pro
Tools/QtTestBrowser/qttestbrowser.cpp
Tools/WebKitTestRunner/InjectedBundle/Target.pri
Tools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp
Tools/WebKitTestRunner/InjectedBundle/qt/QtInitializeTestFonts.cpp [deleted file]
Tools/WebKitTestRunner/InjectedBundle/qt/QtInitializeTestFonts.h [deleted file]
Tools/WebKitTestRunner/InjectedBundle/qt/TestRunnerQt.cpp
Tools/WebKitTestRunner/Target.pri
Tools/WebKitTestRunner/qt/main.cpp