Index: third_party/WebKit/Source/core/events/Event.cpp |
diff --git a/third_party/WebKit/Source/core/events/Event.cpp b/third_party/WebKit/Source/core/events/Event.cpp |
index 9f09da20a324bab98a8f138c413bd6dbb14a4328..1b2daab043a2a7a1fcdf81159dcaf9ef8ca4989c 100644 |
--- a/third_party/WebKit/Source/core/events/Event.cpp |
+++ b/third_party/WebKit/Source/core/events/Event.cpp |
@@ -54,6 +54,7 @@ Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr |
, m_defaultHandled(false) |
, m_cancelBubble(false) |
, m_isTrusted(false) |
+ , m_handlingPassive(false) |
, m_eventPhase(0) |
, m_currentTarget(nullptr) |
, m_createTime(convertSecondsToDOMTimeStamp(currentTime())) |
@@ -179,6 +180,19 @@ bool Event::isBeforeUnloadEvent() const |
return false; |
} |
+void Event::preventDefault() |
+{ |
+ if (m_handlingPassive) { |
+ const LocalDOMWindow* window = m_currentTarget ? m_currentTarget->toDOMWindow() : 0; |
+ if (window) |
+ window->printErrorMessage("Unable to preventDefault inside passive event listener invocation."); |
+ return; |
+ } |
+ |
+ if (m_cancelable) |
+ m_defaultPrevented = true; |
+} |
+ |
void Event::setTarget(PassRefPtrWillBeRawPtr<EventTarget> target) |
{ |
if (m_target == target) |