Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: third_party/WebKit/Source/core/events/Event.cpp

Issue 2811863002: Move ScriptState::GetExecutionContext (Part 4) (Closed)
Patch Set: Fix Document.cpp Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "bindings/core/v8/ScriptState.h"
26 #include "core/dom/ExecutionContext.h"
26 #include "core/dom/StaticNodeList.h" 27 #include "core/dom/StaticNodeList.h"
27 #include "core/events/EventDispatchMediator.h" 28 #include "core/events/EventDispatchMediator.h"
28 #include "core/events/EventTarget.h" 29 #include "core/events/EventTarget.h"
29 #include "core/frame/HostsUsingFeatures.h" 30 #include "core/frame/HostsUsingFeatures.h"
30 #include "core/frame/UseCounter.h" 31 #include "core/frame/UseCounter.h"
31 #include "core/svg/SVGElement.h" 32 #include "core/svg/SVGElement.h"
32 #include "core/timing/DOMWindowPerformance.h" 33 #include "core/timing/DOMWindowPerformance.h"
33 #include "core/timing/Performance.h" 34 #include "core/timing/Performance.h"
34 35
35 namespace blink { 36 namespace blink {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 prevent_default_called_on_uncancelable_event_ = false; 132 prevent_default_called_on_uncancelable_event_ = false;
132 133
133 type_ = event_type_arg; 134 type_ = event_type_arg;
134 can_bubble_ = can_bubble_arg; 135 can_bubble_ = can_bubble_arg;
135 cancelable_ = cancelable_arg; 136 cancelable_ = cancelable_arg;
136 } 137 }
137 138
138 bool Event::legacyReturnValue(ScriptState* script_state) const { 139 bool Event::legacyReturnValue(ScriptState* script_state) const {
139 bool return_value = !defaultPrevented(); 140 bool return_value = !defaultPrevented();
140 if (return_value) { 141 if (return_value) {
141 UseCounter::Count(script_state->GetExecutionContext(), 142 UseCounter::Count(ExecutionContext::From(script_state),
142 UseCounter::kEventGetReturnValueTrue); 143 UseCounter::kEventGetReturnValueTrue);
143 } else { 144 } else {
144 UseCounter::Count(script_state->GetExecutionContext(), 145 UseCounter::Count(ExecutionContext::From(script_state),
145 UseCounter::kEventGetReturnValueFalse); 146 UseCounter::kEventGetReturnValueFalse);
146 } 147 }
147 return return_value; 148 return return_value;
148 } 149 }
149 150
150 void Event::setLegacyReturnValue(ScriptState* script_state, bool return_value) { 151 void Event::setLegacyReturnValue(ScriptState* script_state, bool return_value) {
151 if (return_value) { 152 if (return_value) {
152 UseCounter::Count(script_state->GetExecutionContext(), 153 UseCounter::Count(ExecutionContext::From(script_state),
153 UseCounter::kEventSetReturnValueTrue); 154 UseCounter::kEventSetReturnValueTrue);
154 } else { 155 } else {
155 UseCounter::Count(script_state->GetExecutionContext(), 156 UseCounter::Count(ExecutionContext::From(script_state),
156 UseCounter::kEventSetReturnValueFalse); 157 UseCounter::kEventSetReturnValueFalse);
157 } 158 }
158 SetDefaultPrevented(!return_value); 159 SetDefaultPrevented(!return_value);
159 } 160 }
160 161
161 const AtomicString& Event::InterfaceName() const { 162 const AtomicString& Event::InterfaceName() const {
162 return EventNames::Event; 163 return EventNames::Event;
163 } 164 }
164 165
165 bool Event::HasInterface(const AtomicString& name) const { 166 bool Event::HasInterface(const AtomicString& name) const {
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 } 360 }
360 361
361 DEFINE_TRACE(Event) { 362 DEFINE_TRACE(Event) {
362 visitor->Trace(current_target_); 363 visitor->Trace(current_target_);
363 visitor->Trace(target_); 364 visitor->Trace(target_);
364 visitor->Trace(underlying_event_); 365 visitor->Trace(underlying_event_);
365 visitor->Trace(event_path_); 366 visitor->Trace(event_path_);
366 } 367 }
367 368
368 } // namespace blink 369 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp ('k') | third_party/WebKit/Source/core/fileapi/Blob.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698