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

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

Issue 2137483003: Add UMA metrics for root scroller intervention to track forcing passive breakage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add ability to test histograms from layout tests Created 4 years, 5 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.
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 } 218 }
219 219
220 bool Event::isBeforeUnloadEvent() const 220 bool Event::isBeforeUnloadEvent() const
221 { 221 {
222 return false; 222 return false;
223 } 223 }
224 224
225 void Event::preventDefault() 225 void Event::preventDefault()
226 { 226 {
227 if (m_handlingPassive) { 227 if (m_handlingPassive) {
228 m_preventDefaultCalledDuringPassive = true;
228 const LocalDOMWindow* window = m_eventPath ? m_eventPath->windowEventCon text().window() : 0; 229 const LocalDOMWindow* window = m_eventPath ? m_eventPath->windowEventCon text().window() : 0;
229 if (window) 230 if (window)
230 window->printErrorMessage("Unable to preventDefault inside passive e vent listener invocation."); 231 window->printErrorMessage("Unable to preventDefault inside passive e vent listener invocation.");
231 return; 232 return;
232 } 233 }
233 234
234 if (m_cancelable) 235 if (m_cancelable)
235 m_defaultPrevented = true; 236 m_defaultPrevented = true;
236 } 237 }
237 238
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 HeapVector<Member<EventTarget>> Event::path(ScriptState* scriptState) const 271 HeapVector<Member<EventTarget>> Event::path(ScriptState* scriptState) const
271 { 272 {
272 return pathInternal(scriptState, NonEmptyAfterDispatch); 273 return pathInternal(scriptState, NonEmptyAfterDispatch);
273 } 274 }
274 275
275 HeapVector<Member<EventTarget>> Event::composedPath(ScriptState* scriptState) co nst 276 HeapVector<Member<EventTarget>> Event::composedPath(ScriptState* scriptState) co nst
276 { 277 {
277 return pathInternal(scriptState, EmptyAfterDispatch); 278 return pathInternal(scriptState, EmptyAfterDispatch);
278 } 279 }
279 280
281 void Event::setHandlingPassive(bool value)
282 {
283 m_handlingPassive = value;
284 m_preventDefaultCalledDuringPassive = false;
285 }
286
280 HeapVector<Member<EventTarget>> Event::pathInternal(ScriptState* scriptState, Ev entPathMode mode) const 287 HeapVector<Member<EventTarget>> Event::pathInternal(ScriptState* scriptState, Ev entPathMode mode) const
281 { 288 {
282 if (m_target) 289 if (m_target)
283 HostsUsingFeatures::countHostOrIsolatedWorldHumanReadableName(scriptStat e, *m_target, HostsUsingFeatures::Feature::EventPath); 290 HostsUsingFeatures::countHostOrIsolatedWorldHumanReadableName(scriptStat e, *m_target, HostsUsingFeatures::Feature::EventPath);
284 291
285 if (!m_currentTarget) { 292 if (!m_currentTarget) {
286 ASSERT(m_eventPhase == Event::NONE); 293 ASSERT(m_eventPhase == Event::NONE);
287 if (!m_eventPath) { 294 if (!m_eventPath) {
288 // Before dispatching the event 295 // Before dispatching the event
289 return HeapVector<Member<EventTarget>>(); 296 return HeapVector<Member<EventTarget>>();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 367
361 DEFINE_TRACE(Event) 368 DEFINE_TRACE(Event)
362 { 369 {
363 visitor->trace(m_currentTarget); 370 visitor->trace(m_currentTarget);
364 visitor->trace(m_target); 371 visitor->trace(m_target);
365 visitor->trace(m_underlyingEvent); 372 visitor->trace(m_underlyingEvent);
366 visitor->trace(m_eventPath); 373 visitor->trace(m_eventPath);
367 } 374 }
368 375
369 } // namespace blink 376 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698