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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 409 if (LocalDOMWindow* executingWindow = this->executingWindow()) | 409 if (LocalDOMWindow* executingWindow = this->executingWindow()) |
| 410 UseCounter::count(executingWindow->document(), UseCounter::DOMFocusI nOutEvent); | 410 UseCounter::count(executingWindow->document(), UseCounter::DOMFocusI nOutEvent); |
| 411 } else if (event->type() == EventTypeNames::focusin || event->type() == Even tTypeNames::focusout) { | 411 } else if (event->type() == EventTypeNames::focusin || event->type() == Even tTypeNames::focusout) { |
| 412 if (LocalDOMWindow* executingWindow = this->executingWindow()) | 412 if (LocalDOMWindow* executingWindow = this->executingWindow()) |
| 413 UseCounter::count(executingWindow->document(), UseCounter::FocusInOu tEvent); | 413 UseCounter::count(executingWindow->document(), UseCounter::FocusInOu tEvent); |
| 414 } else if (event->type() == EventTypeNames::textInput) { | 414 } else if (event->type() == EventTypeNames::textInput) { |
| 415 if (LocalDOMWindow* executingWindow = this->executingWindow()) | 415 if (LocalDOMWindow* executingWindow = this->executingWindow()) |
| 416 UseCounter::count(executingWindow->document(), UseCounter::TextInput Fired); | 416 UseCounter::count(executingWindow->document(), UseCounter::TextInput Fired); |
| 417 } | 417 } |
| 418 | 418 |
| 419 ExecutionContext* context = getExecutionContext(); | |
| 420 if (!context) | |
| 421 return; | |
| 422 | |
| 419 size_t i = 0; | 423 size_t i = 0; |
| 420 size_t size = entry.size(); | 424 size_t size = entry.size(); |
| 421 if (!d->firingEventIterators) | 425 if (!d->firingEventIterators) |
| 422 d->firingEventIterators = adoptPtr(new FiringEventIteratorVector); | 426 d->firingEventIterators = adoptPtr(new FiringEventIteratorVector); |
| 423 d->firingEventIterators->append(FiringEventIterator(event->type(), i, size)) ; | 427 d->firingEventIterators->append(FiringEventIterator(event->type(), i, size)) ; |
| 428 | |
| 429 bool shouldReportBlockedEvent = InspectorInstrumentation::shouldReportBlocke dEvent(context, event); | |
|
pfeldman
2016/05/04 22:58:01
Lets instead call EventTarget::logBlockedEventsToC
| |
| 430 double eventBlockedTime = shouldReportBlockedEvent ? WTF::monotonicallyIncre asingTime() - event->platformTimeStamp() : 0; | |
| 431 | |
| 424 while (i < size) { | 432 while (i < size) { |
| 425 RegisteredEventListener& registeredListener = entry[i]; | 433 RegisteredEventListener& registeredListener = entry[i]; |
| 426 | 434 |
| 427 // Move the iterator past this event listener. This must match | 435 // Move the iterator past this event listener. This must match |
| 428 // the handling of the FiringEventIterator::iterator in | 436 // the handling of the FiringEventIterator::iterator in |
| 429 // EventTarget::removeEventListener. | 437 // EventTarget::removeEventListener. |
| 430 ++i; | 438 ++i; |
| 431 | 439 |
| 432 if (event->eventPhase() == Event::CAPTURING_PHASE && !registeredListener .useCapture) | 440 if (event->eventPhase() == Event::CAPTURING_PHASE && !registeredListener .useCapture) |
| 433 continue; | 441 continue; |
| 434 if (event->eventPhase() == Event::BUBBLING_PHASE && registeredListener.u seCapture) | 442 if (event->eventPhase() == Event::BUBBLING_PHASE && registeredListener.u seCapture) |
| 435 continue; | 443 continue; |
| 436 | 444 |
| 437 // If stopImmediatePropagation has been called, we just break out immedi ately, without | 445 // If stopImmediatePropagation has been called, we just break out immedi ately, without |
| 438 // handling any more events on this target. | 446 // handling any more events on this target. |
| 439 if (event->immediatePropagationStopped()) | 447 if (event->immediatePropagationStopped()) |
| 440 break; | 448 break; |
| 441 | 449 |
| 442 ExecutionContext* context = getExecutionContext(); | |
| 443 if (!context) | |
| 444 break; | |
| 445 | |
| 446 event->setHandlingPassive(registeredListener.passive); | 450 event->setHandlingPassive(registeredListener.passive); |
| 447 | 451 |
| 448 InspectorInstrumentation::NativeBreakpoint nativeBreakpoint(context, thi s, event); | 452 InspectorInstrumentation::NativeBreakpoint nativeBreakpoint(context, thi s, event); |
| 449 | 453 |
| 450 // To match Mozilla, the AT_TARGET phase fires both capturing and bubbli ng | 454 // To match Mozilla, the AT_TARGET phase fires both capturing and bubbli ng |
| 451 // event listeners, even though that violates some versions of the DOM s pec. | 455 // event listeners, even though that violates some versions of the DOM s pec. |
| 452 registeredListener.listener->handleEvent(context, event); | 456 registeredListener.listener->handleEvent(context, event); |
| 457 | |
| 458 if (shouldReportBlockedEvent && !registeredListener.passive && !register edListener.blockedEventWarningEmitted && !event->defaultPrevented()) | |
| 459 InspectorInstrumentation::reportBlockedEvent(context, event, ®ist eredListener, eventBlockedTime); | |
| 460 | |
| 453 event->setHandlingPassive(false); | 461 event->setHandlingPassive(false); |
| 454 | 462 |
| 455 RELEASE_ASSERT(i <= size); | 463 RELEASE_ASSERT(i <= size); |
| 456 } | 464 } |
| 457 d->firingEventIterators->removeLast(); | 465 d->firingEventIterators->removeLast(); |
| 458 } | 466 } |
| 459 | 467 |
| 460 DispatchEventResult EventTarget::dispatchEventResult(const Event& event) | 468 DispatchEventResult EventTarget::dispatchEventResult(const Event& event) |
| 461 { | 469 { |
| 462 if (event.defaultPrevented()) | 470 if (event.defaultPrevented()) |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 491 // they have one less listener to invoke. | 499 // they have one less listener to invoke. |
| 492 if (d->firingEventIterators) { | 500 if (d->firingEventIterators) { |
| 493 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { | 501 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { |
| 494 d->firingEventIterators->at(i).iterator = 0; | 502 d->firingEventIterators->at(i).iterator = 0; |
| 495 d->firingEventIterators->at(i).end = 0; | 503 d->firingEventIterators->at(i).end = 0; |
| 496 } | 504 } |
| 497 } | 505 } |
| 498 } | 506 } |
| 499 | 507 |
| 500 } // namespace blink | 508 } // namespace blink |
| OLD | NEW |