Skip to content
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

Adjust MathML tests to Workaround WebKit's bug with document.fonts.ready #10025

merged 2 commits into from Mar 14, 2018


None yet
4 participants
Copy link

fred-wang commented Mar 14, 2018

cc @mrego cc @youennf

That seems to be an acceptable work around to me. WDYT?

See also


This comment has been minimized.

Copy link

wpt-pr-bot commented Mar 14, 2018

There are no owners for this pull request besides its author. Please reach out on W3C's irc server (, port 6665) on channel #testing (web client) to get help with this. Thank you!


This comment has been minimized.

Copy link

w3c-bots commented Mar 14, 2018


Started: 2018-03-14 14:38:57
Finished: 2018-03-14 14:47:04

View more information about this build on:

@@ -62,7 +62,8 @@
setup({ explicit_done: true });
window.addEventListener("load", function() {
// Delay the check to workaround WebKit's bug
setTimeout(() => { document.fonts.ready.then(runTests); }, 0);

This comment has been minimized.

Copy link

mrego Mar 14, 2018


I think it's usually preferred window.requestAnimationFrame() instead of setTimeout().
Could you try if something like that would fix the issue? Thanks!

This comment has been minimized.

Copy link

fred-wang Mar 14, 2018

Author Contributor

The WebKit bug is that document.fonts.ready resolves immediately, even when I replace the CSS @font-face with a list of document.fonts.add(...) just before document.fonts.ready. Using setTimeout or requestAnimationFrame will delay things a bit and hence solve the issue, but I'm not sure requestAnimationFrame is more appropriate here, since it's not really a layout/painting issue but a font API bug. For example the following changes do not allow to workaround the issue:

document.fonts.ready.then(() => { requestAnimationFrame(runTests); });

document.fonts.ready.then(() => { setTimeout(runTests, notSmallEnoughDelta); });

This comment has been minimized.

Copy link

mrego Mar 14, 2018


I was thinking in something like:

    window.requestAnimationFrame(() => { document.fonts.ready.then(runTests); });

However I agree with you that setTimeout() might be clearer, so I'm fine with keeping it.

This comment has been minimized.

Copy link

fred-wang Mar 14, 2018

Author Contributor

Yes, requestAnimationFrame(() => { document.fonts.ready.then(runTests); }); would work too.


mrego approved these changes Mar 14, 2018

Copy link

mrego left a comment


@fred-wang fred-wang merged commit 716fa06 into master Mar 14, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed

@fred-wang fred-wang deleted the mathml-fonts-ready branch Mar 14, 2018

hubot pushed a commit to WebKit/webkit that referenced this pull request Mar 14, 2018
Finish migration to MathML WPT tests

Patch by Frederic Wang <> on 2018-03-14
Reviewed by Manuel Rego Casasnovas.

In r225162, the MathML tests from the WPT repository were imported. They were intended to
replace the ones in imported/mathml-in-html5 but the migration was not fully possible. The
main issue was that many MathML tests use Web fonts to test the use of OpenType parameters
but document.fonts.ready is unreliable in WebKit (bug 174030). A workaround was implemented
in WPT ( web-platform-tests/wpt#10025 ) so this commit finishes
the migration. We update the WPT MathML tests and now run them all, we remove
imported/mathml-in-html5 and the associated TestExpectations failures. Two cases unrelated to
font loading are still failing: One for the SuperscriptShiftUpCramped parameter (bug 156401)
and one for the RadicalDegreeBottomRaisePercent parameter (bug 183631).


Reviewed by Manuel Rego Casasnovas.

* web-platform-tests/mathml/presentation-markup/fractions/frac-parameters-1-expected.txt: Renamed from LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/fractions/frac-parameters-1-expected.txt.
* web-platform-tests/mathml/presentation-markup/fractions/frac-parameters-1.html: Import font loading workaround.
* web-platform-tests/mathml/presentation-markup/fractions/frac-parameters-2-expected.txt: Renamed from LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/fractions/frac-parameters-2-expected.txt.
* web-platform-tests/mathml/presentation-markup/fractions/frac-parameters-2.html: Import font loading workaround.
* web-platform-tests/mathml/presentation-markup/operators/mo-axis-height-1.html: Import font loading workaround.
* web-platform-tests/mathml/presentation-markup/radicals/root-parameters-1-expected.txt: Renamed from LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/radicals/root-parameters-1-expected.txt.
Also add the failure with RadicalDegreeBottomRaisePercent.
* web-platform-tests/mathml/presentation-markup/radicals/root-parameters-1.html: Import font loading workaround.
* web-platform-tests/mathml/presentation-markup/scripts/subsup-parameters-1-expected.txt: Renamed from LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/scripts/subsup-parameters-1-expected.txt.
Also add the failure for SuperscriptShiftUpCramped.
* web-platform-tests/mathml/presentation-markup/scripts/subsup-parameters-1.html: Import font loading workaround.
* web-platform-tests/mathml/presentation-markup/scripts/underover-parameters-1-expected.txt: Renamed from LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/scripts/underover-parameters-1-expected.txt.
* web-platform-tests/mathml/presentation-markup/scripts/underover-parameters-1.html: Import font loading workaround.
* web-platform-tests/mathml/presentation-markup/scripts/underover-parameters-2-expected.txt: Renamed from LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/scripts/underover-parameters-2-expected.txt.
* web-platform-tests/mathml/presentation-markup/scripts/underover-parameters-2.html: Import font loading workaround.
* web-platform-tests/mathml/presentation-markup/scripts/underover-parameters-3-expected.txt: Renamed from LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/scripts/underover-parameters-3-expected.txt.
* web-platform-tests/mathml/presentation-markup/scripts/underover-parameters-3.html: Import font loading workaround.
* web-platform-tests/mathml/presentation-markup/scripts/underover-parameters-4-expected.txt: Renamed from LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/scripts/underover-parameters-4-expected.txt.
* web-platform-tests/mathml/presentation-markup/scripts/underover-parameters-4.html: Import font loading workaround.
* web-platform-tests/mathml/presentation-markup/tables/table-axis-height.html: Import font loading workaround.
* web-platform-tests/mathml/relations/css-styling/displaystyle-1.html: Import font loading workaround.
* web-platform-tests/mathml/relations/css-styling/lengths-3.html: Import font loading workaround.
* web-platform-tests/mathml/tools/utils/ Import update to Python 3.


* TestExpectations: Unskip MathML WPT tests.
* imported/mathml-in-html5/LICENSE: Removed.
* imported/mathml-in-html5/ Removed.
* imported/mathml-in-html5/mathml/presentation-markup/fractions/frac-parameters-1.html: Removed.
* imported/mathml-in-html5/mathml/presentation-markup/fractions/frac-parameters-2.html: Removed.
* imported/mathml-in-html5/mathml/presentation-markup/radicals/root-parameters-1.html: Removed.
* imported/mathml-in-html5/mathml/presentation-markup/scripts/subsup-parameters-1.html: Removed.
* imported/mathml-in-html5/mathml/presentation-markup/scripts/underover-parameters-1.html: Removed.
* imported/mathml-in-html5/mathml/presentation-markup/scripts/underover-parameters-2.html: Removed.
* imported/mathml-in-html5/mathml/presentation-markup/scripts/underover-parameters-3.html: Removed.
* imported/mathml-in-html5/mathml/presentation-markup/scripts/underover-parameters-4.html: Removed.
* platform/mac-wk2/TestExpectations: Remove the expectation.
* platform/win/TestExpectations: Remove the expectation.

git-svn-id: 268f45cc-cd09-0410-ab3c-d52691b4dbfc

fred-wang added a commit that referenced this pull request Mar 14, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.