| 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 if (e == this) | 196 if (e == this) |
| 197 return; | 197 return; |
| 198 m_underlyingEvent = ue; | 198 m_underlyingEvent = ue; |
| 199 } | 199 } |
| 200 | 200 |
| 201 void Event::initEventPath(Node& node) | 201 void Event::initEventPath(Node& node) |
| 202 { | 202 { |
| 203 m_eventPath = adoptPtrWillBeNoop(new EventPath(node, this)); | 203 m_eventPath = adoptPtrWillBeNoop(new EventPath(node, this)); |
| 204 } | 204 } |
| 205 | 205 |
| 206 WillBeHeapVector<RefPtrWillBeRawPtr<EventTarget>> Event::path() const | 206 WillBeHeapVector<RefPtrWillBeMember<EventTarget>> Event::path() const |
| 207 { | 207 { |
| 208 if (!m_currentTarget) { | 208 if (!m_currentTarget) { |
| 209 ASSERT(m_eventPhase == Event::NONE); | 209 ASSERT(m_eventPhase == Event::NONE); |
| 210 if (!m_eventPath) { | 210 if (!m_eventPath) { |
| 211 // Before dispatching the event | 211 // Before dispatching the event |
| 212 return WillBeHeapVector<RefPtrWillBeRawPtr<EventTarget>>(); | 212 return WillBeHeapVector<RefPtrWillBeMember<EventTarget>>(); |
| 213 } | 213 } |
| 214 ASSERT(!m_eventPath->isEmpty()); | 214 ASSERT(!m_eventPath->isEmpty()); |
| 215 // After dispatching the event | 215 // After dispatching the event |
| 216 return m_eventPath->last().treeScopeEventContext().ensureEventPath(*m_ev
entPath); | 216 return m_eventPath->last().treeScopeEventContext().ensureEventPath(*m_ev
entPath); |
| 217 } | 217 } |
| 218 | 218 |
| 219 if (Node* node = m_currentTarget->toNode()) { | 219 if (Node* node = m_currentTarget->toNode()) { |
| 220 ASSERT(m_eventPath); | 220 ASSERT(m_eventPath); |
| 221 size_t eventPathSize = m_eventPath->size(); | 221 size_t eventPathSize = m_eventPath->size(); |
| 222 for (size_t i = 0; i < eventPathSize; ++i) { | 222 for (size_t i = 0; i < eventPathSize; ++i) { |
| 223 if (node == (*m_eventPath)[i].node()) { | 223 if (node == (*m_eventPath)[i].node()) { |
| 224 return (*m_eventPath)[i].treeScopeEventContext().ensureEventPath
(*m_eventPath); | 224 return (*m_eventPath)[i].treeScopeEventContext().ensureEventPath
(*m_eventPath); |
| 225 } | 225 } |
| 226 } | 226 } |
| 227 ASSERT_NOT_REACHED(); | 227 ASSERT_NOT_REACHED(); |
| 228 } | 228 } |
| 229 | 229 |
| 230 // Returns [window] for events that are directly dispatched to the window ob
ject; | 230 // Returns [window] for events that are directly dispatched to the window ob
ject; |
| 231 // e.g., window.load, pageshow, etc. | 231 // e.g., window.load, pageshow, etc. |
| 232 if (LocalDOMWindow* window = m_currentTarget->toDOMWindow()) | 232 if (LocalDOMWindow* window = m_currentTarget->toDOMWindow()) |
| 233 return WillBeHeapVector<RefPtrWillBeRawPtr<EventTarget>>(1, window); | 233 return WillBeHeapVector<RefPtrWillBeMember<EventTarget>>(1, window); |
| 234 | 234 |
| 235 return WillBeHeapVector<RefPtrWillBeRawPtr<EventTarget>>(); | 235 return WillBeHeapVector<RefPtrWillBeMember<EventTarget>>(); |
| 236 } | 236 } |
| 237 | 237 |
| 238 EventTarget* Event::currentTarget() const | 238 EventTarget* Event::currentTarget() const |
| 239 { | 239 { |
| 240 if (!m_currentTarget) | 240 if (!m_currentTarget) |
| 241 return 0; | 241 return 0; |
| 242 Node* node = m_currentTarget->toNode(); | 242 Node* node = m_currentTarget->toNode(); |
| 243 if (node && node->isSVGElement()) { | 243 if (node && node->isSVGElement()) { |
| 244 if (SVGElement* svgElement = toSVGElement(node)->correspondingElement()) | 244 if (SVGElement* svgElement = toSVGElement(node)->correspondingElement()) |
| 245 return svgElement; | 245 return svgElement; |
| 246 } | 246 } |
| 247 return m_currentTarget.get(); | 247 return m_currentTarget.get(); |
| 248 } | 248 } |
| 249 | 249 |
| 250 void Event::trace(Visitor* visitor) | 250 void Event::trace(Visitor* visitor) |
| 251 { | 251 { |
| 252 visitor->trace(m_currentTarget); | 252 visitor->trace(m_currentTarget); |
| 253 visitor->trace(m_target); | 253 visitor->trace(m_target); |
| 254 visitor->trace(m_underlyingEvent); | 254 visitor->trace(m_underlyingEvent); |
| 255 visitor->trace(m_eventPath); | 255 visitor->trace(m_eventPath); |
| 256 } | 256 } |
| 257 | 257 |
| 258 } // namespace blink | 258 } // namespace blink |
| OLD | NEW |