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

Unified Diff: Source/core/html/HTMLLinkElement.cpp

Issue 22573005: [HTML Imports] Implement "load" and "error" events. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: For landing Created 7 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 | « Source/core/html/HTMLLinkElement.h ('k') | Source/core/html/LinkImport.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLLinkElement.cpp
diff --git a/Source/core/html/HTMLLinkElement.cpp b/Source/core/html/HTMLLinkElement.cpp
index 33b5d0fba34d7831cfd8f4c6df5ff75935f3b9d6..de250def0215523557cfb1a7fc4b1ec07e51e1c9 100644
--- a/Source/core/html/HTMLLinkElement.cpp
+++ b/Source/core/html/HTMLLinkElement.cpp
@@ -288,13 +288,18 @@ void HTMLLinkElement::dispatchPendingLoadEvents()
void HTMLLinkElement::dispatchPendingEvent(LinkEventSender* eventSender)
{
ASSERT_UNUSED(eventSender, eventSender == &linkLoadEventSender());
- ASSERT(linkStyle());
- if (linkStyle()->hasLoadedSheet())
+ ASSERT(m_link);
+ if (m_link->hasLoaded())
linkLoaded();
else
linkLoadingErrored();
}
+void HTMLLinkElement::scheduleEvent()
+{
+ linkLoadEventSender().dispatchEventSoon(this);
+}
+
void HTMLLinkElement::startLoadingDynamicSheet()
{
ASSERT(linkStyle());
@@ -455,7 +460,8 @@ void LinkStyle::notifyLoadedSheetAndAllCriticalSubresources(bool errorOccurred)
if (m_firedLoad)
return;
m_loadedSheet = !errorOccurred;
- linkLoadEventSender().dispatchEventSoon(m_owner);
+ if (m_owner)
+ m_owner->scheduleEvent();
m_firedLoad = true;
}
« no previous file with comments | « Source/core/html/HTMLLinkElement.h ('k') | Source/core/html/LinkImport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698