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/EventDispatcher.cpp

Issue 2068053002: Rename Blink constants generated from IDL files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * Copyright (C) 2011 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Google Inc. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 inline EventDispatchContinuation EventDispatcher::dispatchEventPreProcess(EventD ispatchHandlingState*& preDispatchEventHandlerResult) 142 inline EventDispatchContinuation EventDispatcher::dispatchEventPreProcess(EventD ispatchHandlingState*& preDispatchEventHandlerResult)
143 { 143 {
144 // Give the target node a chance to do some work before DOM event handlers g et a crack. 144 // Give the target node a chance to do some work before DOM event handlers g et a crack.
145 preDispatchEventHandlerResult = m_node->preDispatchEventHandler(m_event.get( )); 145 preDispatchEventHandlerResult = m_node->preDispatchEventHandler(m_event.get( ));
146 return (m_event->eventPath().isEmpty() || m_event->propagationStopped()) ? D oneDispatching : ContinueDispatching; 146 return (m_event->eventPath().isEmpty() || m_event->propagationStopped()) ? D oneDispatching : ContinueDispatching;
147 } 147 }
148 148
149 inline EventDispatchContinuation EventDispatcher::dispatchEventAtCapturing() 149 inline EventDispatchContinuation EventDispatcher::dispatchEventAtCapturing()
150 { 150 {
151 // Trigger capturing event handlers, starting at the top and working our way down. 151 // Trigger capturing event handlers, starting at the top and working our way down.
152 m_event->setEventPhase(Event::CAPTURING_PHASE); 152 m_event->setEventPhase(Event::kCapturingPhase);
153 153
154 if (m_event->eventPath().windowEventContext().handleLocalEvents(*m_event) && m_event->propagationStopped()) 154 if (m_event->eventPath().windowEventContext().handleLocalEvents(*m_event) && m_event->propagationStopped())
155 return DoneDispatching; 155 return DoneDispatching;
156 156
157 for (size_t i = m_event->eventPath().size() - 1; i > 0; --i) { 157 for (size_t i = m_event->eventPath().size() - 1; i > 0; --i) {
158 const NodeEventContext& eventContext = m_event->eventPath()[i]; 158 const NodeEventContext& eventContext = m_event->eventPath()[i];
159 if (eventContext.currentTargetSameAsTarget()) 159 if (eventContext.currentTargetSameAsTarget())
160 continue; 160 continue;
161 eventContext.handleLocalEvents(*m_event); 161 eventContext.handleLocalEvents(*m_event);
162 if (m_event->propagationStopped()) 162 if (m_event->propagationStopped())
163 return DoneDispatching; 163 return DoneDispatching;
164 } 164 }
165 165
166 return ContinueDispatching; 166 return ContinueDispatching;
167 } 167 }
168 168
169 inline EventDispatchContinuation EventDispatcher::dispatchEventAtTarget() 169 inline EventDispatchContinuation EventDispatcher::dispatchEventAtTarget()
170 { 170 {
171 m_event->setEventPhase(Event::AT_TARGET); 171 m_event->setEventPhase(Event::kAtTarget);
172 m_event->eventPath()[0].handleLocalEvents(*m_event); 172 m_event->eventPath()[0].handleLocalEvents(*m_event);
173 return m_event->propagationStopped() ? DoneDispatching : ContinueDispatching ; 173 return m_event->propagationStopped() ? DoneDispatching : ContinueDispatching ;
174 } 174 }
175 175
176 inline void EventDispatcher::dispatchEventAtBubbling() 176 inline void EventDispatcher::dispatchEventAtBubbling()
177 { 177 {
178 // Trigger bubbling event handlers, starting at the bottom and working our w ay up. 178 // Trigger bubbling event handlers, starting at the bottom and working our w ay up.
179 size_t size = m_event->eventPath().size(); 179 size_t size = m_event->eventPath().size();
180 for (size_t i = 1; i < size; ++i) { 180 for (size_t i = 1; i < size; ++i) {
181 const NodeEventContext& eventContext = m_event->eventPath()[i]; 181 const NodeEventContext& eventContext = m_event->eventPath()[i];
182 if (eventContext.currentTargetSameAsTarget()) { 182 if (eventContext.currentTargetSameAsTarget()) {
183 m_event->setEventPhase(Event::AT_TARGET); 183 m_event->setEventPhase(Event::kAtTarget);
184 } else if (m_event->bubbles() && !m_event->cancelBubble()) { 184 } else if (m_event->bubbles() && !m_event->cancelBubble()) {
185 m_event->setEventPhase(Event::BUBBLING_PHASE); 185 m_event->setEventPhase(Event::kBubblingPhase);
186 } else { 186 } else {
187 if (m_event->bubbles() && m_event->cancelBubble() && eventContext.no de() && eventContext.node()->hasEventListeners(m_event->type())) 187 if (m_event->bubbles() && m_event->cancelBubble() && eventContext.no de() && eventContext.node()->hasEventListeners(m_event->type()))
188 UseCounter::count(eventContext.node()->document(), UseCounter::E ventCancelBubbleAffected); 188 UseCounter::count(eventContext.node()->document(), UseCounter::E ventCancelBubbleAffected);
189 continue; 189 continue;
190 } 190 }
191 eventContext.handleLocalEvents(*m_event); 191 eventContext.handleLocalEvents(*m_event);
192 if (m_event->propagationStopped()) 192 if (m_event->propagationStopped())
193 return; 193 return;
194 } 194 }
195 if (m_event->bubbles() && !m_event->cancelBubble()) { 195 if (m_event->bubbles() && !m_event->cancelBubble()) {
196 m_event->setEventPhase(Event::BUBBLING_PHASE); 196 m_event->setEventPhase(Event::kBubblingPhase);
197 m_event->eventPath().windowEventContext().handleLocalEvents(*m_event); 197 m_event->eventPath().windowEventContext().handleLocalEvents(*m_event);
198 } else if (m_event->bubbles() && m_event->eventPath().windowEventContext().w indow() && m_event->eventPath().windowEventContext().window()->hasEventListeners (m_event->type())) { 198 } else if (m_event->bubbles() && m_event->eventPath().windowEventContext().w indow() && m_event->eventPath().windowEventContext().window()->hasEventListeners (m_event->type())) {
199 UseCounter::count(m_event->eventPath().windowEventContext().window()->ge tExecutionContext(), UseCounter::EventCancelBubbleAffected); 199 UseCounter::count(m_event->eventPath().windowEventContext().window()->ge tExecutionContext(), UseCounter::EventCancelBubbleAffected);
200 } 200 }
201 } 201 }
202 202
203 inline void EventDispatcher::dispatchEventPostProcess(EventDispatchHandlingState * preDispatchEventHandlerResult) 203 inline void EventDispatcher::dispatchEventPostProcess(EventDispatchHandlingState * preDispatchEventHandlerResult)
204 { 204 {
205 m_event->setTarget(EventPath::eventTargetRespectingTargetRules(*m_node)); 205 m_event->setTarget(EventPath::eventTargetRespectingTargetRules(*m_node));
206 m_event->setCurrentTarget(nullptr); 206 m_event->setCurrentTarget(nullptr);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 if (m_event->defaultHandled()) 239 if (m_event->defaultHandled())
240 break; 240 break;
241 } 241 }
242 } 242 }
243 if (m_event->defaultHandled() && !m_event->isTrusted() && !isClick) 243 if (m_event->defaultHandled() && !m_event->isTrusted() && !isClick)
244 Deprecation::countDeprecation(m_node->document(), UseCounter::Untrus tedEventDefaultHandled); 244 Deprecation::countDeprecation(m_node->document(), UseCounter::Untrus tedEventDefaultHandled);
245 } 245 }
246 } 246 }
247 247
248 } // namespace blink 248 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/Event.cpp ('k') | third_party/WebKit/Source/core/events/EventTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698