Closed
Bug 892684
Opened 12 years ago
Closed 11 years ago
Work - Implement axis locking for panning in APZC
Categories
(Core :: Graphics: Layers, defect)
Core
Graphics: Layers
Tracking
()
RESOLVED
FIXED
mozilla27
People
(Reporter: bbondy, Assigned: mbrubeck)
References
Details
Attachments
(3 files, 3 obsolete files)
5.24 KB,
patch
|
kats
:
review+
|
Details | Diff | Splinter Review |
5.92 KB,
text/plain
|
Details | |
22.40 KB,
patch
|
kats
:
review+
botond
:
review+
|
Details | Diff | Splinter Review |
When panning up and down a page, it is very jittery left to right (within a few pixels). Before we enable APZC on Metro we need to fix this. To do this kats previously mentioned we should implement axis locking in gfx code.
From kats:
The Java code starts at http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/gfx/JavaPanZoomController.java#153 - look through the rest of the file for the mMode variable and you'll see the rest of it.
Reporter | ||
Updated•12 years ago
|
Blocks: metro-apzc
Reporter | ||
Updated•12 years ago
|
Summary: Implement axis locking for panning in APZC → Work -Implement axis locking for panning in APZC
Reporter | ||
Updated•12 years ago
|
Summary: Work -Implement axis locking for panning in APZC → Work - Implement axis locking for panning in APZC
Updated•12 years ago
|
Whiteboard: [preview]
Reporter | ||
Updated•12 years ago
|
No longer blocks: metro-apzc
Reporter | ||
Updated•12 years ago
|
Blocks: metrov2defect&change
Reporter | ||
Updated•11 years ago
|
Assignee: netzen → nobody
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → mbrubeck
Assignee | ||
Comment 1•11 years ago
|
||
This is the start of a direct port of the locking code from JavaPanZoomController. Not yet working correctly.
Assignee | ||
Comment 2•11 years ago
|
||
This is just some minor cleanup to reduce some boilerplate by changing GetFirstSingleTouch to return a ScreenIntPoint directly. This is totally optional; it just makes the next patch a bit less verbose. If you'd rather leave this as-is, that's fine.
This also fixes the Vim modeline comments to set 2-space indents like the Emacs ones (and the actual file indentation).
Attachment #812122 -
Attachment is obsolete: true
Attachment #812187 -
Flags: review?(bugmail.mozilla)
Assignee | ||
Comment 3•11 years ago
|
||
This is a direct port of all of the axis locking logic from JavaPanZoomController. It is disabled by default, so B2G won't be affected until they opt in.
Attachment #812188 -
Flags: review?(bugmail.mozilla)
Assignee | ||
Updated•11 years ago
|
Status: NEW → ASSIGNED
Updated•11 years ago
|
Attachment #812187 -
Flags: review?(bugmail.mozilla) → review+
Assignee | ||
Comment 4•11 years ago
|
||
I just noticed a couple of lines I missed in part 2. Uploading this separately for review purposes, but I'll fold it into part 2 before pushing.
Attachment #812315 -
Flags: review?(bugmail.mozilla)
Assignee | ||
Comment 5•11 years ago
|
||
Pushed to Try:
https://tbpl.mozilla.org/?tree=Try&rev=39c5fa32bb6f
Comment 6•11 years ago
|
||
Comment on attachment 812188 [details] [diff] [review]
part 2: port axis locking code from Android
Review of attachment 812188 [details] [diff] [review]:
-----------------------------------------------------------------
This looks ok to me, but I'd like to have Botond take a quick look at this as well to make sure it won't interfere with his overscroll handoff code. That code is new to APZC and doesn't have any equivalent in the JavaPanZoomController so I'm not sure if there will be tricky interactions there.
::: gfx/layers/ipc/AsyncPanZoomController.cpp
@@ +741,5 @@
> + mX.StartTouch(point.x);
> + mY.StartTouch(point.y);
> + mLastEventTime = aEvent.mTime;
> +
> + AxisLockMode mode = static_cast<AxisLockMode>(gAxisLockMode);
I'd prefer to add a private getAxisLockMode() function that returns a AxisLockMode, so as to hide the static_cast.
Attachment #812188 -
Flags: review?(bugmail.mozilla)
Attachment #812188 -
Flags: review?(botond)
Attachment #812188 -
Flags: review+
Updated•11 years ago
|
Attachment #812315 -
Flags: review?(bugmail.mozilla) → review+
Comment 7•11 years ago
|
||
Turning on axis locking on B2G and attempting to scroll results in a crash. Stack attached.
Comment 8•11 years ago
|
||
Comment on attachment 812188 [details] [diff] [review]
part 2: port axis locking code from Android
Review of attachment 812188 [details] [diff] [review]:
-----------------------------------------------------------------
::: gfx/layers/ipc/Axis.cpp
@@ +109,5 @@
> InitAxisPrefs();
> }
>
> void Axis::UpdateWithTouchAtDevicePoint(int32_t aPos, const TimeDuration& aTimeDelta) {
> + float newVelocity = Scrollable() ? (mPos - aPos) / aTimeDelta.ToMilliseconds() : 0;
Actually this call to Scrollable() is happening even if axis lock is turned off, and so crashes debug builds regardless of the pref. It should crash metro debug builds too, I think. Minusing for now.
Attachment #812188 -
Flags: review+ → review-
Assignee | ||
Comment 9•11 years ago
|
||
Comment on attachment 812790 [details]
Crash stack on B2G when axis locking is turned on
>#4 0x41b8da90 in mozilla::ReentrantMonitor::AssertCurrentThreadIn
>#5 mozilla::layers::AsyncPanZoomController::GetFrameMetrics
>#6 0x41b90ae8 in mozilla::layers::Axis::GetCompositionLength
>#7 0x41b90d90 in mozilla::layers::Axis::Scrollable
>#8 0x41b911b4 in mozilla::layers::Axis::UpdateWithTouchAtDevicePoint
So I guess I need to make sure anything that ends up calling Axis::Scrollable is protected by a ReentrantMonitorAutoEnter, right?
We could also avoid it in this particular case by using mScrollingDisabled instead of Scrollable.
I'm updating my debug Windows build to see if I can reproduce the assertion there.
Assignee | ||
Comment 10•11 years ago
|
||
This folds together the old "part 2" and "part 3" patches, addresses review comments, and fixes the assertion.
If you want to see an interdiff of the assertion fix alone, it is:
https://hg.mozilla.org/users/mbrubeck_mozilla.com/elm-patches/file/899c5789fafa/scrollable-assertion
Attachment #812188 -
Attachment is obsolete: true
Attachment #812315 -
Attachment is obsolete: true
Attachment #812188 -
Flags: review?(botond)
Attachment #812966 -
Flags: review?(bugmail.mozilla)
Attachment #812966 -
Flags: review?(botond)
Comment 11•11 years ago
|
||
Comment on attachment 812966 [details] [diff] [review]
part 2: port axis locking code from Android (v2)
Review of attachment 812966 [details] [diff] [review]:
-----------------------------------------------------------------
LGTM. I tested it on B2G and it doesn't crash any more. With axis locking turned on it's pretty hard to not do a pan that's not axis-locked, so that might need some tuning but we can do that if/when we turn it on on B2G by default.
Attachment #812966 -
Flags: review?(bugmail.mozilla) → review+
Comment 12•11 years ago
|
||
Comment on attachment 812966 [details] [diff] [review]
part 2: port axis locking code from Android (v2)
Review of attachment 812966 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good, doesn't seem to interfere with overscroll handoff. r=me with the requested documentation change.
::: gfx/layers/ipc/AsyncPanZoomController.cpp
@@ +758,5 @@
> angle = fabs(angle); // range [0, pi]
>
> + if (!mX.Scrollable() || !mY.Scrollable()) {
> + SetState(PANNING);
> + } else if (angle < AXIS_LOCK_ANGLE || angle > (M_PI - AXIS_LOCK_ANGLE)) {
Suggestion: factor these comparisons out into a function like IsCloseToHorizontal(angle) (and likewise for the vertical case).
::: gfx/layers/ipc/Axis.cpp
@@ +141,5 @@
> + if (mScrollingDisabled) {
> + aOverscrollAmountOut = 0;
> + return 0;
> + }
> +
Please update the comment describing what AdjustDisplacement() does (in Axis.h) to mention that it adjusts for axis locking too.
Attachment #812966 -
Flags: review?(botond) → review+
Assignee | ||
Comment 13•11 years ago
|
||
Thanks, guys! Pushed to Try again with review comments addressed:
https://tbpl.mozilla.org/?tree=Try&rev=e57ff24df4f8
Assignee | ||
Comment 14•11 years ago
|
||
https://hg.mozilla.org/integration/fx-team/rev/9fa7b7e3138b
https://hg.mozilla.org/integration/fx-team/rev/15da9a9ae411
Flags: in-testsuite?
OS: Windows 8 → All
Hardware: x86_64 → All
Assignee | ||
Comment 15•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/9fa7b7e3138b
https://hg.mozilla.org/mozilla-central/rev/15da9a9ae411
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
Comment 16•11 years ago
|
||
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #11)
> With axis locking
> turned on it's pretty hard to not do a pan that's not axis-locked
Whoops, too many negatives. I meant to say, "With axis locking turned on, it's hard to do a pan that's not axis locked". i.e. it's hard to hit that narrow pan angle window around 45deg where you don't get axis locked.
Updated•11 years ago
|
No longer blocks: metrov2defect&change, 915328
Whiteboard: [preview]
You need to log in
before you can comment on or make changes to this bug.
Description
•