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 eventType == EventTypeNames::touchstart |
Rick Byers
2016/07/07 20:02:09
nit: replace these two lines with isTouchScrollBlo
dtapuska
2016/07/07 20:34:22
Done.
| |
73 || eventType == EventTypeNames::touchmove | 79 || eventType == EventTypeNames::touchmove |
74 || eventType == EventTypeNames::mousewheel | 80 || eventType == EventTypeNames::mousewheel |
75 || eventType == EventTypeNames::wheel; | 81 || eventType == EventTypeNames::wheel; |
76 } | 82 } |
77 | 83 |
78 double blockedEventsWarningThreshold(const ExecutionContext* context, const Even t* event) | 84 double blockedEventsWarningThreshold(const ExecutionContext* context, const Even t* event) |
79 { | 85 { |
80 if (!event->cancelable()) | 86 if (!event->cancelable()) |
81 return 0.0; | 87 return 0.0; |
82 if (!isScrollBlockingEvent(event->type())) | 88 if (!isScrollBlockingEvent(event->type())) |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
192 options.setPassive(false); | 198 options.setPassive(false); |
193 return; | 199 return; |
194 } | 200 } |
195 | 201 |
196 if (LocalDOMWindow* executingWindow = this->executingWindow()) { | 202 if (LocalDOMWindow* executingWindow = this->executingWindow()) { |
197 if (options.hasPassive()) { | 203 if (options.hasPassive()) { |
198 UseCounter::count(executingWindow->document(), options.passive() ? U seCounter::AddEventListenerPassiveTrue : UseCounter::AddEventListenerPassiveFals e); | 204 UseCounter::count(executingWindow->document(), options.passive() ? U seCounter::AddEventListenerPassiveTrue : UseCounter::AddEventListenerPassiveFals e); |
199 } | 205 } |
200 } | 206 } |
201 | 207 |
202 if (RuntimeEnabledFeatures::passiveDocumentEventListenersEnabled()) { | 208 if (RuntimeEnabledFeatures::passiveDocumentEventListenersEnabled() && isTouc hScrollBlockingEvent(eventType)) { |
203 if (!options.hasPassive()) { | 209 if (!options.hasPassive()) { |
204 if (Node* node = toNode()) { | 210 if (Node* node = toNode()) { |
205 if (node->isDocumentNode() || node->document().documentElement() == node || node->document().body() == node) { | 211 if (node->isDocumentNode() || node->document().documentElement() == node || node->document().body() == node) { |
206 options.setPassive(true); | 212 options.setPassive(true); |
207 return; | 213 return; |
208 } | 214 } |
209 } else if (toLocalDOMWindow()) { | 215 } else if (toLocalDOMWindow()) { |
210 options.setPassive(true); | 216 options.setPassive(true); |
211 return; | 217 return; |
212 } | 218 } |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
651 // they have one less listener to invoke. | 657 // they have one less listener to invoke. |
652 if (d->firingEventIterators) { | 658 if (d->firingEventIterators) { |
653 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { | 659 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { |
654 d->firingEventIterators->at(i).iterator = 0; | 660 d->firingEventIterators->at(i).iterator = 0; |
655 d->firingEventIterators->at(i).end = 0; | 661 d->firingEventIterators->at(i).end = 0; |
656 } | 662 } |
657 } | 663 } |
658 } | 664 } |
659 | 665 |
660 } // namespace blink | 666 } // namespace blink |
OLD | NEW |