Title: [203002] trunk
Revision
203002
Author
mmaxfi...@apple.com
Date
2016-07-08 12:40:20 -0700 (Fri, 08 Jul 2016)

Log Message

[Font Loading] The callback passed to document.fonts.ready should always be called
https://bugs.webkit.org/show_bug.cgi?id=158884

Reviewed by Dean Jackson.

Source/WebCore:

The boolean was simply not being reset when loads start.

Test: fast/text/font-face-set-ready-fire.html

* css/FontFaceSet.cpp:
(WebCore::FontFaceSet::startedLoading):
* css/FontFaceSet.h:

LayoutTests:

* TestExpectations:
* fast/text/font-face-set-ready-fire-expected.txt: Added.
* fast/text/font-face-set-ready-fire.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (203001 => 203002)


--- trunk/LayoutTests/ChangeLog	2016-07-08 19:01:05 UTC (rev 203001)
+++ trunk/LayoutTests/ChangeLog	2016-07-08 19:40:20 UTC (rev 203002)
@@ -1,3 +1,14 @@
+2016-07-08  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [Font Loading] The callback passed to document.fonts.ready should always be called
+        https://bugs.webkit.org/show_bug.cgi?id=158884
+
+        Reviewed by Dean Jackson.
+
+        * TestExpectations:
+        * fast/text/font-face-set-ready-fire-expected.txt: Added.
+        * fast/text/font-face-set-ready-fire.html: Added.
+
 2016-07-08  Ryan Haddad  <ryanhad...@apple.com>
 
         Rebaseline fast/shadow-dom/trusted-event-scoped-flags.html for ios-simulator after r202953.

Modified: trunk/LayoutTests/TestExpectations (203001 => 203002)


--- trunk/LayoutTests/TestExpectations	2016-07-08 19:01:05 UTC (rev 203001)
+++ trunk/LayoutTests/TestExpectations	2016-07-08 19:40:20 UTC (rev 203002)
@@ -984,10 +984,3 @@
 webkit.org/b/159370 [ Debug ] fast/history/page-cache-destroy-document.html [ Skip ]
 
 [ Debug ] js/regress/misc-bugs-847389-jpeg2000.html [ Skip ]
-
-# These tests time out due to https://bugs.webkit.org/show_bug.cgi?id=158884
-imported/mathml-in-html5/mathml/presentation-markup/fractions/frac-parameters-1.html [ Timeout ]
-imported/mathml-in-html5/mathml/presentation-markup/operators/mo-axis-height-1.html [ Timeout ]
-imported/mathml-in-html5/mathml/presentation-markup/radicals/root-parameters-1.html [ Timeout ]
-imported/mathml-in-html5/mathml/presentation-markup/tables/table-axis-height.html [ Timeout ]
-imported/mathml-in-html5/mathml/relations/css-styling/displaystyle-1.html [ Timeout ]

Added: trunk/LayoutTests/fast/text/font-face-set-ready-fire-expected.txt (0 => 203002)


--- trunk/LayoutTests/fast/text/font-face-set-ready-fire-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/text/font-face-set-ready-fire-expected.txt	2016-07-08 19:40:20 UTC (rev 203002)
@@ -0,0 +1,11 @@
+This test makes sure that document.fonts.ready always triggers its promise when there are no loads.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.fonts.status is "loaded"
+PASS document.fonts.status is "loading"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/fast/text/font-face-set-ready-fire-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/font-face-set-ready-fire.html (0 => 203002)


--- trunk/LayoutTests/fast/text/font-face-set-ready-fire.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/font-face-set-ready-fire.html	2016-07-08 19:40:20 UTC (rev 203002)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+self.jsTestIsAsync = true;
+description("This test makes sure that document.fonts.ready always triggers its promise when there are no loads.")
+if (window.internals)
+    internals.clearMemoryCache();
+
+var counter = 0;
+function bumpCounter() {
+    counter = counter + 1;
+    if (counter == 4)
+        finishJSTest();
+}
+function failure() {
+    testFailed("Promise should not fail.");
+}
+
+document.fonts.ready.then(bumpCounter);
+window.addEventListener("DOMContentLoaded", function() {
+    document.fonts.ready.then(bumpCounter, failure);
+});
+window.addEventListener("load", function() {
+    document.fonts.ready.then(bumpCounter, failure);
+});
+shouldBeEqualToString("document.fonts.status", "loaded");
+document.fonts.add(new FontFace("WebFont", "url('../../resources/Ahem.ttf') format('truetype')", {}));
+document.fonts.load("14px WebFont").then(bumpCounter, failure);
+shouldBeEqualToString("document.fonts.status", "loading");
+</script>
+</head>
+<body>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (203001 => 203002)


--- trunk/Source/WebCore/ChangeLog	2016-07-08 19:01:05 UTC (rev 203001)
+++ trunk/Source/WebCore/ChangeLog	2016-07-08 19:40:20 UTC (rev 203002)
@@ -1,3 +1,18 @@
+2016-07-08  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [Font Loading] The callback passed to document.fonts.ready should always be called
+        https://bugs.webkit.org/show_bug.cgi?id=158884
+
+        Reviewed by Dean Jackson.
+
+        The boolean was simply not being reset when loads start.
+
+        Test: fast/text/font-face-set-ready-fire.html
+
+        * css/FontFaceSet.cpp:
+        (WebCore::FontFaceSet::startedLoading):
+        * css/FontFaceSet.h:
+
 2016-07-08  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r202944.

Modified: trunk/Source/WebCore/css/FontFaceSet.cpp (203001 => 203002)


--- trunk/Source/WebCore/css/FontFaceSet.cpp	2016-07-08 19:01:05 UTC (rev 203001)
+++ trunk/Source/WebCore/css/FontFaceSet.cpp	2016-07-08 19:40:20 UTC (rev 203002)
@@ -197,6 +197,7 @@
 void FontFaceSet::startedLoading()
 {
     // FIXME: Fire a "loading" event asynchronously.
+    m_isReady = false;
 }
 
 void FontFaceSet::completedLoading()

Modified: trunk/Source/WebCore/css/FontFaceSet.h (203001 => 203002)


--- trunk/Source/WebCore/css/FontFaceSet.h	2016-07-08 19:01:05 UTC (rev 203001)
+++ trunk/Source/WebCore/css/FontFaceSet.h	2016-07-08 19:40:20 UTC (rev 203002)
@@ -111,7 +111,7 @@
     Ref<CSSFontFaceSet> m_backing;
     HashMap<RefPtr<CSSFontFace>, Vector<Ref<PendingPromise>>> m_pendingPromises;
     Optional<ReadyPromise> m_promise;
-    bool m_isReady { false };
+    bool m_isReady { true };
 };
 
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to