| OLD | NEW |
| 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 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
| 6 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 6 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 7 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 7 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
| 8 * | 8 * |
| 9 * Redistribution and use in source and binary forms, with or without | 9 * Redistribution and use in source and binary forms, with or without |
| 10 * modification, are permitted provided that the following conditions | 10 * modification, are permitted provided that the following conditions |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 Settings* windowSettings(LocalDOMWindow* executingWindow) | 60 Settings* windowSettings(LocalDOMWindow* executingWindow) |
| 61 { | 61 { |
| 62 if (executingWindow) { | 62 if (executingWindow) { |
| 63 if (LocalFrame* frame = executingWindow->frame()) { | 63 if (LocalFrame* frame = executingWindow->frame()) { |
| 64 return frame->settings(); | 64 return frame->settings(); |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 return nullptr; | 67 return nullptr; |
| 68 } | 68 } |
| 69 | 69 |
| 70 bool isTouchScrollBlockingEvent(const AtomicString& eventType) |
| 71 { |
| 72 return eventType == EventTypeNames::touchstart |
| 73 || eventType == EventTypeNames::touchmove; |
| 74 } |
| 75 |
| 70 bool isScrollBlockingEvent(const AtomicString& eventType) | 76 bool isScrollBlockingEvent(const AtomicString& eventType) |
| 71 { | 77 { |
| 72 return eventType == EventTypeNames::touchstart | 78 return isTouchScrollBlockingEvent(eventType) |
| 73 || eventType == EventTypeNames::touchmove | |
| 74 || eventType == EventTypeNames::mousewheel | 79 || eventType == EventTypeNames::mousewheel |
| 75 || eventType == EventTypeNames::wheel; | 80 || eventType == EventTypeNames::wheel; |
| 76 } | 81 } |
| 77 | 82 |
| 78 double blockedEventsWarningThreshold(const ExecutionContext* context, const Even
t* event) | 83 double blockedEventsWarningThreshold(const ExecutionContext* context, const Even
t* event) |
| 79 { | 84 { |
| 80 if (!event->cancelable()) | 85 if (!event->cancelable()) |
| 81 return 0.0; | 86 return 0.0; |
| 82 if (!isScrollBlockingEvent(event->type())) | 87 if (!isScrollBlockingEvent(event->type())) |
| 83 return 0.0; | 88 return 0.0; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 options.setPassive(false); | 197 options.setPassive(false); |
| 193 return; | 198 return; |
| 194 } | 199 } |
| 195 | 200 |
| 196 if (LocalDOMWindow* executingWindow = this->executingWindow()) { | 201 if (LocalDOMWindow* executingWindow = this->executingWindow()) { |
| 197 if (options.hasPassive()) { | 202 if (options.hasPassive()) { |
| 198 UseCounter::count(executingWindow->document(), options.passive() ? U
seCounter::AddEventListenerPassiveTrue : UseCounter::AddEventListenerPassiveFals
e); | 203 UseCounter::count(executingWindow->document(), options.passive() ? U
seCounter::AddEventListenerPassiveTrue : UseCounter::AddEventListenerPassiveFals
e); |
| 199 } | 204 } |
| 200 } | 205 } |
| 201 | 206 |
| 202 if (RuntimeEnabledFeatures::passiveDocumentEventListenersEnabled()) { | 207 if (RuntimeEnabledFeatures::passiveDocumentEventListenersEnabled() && isTouc
hScrollBlockingEvent(eventType)) { |
| 203 if (!options.hasPassive()) { | 208 if (!options.hasPassive()) { |
| 204 if (Node* node = toNode()) { | 209 if (Node* node = toNode()) { |
| 205 if (node->isDocumentNode() || node->document().documentElement()
== node || node->document().body() == node) { | 210 if (node->isDocumentNode() || node->document().documentElement()
== node || node->document().body() == node) { |
| 206 options.setPassive(true); | 211 options.setPassive(true); |
| 207 return; | 212 return; |
| 208 } | 213 } |
| 209 } else if (toLocalDOMWindow()) { | 214 } else if (toLocalDOMWindow()) { |
| 210 options.setPassive(true); | 215 options.setPassive(true); |
| 211 return; | 216 return; |
| 212 } | 217 } |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 // they have one less listener to invoke. | 656 // they have one less listener to invoke. |
| 652 if (d->firingEventIterators) { | 657 if (d->firingEventIterators) { |
| 653 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { | 658 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { |
| 654 d->firingEventIterators->at(i).iterator = 0; | 659 d->firingEventIterators->at(i).iterator = 0; |
| 655 d->firingEventIterators->at(i).end = 0; | 660 d->firingEventIterators->at(i).end = 0; |
| 656 } | 661 } |
| 657 } | 662 } |
| 658 } | 663 } |
| 659 | 664 |
| 660 } // namespace blink | 665 } // namespace blink |
| OLD | NEW |