Bug 27109

Summary: [Qt] Some tests in the Qt DRT pass and fail randomly, depending on whether previous tests used @font-face
Product: WebKit Reporter: Simon Hausmann <hausmann>
Component: WebKit QtAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Bug Depends on:    
Bug Blocks: 26886    
Attachments:
Description Flags
[Qt] Fix Qt DRT Fontconfig side-effects zecke: review+

Description Simon Hausmann 2009-07-09 00:41:04 PDT
Sometimes when a test loads an application font using the @font-face css rule, then a following test may expose different metric. In normal web browsing this is not an issue, but with the Qt DRT we enforce a limited set of fonts through a fontconfig application fontset, which is also used by QFontDatabase::addApplicationFont. When removing an application font through QFontDatabase::removeApplicationFont, then Qt clears the entire app fontset and re-initializes it from its sent of known application fonts. That discards the app set the Qt DRT initializes on startup.

Private application fontsets _together_ with QFontDatabase::addApplicationFonts are not really supported, so we have to work around this in the Qt DRT by re-initializing our font set when necessary.
Comment 1 Simon Hausmann 2009-07-09 00:42:04 PDT
The following tests that are currently skipped also fail due to this side-effect:

fast/dom/inner-text-001.html
fast/events/frame-tab-focus.html
fast/events/mousemove-after-drag-over-scrollbar.html
fast/events/scroll-to-anchor-in-overflow-hidden.html
fast/flexbox/repaint-scrollbar.html
fast/forms/button-state-restore.html
fast/forms/input-multiple.html
fast/forms/select-script-onchange.html
fast/frames/frame-unload-crash.html
fast/loader/onunload-form-submit-crash-2.html
fast/loader/onunload-form-submit-crash.html
fast/loader/plain-text-document.html

There may be more tests in the skip list suffering from this side-effect.
Comment 2 Simon Hausmann 2009-07-09 00:55:27 PDT
Created attachment 32507 [details]
[Qt] Fix Qt DRT Fontconfig side-effects


2009-07-08  Simon Hausmann  <hausmann@webkit.org>

        Reviewed by NOBODY (OOPS!).

        https://bugs.webkit.org/show_bug.cgi?id=27109

        Fix side-effects in the Qt DRT with tests using application fonts.

        Detect if a test used application fonts and re-initialize the fontconfig
        application fontset accordingly.

        * DumpRenderTree/qt/DumpRenderTree.cpp:
        (WebCore::DumpRenderTree::open): call initializeFonts and remove all application fonts
        after running a testcase.
        (WebCore::DumpRenderTree::initializeFonts): Moved fontconfig initialization code
        here from main.
        * DumpRenderTree/qt/DumpRenderTree.h: Declare initializeFonts.
        * DumpRenderTree/qt/main.cpp:
        (main): Moved fontconfig initialization code to DRT::initializeFonts.

LayoutTests:

2009-07-08  Simon Hausmann  <hausmann@webkit.org>

        Reviewed by NOBODY (OOPS!).

        https://bugs.webkit.org/show_bug.cgi?id=27109

        Remove various tests from the Qt skip list that previously failed
        due to DRT side-effects.

        * platform/qt/Skipped:
---
 6 files changed, 85 insertions(+), 34 deletions(-)
Comment 3 Simon Hausmann 2009-07-10 05:48:08 PDT
Landed in r45706