Index: third_party/WebKit/Source/core/dom/Document.cpp |
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp |
index 829e3b3faa55811409cef1770422e02e4a5a54e8..ca1ee1e1153cf75966e472cae99e65fc87446542 100644 |
--- a/third_party/WebKit/Source/core/dom/Document.cpp |
+++ b/third_party/WebKit/Source/core/dom/Document.cpp |
@@ -4593,7 +4593,8 @@ void Document::AddMutationEventListenerTypeIfEnabled( |
AddListenerType(listener_type); |
} |
-void Document::AddListenerTypeIfNeeded(const AtomicString& event_type) { |
+void Document::AddListenerTypeIfNeeded(const AtomicString& event_type, |
+ EventTarget& event_target) { |
if (event_type == EventTypeNames::DOMSubtreeModified) { |
UseCounter::Count(*this, UseCounter::kDOMSubtreeModifiedEvent); |
AddMutationEventListenerTypeIfEnabled(DOMSUBTREEMODIFIED_LISTENER); |
@@ -4630,6 +4631,15 @@ void Document::AddListenerTypeIfNeeded(const AtomicString& event_type) { |
AddListenerType(TRANSITIONEND_LISTENER); |
} else if (event_type == EventTypeNames::scroll) { |
AddListenerType(SCROLL_LISTENER); |
+ } else if (event_type == EventTypeNames::load) { |
+ if (Node* node = event_target.ToNode()) { |
+ if (isHTMLStyleElement(*node)) { |
+ AddListenerType(LOAD_LISTENER_AT_CAPTURE_PHASE_OR_AT_STYLE_ELEMENT); |
+ return; |
+ } |
+ } |
+ if (event_target.HasCapturingEventListeners(event_type)) |
+ AddListenerType(LOAD_LISTENER_AT_CAPTURE_PHASE_OR_AT_STYLE_ELEMENT); |
} |
} |