OLD | NEW |
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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 } | 218 } |
219 | 219 |
220 bool Event::isBeforeUnloadEvent() const | 220 bool Event::isBeforeUnloadEvent() const |
221 { | 221 { |
222 return false; | 222 return false; |
223 } | 223 } |
224 | 224 |
225 void Event::preventDefault() | 225 void Event::preventDefault() |
226 { | 226 { |
227 if (m_handlingPassive) { | 227 if (m_handlingPassive) { |
| 228 m_preventDefaultCalledDuringPassive = true; |
228 const LocalDOMWindow* window = m_eventPath ? m_eventPath->windowEventCon
text().window() : 0; | 229 const LocalDOMWindow* window = m_eventPath ? m_eventPath->windowEventCon
text().window() : 0; |
229 if (window) | 230 if (window) |
230 window->printErrorMessage("Unable to preventDefault inside passive e
vent listener invocation."); | 231 window->printErrorMessage("Unable to preventDefault inside passive e
vent listener invocation."); |
231 return; | 232 return; |
232 } | 233 } |
233 | 234 |
234 if (m_cancelable) | 235 if (m_cancelable) |
235 m_defaultPrevented = true; | 236 m_defaultPrevented = true; |
236 } | 237 } |
237 | 238 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 HeapVector<Member<EventTarget>> Event::path(ScriptState* scriptState) const | 271 HeapVector<Member<EventTarget>> Event::path(ScriptState* scriptState) const |
271 { | 272 { |
272 return pathInternal(scriptState, NonEmptyAfterDispatch); | 273 return pathInternal(scriptState, NonEmptyAfterDispatch); |
273 } | 274 } |
274 | 275 |
275 HeapVector<Member<EventTarget>> Event::composedPath(ScriptState* scriptState) co
nst | 276 HeapVector<Member<EventTarget>> Event::composedPath(ScriptState* scriptState) co
nst |
276 { | 277 { |
277 return pathInternal(scriptState, EmptyAfterDispatch); | 278 return pathInternal(scriptState, EmptyAfterDispatch); |
278 } | 279 } |
279 | 280 |
| 281 void Event::setHandlingPassive(bool value) |
| 282 { |
| 283 m_handlingPassive = value; |
| 284 m_preventDefaultCalledDuringPassive = false; |
| 285 } |
| 286 |
280 HeapVector<Member<EventTarget>> Event::pathInternal(ScriptState* scriptState, Ev
entPathMode mode) const | 287 HeapVector<Member<EventTarget>> Event::pathInternal(ScriptState* scriptState, Ev
entPathMode mode) const |
281 { | 288 { |
282 if (m_target) | 289 if (m_target) |
283 HostsUsingFeatures::countHostOrIsolatedWorldHumanReadableName(scriptStat
e, *m_target, HostsUsingFeatures::Feature::EventPath); | 290 HostsUsingFeatures::countHostOrIsolatedWorldHumanReadableName(scriptStat
e, *m_target, HostsUsingFeatures::Feature::EventPath); |
284 | 291 |
285 if (!m_currentTarget) { | 292 if (!m_currentTarget) { |
286 ASSERT(m_eventPhase == Event::NONE); | 293 ASSERT(m_eventPhase == Event::NONE); |
287 if (!m_eventPath) { | 294 if (!m_eventPath) { |
288 // Before dispatching the event | 295 // Before dispatching the event |
289 return HeapVector<Member<EventTarget>>(); | 296 return HeapVector<Member<EventTarget>>(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 | 367 |
361 DEFINE_TRACE(Event) | 368 DEFINE_TRACE(Event) |
362 { | 369 { |
363 visitor->trace(m_currentTarget); | 370 visitor->trace(m_currentTarget); |
364 visitor->trace(m_target); | 371 visitor->trace(m_target); |
365 visitor->trace(m_underlyingEvent); | 372 visitor->trace(m_underlyingEvent); |
366 visitor->trace(m_eventPath); | 373 visitor->trace(m_eventPath); |
367 } | 374 } |
368 | 375 |
369 } // namespace blink | 376 } // namespace blink |
OLD | NEW |