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

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

Issue 2641953006: Remove setting cancelBubble to false. (Closed)
Patch Set: update Created 3 years, 11 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 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 * rights reserved. 6 * rights reserved.
7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2011 Google Inc. All rights reserved. 10 * Copyright (C) 2011 Google Inc. All rights reserved.
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 // Trigger bubbling event handlers, starting at the bottom and working our way 211 // Trigger bubbling event handlers, starting at the bottom and working our way
212 // up. 212 // up.
213 size_t size = m_event->eventPath().size(); 213 size_t size = m_event->eventPath().size();
214 for (size_t i = 1; i < size; ++i) { 214 for (size_t i = 1; i < size; ++i) {
215 const NodeEventContext& eventContext = m_event->eventPath()[i]; 215 const NodeEventContext& eventContext = m_event->eventPath()[i];
216 if (eventContext.currentTargetSameAsTarget()) { 216 if (eventContext.currentTargetSameAsTarget()) {
217 m_event->setEventPhase(Event::kAtTarget); 217 m_event->setEventPhase(Event::kAtTarget);
218 } else if (m_event->bubbles() && !m_event->cancelBubble()) { 218 } else if (m_event->bubbles() && !m_event->cancelBubble()) {
219 m_event->setEventPhase(Event::kBubblingPhase); 219 m_event->setEventPhase(Event::kBubblingPhase);
220 } else { 220 } else {
221 if (m_event->bubbles() && m_event->cancelBubble() &&
222 eventContext.node() &&
223 eventContext.node()->hasEventListeners(m_event->type()))
224 UseCounter::count(eventContext.node()->document(),
225 UseCounter::EventCancelBubbleAffected);
226 continue; 221 continue;
227 } 222 }
228 eventContext.handleLocalEvents(*m_event); 223 eventContext.handleLocalEvents(*m_event);
229 if (m_event->propagationStopped()) 224 if (m_event->propagationStopped())
230 return; 225 return;
231 } 226 }
232 if (m_event->bubbles() && !m_event->cancelBubble()) { 227 if (m_event->bubbles() && !m_event->cancelBubble()) {
233 m_event->setEventPhase(Event::kBubblingPhase); 228 m_event->setEventPhase(Event::kBubblingPhase);
234 m_event->eventPath().windowEventContext().handleLocalEvents(*m_event); 229 m_event->eventPath().windowEventContext().handleLocalEvents(*m_event);
235 } else if (m_event->bubbles() &&
236 m_event->eventPath().windowEventContext().window() &&
237 m_event->eventPath()
238 .windowEventContext()
239 .window()
240 ->hasEventListeners(m_event->type())) {
241 UseCounter::count(m_event->eventPath()
242 .windowEventContext()
243 .window()
244 ->getExecutionContext(),
245 UseCounter::EventCancelBubbleAffected);
246 } 230 }
247 } 231 }
248 232
249 inline void EventDispatcher::dispatchEventPostProcess( 233 inline void EventDispatcher::dispatchEventPostProcess(
250 EventDispatchHandlingState* preDispatchEventHandlerResult) { 234 EventDispatchHandlingState* preDispatchEventHandlerResult) {
251 m_event->setTarget(EventPath::eventTargetRespectingTargetRules(*m_node)); 235 m_event->setTarget(EventPath::eventTargetRespectingTargetRules(*m_node));
252 // https://dom.spec.whatwg.org/#concept-event-dispatch 236 // https://dom.spec.whatwg.org/#concept-event-dispatch
253 // 14. Unset event’s dispatch flag, stop propagation flag, and stop immediate 237 // 14. Unset event’s dispatch flag, stop propagation flag, and stop immediate
254 // propagation flag. 238 // propagation flag.
255 m_event->setStopPropagation(false); 239 m_event->setStopPropagation(false);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 // events to open select boxes. 304 // events to open select boxes.
321 if (!m_event->isTrusted() && m_event->isMouseEvent() && 305 if (!m_event->isTrusted() && m_event->isMouseEvent() &&
322 m_event->type() == EventTypeNames::mousedown && 306 m_event->type() == EventTypeNames::mousedown &&
323 isHTMLSelectElement(*m_node)) { 307 isHTMLSelectElement(*m_node)) {
324 UseCounter::count(m_node->document(), 308 UseCounter::count(m_node->document(),
325 UseCounter::UntrustedMouseDownEventDispatchedToSelect); 309 UseCounter::UntrustedMouseDownEventDispatchedToSelect);
326 } 310 }
327 } 311 }
328 312
329 } // namespace blink 313 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698