| 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. |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 return false; | 218 return false; |
| 219 } | 219 } |
| 220 | 220 |
| 221 void Event::preventDefault() { | 221 void Event::preventDefault() { |
| 222 if (m_handlingPassive != PassiveMode::NotPassive && | 222 if (m_handlingPassive != PassiveMode::NotPassive && |
| 223 m_handlingPassive != PassiveMode::NotPassiveDefault) { | 223 m_handlingPassive != PassiveMode::NotPassiveDefault) { |
| 224 m_preventDefaultCalledDuringPassive = true; | 224 m_preventDefaultCalledDuringPassive = true; |
| 225 | 225 |
| 226 const LocalDOMWindow* window = | 226 const LocalDOMWindow* window = |
| 227 m_eventPath ? m_eventPath->windowEventContext().window() : 0; | 227 m_eventPath ? m_eventPath->windowEventContext().window() : 0; |
| 228 if (window) { | 228 if (window && m_handlingPassive == PassiveMode::Passive) { |
| 229 const char* devToolsMsg = nullptr; | 229 window->printErrorMessage( |
| 230 switch (m_handlingPassive) { | 230 "Unable to preventDefault inside passive event listener invocation."); |
| 231 case PassiveMode::NotPassive: | |
| 232 case PassiveMode::NotPassiveDefault: | |
| 233 NOTREACHED(); | |
| 234 break; | |
| 235 case PassiveMode::Passive: | |
| 236 case PassiveMode::PassiveDefault: | |
| 237 devToolsMsg = | |
| 238 "Unable to preventDefault inside passive event listener " | |
| 239 "invocation."; | |
| 240 break; | |
| 241 case PassiveMode::PassiveForcedDocumentLevel: | |
| 242 devToolsMsg = | |
| 243 "Unable to preventDefault inside passive event listener due to " | |
| 244 "target being treated as passive. See " | |
| 245 "https://www.chromestatus.com/features/5093566007214080"; | |
| 246 break; | |
| 247 } | |
| 248 if (devToolsMsg) | |
| 249 window->printErrorMessage(devToolsMsg); | |
| 250 } | 231 } |
| 251 return; | 232 return; |
| 252 } | 233 } |
| 253 | 234 |
| 254 if (m_cancelable) | 235 if (m_cancelable) |
| 255 m_defaultPrevented = true; | 236 m_defaultPrevented = true; |
| 256 else | 237 else |
| 257 m_preventDefaultCalledOnUncancelableEvent = true; | 238 m_preventDefaultCalledOnUncancelableEvent = true; |
| 258 } | 239 } |
| 259 | 240 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 } | 348 } |
| 368 | 349 |
| 369 DEFINE_TRACE(Event) { | 350 DEFINE_TRACE(Event) { |
| 370 visitor->trace(m_currentTarget); | 351 visitor->trace(m_currentTarget); |
| 371 visitor->trace(m_target); | 352 visitor->trace(m_target); |
| 372 visitor->trace(m_underlyingEvent); | 353 visitor->trace(m_underlyingEvent); |
| 373 visitor->trace(m_eventPath); | 354 visitor->trace(m_eventPath); |
| 374 } | 355 } |
| 375 | 356 |
| 376 } // namespace blink | 357 } // namespace blink |
| OLD | NEW |