-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failures on Edge due to anti-aliasing of Ahem (formerly also Safari) #20058
Comments
@foolip since we were talking about this at the webkit contributors meeting. |
See also issue #5498 |
@litherum does #5498 (comment) apply to Cocoa platforms? |
#5498 is about hidpi and our Safari runs on Azure Pipelines actually have a 1:1 pixel ratio, but perhaps there’s another connection? Is there a way to disable font antialiasing in Safari or in macOS system-wise? If so we could to a trial run and compare how many tests are affected by it. Do WebKit layout tests run with any extra settings to avoid this issue, or are these tests failing in the WebKit imported copy too? |
We spent a bunch of time looking at this for Firefox runs on MacOS. I think the final approach was to disable antialiasing specificaly for Ahem in test runs: https://searchfox.org/mozilla-central/source/testing/profiles/web-platform/user.js#26 @gsnedders and I also spent some time looking at modifying Ahem itself to disable AA, but without any success; the relevant features seemed to be set already just ignored by the renderers. @jfkthame might also have some insight here. |
Here's a run where the gasp table is set to not do grayscale or grid-fitting, which clearly makes no difference here. |
Related: #13010 |
A possible solution for Safari is disabling font antialiasing with the non-standard CSS The following patch makes the test diff --git a/css/CSS2/text/painting-order-underline-001-ref.xht b/css/CSS2/text/painting-order-underline-001-ref.xht
index bec88a5a9b..b222bc1cd6 100644
--- a/css/CSS2/text/painting-order-underline-001-ref.xht
+++ b/css/CSS2/text/painting-order-underline-001-ref.xht
@@ -3,7 +3,11 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
-
+ <style>
+ html {
+ -webkit-font-smoothing: none;
+ }
+ </style>
<title>CSS Reftest Reference</title>
<link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
diff --git a/css/CSS2/text/painting-order-underline-001.xht b/css/CSS2/text/painting-order-underline-001.xht
index 9c01cbaa18..3c9d8a6e87 100644
--- a/css/CSS2/text/painting-order-underline-001.xht
+++ b/css/CSS2/text/painting-order-underline-001.xht
@@ -3,7 +3,11 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
-
+ <style>
+ html {
+ -webkit-font-smoothing: none;
+ }
+ </style>
<title>CSS Test: 'underline' decoration painting order and descender</title>
<link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> It is needed to set I have two ideas to automate this:
Perhaps instead of doing this indiscriminately for every test, it can be done only for the tests using Ahem font after they fail. Like:
Another idea is to patch WebKit to disable font smoothing (or at least to set it by default to disabled instead of auto) when some magic environment variable like WDYT? For MS Edge maybe it works disabling font smoothing for the whole system in the Azure CI? |
Note that the WebKit layout test test-runner |
If we could set a pref or an environment variable to disable font smoothing — for all text or Ahem in particular — that seems better to me than trying to hack the CSS provided to the tests, in case the latter has unexpected side effects. The fact that the layout test runner already does that does seem like evidence that this should be exposed to wpt as well. |
@smfr if we had a way to disable font smoothing with |
That's the plan. We'll implement this in WebKit. |
Ah yes, the good old |
Someone (me?) should probably sit down and go through all the prefs Gecko sets and figure out what we need as prefs to alter behaviour and ensure we have them all documented. |
That's great! Do you know which STP release this will be in? |
I implemented it for WebKitGTK on r254567 However, after looking at the diff on wpt.fyi between the versions of WebKitGTK without the fix (on the left: r254504) and the one with it (on the right: r254674), I can't find any diff on the test run related to this change. After some investigation I discovered that the issue with the Ahem font only seems to happens if you turn antialising on and disable font hinting. But if you enable font hinting, then the issue doesn't happen: tests pass and the squares of Ahem render like without antialias, even if you still let antialiasing enabled (at least on Linux). And that setting ( However, most Linux distributions default to enable font hinting. So I think that explains why the fix of disabling Antialiasing for Ahem for WebKitGTK has not caused new passes for wpt.fyi. The good part is that this fix should fix the issue with Ahem for everybody, including in setups with hinting disabled. I verified that is that the case, by manually running the affected WPT tests before and after. FTR, this seems to be also an issue affecting Chrome: |
If you can't find an existing issue, then filing a new one would be good. It sounds like it may be an issue affecting many tests, assuming the tests you mentioned aren't doing anything unusual. |
So as far as I can tell from this discussion, we are now in a position where Safari is fixed but Edge is not. That is borne out by the wpt.fyi URLs in the original report now showing fails for just Edge. |
Digging into Safari CSS test failures, many of them are caused by differences in font rendering in tests that assume that Ahem glyphs will produce sharp-edged boxes that can be compared with CSS backgrounds. Some random examples:
https://wpt.fyi/results/css/CSS2/text/painting-order-underline-001.xht?label=master&label=experimental&aligned
https://wpt.fyi/results/css/CSS2/text/white-space-applies-to-008.xht?label=master&label=experimental&aligned
https://wpt.fyi/results/css/CSS2/linebox/line-height-039.xht?label=master&label=experimental&aligned
https://wpt.fyi/results/css/css-multicol/multicol-basic-001.html?label=master&label=experimental&aligned
Interestingly, many tests that both Edge and Safari fail but Chrome and Firefox pass are in this category.
Adding
<meta name=fuzzy>
to all these tests will be very laborious.I wonder if this behavior changed with Ahem-the-web-font (@gsnedders)?
The text was updated successfully, but these errors were encountered: