Closed Bug 668502 Opened 13 years ago Closed 13 years ago

scrolling tree scrolls container a bit the first time

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: enndeakin, Unassigned)

Details

Attachments

(1 file)

2.37 KB, application/vnd.mozilla.xul+xml
Details
Attached file testcase
Steps:

1. Make sure the patch for bug 655004 is applied.
2. Open the testcase and mousescroll (I'm using the two-finger scroll on the mac trackpad) over the tree.
3. The tree scrolls but the container also scrolls a couple of pixels.

This issue only occurs the first time scrolling is done. It sometimes doesn't happen at all though.

It seems that the oddity relates to the nsEventStateManager::mLastLineScrollConsumedY field. It is a value that, if set, cancels the event. It defaults to false, but is set to true after the first scroll, causing different behaviour -- the event is cancelled/consumed before the event even gets to the node at http://mxr.mozilla.org/mozilla-central/source/content/events/src/nsEventStateManager.cpp#1308

I'm unclear what this code is trying to accomplish. It seems broken.
If the tree wants to preventDefault all scroll events, then it also needs to call preventDefault on MozMousePixelScroll events, not only on DOMMouseScroll events.

The first DOMMouseScroll event of a scroll motion is only sent after a small threshold. If this threshold didn't exist, touchpad tree scrolling would probably feel more erratic because it'd be easier to trigger.
Did that answer the question? Should I elaborate more?

And if you have a better idea of how to deal with the problem, I'm all ears :)
I'm not really clear what the exact meaning or difference between these two events is. Is there some documentation on this somewhere?
There's https://developer.mozilla.org/en/Gecko-Specific_DOM_Events#MozMousePixelScroll and the code comment it links to.

MozMousePixelScroll is sent for every pixel scroll, i.e. it's the most fine-grained touchpad scroll event. DOMMouseScroll is only sent every several pixels (maybe about 15) for things that want to scroll row-wise instead of pixel-wise, for example trees. If a tree scrolled one row for every touchpad MozMousePixelScroll event, scrolling would be way too fast.
For the complete, long-winded and repetitive discussion see bug 350471.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → WONTFIX
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: