Closed Bug 1159985 Opened 9 years ago Closed 9 years ago

Flinging doesn't always work on desktop

Categories

(Core :: Panning and Zooming, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
firefox40 --- affected
firefox41 --- fixed

People

(Reporter: botond, Assigned: botond)

References

Details

Attachments

(3 files, 1 obsolete file)

STR:
  1. Get touch events to drive APZ on Linux. To do this:
        - Apply the patch in bug 978679.
        - Modify the call to DispatchEvent in nsWindow::OnTouchEvent
          to be DispatchAPZAwareEvent.
        - Build with '--enable-default-toolkit=cairo-gtk3'
        - Turn on the 'layers.async-pan-zoom.enabled' and
          'dom.w3c_touch_events.enabled' prefs.
  2. Load a scrollable page, such as http://people.mozilla.org/~bballo/grid.html
  3. Fling the page.

Expected results:
  Flinging always works.

Actual results:
  Sometimes the page comes to an abrupt halt after lifting the finger.

I will investigate.
Investigation revealed the following:

  - The problem occurs when the fling velocity has a component in a direction
    in which we have no room to scroll. For example, if you fling up and to
    the right, and you're already at the left edge of the page.

  - The problem is not specific to desktop, but on B2G it's largely covered 
    up by axis locking being enabled, which makes it such that you rarely
    end up in the situation described above.

The problem arises because in this scenario, the fling goes into overscroll and is handed off right away. If there is no one to hand off to, or the thing handed off can't scroll in the intended direction (e.g. vertically), then no kinetic motion occurs.

We could paper over this by tweaking the velocity-dropping code here [1] yet again, but it wouldn't handle all scenarios (for example, it wouldn't handle the scenario where you're *near* the left edge of the page when you start the fling; in that case, the fling would start but then abruptly stop when you reach the left edge).

I would like to propose finally implementing what I believe is the proper solution here: partial handoff, where we hand off just the component of the fling that's in overscroll, and keep the other component in the original APZC (if the other component isn't also in overscroll). Kats, any objections to this, or other thoughts on this topic?

[1] http://mxr.mozilla.org/mozilla-central/source/gfx/layers/apz/src/AsyncPanZoomController.cpp?rev=262243fb509a#439
Flags: needinfo?(bugmail.mozilla)
That sounds fine to me.
Flags: needinfo?(bugmail.mozilla)
Attached file MozReview Request: bz://1159985/botond (obsolete) —
/r/8621 - Bug 1159985 - If only one component of a fling is in overscroll, continue the fling in the other component. r=kats
/r/8623 - Bug 1159985 - In APZ gtests, allow panning in both directions. r=kats
/r/8625 - Bug 1159985 - Gtest. r=kats

Pull down these commits:

hg pull -r 99987406ab48814fc9c3f04bb9ffa163b62c0464 https://reviewboard-hg.mozilla.org/gecko/
These are WIP patches for implementing partial fling handoff. They need more testing.
Attachment #8604433 - Flags: review?(bugmail.mozilla)
Comment on attachment 8604433 [details]
MozReview Request: bz://1159985/botond

/r/8621 - Bug 1159985 - If only one component of a fling is in overscroll, continue the fling in the other component. r=kats
/r/8623 - Bug 1159985 - In APZ gtests, allow panning in both directions. r=kats
/r/8625 - Bug 1159985 - Gtest. r=kats

Pull down these commits:

hg pull -r 99987406ab48814fc9c3f04bb9ffa163b62c0464 https://reviewboard-hg.mozilla.org/gecko/
Tested the patches on desktop and B2G. They seem to fix the issue on desktop, while not breaking anything obviously on b2g.
Comment on attachment 8604433 [details]
MozReview Request: bz://1159985/botond

https://reviewboard.mozilla.org/r/8619/#review7513

::: gfx/layers/apz/src/AsyncPanZoomController.h:530
(Diff revision 1)
> +  void SetVelocityVector(const ParentLayerPoint& aVelocityVector);

Doesn't look like this function is used anywhere. Remove?
Attachment #8604433 - Flags: review?(bugmail.mozilla) → review+
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #7)
> ::: gfx/layers/apz/src/AsyncPanZoomController.h:530
> (Diff revision 1)
> > +  void SetVelocityVector(const ParentLayerPoint& aVelocityVector);
> 
> Doesn't look like this function is used anywhere. Remove?

Ah, yes - this was used in an older version of the patch, and then the use was removed. Thanks for catching it.

(I also just realized that with this removed, this basically ended up being a one-line fix :)).
Attachment #8604433 - Attachment is obsolete: true
Attachment #8620196 - Flags: review+
Attachment #8620197 - Flags: review+
Attachment #8620198 - Flags: review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: