Chromium Code Reviews| 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 && shouldLogPassiveDevtoolsWarning()) { |
| 229 const char* devToolsMsg = nullptr; | 229 const char* devToolsMsg = nullptr; |
| 230 switch (m_handlingPassive) { | 230 switch (m_handlingPassive) { |
| 231 case PassiveMode::NotPassive: | 231 case PassiveMode::NotPassive: |
| 232 case PassiveMode::NotPassiveDefault: | 232 case PassiveMode::NotPassiveDefault: |
| 233 NOTREACHED(); | 233 NOTREACHED(); |
| 234 break; | 234 break; |
| 235 case PassiveMode::Passive: | 235 case PassiveMode::Passive: |
| 236 case PassiveMode::PassiveDefault: | 236 case PassiveMode::PassiveDefault: |
| 237 devToolsMsg = | 237 devToolsMsg = |
| 238 "Unable to preventDefault inside passive event listener " | 238 "Unable to preventDefault inside passive event listener " |
| 239 "invocation."; | 239 "invocation."; |
| 240 break; | 240 break; |
| 241 case PassiveMode::PassiveForcedDocumentLevel: | 241 case PassiveMode::PassiveForcedDocumentLevel: |
|
Rick Byers
2016/11/22 20:40:33
I think this would get a little cleaner (and avoid
| |
| 242 devToolsMsg = | 242 devToolsMsg = |
| 243 "Unable to preventDefault inside passive event listener due to " | 243 "Unable to preventDefault inside passive event listener due to " |
| 244 "target being treated as passive. See " | 244 "target being treated as passive. See " |
| 245 "https://www.chromestatus.com/features/5093566007214080"; | 245 "https://www.chromestatus.com/features/5093566007214080"; |
| 246 break; | 246 break; |
| 247 } | 247 } |
| 248 if (devToolsMsg) | 248 if (devToolsMsg) |
| 249 window->printErrorMessage(devToolsMsg); | 249 window->printErrorMessage(devToolsMsg); |
| 250 } | 250 } |
| 251 return; | 251 return; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 367 } | 367 } |
| 368 | 368 |
| 369 DEFINE_TRACE(Event) { | 369 DEFINE_TRACE(Event) { |
| 370 visitor->trace(m_currentTarget); | 370 visitor->trace(m_currentTarget); |
| 371 visitor->trace(m_target); | 371 visitor->trace(m_target); |
| 372 visitor->trace(m_underlyingEvent); | 372 visitor->trace(m_underlyingEvent); |
| 373 visitor->trace(m_eventPath); | 373 visitor->trace(m_eventPath); |
| 374 } | 374 } |
| 375 | 375 |
| 376 } // namespace blink | 376 } // namespace blink |
| OLD | NEW |