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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |