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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLLinkElement.h ('k') | Source/core/html/LinkImport.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
6 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com) 6 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com)
7 * Copyright (C) 2011 Google Inc. All rights reserved. 7 * Copyright (C) 2011 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 } 281 }
282 282
283 void HTMLLinkElement::dispatchPendingLoadEvents() 283 void HTMLLinkElement::dispatchPendingLoadEvents()
284 { 284 {
285 linkLoadEventSender().dispatchPendingEvents(); 285 linkLoadEventSender().dispatchPendingEvents();
286 } 286 }
287 287
288 void HTMLLinkElement::dispatchPendingEvent(LinkEventSender* eventSender) 288 void HTMLLinkElement::dispatchPendingEvent(LinkEventSender* eventSender)
289 { 289 {
290 ASSERT_UNUSED(eventSender, eventSender == &linkLoadEventSender()); 290 ASSERT_UNUSED(eventSender, eventSender == &linkLoadEventSender());
291 ASSERT(linkStyle()); 291 ASSERT(m_link);
292 if (linkStyle()->hasLoadedSheet()) 292 if (m_link->hasLoaded())
293 linkLoaded(); 293 linkLoaded();
294 else 294 else
295 linkLoadingErrored(); 295 linkLoadingErrored();
296 } 296 }
297 297
298 void HTMLLinkElement::scheduleEvent()
299 {
300 linkLoadEventSender().dispatchEventSoon(this);
301 }
302
298 void HTMLLinkElement::startLoadingDynamicSheet() 303 void HTMLLinkElement::startLoadingDynamicSheet()
299 { 304 {
300 ASSERT(linkStyle()); 305 ASSERT(linkStyle());
301 linkStyle()->startLoadingDynamicSheet(); 306 linkStyle()->startLoadingDynamicSheet();
302 } 307 }
303 308
304 bool HTMLLinkElement::isURLAttribute(const Attribute& attribute) const 309 bool HTMLLinkElement::isURLAttribute(const Attribute& attribute) const
305 { 310 {
306 return attribute.name().localName() == hrefAttr || HTMLElement::isURLAttribu te(attribute); 311 return attribute.name().localName() == hrefAttr || HTMLElement::isURLAttribu te(attribute);
307 } 312 }
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 return true; 453 return true;
449 } 454 }
450 return false; 455 return false;
451 } 456 }
452 457
453 void LinkStyle::notifyLoadedSheetAndAllCriticalSubresources(bool errorOccurred) 458 void LinkStyle::notifyLoadedSheetAndAllCriticalSubresources(bool errorOccurred)
454 { 459 {
455 if (m_firedLoad) 460 if (m_firedLoad)
456 return; 461 return;
457 m_loadedSheet = !errorOccurred; 462 m_loadedSheet = !errorOccurred;
458 linkLoadEventSender().dispatchEventSoon(m_owner); 463 if (m_owner)
464 m_owner->scheduleEvent();
459 m_firedLoad = true; 465 m_firedLoad = true;
460 } 466 }
461 467
462 void LinkStyle::startLoadingDynamicSheet() 468 void LinkStyle::startLoadingDynamicSheet()
463 { 469 {
464 ASSERT(m_pendingSheetType < Blocking); 470 ASSERT(m_pendingSheetType < Blocking);
465 addPendingSheet(Blocking); 471 addPendingSheet(Blocking);
466 } 472 }
467 473
468 void LinkStyle::clearSheet() 474 void LinkStyle::clearSheet()
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 void LinkStyle::ownerRemoved() 639 void LinkStyle::ownerRemoved()
634 { 640 {
635 if (m_sheet) 641 if (m_sheet)
636 clearSheet(); 642 clearSheet();
637 643
638 if (styleSheetIsLoading()) 644 if (styleSheetIsLoading())
639 removePendingSheet(RemovePendingSheetNotifyLater); 645 removePendingSheet(RemovePendingSheetNotifyLater);
640 } 646 }
641 647
642 } // namespace WebCore 648 } // namespace WebCore
OLDNEW
« 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