Title: [202945] trunk
- Revision
- 202945
- Author
- [email protected]
- Date
- 2016-07-07 16:34:09 -0700 (Thu, 07 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:
* 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 (202944 => 202945)
--- trunk/LayoutTests/ChangeLog 2016-07-07 23:26:28 UTC (rev 202944)
+++ trunk/LayoutTests/ChangeLog 2016-07-07 23:34:09 UTC (rev 202945)
@@ -1,3 +1,13 @@
+2016-07-07 Myles C. Maxfield <[email protected]> and Frédéric Wang <[email protected]>
+
+ [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.
+
+ * fast/text/font-face-set-ready-fire-expected.txt: Added.
+ * fast/text/font-face-set-ready-fire.html: Added.
+
2016-07-07 Andy Estes <[email protected]>
[Content Filtering] Load blocked pages more like other error pages are loaded
Added: trunk/LayoutTests/fast/text/font-face-set-ready-fire-expected.txt (0 => 202945)
--- 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-07 23:34:09 UTC (rev 202945)
@@ -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
+
Added: trunk/LayoutTests/fast/text/font-face-set-ready-fire.html (0 => 202945)
--- trunk/LayoutTests/fast/text/font-face-set-ready-fire.html (rev 0)
+++ trunk/LayoutTests/fast/text/font-face-set-ready-fire.html 2016-07-07 23:34:09 UTC (rev 202945)
@@ -0,0 +1,35 @@
+<!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.")
+
+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 (202944 => 202945)
--- trunk/Source/WebCore/ChangeLog 2016-07-07 23:26:28 UTC (rev 202944)
+++ trunk/Source/WebCore/ChangeLog 2016-07-07 23:34:09 UTC (rev 202945)
@@ -1,3 +1,18 @@
+2016-07-07 Myles C. Maxfield <[email protected]> and Frédéric Wang <[email protected]>
+
+ [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-07 Andy Estes <[email protected]>
[Content Filtering] Load blocked pages more like other error pages are loaded
Modified: trunk/Source/WebCore/css/FontFaceSet.cpp (202944 => 202945)
--- trunk/Source/WebCore/css/FontFaceSet.cpp 2016-07-07 23:26:28 UTC (rev 202944)
+++ trunk/Source/WebCore/css/FontFaceSet.cpp 2016-07-07 23:34:09 UTC (rev 202945)
@@ -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 (202944 => 202945)
--- trunk/Source/WebCore/css/FontFaceSet.h 2016-07-07 23:26:28 UTC (rev 202944)
+++ trunk/Source/WebCore/css/FontFaceSet.h 2016-07-07 23:34:09 UTC (rev 202945)
@@ -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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes