| 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. |
| 11 * | 11 * |
| 12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
| 16 * | 16 * |
| 17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
| 18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
| 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
| 21 */ | 21 */ |
| 22 | 22 |
| 23 #include "config.h" | 23 #include "config.h" |
| 24 #include "core/events/Event.h" | 24 #include "core/events/Event.h" |
| 25 | 25 |
| 26 #include "core/dom/StaticNodeList.h" | 26 #include "core/dom/StaticNodeList.h" |
| 27 #include "core/events/EventTarget.h" | 27 #include "core/events/EventTarget.h" |
| 28 #include "core/frame/UseCounter.h" |
| 28 #include "wtf/CurrentTime.h" | 29 #include "wtf/CurrentTime.h" |
| 29 | 30 |
| 30 namespace WebCore { | 31 namespace WebCore { |
| 31 | 32 |
| 32 EventInit::EventInit() | 33 EventInit::EventInit() |
| 33 : bubbles(false) | 34 : bubbles(false) |
| 34 , cancelable(false) | 35 , cancelable(false) |
| 35 { | 36 { |
| 36 } | 37 } |
| 37 | 38 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 95 |
| 95 m_propagationStopped = false; | 96 m_propagationStopped = false; |
| 96 m_immediatePropagationStopped = false; | 97 m_immediatePropagationStopped = false; |
| 97 m_defaultPrevented = false; | 98 m_defaultPrevented = false; |
| 98 | 99 |
| 99 m_type = eventTypeArg; | 100 m_type = eventTypeArg; |
| 100 m_canBubble = canBubbleArg; | 101 m_canBubble = canBubbleArg; |
| 101 m_cancelable = cancelableArg; | 102 m_cancelable = cancelableArg; |
| 102 } | 103 } |
| 103 | 104 |
| 105 bool Event::legacyReturnValue(ExecutionContext* executionContext) const |
| 106 { |
| 107 bool returnValue = !defaultPrevented(); |
| 108 if (returnValue) |
| 109 UseCounter::count(executionContext, UseCounter::EventGetReturnValueTrue)
; |
| 110 else |
| 111 UseCounter::count(executionContext, UseCounter::EventGetReturnValueFalse
); |
| 112 return returnValue; |
| 113 } |
| 114 |
| 115 void Event::setLegacyReturnValue(ExecutionContext* executionContext, bool return
Value) |
| 116 { |
| 117 if (returnValue) |
| 118 UseCounter::count(executionContext, UseCounter::EventSetReturnValueTrue)
; |
| 119 else |
| 120 UseCounter::count(executionContext, UseCounter::EventSetReturnValueFalse
); |
| 121 setDefaultPrevented(!returnValue); |
| 122 } |
| 123 |
| 104 const AtomicString& Event::interfaceName() const | 124 const AtomicString& Event::interfaceName() const |
| 105 { | 125 { |
| 106 return EventNames::Event; | 126 return EventNames::Event; |
| 107 } | 127 } |
| 108 | 128 |
| 109 bool Event::hasInterface(const AtomicString& name) const | 129 bool Event::hasInterface(const AtomicString& name) const |
| 110 { | 130 { |
| 111 return interfaceName() == name; | 131 return interfaceName() == name; |
| 112 } | 132 } |
| 113 | 133 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 return StaticNodeList::createEmpty(); | 233 return StaticNodeList::createEmpty(); |
| 214 } | 234 } |
| 215 | 235 |
| 216 void Event::trace(Visitor* visitor) | 236 void Event::trace(Visitor* visitor) |
| 217 { | 237 { |
| 218 visitor->trace(m_underlyingEvent); | 238 visitor->trace(m_underlyingEvent); |
| 219 visitor->trace(m_eventPath); | 239 visitor->trace(m_eventPath); |
| 220 } | 240 } |
| 221 | 241 |
| 222 } // namespace WebCore | 242 } // namespace WebCore |
| OLD | NEW |