| 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 "core/events/Event.h" | 23 #include "core/events/Event.h" |
| 24 | 24 |
| 25 #include "bindings/core/v8/ScriptState.h" |
| 25 #include "core/dom/StaticNodeList.h" | 26 #include "core/dom/StaticNodeList.h" |
| 26 #include "core/events/EventDispatchMediator.h" | 27 #include "core/events/EventDispatchMediator.h" |
| 27 #include "core/events/EventTarget.h" | 28 #include "core/events/EventTarget.h" |
| 28 #include "core/frame/HostsUsingFeatures.h" | 29 #include "core/frame/HostsUsingFeatures.h" |
| 29 #include "core/frame/UseCounter.h" | 30 #include "core/frame/UseCounter.h" |
| 30 #include "core/svg/SVGElement.h" | 31 #include "core/svg/SVGElement.h" |
| 31 #include "core/timing/DOMWindowPerformance.h" | 32 #include "core/timing/DOMWindowPerformance.h" |
| 32 #include "core/timing/Performance.h" | 33 #include "core/timing/Performance.h" |
| 33 | 34 |
| 34 namespace blink { | 35 namespace blink { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 m_immediatePropagationStopped = false; | 128 m_immediatePropagationStopped = false; |
| 128 m_defaultPrevented = false; | 129 m_defaultPrevented = false; |
| 129 m_isTrusted = false; | 130 m_isTrusted = false; |
| 130 m_preventDefaultCalledOnUncancelableEvent = false; | 131 m_preventDefaultCalledOnUncancelableEvent = false; |
| 131 | 132 |
| 132 m_type = eventTypeArg; | 133 m_type = eventTypeArg; |
| 133 m_canBubble = canBubbleArg; | 134 m_canBubble = canBubbleArg; |
| 134 m_cancelable = cancelableArg; | 135 m_cancelable = cancelableArg; |
| 135 } | 136 } |
| 136 | 137 |
| 137 bool Event::legacyReturnValue(ExecutionContext* executionContext) const { | 138 bool Event::legacyReturnValue(ScriptState* scriptState) const { |
| 138 bool returnValue = !defaultPrevented(); | 139 bool returnValue = !defaultPrevented(); |
| 139 if (returnValue) | 140 if (returnValue) { |
| 140 UseCounter::count(executionContext, UseCounter::EventGetReturnValueTrue); | 141 UseCounter::count(scriptState->getExecutionContext(), |
| 141 else | 142 UseCounter::EventGetReturnValueTrue); |
| 142 UseCounter::count(executionContext, UseCounter::EventGetReturnValueFalse); | 143 } else { |
| 144 UseCounter::count(scriptState->getExecutionContext(), |
| 145 UseCounter::EventGetReturnValueFalse); |
| 146 } |
| 143 return returnValue; | 147 return returnValue; |
| 144 } | 148 } |
| 145 | 149 |
| 146 void Event::setLegacyReturnValue(ExecutionContext* executionContext, | 150 void Event::setLegacyReturnValue(ScriptState* scriptState, bool returnValue) { |
| 147 bool returnValue) { | 151 if (returnValue) { |
| 148 if (returnValue) | 152 UseCounter::count(scriptState->getExecutionContext(), |
| 149 UseCounter::count(executionContext, UseCounter::EventSetReturnValueTrue); | 153 UseCounter::EventSetReturnValueTrue); |
| 150 else | 154 } else { |
| 151 UseCounter::count(executionContext, UseCounter::EventSetReturnValueFalse); | 155 UseCounter::count(scriptState->getExecutionContext(), |
| 156 UseCounter::EventSetReturnValueFalse); |
| 157 } |
| 152 setDefaultPrevented(!returnValue); | 158 setDefaultPrevented(!returnValue); |
| 153 } | 159 } |
| 154 | 160 |
| 155 const AtomicString& Event::interfaceName() const { | 161 const AtomicString& Event::interfaceName() const { |
| 156 return EventNames::Event; | 162 return EventNames::Event; |
| 157 } | 163 } |
| 158 | 164 |
| 159 bool Event::hasInterface(const AtomicString& name) const { | 165 bool Event::hasInterface(const AtomicString& name) const { |
| 160 return interfaceName() == name; | 166 return interfaceName() == name; |
| 161 } | 167 } |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 Performance* performance = | 334 Performance* performance = |
| 329 DOMWindowPerformance::performance(*scriptState->domWindow()); | 335 DOMWindowPerformance::performance(*scriptState->domWindow()); |
| 330 double timestampSeconds = (m_platformTimeStamp - TimeTicks()).InSecondsF(); | 336 double timestampSeconds = (m_platformTimeStamp - TimeTicks()).InSecondsF(); |
| 331 timeStamp = | 337 timeStamp = |
| 332 performance->monotonicTimeToDOMHighResTimeStamp(timestampSeconds); | 338 performance->monotonicTimeToDOMHighResTimeStamp(timestampSeconds); |
| 333 } | 339 } |
| 334 | 340 |
| 335 return timeStamp; | 341 return timeStamp; |
| 336 } | 342 } |
| 337 | 343 |
| 338 void Event::setCancelBubble(ExecutionContext* context, bool cancel) { | 344 void Event::setCancelBubble(ScriptState* scriptState, bool cancel) { |
| 339 if (cancel) | 345 if (cancel) |
| 340 m_propagationStopped = true; | 346 m_propagationStopped = true; |
| 341 } | 347 } |
| 342 | 348 |
| 343 DEFINE_TRACE(Event) { | 349 DEFINE_TRACE(Event) { |
| 344 visitor->trace(m_currentTarget); | 350 visitor->trace(m_currentTarget); |
| 345 visitor->trace(m_target); | 351 visitor->trace(m_target); |
| 346 visitor->trace(m_underlyingEvent); | 352 visitor->trace(m_underlyingEvent); |
| 347 visitor->trace(m_eventPath); | 353 visitor->trace(m_eventPath); |
| 348 } | 354 } |
| 349 | 355 |
| 350 } // namespace blink | 356 } // namespace blink |
| OLD | NEW |