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

Add a test for document.fonts.ready timing assumptions #18489

Merged
merged 1 commit into from
Aug 16, 2019

Conversation

foolip
Copy link
Member

@foolip foolip commented Aug 16, 2019

In #17219 (comment)
a number of tests were found to depend on document.fonts.ready in this
way, and it turns out it doesn't work in Safari with web fonts. Add a
test to surface this problem more clearly.

In #17219 (comment)
a number of tests were found to depend on document.fonts.ready in this
way, and it turns out it doesn't work in Safari with web fonts. Add a
test to surface this problem more clearly.
@foolip
Copy link
Member Author

foolip commented Aug 16, 2019

As suspected, the test currently passes. https://bugs.webkit.org/show_bug.cgi?id=174030 should be linked when this test begins to fail due to no longer having Ahem as a system font.

@foolip foolip merged commit 29e72c5 into master Aug 16, 2019
natechapin pushed a commit to natechapin/wpt that referenced this pull request Aug 23, 2019
…tests#18489)

In web-platform-tests#17219 (comment)
a number of tests were found to depend on document.fonts.ready in this
way, and it turns out it doesn't work in Safari with web fonts. Add a
test to surface this problem more clearly.
@gsnedders gsnedders deleted the foolip/document-fonts-ready-assumptions branch August 27, 2019 15:20
zdobersek pushed a commit to Igalia/webkit that referenced this pull request Aug 30, 2019
https://bugs.webkit.org/show_bug.cgi?id=174030
<rdar://problem/33083550>

Reviewed by Frédéric Wang.

LayoutTests/imported/w3c:

Test from web-platform-tests/wpt#18489.

* web-platform-tests/fonts/ahem.css: Added.
(@font-face):
* web-platform-tests/infrastructure/assumptions/document-fonts-ready-expected.txt: Added.
* web-platform-tests/infrastructure/assumptions/document-fonts-ready.html: Added.

Source/WebCore:

As described in https://drafts.csswg.org/css-font-loading/#font-face-set-ready, the ready promise
is only fulfilled after layout operations complete and no additional font loads are necessary.

This patch implements this by notifying the FontFaceSet created for the document when the document
is finished loading. At that time, the promise will be resolved as soon as fonts are finished loading if any.

Test: imported/w3c/web-platform-tests/infrastructure/assumptions/document-fonts-ready.html

* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::optionalFontFaceSet):
* css/CSSFontSelector.h:
* css/FontFaceSet.cpp:
(WebCore::FontFaceSet::FontFaceSet):
(WebCore::FontFaceSet::startedLoading):
(WebCore::FontFaceSet::didFirstLayout):
(WebCore::FontFaceSet::completedLoading):
* css/FontFaceSet.h:
* dom/Document.cpp:
(WebCore::Document::implicitClose):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@249295 268f45cc-cd09-0410-ab3c-d52691b4dbfc
bertogg pushed a commit to Igalia/webkit that referenced this pull request Sep 2, 2019
https://bugs.webkit.org/show_bug.cgi?id=174030
<rdar://problem/33083550>

Reviewed by Frédéric Wang.

LayoutTests/imported/w3c:

Test from web-platform-tests/wpt#18489.

* web-platform-tests/fonts/ahem.css: Added.
(@font-face):
* web-platform-tests/infrastructure/assumptions/document-fonts-ready-expected.txt: Added.
* web-platform-tests/infrastructure/assumptions/document-fonts-ready.html: Added.

Source/WebCore:

As described in https://drafts.csswg.org/css-font-loading/#font-face-set-ready, the ready promise
is only fulfilled after layout operations complete and no additional font loads are necessary.

This patch implements this by notifying the FontFaceSet created for the document when the document
is finished loading. At that time, the promise will be resolved as soon as fonts are finished loading if any.

Test: imported/w3c/web-platform-tests/infrastructure/assumptions/document-fonts-ready.html

* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::optionalFontFaceSet):
* css/CSSFontSelector.h:
* css/FontFaceSet.cpp:
(WebCore::FontFaceSet::FontFaceSet):
(WebCore::FontFaceSet::startedLoading):
(WebCore::FontFaceSet::didFirstLayout):
(WebCore::FontFaceSet::completedLoading):
* css/FontFaceSet.h:
* dom/Document.cpp:
(WebCore::Document::implicitClose):

git-svn-id: http://svn.webkit.org/repository/webkit/releases/WebKitGTK/webkit-2.26@249385 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JonWBedard pushed a commit to WebKit/WebKit that referenced this pull request Dec 1, 2022
https://bugs.webkit.org/show_bug.cgi?id=174030
<rdar://problem/33083550>

Reviewed by Frédéric Wang.

LayoutTests/imported/w3c:

Test from web-platform-tests/wpt#18489.

* web-platform-tests/fonts/ahem.css: Added.
(@font-face):
* web-platform-tests/infrastructure/assumptions/document-fonts-ready-expected.txt: Added.
* web-platform-tests/infrastructure/assumptions/document-fonts-ready.html: Added.

Source/WebCore:

As described in https://drafts.csswg.org/css-font-loading/#font-face-set-ready, the ready promise
is only fulfilled after layout operations complete and no additional font loads are necessary.

This patch implements this by notifying the FontFaceSet created for the document when the document
is finished loading. At that time, the promise will be resolved as soon as fonts are finished loading if any.

Test: imported/w3c/web-platform-tests/infrastructure/assumptions/document-fonts-ready.html

* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::optionalFontFaceSet):
* css/CSSFontSelector.h:
* css/FontFaceSet.cpp:
(WebCore::FontFaceSet::FontFaceSet):
(WebCore::FontFaceSet::startedLoading):
(WebCore::FontFaceSet::didFirstLayout):
(WebCore::FontFaceSet::completedLoading):
* css/FontFaceSet.h:
* dom/Document.cpp:
(WebCore::Document::implicitClose):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants