Title: [282570] branches/safari-612-branch
Revision
282570
Author
[email protected]
Date
2021-09-16 11:48:14 -0700 (Thu, 16 Sep 2021)

Log Message

Cherry-pick r282015. rdar://problem/83183864

    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.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@282015 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-612-branch/LayoutTests/ChangeLog (282569 => 282570)


--- branches/safari-612-branch/LayoutTests/ChangeLog	2021-09-16 18:48:10 UTC (rev 282569)
+++ branches/safari-612-branch/LayoutTests/ChangeLog	2021-09-16 18:48:14 UTC (rev 282570)
@@ -1,3 +1,48 @@
+2021-09-16  Russell Epstein  <[email protected]>
+
+        Cherry-pick r282015. rdar://problem/83183864
+
+    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.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@282015 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-09-03  Myles C. Maxfield  <[email protected]>
+
+            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-09  Russell Epstein  <[email protected]>
 
         Cherry-pick r281792. rdar://problem/82949614

Added: branches/safari-612-branch/LayoutTests/fast/text/FontFaceSet-status-after-style-update-expected.txt (0 => 282570)


--- branches/safari-612-branch/LayoutTests/fast/text/FontFaceSet-status-after-style-update-expected.txt	                        (rev 0)
+++ branches/safari-612-branch/LayoutTests/fast/text/FontFaceSet-status-after-style-update-expected.txt	2021-09-16 18:48:14 UTC (rev 282570)
@@ -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
+

Added: branches/safari-612-branch/LayoutTests/fast/text/FontFaceSet-status-after-style-update.html (0 => 282570)


--- branches/safari-612-branch/LayoutTests/fast/text/FontFaceSet-status-after-style-update.html	                        (rev 0)
+++ branches/safari-612-branch/LayoutTests/fast/text/FontFaceSet-status-after-style-update.html	2021-09-16 18:48:14 UTC (rev 282570)
@@ -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: branches/safari-612-branch/Source/WebCore/ChangeLog (282569 => 282570)


--- branches/safari-612-branch/Source/WebCore/ChangeLog	2021-09-16 18:48:10 UTC (rev 282569)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog	2021-09-16 18:48:14 UTC (rev 282570)
@@ -1,5 +1,58 @@
 2021-09-16  Russell Epstein  <[email protected]>
 
+        Cherry-pick r282015. rdar://problem/83183864
+
+    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.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@282015 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-09-03  Myles C. Maxfield  <[email protected]>
+
+            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-16  Russell Epstein  <[email protected]>
+
         Cherry-pick r281544. rdar://problem/83183832
 
     Refactor ENABLE(JIT_OPERATION_VALIDATION) code to emit no code when disabled.

Modified: branches/safari-612-branch/Source/WebCore/css/FontFaceSet.cpp (282569 => 282570)


--- branches/safari-612-branch/Source/WebCore/css/FontFaceSet.cpp	2021-09-16 18:48:10 UTC (rev 282569)
+++ branches/safari-612-branch/Source/WebCore/css/FontFaceSet.cpp	2021-09-16 18:48:14 UTC (rev 282570)
@@ -183,7 +183,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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to