Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(567)

Unified Diff: Source/core/css/FontLoader.cpp

Issue 457273002: Webfonts should not block load event for more than one frame (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/css/resources/ahem.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/FontLoader.cpp
diff --git a/Source/core/css/FontLoader.cpp b/Source/core/css/FontLoader.cpp
index 8646bfac6081351779dfab144ff835b6477edbc5..fda6bdc21dbbb48e38a0669eda03499b9f2bf03f 100644
--- a/Source/core/css/FontLoader.cpp
+++ b/Source/core/css/FontLoader.cpp
@@ -6,6 +6,7 @@
#include "core/css/FontLoader.h"
#include "core/css/CSSFontSelector.h"
+#include "core/dom/Document.h"
#include "core/fetch/FontResource.h"
#include "core/fetch/ResourceFetcher.h"
@@ -53,11 +54,26 @@ void FontLoader::loadPendingFonts()
{
ASSERT(m_resourceFetcher);
+ if (m_fontsToBeginLoading.isEmpty())
+ return;
+
FontsToLoadVector fontsToBeginLoading;
fontsToBeginLoading.swap(m_fontsToBeginLoading);
+ bool loaded = false;
for (FontsToLoadVector::iterator it = fontsToBeginLoading.begin(); it != fontsToBeginLoading.end(); ++it) {
FontResource* fontResource = it->first.get();
- fontResource->beginLoadIfNeeded(m_resourceFetcher);
+ if (fontResource->stillNeedsLoad()) {
+ fontResource->beginLoadIfNeeded(m_resourceFetcher);
+ loaded = true;
+ }
+ }
+
+ if (!loaded) {
+ // Since we have prevented load event by RequestCountTracker but did not
+ // start any load, schedule a check for load event here.
+ Document* document = m_resourceFetcher->document();
+ if (document && !document->loadEventFinished() && !document->isDelayingLoadEvent())
+ document->checkLoadEventSoon();
Nate Chapin 2014/08/11 22:06:15 Do we need to block the load event on webfonts in
Kunihiko Sakamoto 2014/08/12 03:12:09 It worked this way for years and I think many webs
}
// When the local fontsToBeginLoading vector goes out of scope it will
« no previous file with comments | « LayoutTests/fast/css/resources/ahem.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698