In bug 1356705, we switched scrollbox to use CSS smooth scroll when
the scrollbox is configured to scroll smoothly. This caused the tab
strip to scroll with a "pulse" when using the arrow scrollbuttons.
This is because we scroll by a single tab each time, as opposed to
scrolling by pixels.
This reverts part of bug 1356705 so that we use instant scrolling
instead of smooth scrolling in the scrollbuttons case, which returns
the original behaviour of the strip without the pulse.
MozReview-Commit-ID: D8QQ8kQ7AjM
Touchmove and wheel events are sent frequently enough that smooth scroll behavior
prevents the expected pixel distance from being reached before the next event.
Also replace aSmoothScroll parameters with aInstant to better reflect how this
works: its purpose is to force instant scrolling, whereas omitting it falls back
to "auto" (which may mean instant or smooth depending on different factors).
The ensureElementIsVisible call from browser-customization.js can go away as
customize mode doesn't add padding around the window anymore.
Finally, remove the unused scrollPosition and scrollPaddingRect properties.
MozReview-Commit-ID: 3Ac7g6zZ0hW
The scroll destination of the smooth scroller of <scrollbox> can be outside of the actual scrollable range. Therefore, it doesn't make scroll slower even when the end appears.
This patch makes the destination always in the scrollable range.
MozReview-Commit-ID: CfEGzhG7Jh7
Currently, <scrollbox>.lineScrollAmount returns its font height. However, according to the other methods, <scrollbox> is designed for scrolling elements in it. Additionally, old implementation declared that1 line is 1 element. Therefore, this patch makes it returns avarage width or height of the children.
MozReview-Commit-ID: E9qfhHy5sTt
<scrollbox> should scroll its contents smoothly even if wheel device doesn't support high resolution scroll.
This patch makes the wheel event handler use |_smoothScrollByPixels| when deltaMode is DOM_DELTA_LINE or DOM_DELTA_PAGE. The reason why ignoring DOM_DELTA_PIXEL is, such devices are typically supports high resolution scroll. Therefore, <scrollbox> doesn't need to animate its scroll by itself.
However, |_smoothScrollByPixels| doesn't work fine without some additional fixes.
First, this patch doesn't stop pending scroll from |_smoothScrollByPixels| because discarding some pending scroll causes slower scroll. Actually, when you turn mouse wheel faster, scroll amount becomes smaller without this fix.
Next, this patch adds continous scroll mode to |_scrollAnim| object. If it's requested new animation during processing previous scroll, it keeps previous scroll amount and restart animation with new destination. Additionally, accumulating the scroll distance as fractional value. Therefore, it scrolls 3px when 1.5px scroll is requested twice.
Finally, this patch discards pending scrolls when user tries to scroll to reverse direction. When user tries to scroll to reserse direction, the user must want to scroll the contents from current position rather than actual scroll destination. Therefore, this patch discards pending scrolls in |_smoothScrollByPixels|. Although, it might be better to handle this in |_scrollAnim|. However, |_isScrolling| is not managed by it and changing the behavior in private method is safer than changing utility object (i.e., |_scrollAnim|).
Additionally, this patch fixes timestamp issue at callback of requestAnimationFrame(). Sometimes, the given timestamp is older than start time. In that case, current code scrolls to reverse diretion. Therefore, we should treat such old timestamp as same as start time.
MozReview-Commit-ID: DluWUN2VhVw
Similar to the previous patch, "wheel" event should use |.scrollByPixels()| instead of |.scrollByPages()| because |.scrollByPages()| doesn't support high resolution delta value.
This patch makes the "wheel" event handler of <scrollbox> use |.scrollByPixels()| at handling "wheel" events whose deltaMode is DOM_DELTA_PAGE and multiplies the delta value and |.scrollClientSize|.
MozReview-Commit-ID: 1nyD7niiq3W
Currently, ths "wheel" event handler of <scrollbox> uses |.scrollByIndex()|. However, it scrolls too fast when "wheel" event has high resolution delta value when its deltaMode is DOM_DELTA_LINE.
For respecting the delta value, it should use |.scrollByPixels()|. Therefore, this patch implements new readonly property, |.lineScrollAmount|, which returns font size of the |.scrollbox| and makes "wheel" event handler multiplies the delta value and |.lineScrollAmount|.
MozReview-Commit-ID: KzIvJyxqrn5