Bug 150464 - [WinCairo] Improve test results for fast layouttests.
Summary: [WinCairo] Improve test results for fast layouttests.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-22 12:55 PDT by peavo
Modified: 2015-10-23 13:24 PDT (History)
6 users (show)

See Also:


Attachments
Patch (1.48 KB, patch)
2015-10-22 13:04 PDT, peavo
no flags Details | Formatted Diff | Diff
Patch (2.66 KB, patch)
2015-10-23 05:47 PDT, peavo
achristensen: review+
achristensen: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description peavo 2015-10-22 12:55:50 PDT
There are many failures on the WinCairo fast layout tests. Many of these seems to be caused by differences in font metrics.
WinCairo is currently applying the Mac ascent hack. It seems this should only be used for platforms using CoreGraphics.
Also, a device scale factor different from 1.0, is causing differences from the expected result.
Comment 1 peavo 2015-10-22 13:04:48 PDT
Created attachment 263848 [details]
Patch
Comment 2 peavo 2015-10-22 13:09:01 PDT
This patch does not fix many tests (if any), but it brings the result closer to the expected result. The font metrics are not in line with the expected results yet, but they are closer :)
Comment 3 Csaba Osztrogonác 2015-10-22 14:00:57 PDT
run-webkit-tests doesn't know --wincairo platform at all.

Do you plan to fix it and make the WinCairo bot run tests?
Comment 4 peavo 2015-10-22 14:16:00 PDT
(In reply to comment #3)
> run-webkit-tests doesn't know --wincairo platform at all.
> 
> Do you plan to fix it and make the WinCairo bot run tests?

It would be very nice to get this fixed, I will start with looking into the font metrics, and see how far it gets us :)
Comment 5 Alex Christensen 2015-10-22 15:03:53 PDT
Comment on attachment 263848 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=263848&action=review

> Tools/DumpRenderTree/win/DumpRenderTree.cpp:1237
> +#if !USE(CAIRO)
>      viewPrivate->setShouldApplyMacFontAscentHack(TRUE);
> +#endif

This seems good, or maybe this should be inside the definition of setShouldApplyMacFontAscentHack

> Tools/DumpRenderTree/win/DumpRenderTree.cpp:1241
> +#if USE(CAIRO)
> +    viewPrivate->setCustomBackingScaleFactor(1.0);
> +#endif

Why?
Comment 6 peavo 2015-10-23 05:47:20 PDT
Created attachment 263918 [details]
Patch
Comment 7 peavo 2015-10-23 05:52:12 PDT
(In reply to comment #5)
> Comment on attachment 263848 [details]
> Patch
>

Thanks for reviewing :)
 
> 
> > Tools/DumpRenderTree/win/DumpRenderTree.cpp:1241
> > +#if USE(CAIRO)
> > +    viewPrivate->setCustomBackingScaleFactor(1.0);
> > +#endif
> 
> Why?

The render tree text output is in logical coordinates.
If the logical coordinate space is different from the pixel coordinate space, we will not get the expected output.
Alternatively, we could also scale the size of the web view with the device scale factor.
It seems Mac is doing the same thing.
Comment 8 Alex Christensen 2015-10-23 11:14:32 PDT
Comment on attachment 263918 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=263918&action=review

> Tools/DumpRenderTree/win/DumpRenderTree.cpp:1239
> +#if USE(CAIRO)
> +    viewPrivate->setCustomBackingScaleFactor(1.0);
> +#endif

Now that you mention it, I've run into this problem on the AppleWin port, too, when trying to test on high dpi screens.  This should be done for all Windows testing.  Please remove the #if USE(CAIRO)
Comment 9 Alex Christensen 2015-10-23 12:17:27 PDT
Comment on attachment 263918 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=263918&action=review

> Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp:-84
> -    ascent = ascentConsideringMacAscentHack(faceName.data(), ascent, descent);

On second thought, removing this would make the Windows ports more different, which would make them harder to test, wouldn't it?
Comment 10 peavo 2015-10-23 12:30:03 PDT
(In reply to comment #9)
> Comment on attachment 263918 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=263918&action=review
> 
> > Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp:-84
> > -    ascent = ascentConsideringMacAscentHack(faceName.data(), ascent, descent);
> 
> On second thought, removing this would make the Windows ports more
> different, which would make them harder to test, wouldn't it?

Sorry, I don't quite understand what you mean :) This is only for WinCairo, and should make the font metrics less different than before. I think we should only apply the Mac ascent adjustment for CoreGraphics platforms.
Comment 11 Alex Christensen 2015-10-23 12:31:40 PDT
Doesn't applying the mac ascent adjustment on WinCairo make WinCairo layout text more similar to the AppleWin port?  Ideally the two ports would lay everything out the same.
Comment 12 peavo 2015-10-23 12:46:58 PDT
(In reply to comment #11)
> Doesn't applying the mac ascent adjustment on WinCairo make WinCairo layout
> text more similar to the AppleWin port?  Ideally the two ports would lay
> everything out the same.

I believe it makes it more different :) As I have understood it, the Mac adjustment hack is applied to make the Mac font metrics more similar to certain Windows font metrics (Times, for example), because some Windows font metrics had become a de facto standard on the web. When getting font metrics on Windows with the native API, we already have the "correct" metrics, and there is no need to apply the Mac ascent adjustment, except for AppleWin, which is using CoreGraphics, and thereby behaving in the same way as Mac. Debugging also shows that if we apply the ascent adjustment, the layout elements are too big compared to what is expected.
Comment 13 Alex Christensen 2015-10-23 12:48:51 PDT
Comment on attachment 263918 [details]
Patch

Sounds good.  Commit it without the #if USE(CAIRO) in DumpRenderTree.cpp.
Comment 14 peavo 2015-10-23 12:50:30 PDT
(In reply to comment #13)
> Comment on attachment 263918 [details]
> Patch
> 
> Sounds good.  Commit it without the #if USE(CAIRO) in DumpRenderTree.cpp.

Thanks! Will do.
Comment 15 peavo 2015-10-23 13:24:38 PDT
Committed r191507: <http://trac.webkit.org/changeset/191507>.