Chromium Code Reviews| 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 21 matching lines...) Expand all Loading... | |
| 32 #include "core/events/EventTarget.h" | 32 #include "core/events/EventTarget.h" |
| 33 | 33 |
| 34 #include "bindings/core/v8/ExceptionState.h" | 34 #include "bindings/core/v8/ExceptionState.h" |
| 35 #include "bindings/core/v8/ScriptEventListener.h" | 35 #include "bindings/core/v8/ScriptEventListener.h" |
| 36 #include "bindings/core/v8/SourceLocation.h" | 36 #include "bindings/core/v8/SourceLocation.h" |
| 37 #include "bindings/core/v8/V8DOMActivityLogger.h" | 37 #include "bindings/core/v8/V8DOMActivityLogger.h" |
| 38 #include "core/dom/ExceptionCode.h" | 38 #include "core/dom/ExceptionCode.h" |
| 39 #include "core/editing/Editor.h" | 39 #include "core/editing/Editor.h" |
| 40 #include "core/events/Event.h" | 40 #include "core/events/Event.h" |
| 41 #include "core/events/EventUtil.h" | 41 #include "core/events/EventUtil.h" |
| 42 #include "core/events/PointerEvent.h" | |
| 42 #include "core/frame/FrameHost.h" | 43 #include "core/frame/FrameHost.h" |
| 43 #include "core/frame/LocalDOMWindow.h" | 44 #include "core/frame/LocalDOMWindow.h" |
| 44 #include "core/frame/Settings.h" | 45 #include "core/frame/Settings.h" |
| 45 #include "core/frame/UseCounter.h" | 46 #include "core/frame/UseCounter.h" |
| 46 #include "core/inspector/ConsoleMessage.h" | 47 #include "core/inspector/ConsoleMessage.h" |
| 47 #include "core/inspector/InspectorInstrumentation.h" | 48 #include "core/inspector/InspectorInstrumentation.h" |
| 48 #include "platform/EventDispatchForbiddenScope.h" | 49 #include "platform/EventDispatchForbiddenScope.h" |
| 49 #include "wtf/PtrUtil.h" | 50 #include "wtf/PtrUtil.h" |
| 50 #include "wtf/StdLibExtras.h" | 51 #include "wtf/StdLibExtras.h" |
| 51 #include "wtf/Threading.h" | 52 #include "wtf/Threading.h" |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 531 return dispatchEventResult(*event); | 532 return dispatchEventResult(*event); |
| 532 } | 533 } |
| 533 | 534 |
| 534 bool EventTarget::fireEventListeners(Event* event, EventTargetData* d, EventList enerVector& entry) | 535 bool EventTarget::fireEventListeners(Event* event, EventTargetData* d, EventList enerVector& entry) |
| 535 { | 536 { |
| 536 // Fire all listeners registered for this event. Don't fire listeners remove d | 537 // Fire all listeners registered for this event. Don't fire listeners remove d |
| 537 // during event dispatch. Also, don't fire event listeners added during even t | 538 // during event dispatch. Also, don't fire event listeners added during even t |
| 538 // dispatch. Conveniently, all new event listeners will be added after or at | 539 // dispatch. Conveniently, all new event listeners will be added after or at |
| 539 // index |size|, so iterating up to (but not including) |size| naturally exc ludes | 540 // index |size|, so iterating up to (but not including) |size| naturally exc ludes |
| 540 // new event listeners. | 541 // new event listeners. |
| 542 // | |
| 543 // TODO(mustaq): This code needs to be refactored, crbug.com/629601 | |
| 541 | 544 |
| 542 if (event->type() == EventTypeNames::beforeunload) { | 545 if (event->type() == EventTypeNames::beforeunload) { |
| 543 if (LocalDOMWindow* executingWindow = this->executingWindow()) { | 546 if (LocalDOMWindow* executingWindow = this->executingWindow()) { |
| 544 if (executingWindow->top()) | 547 if (executingWindow->top()) |
| 545 UseCounter::count(executingWindow->document(), UseCounter::SubFr ameBeforeUnloadFired); | 548 UseCounter::count(executingWindow->document(), UseCounter::SubFr ameBeforeUnloadFired); |
| 546 UseCounter::count(executingWindow->document(), UseCounter::DocumentB eforeUnloadFired); | 549 UseCounter::count(executingWindow->document(), UseCounter::DocumentB eforeUnloadFired); |
| 547 } | 550 } |
| 548 } else if (event->type() == EventTypeNames::unload) { | 551 } else if (event->type() == EventTypeNames::unload) { |
| 549 if (LocalDOMWindow* executingWindow = this->executingWindow()) | 552 if (LocalDOMWindow* executingWindow = this->executingWindow()) |
| 550 UseCounter::count(executingWindow->document(), UseCounter::DocumentU nloadFired); | 553 UseCounter::count(executingWindow->document(), UseCounter::DocumentU nloadFired); |
| 551 } else if (event->type() == EventTypeNames::DOMFocusIn || event->type() == E ventTypeNames::DOMFocusOut) { | 554 } else if (event->type() == EventTypeNames::DOMFocusIn || event->type() == E ventTypeNames::DOMFocusOut) { |
| 552 if (LocalDOMWindow* executingWindow = this->executingWindow()) | 555 if (LocalDOMWindow* executingWindow = this->executingWindow()) |
| 553 UseCounter::count(executingWindow->document(), UseCounter::DOMFocusI nOutEvent); | 556 UseCounter::count(executingWindow->document(), UseCounter::DOMFocusI nOutEvent); |
| 554 } else if (event->type() == EventTypeNames::focusin || event->type() == Even tTypeNames::focusout) { | 557 } else if (event->type() == EventTypeNames::focusin || event->type() == Even tTypeNames::focusout) { |
| 555 if (LocalDOMWindow* executingWindow = this->executingWindow()) | 558 if (LocalDOMWindow* executingWindow = this->executingWindow()) |
| 556 UseCounter::count(executingWindow->document(), UseCounter::FocusInOu tEvent); | 559 UseCounter::count(executingWindow->document(), UseCounter::FocusInOu tEvent); |
| 557 } else if (event->type() == EventTypeNames::textInput) { | 560 } else if (event->type() == EventTypeNames::textInput) { |
| 558 if (LocalDOMWindow* executingWindow = this->executingWindow()) | 561 if (LocalDOMWindow* executingWindow = this->executingWindow()) |
| 559 UseCounter::count(executingWindow->document(), UseCounter::TextInput Fired); | 562 UseCounter::count(executingWindow->document(), UseCounter::TextInput Fired); |
| 563 } else if (event->type() == EventTypeNames::touchstart) { | |
| 564 if (LocalDOMWindow* executingWindow = this->executingWindow()) | |
| 565 UseCounter::count(executingWindow->document(), UseCounter::TouchStar tFired); | |
| 566 } else if (event->type() == EventTypeNames::mousedown) { | |
| 567 if (LocalDOMWindow* executingWindow = this->executingWindow()) | |
| 568 UseCounter::count(executingWindow->document(), UseCounter::MouseDown Fired); | |
| 569 } else if (event->type() == EventTypeNames::pointerdown) { | |
| 570 if (LocalDOMWindow* executingWindow = this->executingWindow()) { | |
| 571 if (toPointerEvent(event)->pointerType() == "touch") | |
|
dtapuska
2016/07/19 20:01:54
That is now just going to crash the process. I don
mustaq
2016/07/19 20:36:07
Yikes, done.
| |
| 572 UseCounter::count(executingWindow->document(), UseCounter::Point erDownFiredForTouch); | |
| 573 UseCounter::count(executingWindow->document(), UseCounter::PointerDo wnFired); | |
| 574 } | |
| 560 } | 575 } |
| 561 | 576 |
| 562 ExecutionContext* context = getExecutionContext(); | 577 ExecutionContext* context = getExecutionContext(); |
| 563 if (!context) | 578 if (!context) |
| 564 return false; | 579 return false; |
| 565 | 580 |
| 566 size_t i = 0; | 581 size_t i = 0; |
| 567 size_t size = entry.size(); | 582 size_t size = entry.size(); |
| 568 if (!d->firingEventIterators) | 583 if (!d->firingEventIterators) |
| 569 d->firingEventIterators = wrapUnique(new FiringEventIteratorVector); | 584 d->firingEventIterators = wrapUnique(new FiringEventIteratorVector); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 656 // they have one less listener to invoke. | 671 // they have one less listener to invoke. |
| 657 if (d->firingEventIterators) { | 672 if (d->firingEventIterators) { |
| 658 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { | 673 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { |
| 659 d->firingEventIterators->at(i).iterator = 0; | 674 d->firingEventIterators->at(i).iterator = 0; |
| 660 d->firingEventIterators->at(i).end = 0; | 675 d->firingEventIterators->at(i).end = 0; |
| 661 } | 676 } |
| 662 } | 677 } |
| 663 } | 678 } |
| 664 | 679 |
| 665 } // namespace blink | 680 } // namespace blink |
| OLD | NEW |