Title: [282015] trunk
- Revision
- 282015
- Author
- mmaxfi...@apple.com
- Date
- 2021-09-03 13:03:18 -0700 (Fri, 03 Sep 2021)
Log Message
FontFaceSet.status needs to react to style changes
https://bugs.webkit.org/show_bug.cgi?id=229839
Reviewed by Sam Weinig.
Source/WebCore:
When content says "document.fonts.status", the ".status" 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.status ... <=== This needs to reflect the style changes.
Test: fast/text/FontFaceSet-status-after-style-update.html
* css/FontFaceSet.cpp:
(WebCore::FontFaceSet::status const):
LayoutTests:
This is not a WPT test because it requires internals.invalidateFontCache().
* fast/text/FontFaceSet-status-after-style-update-expected.txt: Added.
* fast/text/FontFaceSet-status-after-style-update.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (282014 => 282015)
--- trunk/LayoutTests/ChangeLog 2021-09-03 19:46:40 UTC (rev 282014)
+++ trunk/LayoutTests/ChangeLog 2021-09-03 20:03:18 UTC (rev 282015)
@@ -1,3 +1,15 @@
+2021-09-03 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ FontFaceSet.status needs to react to style changes
+ https://bugs.webkit.org/show_bug.cgi?id=229839
+
+ Reviewed by Sam Weinig.
+
+ This is not a WPT test because it requires internals.invalidateFontCache().
+
+ * fast/text/FontFaceSet-status-after-style-update-expected.txt: Added.
+ * fast/text/FontFaceSet-status-after-style-update.html: Added.
+
2021-09-03 Ziran Sun <z...@igalia.com>
REGRESSION(r280078): broke fast/images/exif-orientation-composited.html on windows
Added: trunk/LayoutTests/fast/text/FontFaceSet-status-after-style-update-expected.txt (0 => 282015)
--- trunk/LayoutTests/fast/text/FontFaceSet-status-after-style-update-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/text/FontFaceSet-status-after-style-update-expected.txt 2021-09-03 20:03:18 UTC (rev 282015)
@@ -0,0 +1,12 @@
+This function makes sure document.fonts.status gets updated after style changes.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS fonts.status is "loaded"
+PASS fonts.status is "loading"
+PASS fonts.status is "loaded"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/fast/text/FontFaceSet-status-after-style-update-expected.txt
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Author Date Id Rev URL
\ No newline at end of property
Added: trunk/LayoutTests/fast/text/FontFaceSet-status-after-style-update.html (0 => 282015)
--- trunk/LayoutTests/fast/text/FontFaceSet-status-after-style-update.html (rev 0)
+++ trunk/LayoutTests/fast/text/FontFaceSet-status-after-style-update.html 2021-09-03 20:03:18 UTC (rev 282015)
@@ -0,0 +1,29 @@
+<!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.status gets updated after style changes.");
+let fonts = document.fonts;
+shouldBeEqualToString("fonts.status", "loaded");
+fonts.values().next().value.load();
+shouldBeEqualToString("fonts.status", "loading");
+document.getElementById("head").removeChild(document.getElementById("style"));
+shouldBeEqualToString("fonts.status", "loaded");
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (282014 => 282015)
--- trunk/Source/WebCore/ChangeLog 2021-09-03 19:46:40 UTC (rev 282014)
+++ trunk/Source/WebCore/ChangeLog 2021-09-03 20:03:18 UTC (rev 282015)
@@ -1,3 +1,23 @@
+2021-09-03 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ FontFaceSet.status needs to react to style changes
+ https://bugs.webkit.org/show_bug.cgi?id=229839
+
+ Reviewed by Sam Weinig.
+
+ When content says "document.fonts.status", the ".status" 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.status ... <=== This needs to reflect the style changes.
+
+ Test: fast/text/FontFaceSet-status-after-style-update.html
+
+ * css/FontFaceSet.cpp:
+ (WebCore::FontFaceSet::status const):
+
2021-09-03 Ziran Sun <z...@igalia.com>
REGRESSION(r280078): broke fast/images/exif-orientation-composited.html on windows
Modified: trunk/Source/WebCore/css/FontFaceSet.cpp (282014 => 282015)
--- trunk/Source/WebCore/css/FontFaceSet.cpp 2021-09-03 19:46:40 UTC (rev 282014)
+++ trunk/Source/WebCore/css/FontFaceSet.cpp 2021-09-03 20:03:18 UTC (rev 282015)
@@ -193,7 +193,10 @@
auto FontFaceSet::status() const -> LoadStatus
{
- switch (m_backing->status()) {
+ Ref protect = m_backing;
+ protect->updateStyleIfNeeded();
+
+ switch (protect->status()) {
case CSSFontFaceSet::Status::Loading:
return LoadStatus::Loading;
case CSSFontFaceSet::Status::Loaded:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes