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

Log Message

Cherry-pick r282261. rdar://problem/83183323

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

    Reviewed by Antti Koivisto.

    LayoutTests/imported/w3c:

    This test is being upstreamed in https://github.com/web-platform-tests/wpt/pull/30491

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

    Source/WebCore:

    If content does something like
    let fonts = document.fonts;
    ... modify style sheets ...
    fonts.load(...)

    The load() function needs to see the result of hte style sheet modification.

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

    * css/FontFaceSet.cpp:
    (WebCore::FontFaceSet::load):

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

Modified Paths

Added Paths

Diff

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


--- branches/safari-612-branch/LayoutTests/imported/w3c/ChangeLog	2021-09-16 18:48:27 UTC (rev 282574)
+++ branches/safari-612-branch/LayoutTests/imported/w3c/ChangeLog	2021-09-16 18:48:31 UTC (rev 282575)
@@ -1,5 +1,49 @@
 2021-09-16  Russell Epstein  <[email protected]>
 
+        Cherry-pick r282261. rdar://problem/83183323
+
+    FontFaceSet.load() needs to react to style changes
+    https://bugs.webkit.org/show_bug.cgi?id=230132
+    
+    Reviewed by Antti Koivisto.
+    
+    LayoutTests/imported/w3c:
+    
+    This test is being upstreamed in https://github.com/web-platform-tests/wpt/pull/30491
+    
+    * web-platform-tests/css/css-font-loading/fontfaceset-load-css-connected-expected.txt: Added.
+    * web-platform-tests/css/css-font-loading/fontfaceset-load-css-connected.html: Added.
+    
+    Source/WebCore:
+    
+    If content does something like
+    let fonts = document.fonts;
+    ... modify style sheets ...
+    fonts.load(...)
+    
+    The load() function needs to see the result of hte style sheet modification.
+    
+    Test: imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-load-css-connected.html
+    
+    * css/FontFaceSet.cpp:
+    (WebCore::FontFaceSet::load):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@282261 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-09-09  Myles C. Maxfield  <[email protected]>
+
+            FontFaceSet.load() needs to react to style changes
+            https://bugs.webkit.org/show_bug.cgi?id=230132
+
+            Reviewed by Antti Koivisto.
+
+            This test is being upstreamed in https://github.com/web-platform-tests/wpt/pull/30491
+
+            * web-platform-tests/css/css-font-loading/fontfaceset-load-css-connected-expected.txt: Added.
+            * web-platform-tests/css/css-font-loading/fontfaceset-load-css-connected.html: Added.
+
+2021-09-16  Russell Epstein  <[email protected]>
+
         Cherry-pick r282204. rdar://problem/83183703
 
     FontFaceSet.has() needs to react to style changes

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


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

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


--- branches/safari-612-branch/LayoutTests/imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-load-css-connected.html	                        (rev 0)
+++ branches/safari-612-branch/LayoutTests/imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-load-css-connected.html	2021-09-16 18:48:31 UTC (rev 282575)
@@ -0,0 +1,27 @@
+<!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.load() operates on the up-to-date @font-face blocks." />
+<script src=""
+<script src=""
+<style id="style">
+@font-face {
+    font-family: "WebFont";
+    src: url("resources/Rochester.otf") format("opentype");
+}
+</style>
+</head>
+<body>
+<script>
+promise_test(async function(t) {
+    let fonts = document.fonts;
+    document.getElementById("head").removeChild(document.getElementById("style"));
+    let result = await fonts.load("12px 'WebFont'");
+    assert_equals(result.length, 0);
+});
+</script>
+</body>
+</html>

Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (282574 => 282575)


--- branches/safari-612-branch/Source/WebCore/ChangeLog	2021-09-16 18:48:27 UTC (rev 282574)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog	2021-09-16 18:48:31 UTC (rev 282575)
@@ -1,5 +1,56 @@
 2021-09-16  Russell Epstein  <[email protected]>
 
+        Cherry-pick r282261. rdar://problem/83183323
+
+    FontFaceSet.load() needs to react to style changes
+    https://bugs.webkit.org/show_bug.cgi?id=230132
+    
+    Reviewed by Antti Koivisto.
+    
+    LayoutTests/imported/w3c:
+    
+    This test is being upstreamed in https://github.com/web-platform-tests/wpt/pull/30491
+    
+    * web-platform-tests/css/css-font-loading/fontfaceset-load-css-connected-expected.txt: Added.
+    * web-platform-tests/css/css-font-loading/fontfaceset-load-css-connected.html: Added.
+    
+    Source/WebCore:
+    
+    If content does something like
+    let fonts = document.fonts;
+    ... modify style sheets ...
+    fonts.load(...)
+    
+    The load() function needs to see the result of hte style sheet modification.
+    
+    Test: imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-load-css-connected.html
+    
+    * css/FontFaceSet.cpp:
+    (WebCore::FontFaceSet::load):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@282261 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-09-09  Myles C. Maxfield  <[email protected]>
+
+            FontFaceSet.load() needs to react to style changes
+            https://bugs.webkit.org/show_bug.cgi?id=230132
+
+            Reviewed by Antti Koivisto.
+
+            If content does something like
+            let fonts = document.fonts;
+            ... modify style sheets ...
+            fonts.load(...)
+
+            The load() function needs to see the result of hte style sheet modification.
+
+            Test: imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-load-css-connected.html
+
+            * css/FontFaceSet.cpp:
+            (WebCore::FontFaceSet::load):
+
+2021-09-16  Russell Epstein  <[email protected]>
+
         Cherry-pick r282204. rdar://problem/83183703
 
     FontFaceSet.has() needs to react to style changes

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


--- branches/safari-612-branch/Source/WebCore/css/FontFaceSet.cpp	2021-09-16 18:48:27 UTC (rev 282574)
+++ branches/safari-612-branch/Source/WebCore/css/FontFaceSet.cpp	2021-09-16 18:48:31 UTC (rev 282575)
@@ -140,6 +140,7 @@
 
 void FontFaceSet::load(const String& font, const String& text, LoadPromise&& promise)
 {
+    m_backing->updateStyleIfNeeded();
     auto matchingFacesResult = m_backing->matchingFacesExcludingPreinstalledFonts(font, text);
     if (matchingFacesResult.hasException()) {
         promise.reject(matchingFacesResult.releaseException());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to