Index: third_party/WebKit/Source/core/html/HTMLStyleElement.cpp |
diff --git a/third_party/WebKit/Source/core/html/HTMLStyleElement.cpp b/third_party/WebKit/Source/core/html/HTMLStyleElement.cpp |
index a62e1e9c417e23705102dd17553a32bf94a60870..d3b1f7f60e7d91a49bc874ca05ee8f9b2a3de1bc 100644 |
--- a/third_party/WebKit/Source/core/html/HTMLStyleElement.cpp |
+++ b/third_party/WebKit/Source/core/html/HTMLStyleElement.cpp |
@@ -27,20 +27,14 @@ |
#include "core/css/MediaList.h" |
#include "core/dom/Document.h" |
#include "core/dom/StyleEngine.h" |
+#include "core/dom/TaskRunnerHelper.h" |
#include "core/dom/shadow/ShadowRoot.h" |
#include "core/events/Event.h" |
-#include "core/events/EventSender.h" |
namespace blink { |
using namespace HTMLNames; |
-static StyleEventSender& styleLoadEventSender() { |
- DEFINE_STATIC_LOCAL(StyleEventSender, sharedLoadEventSender, |
- (StyleEventSender::create(EventTypeNames::load))); |
- return sharedLoadEventSender; |
-} |
- |
inline HTMLStyleElement::HTMLStyleElement(Document& document, |
bool createdByParser) |
: HTMLElement(styleTag, document), |
@@ -113,12 +107,8 @@ const AtomicString& HTMLStyleElement::type() const { |
return getAttribute(typeAttr); |
} |
-void HTMLStyleElement::dispatchPendingLoadEvents() { |
- styleLoadEventSender().dispatchPendingEvents(); |
-} |
- |
-void HTMLStyleElement::dispatchPendingEvent(StyleEventSender* eventSender) { |
- DCHECK_EQ(eventSender, &styleLoadEventSender()); |
+void HTMLStyleElement::dispatchPendingEvent( |
+ std::unique_ptr<IncrementLoadEventDelayCount>) { |
dispatchEvent(Event::create(m_loadedSheet ? EventTypeNames::load |
: EventTypeNames::error)); |
} |
@@ -129,7 +119,12 @@ void HTMLStyleElement::notifyLoadedSheetAndAllCriticalSubresources( |
if (m_firedLoad && isLoadEvent) |
return; |
m_loadedSheet = isLoadEvent; |
- styleLoadEventSender().dispatchEventSoon(this); |
+ TaskRunnerHelper::get(TaskType::DOMManipulation, &document()) |
+ ->postTask( |
+ BLINK_FROM_HERE, |
+ WTF::bind(&HTMLStyleElement::dispatchPendingEvent, |
+ wrapPersistent(this), |
+ passed(IncrementLoadEventDelayCount::create(document())))); |
m_firedLoad = true; |
} |