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

Log Message

Cherry-pick r282204. rdar://problem/83183703

    FontFaceSet.has() needs to react to style changes
    https://bugs.webkit.org/show_bug.cgi?id=229848

    Reviewed by Antti Koivisto.

    LayoutTests/imported/w3c:

    This test was landed upstream in https://github.com/web-platform-tests/wpt/pull/30322

    * web-platform-tests/css/css-font-loading/fontfaceset-has-expected.txt: Added.
    * web-platform-tests/css/css-font-loading/fontfaceset-has.html: Added.

    Source/WebCore:

    When content says "document.fonts.has(...)", the ".has(...)" 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.has(...) ... <=== This needs to reflect the style changes.

    Test: imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-has.html

    * css/FontFaceSet.cpp:
    (WebCore::FontFaceSet::has const):

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-612-branch/LayoutTests/imported/w3c/ChangeLog (282572 => 282573)


--- branches/safari-612-branch/LayoutTests/imported/w3c/ChangeLog	2021-09-16 18:48:20 UTC (rev 282572)
+++ branches/safari-612-branch/LayoutTests/imported/w3c/ChangeLog	2021-09-16 18:48:24 UTC (rev 282573)
@@ -1,3 +1,49 @@
+2021-09-16  Russell Epstein  <[email protected]>
+
+        Cherry-pick r282204. rdar://problem/83183703
+
+    FontFaceSet.has() needs to react to style changes
+    https://bugs.webkit.org/show_bug.cgi?id=229848
+    
+    Reviewed by Antti Koivisto.
+    
+    LayoutTests/imported/w3c:
+    
+    This test was landed upstream in https://github.com/web-platform-tests/wpt/pull/30322
+    
+    * web-platform-tests/css/css-font-loading/fontfaceset-has-expected.txt: Added.
+    * web-platform-tests/css/css-font-loading/fontfaceset-has.html: Added.
+    
+    Source/WebCore:
+    
+    When content says "document.fonts.has(...)", the ".has(...)" 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.has(...) ... <=== This needs to reflect the style changes.
+    
+    Test: imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-has.html
+    
+    * css/FontFaceSet.cpp:
+    (WebCore::FontFaceSet::has const):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@282204 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-09-09  Myles C. Maxfield  <[email protected]>
+
+            FontFaceSet.has() needs to react to style changes
+            https://bugs.webkit.org/show_bug.cgi?id=229848
+
+            Reviewed by Antti Koivisto.
+
+            This test was landed upstream in https://github.com/web-platform-tests/wpt/pull/30322
+
+            * web-platform-tests/css/css-font-loading/fontfaceset-has-expected.txt: Added.
+            * web-platform-tests/css/css-font-loading/fontfaceset-has.html: Added.
+
 2021-09-01  Russell Epstein  <[email protected]>
 
         Cherry-pick r281860. rdar://problem/82651913

Added: branches/safari-612-branch/LayoutTests/imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-has-expected.txt (0 => 282573)


--- branches/safari-612-branch/LayoutTests/imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-has-expected.txt	                        (rev 0)
+++ branches/safari-612-branch/LayoutTests/imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-has-expected.txt	2021-09-16 18:48:24 UTC (rev 282573)
@@ -0,0 +1,3 @@
+
+PASS fontfaceset-has
+

Added: branches/safari-612-branch/LayoutTests/imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-has.html (0 => 282573)


--- branches/safari-612-branch/LayoutTests/imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-has.html	                        (rev 0)
+++ branches/safari-612-branch/LayoutTests/imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-has.html	2021-09-16 18:48:24 UTC (rev 282573)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head id="head">
+<meta charset="utf-8">
+<link rel="author" title="Myles C. Maxfield" href=""
+<link rel="help" href=""
+<meta name="assert" content="Ensure that calling FontFaceSet.has() works properly." />
+<script src=""
+<script src=""
+<style id="style">
+@font-face {
+    font-family: "WebFont";
+    src: url("resources/Rochester.otf") format("opentype");
+}
+</style>
+</head>
+<body>
+<script>
+test(function(t) {
+    let fonts = document.fonts;
+    let font = fonts.keys().next().value;
+    let font2 = new FontFace("WebFont2", "url('resources/GenR102.woff2') format('woff2')");
+    assert_true(fonts.has(font));
+    assert_false(fonts.has(font2));
+    fonts.add(font2);
+    assert_true(fonts.has(font));
+    assert_true(fonts.has(font2));
+    document.getElementById("head").removeChild(document.getElementById("style"));
+    assert_false(fonts.has(font));
+    assert_true(fonts.has(font2));
+    fonts.delete(font2);
+    assert_false(fonts.has(font));
+    assert_false(fonts.has(font2));
+});
+</script>
+</body>
+</html>

Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (282572 => 282573)


--- branches/safari-612-branch/Source/WebCore/ChangeLog	2021-09-16 18:48:20 UTC (rev 282572)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog	2021-09-16 18:48:24 UTC (rev 282573)
@@ -1,5 +1,59 @@
 2021-09-16  Russell Epstein  <[email protected]>
 
+        Cherry-pick r282204. rdar://problem/83183703
+
+    FontFaceSet.has() needs to react to style changes
+    https://bugs.webkit.org/show_bug.cgi?id=229848
+    
+    Reviewed by Antti Koivisto.
+    
+    LayoutTests/imported/w3c:
+    
+    This test was landed upstream in https://github.com/web-platform-tests/wpt/pull/30322
+    
+    * web-platform-tests/css/css-font-loading/fontfaceset-has-expected.txt: Added.
+    * web-platform-tests/css/css-font-loading/fontfaceset-has.html: Added.
+    
+    Source/WebCore:
+    
+    When content says "document.fonts.has(...)", the ".has(...)" 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.has(...) ... <=== This needs to reflect the style changes.
+    
+    Test: imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-has.html
+    
+    * css/FontFaceSet.cpp:
+    (WebCore::FontFaceSet::has const):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@282204 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-09-09  Myles C. Maxfield  <[email protected]>
+
+            FontFaceSet.has() needs to react to style changes
+            https://bugs.webkit.org/show_bug.cgi?id=229848
+
+            Reviewed by Antti Koivisto.
+
+            When content says "document.fonts.has(...)", the ".has(...)" 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.has(...) ... <=== This needs to reflect the style changes.
+
+            Test: imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-has.html
+
+            * css/FontFaceSet.cpp:
+            (WebCore::FontFaceSet::has const):
+
+2021-09-16  Russell Epstein  <[email protected]>
+
         Cherry-pick r282016. rdar://problem/83183608
 
     FontFaceSet.check() needs to react to style changes

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


--- branches/safari-612-branch/Source/WebCore/css/FontFaceSet.cpp	2021-09-16 18:48:20 UTC (rev 282572)
+++ branches/safari-612-branch/Source/WebCore/css/FontFaceSet.cpp	2021-09-16 18:48:24 UTC (rev 282573)
@@ -107,6 +107,8 @@
 
 bool FontFaceSet::has(FontFace& face) const
 {
+    if (face.backing().cssConnection())
+        m_backing->updateStyleIfNeeded();
     return m_backing->hasFace(face.backing());
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to