New issue
Advanced search Search tips

Issue 679828 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug



Sign in to add a comment

PointerEventManager fires PointerEvents even when there's no listener

Project Member Reported by mustaq@chromium.org, Jan 10 2017

Issue description

Seems PointerEventManager::dispatchPointerEvent doesn't check for event listeners (checkForListener = false) by default for all events except for pointerenter/leave. Only enter/leave events dispatchers provide explicit checkForListener values.

This is a bit of extra work for all other events, and contributes to unnecessary use-counts for PointerEventDispatch & PointerEventDispatchPointerDown.

We have changed this code quite a few times but the original intention is unchanged IIRC: except for enter/leave, we want to follow regular checks.

Navid, could you please take a look?

 
I do recall changing this code. The original code was to only check for the existence of listener for leave/enter and if there was one then fire them. But always fire it for other types which it is right now. So what is the plan now? Always check for the existence of the listener then?

Comment 2 by mustaq@chromium.org, Jan 10 2017

For enter/leave, we are checking for listeners separately (further upstream in the event path) so I am pretty sure we won't change it.

For other events, I don't recall why we had no listener checks. Is it because there could be a capturing listener in an ancestor node?
I don't know the original reason to be honest with you. I just tried to keep the behavior the same and not to break the existing code. Rick do you know any particular reason?

For the Leave/Enter if this is what you are referring to this is not that further up in the stack:

https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/input/BoundaryEventDispatcher.cpp?sq=package:chromium&dr=CSs&rcl=1484065239&l=111

Event there I didn't quite understand why the logic was like that.

Comment 4 by mustaq@chromium.org, Jan 11 2017

The EventTarget dispatch code already checks for listeners, so my comment about "a bit of extra work" is useless here since one more function call is nothing.

UMA counting is clearly wrong: let's move it to around EventTarget::fireEventListeners where the listener check is done.

---

Re enter/leave checks: a code health question just came to me. We could have checked for listeners for these two dispatches before, and remove the checkForListener parameters. Not a big concern though.
Cc: nzolghadr@chromium.org
Owner: eirage@chromium.org
Project Member

Comment 7 by bugdroid1@chromium.org, Jun 7 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6026189765a3923e474f2431524199934c6b162d

commit 6026189765a3923e474f2431524199934c6b162d
Author: eirage <eirage@chromium.org>
Date: Wed Jun 07 20:14:41 2017

Bookkeep the pointer event listeners added to page

Check if the page has pointer event listeners
before firing the pointer events.

BUG= 679828 

Review-Url: https://codereview.chromium.org/2916893003
Cr-Commit-Position: refs/heads/master@{#477743}

[add] https://crrev.com/6026189765a3923e474f2431524199934c6b162d/third_party/WebKit/LayoutTests/fast/events/pointerevents/pointer-handler-count.html
[modify] https://crrev.com/6026189765a3923e474f2431524199934c6b162d/third_party/WebKit/LayoutTests/inspector/tracing/timeline-misc/timeline-event-dispatch-expected.txt
[modify] https://crrev.com/6026189765a3923e474f2431524199934c6b162d/third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp
[modify] https://crrev.com/6026189765a3923e474f2431524199934c6b162d/third_party/WebKit/Source/core/frame/EventHandlerRegistry.h
[modify] https://crrev.com/6026189765a3923e474f2431524199934c6b162d/third_party/WebKit/Source/core/html/forms/SliderThumbElement.cpp
[modify] https://crrev.com/6026189765a3923e474f2431524199934c6b162d/third_party/WebKit/Source/core/input/PointerEventManager.cpp
[modify] https://crrev.com/6026189765a3923e474f2431524199934c6b162d/third_party/WebKit/Source/core/testing/Internals.cpp
[modify] https://crrev.com/6026189765a3923e474f2431524199934c6b162d/third_party/WebKit/Source/core/testing/Internals.h
[modify] https://crrev.com/6026189765a3923e474f2431524199934c6b162d/third_party/WebKit/Source/core/testing/Internals.idl

Status: Fixed (was: Assigned)
Cc: eirage@chromium.org
 Issue 661265  has been merged into this issue.

Sign in to add a comment