Title: [282571] branches/safari-612-branch
- Revision
- 282571
- Author
- [email protected]
- Date
- 2021-09-16 11:48:18 -0700 (Thu, 16 Sep 2021)
Log Message
Cherry-pick r282016. rdar://problem/83183608
FontFaceSet.check() needs to react to style changes
https://bugs.webkit.org/show_bug.cgi?id=229844
Reviewed by Sam Weinig.
Source/WebCore:
When content says "document.fonts.check(...)", the ".check(...)" part needs to
update style instead of the "document.fonts" part. This is because it's
totally legal for content to say:
var f = document.fonts;
// Modify style here
... f.check(...) ... <=== This needs to reflect the style changes.
Test: fast/text/FontFaceSet-check-after-style-update.html
* WebCore.xcodeproj/xcshareddata/xcschemes/WebCore.xcscheme:
* css/CSSFontFaceSet.cpp:
(WebCore::CSSFontFaceSet::check):
* css/FontFaceSet.cpp:
(WebCore::FontFaceSet::check):
LayoutTests:
This can't be a WPT test because it requires internals.invalidateFontCache().
* fast/text/FontFaceSet-check-after-style-update-expected.txt: Added.
* fast/text/FontFaceSet-check-after-style-update.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@282016 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Added Paths
Diff
Modified: branches/safari-612-branch/LayoutTests/ChangeLog (282570 => 282571)
--- branches/safari-612-branch/LayoutTests/ChangeLog 2021-09-16 18:48:14 UTC (rev 282570)
+++ branches/safari-612-branch/LayoutTests/ChangeLog 2021-09-16 18:48:18 UTC (rev 282571)
@@ -1,5 +1,53 @@
2021-09-16 Russell Epstein <[email protected]>
+ Cherry-pick r282016. rdar://problem/83183608
+
+ FontFaceSet.check() needs to react to style changes
+ https://bugs.webkit.org/show_bug.cgi?id=229844
+
+ Reviewed by Sam Weinig.
+
+ Source/WebCore:
+
+ When content says "document.fonts.check(...)", the ".check(...)" part needs to
+ update style instead of the "document.fonts" part. This is because it's
+ totally legal for content to say:
+
+ var f = document.fonts;
+ // Modify style here
+ ... f.check(...) ... <=== This needs to reflect the style changes.
+
+ Test: fast/text/FontFaceSet-check-after-style-update.html
+
+ * WebCore.xcodeproj/xcshareddata/xcschemes/WebCore.xcscheme:
+ * css/CSSFontFaceSet.cpp:
+ (WebCore::CSSFontFaceSet::check):
+ * css/FontFaceSet.cpp:
+ (WebCore::FontFaceSet::check):
+
+ LayoutTests:
+
+ This can't be a WPT test because it requires internals.invalidateFontCache().
+
+ * fast/text/FontFaceSet-check-after-style-update-expected.txt: Added.
+ * fast/text/FontFaceSet-check-after-style-update.html: Added.
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@282016 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-09-03 Myles C. Maxfield <[email protected]>
+
+ FontFaceSet.check() needs to react to style changes
+ https://bugs.webkit.org/show_bug.cgi?id=229844
+
+ Reviewed by Sam Weinig.
+
+ This can't be a WPT test because it requires internals.invalidateFontCache().
+
+ * fast/text/FontFaceSet-check-after-style-update-expected.txt: Added.
+ * fast/text/FontFaceSet-check-after-style-update.html: Added.
+
+2021-09-16 Russell Epstein <[email protected]>
+
Cherry-pick r282015. rdar://problem/83183864
FontFaceSet.status needs to react to style changes
Added: branches/safari-612-branch/LayoutTests/fast/text/FontFaceSet-check-after-style-update-expected.txt (0 => 282571)
--- branches/safari-612-branch/LayoutTests/fast/text/FontFaceSet-check-after-style-update-expected.txt (rev 0)
+++ branches/safari-612-branch/LayoutTests/fast/text/FontFaceSet-check-after-style-update-expected.txt 2021-09-16 18:48:18 UTC (rev 282571)
@@ -0,0 +1,13 @@
+This function makes sure document.fonts.check() is affected by style changes.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS fonts.check('12px ThisIsNotARealFont') is true
+PASS fonts.check('12px WebFont') is false
+PASS fonts.check('12px WebFont') is false
+PASS fonts.check('12px WebFont') is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-612-branch/LayoutTests/fast/text/FontFaceSet-check-after-style-update.html (0 => 282571)
--- branches/safari-612-branch/LayoutTests/fast/text/FontFaceSet-check-after-style-update.html (rev 0)
+++ branches/safari-612-branch/LayoutTests/fast/text/FontFaceSet-check-after-style-update.html 2021-09-16 18:48:18 UTC (rev 282571)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head id="head">
+<style id="style">
+@font-face {
+ font-family: "WebFont";
+ src: url("../../resources/Ahem.ttf") format("truetype");
+}
+</style>
+<script src=""
+<script>
+if (window.internals) {
+ internals.invalidateFontCache();
+ internals.clearMemoryCache();
+}
+</script>
+</head>
+<body>
+<script>
+description("This function makes sure document.fonts.check() is affected by style changes.");
+let fonts = document.fonts;
+shouldBeTrue("fonts.check('12px ThisIsNotARealFont')");
+shouldBeFalse("fonts.check('12px WebFont')");
+fonts.values().next().value.load();
+shouldBeFalse("fonts.check('12px WebFont')");
+document.getElementById("head").removeChild(document.getElementById("style"));
+// https://drafts.csswg.org/css-font-loading-3/#font-face-set-check
+// "if none of the specified fonts exist (for example, names are mis-spelled), the method also returns true"
+shouldBeTrue("fonts.check('12px WebFont')");
+</script>
+</body>
+</html>
Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (282570 => 282571)
--- branches/safari-612-branch/Source/WebCore/ChangeLog 2021-09-16 18:48:14 UTC (rev 282570)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog 2021-09-16 18:48:18 UTC (rev 282571)
@@ -1,5 +1,64 @@
2021-09-16 Russell Epstein <[email protected]>
+ Cherry-pick r282016. rdar://problem/83183608
+
+ FontFaceSet.check() needs to react to style changes
+ https://bugs.webkit.org/show_bug.cgi?id=229844
+
+ Reviewed by Sam Weinig.
+
+ Source/WebCore:
+
+ When content says "document.fonts.check(...)", the ".check(...)" part needs to
+ update style instead of the "document.fonts" part. This is because it's
+ totally legal for content to say:
+
+ var f = document.fonts;
+ // Modify style here
+ ... f.check(...) ... <=== This needs to reflect the style changes.
+
+ Test: fast/text/FontFaceSet-check-after-style-update.html
+
+ * WebCore.xcodeproj/xcshareddata/xcschemes/WebCore.xcscheme:
+ * css/CSSFontFaceSet.cpp:
+ (WebCore::CSSFontFaceSet::check):
+ * css/FontFaceSet.cpp:
+ (WebCore::FontFaceSet::check):
+
+ LayoutTests:
+
+ This can't be a WPT test because it requires internals.invalidateFontCache().
+
+ * fast/text/FontFaceSet-check-after-style-update-expected.txt: Added.
+ * fast/text/FontFaceSet-check-after-style-update.html: Added.
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@282016 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-09-03 Myles C. Maxfield <[email protected]>
+
+ FontFaceSet.check() needs to react to style changes
+ https://bugs.webkit.org/show_bug.cgi?id=229844
+
+ Reviewed by Sam Weinig.
+
+ When content says "document.fonts.check(...)", the ".check(...)" part needs to
+ update style instead of the "document.fonts" part. This is because it's
+ totally legal for content to say:
+
+ var f = document.fonts;
+ // Modify style here
+ ... f.check(...) ... <=== This needs to reflect the style changes.
+
+ Test: fast/text/FontFaceSet-check-after-style-update.html
+
+ * WebCore.xcodeproj/xcshareddata/xcschemes/WebCore.xcscheme:
+ * css/CSSFontFaceSet.cpp:
+ (WebCore::CSSFontFaceSet::check):
+ * css/FontFaceSet.cpp:
+ (WebCore::FontFaceSet::check):
+
+2021-09-16 Russell Epstein <[email protected]>
+
Cherry-pick r282015. rdar://problem/83183864
FontFaceSet.status needs to react to style changes
Modified: branches/safari-612-branch/Source/WebCore/css/CSSFontFaceSet.cpp (282570 => 282571)
--- branches/safari-612-branch/Source/WebCore/css/CSSFontFaceSet.cpp 2021-09-16 18:48:14 UTC (rev 282570)
+++ branches/safari-612-branch/Source/WebCore/css/CSSFontFaceSet.cpp 2021-09-16 18:48:18 UTC (rev 282571)
@@ -435,7 +435,8 @@
return matchingFaces.releaseException();
for (auto& face : matchingFaces.releaseReturnValue()) {
- if (face.get().status() == CSSFontFace::Status::Pending)
+ if (face.get().status() == CSSFontFace::Status::Pending
+ || face.get().status() == CSSFontFace::Status::Loading)
return false;
}
return true;
Modified: branches/safari-612-branch/Source/WebCore/css/FontFaceSet.cpp (282570 => 282571)
--- branches/safari-612-branch/Source/WebCore/css/FontFaceSet.cpp 2021-09-16 18:48:14 UTC (rev 282570)
+++ branches/safari-612-branch/Source/WebCore/css/FontFaceSet.cpp 2021-09-16 18:48:18 UTC (rev 282571)
@@ -178,7 +178,9 @@
ExceptionOr<bool> FontFaceSet::check(const String& family, const String& text)
{
- return m_backing->check(family, text);
+ Ref protect = m_backing;
+ protect->updateStyleIfNeeded();
+ return protect->check(family, text);
}
auto FontFaceSet::status() const -> LoadStatus
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes