Closed Bug 1320609 Opened 9 years ago Closed 9 years ago

tabbar should scroll smoothly even when wheel device doesn't support high resolution scroll

Categories

(Toolkit :: UI Widgets, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla53
Tracking Status
firefox50 --- unaffected
firefox51 --- unaffected
firefox52 --- unaffected
firefox53 + fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

(Keywords: regression)

Attachments

(2 files)

Currently, <scrollbox>.scrollByPixels doesn't support smooth scroll, but wheel event handler always use it even when wheel event's deltaMode is DOM_DELTA_MODE_LINE or DOM_DELTA_MODE_PAGE. This causes uncomfortable scroll.
[Tracking Requested - why for this release]: regression from bug 1316505 on devices that don't support high-resolution scrolling (that's a lot of devices)
Component: Tabbed Browser → XUL Widgets
Product: Firefox → Toolkit
Priority: -- → P1
Sigh. I'm struggling with test_mousescroll.xul since it's not smooth scroll aware and only on macOS, it times out... https://treeherder.mozilla.org/#/jobs?repo=try&revision=0c85631bc9ffa800ab17cf6ba04cf3262d13c5ad
I give up to fix the odd orange on macOS. It's caused by setting scrollPosition which doesn't work well only during the test. For example, in my environment, the arrowscrollbox#hscrollbox's scrollSize is 326. However, setting scrollPosition to any big value nor retrying to set it to same value again sets 266. I don't understand what happens. With Trackpad, it can be scrolled to right-most and then the test restarts. I don't have much time to investigating it for now and the test works fine on the other platforms. So, using todo_is() should be enough for now.
Comment on attachment 8816059 [details] Bug 1320609 part.1 wheel event handler of <scrollbox> should use |_smoothScrollByPixels| instead of |scrollByPixels| when the deltaMode is DOM_DELTA_LINE or DOM_DELTA_PAGE Calling _smoothScrollByPixels like this means that you'll ignore the smoothscroll attribute and toolkit.scrollbox.smoothScroll pref. nit: rename toScroll to scrollDirection The code you added in _scrollAnim could use a few blank lines for better structuring and readability.
Attachment #8816059 - Flags: review?(mstange) → review-
Tracking 53+ for the reasons in Comment 1.
Comment on attachment 8816059 [details] Bug 1320609 part.1 wheel event handler of <scrollbox> should use |_smoothScrollByPixels| instead of |scrollByPixels| when the deltaMode is DOM_DELTA_LINE or DOM_DELTA_PAGE https://reviewboard.mozilla.org/r/96842/#review99498 This is pretty good! I'm not completely convinced on the "discard destination when scrolling backwards" argument, but I'll leave it up to you to decide whether to leave it in or to drop it. I also don't really like the fact that we have all three of .startPos, .distance and .destination, where just .startPos and .destination would have sufficed to express the same information. But that's not the end of the world, and I can see how changing it would make the code harder to read in some places. ::: toolkit/content/widgets/scrollbox.xml:312 (Diff revision 2) > + // However, if the scroll direction is changed, let's cancel the > + // pending scroll because user must want to scroll from current > + // position. > + if (this._isScrolling && this._isScrolling != scrollDirection) > - this._stopSmoothScroll(); > + this._stopSmoothScroll(); I'm not convinced of this argument. It might make sense, but it also breaks symmetry - if you quickly scroll back and forth, then you'll and up scrolling slightly backwards instead of ending up at your starting position. ::: toolkit/content/widgets/scrollbox.xml:318 (Diff revision 2) > if (amountToScroll == 0) > return; I'd put this if at the very start, so that we don't accidentally reset smooth scrolls for zero-delta events. I know that that's what the old code was doing, but I don't think it's a good idea.
Attachment #8816059 - Flags: review?(mstange) → review+
Comment on attachment 8816060 [details] Bug 1320609 part.2 Rewrite test_mousescroll.xul with generator for async-scroll-aware https://reviewboard.mozilla.org/r/96844/#review99510 ::: toolkit/content/tests/chrome/test_mousescroll.xul:234 (Diff revision 2) > + if (getPos() == expected) { > + return true; > + } > + if (oldPos == getPos()) { > + // If scroll stopped completely, let's continue the test. > + return ++retry == 5; Maybe pull the 5 out into a MAX_RETRY_COUNT constant.
Attachment #8816060 - Flags: review?(mstange) → review+
Masayuki, we looked at this during regression triage today and thought we'd ping you about landing this fix.
Flags: needinfo?(masayuki)
I'd like to try to land this tonight, but I'm not sure if it's possible. Sorry for the delay due to some trouble of my machine and business trip.
Flags: needinfo?(masayuki)
Comment on attachment 8816059 [details] Bug 1320609 part.1 wheel event handler of <scrollbox> should use |_smoothScrollByPixels| instead of |scrollByPixels| when the deltaMode is DOM_DELTA_LINE or DOM_DELTA_PAGE https://reviewboard.mozilla.org/r/96842/#review101002 ::: toolkit/content/widgets/scrollbox.xml:312 (Diff revision 2) > + // However, if the scroll direction is changed, let's cancel the > + // pending scroll because user must want to scroll from current > + // position. > + if (this._isScrolling && this._isScrolling != scrollDirection) > - this._stopSmoothScroll(); > + this._stopSmoothScroll(); > but it also breaks symmetry Yes, I intentionally do it. If the process is busy, delayed scroll is very annoying. > if you quickly scroll back and forth, then you'll > and up scrolling slightly backwards instead of > ending up at your starting position. Indeed. However, I don't think that users manage scroll position so strictly in their brain. So, if this behavior makes users feel bad, I have another option. That is, we can skip the animation and restart animation from old destination. But I feel this is odd behavior. Anyway, I'd like to check feedback from users if this makes users feel bad. ::: toolkit/content/widgets/scrollbox.xml:318 (Diff revision 2) > if (amountToScroll == 0) > return; Okay. Basically, 0 delta wheel events shouldn't be fired. See here. https://dxr.mozilla.org/mozilla-central/rev/10a5e2fc24e4e24fbe115fb190bcc28df4627ee2/widget/WidgetEventImpl.cpp#373,396,400-401 So, moving this check to the start shouldn't change anything actually.
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/83bfdbcc5018 part.1 wheel event handler of <scrollbox> should use |_smoothScrollByPixels| instead of |scrollByPixels| when the deltaMode is DOM_DELTA_LINE or DOM_DELTA_PAGE r=mstange https://hg.mozilla.org/integration/autoland/rev/9fc13b45970a part.2 Rewrite test_mousescroll.xul with generator for async-scroll-aware r=mstange
Setting qe-verify- since this fix seems to have automated coverage. Masayuki, if you think manual QA should instead be looking at this, feel free to flip the flag or ni? me.
Flags: qe-verify-
Depends on: 1351466
Depends on: 1349828
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: