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

Side by Side Diff: third_party/WebKit/Source/core/events/Event.cpp

Issue 1563623002: Support registering and dispatching passive event listeners. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjust comments in layout tests Created 4 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com)
3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
5 * Copyright (C) 2003, 2005, 2006, 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2005, 2006, 2008 Apple Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g, double platformTimeStamp) 47 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g, double platformTimeStamp)
48 : m_type(eventType) 48 : m_type(eventType)
49 , m_canBubble(canBubbleArg) 49 , m_canBubble(canBubbleArg)
50 , m_cancelable(cancelableArg) 50 , m_cancelable(cancelableArg)
51 , m_propagationStopped(false) 51 , m_propagationStopped(false)
52 , m_immediatePropagationStopped(false) 52 , m_immediatePropagationStopped(false)
53 , m_defaultPrevented(false) 53 , m_defaultPrevented(false)
54 , m_defaultHandled(false) 54 , m_defaultHandled(false)
55 , m_cancelBubble(false) 55 , m_cancelBubble(false)
56 , m_isTrusted(false) 56 , m_isTrusted(false)
57 , m_handlingPassive(false)
57 , m_eventPhase(0) 58 , m_eventPhase(0)
58 , m_currentTarget(nullptr) 59 , m_currentTarget(nullptr)
59 , m_createTime(convertSecondsToDOMTimeStamp(currentTime())) 60 , m_createTime(convertSecondsToDOMTimeStamp(currentTime()))
60 , m_platformTimeStamp(platformTimeStamp) 61 , m_platformTimeStamp(platformTimeStamp)
61 { 62 {
62 } 63 }
63 64
64 Event::Event(const AtomicString& eventType, const EventInit& initializer) 65 Event::Event(const AtomicString& eventType, const EventInit& initializer)
65 : Event(eventType, initializer.bubbles(), initializer.cancelable()) 66 : Event(eventType, initializer.bubbles(), initializer.cancelable())
66 { 67 {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 bool Event::isBeforeTextInsertedEvent() const 173 bool Event::isBeforeTextInsertedEvent() const
173 { 174 {
174 return false; 175 return false;
175 } 176 }
176 177
177 bool Event::isBeforeUnloadEvent() const 178 bool Event::isBeforeUnloadEvent() const
178 { 179 {
179 return false; 180 return false;
180 } 181 }
181 182
183 void Event::preventDefault()
184 {
185 if (m_handlingPassive) {
186 const LocalDOMWindow* window = m_currentTarget ? m_currentTarget->toDOMW indow() : 0;
187 if (window)
188 window->printErrorMessage("Unable to preventDefault inside passive e vent listener invocation.");
189 return;
190 }
191
192 if (m_cancelable)
193 m_defaultPrevented = true;
194 }
195
182 void Event::setTarget(PassRefPtrWillBeRawPtr<EventTarget> target) 196 void Event::setTarget(PassRefPtrWillBeRawPtr<EventTarget> target)
183 { 197 {
184 if (m_target == target) 198 if (m_target == target)
185 return; 199 return;
186 200
187 m_target = target; 201 m_target = target;
188 if (m_target) 202 if (m_target)
189 receivedTarget(); 203 receivedTarget();
190 } 204 }
191 205
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 297
284 DEFINE_TRACE(Event) 298 DEFINE_TRACE(Event)
285 { 299 {
286 visitor->trace(m_currentTarget); 300 visitor->trace(m_currentTarget);
287 visitor->trace(m_target); 301 visitor->trace(m_target);
288 visitor->trace(m_underlyingEvent); 302 visitor->trace(m_underlyingEvent);
289 visitor->trace(m_eventPath); 303 visitor->trace(m_eventPath);
290 } 304 }
291 305
292 } // namespace blink 306 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/Event.h ('k') | third_party/WebKit/Source/core/events/EventListenerOptions.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698