Closed
Bug 1445419
Opened 7 years ago
Closed 7 years ago
AsyncPanZoomController::CanScroll mistakenly called CanScrollWithWheel without distinguishing between wheel scrolling and non-wheel scrolling
Categories
(Core :: DOM: Events, defect)
Core
DOM: Events
Tracking
()
RESOLVED
FIXED
mozilla61
| Tracking | Status | |
|---|---|---|
| firefox61 | --- | fixed |
People
(Reporter: zjz, Assigned: zjz)
Details
Attachments
(1 file)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0
Build ID: 20180123231643
| Assignee | ||
Comment 1•7 years ago
|
||
Scrollablab doesn't mean exactly the same thing as wheel-scrollable.
However, in AsyncPanZoomController, CanScroll(const InputData& aEvent) mistakenly calls CanScrollWithWheel without distinguishing between wheel scrolling and non-wheel scrolling, which can potentially lead to wrong APZC targets during the hittesting stage.
| Comment hidden (mozreview-request) |
Comment 3•7 years ago
|
||
| mozreview-review | ||
Comment on attachment 8958597 [details]
Bug 1445419 - Makes AsyncPanZoomController::CanScroll distinguish between wheel scrolling and non-wheel scrolling
https://reviewboard.mozilla.org/r/227504/#review233432
::: commit-message-00ef5:1
(Diff revision 1)
> +Bug 1445419 - Tiny fix. Makes AsyncPanZoomController::CanScroll distinguish between wheel scrolling and non-wheel scrolling r?kats
Drop the "Tiny fix" sentence from the commit message
::: gfx/layers/apz/src/AsyncPanZoomController.cpp:1981
(Diff revision 1)
> }
>
> bool
> +AsyncPanZoomController::CanScroll(const ParentLayerPoint& aDelta) const
> +{
> + return mX.CanScroll(aDelta.x) || mY.CanScroll(aDelta.y);
This needs to hold the mRecursiveMutex here, same as CanScrollWithWheel. Otherwise looks good.
Attachment #8958597 -
Flags: review?(bugmail) → review+
| Assignee | ||
Comment 4•7 years ago
|
||
| mozreview-review-reply | ||
Comment on attachment 8958597 [details]
Bug 1445419 - Makes AsyncPanZoomController::CanScroll distinguish between wheel scrolling and non-wheel scrolling
https://reviewboard.mozilla.org/r/227504/#review233432
> This needs to hold the mRecursiveMutex here, same as CanScrollWithWheel. Otherwise looks good.
Maybe I missed something, but I am a little confused.
The comment for |mRecursiveMutex| doesn't mention that it protects |mX| and |mY|, is the comment outdated or unintentionally omissive that needs to be updated?
// Protects |mFrameMetrics|, |mLastContentPaintMetrics|, and |mState|.
// Before manipulating |mFrameMetrics| or |mLastContentPaintMetrics|, the
// monitor should be held. When setting |mState|, either the SetState()
// function can be used, or the monitor can be held and then |mState| updated.
// IMPORTANT: See the note about lock ordering at the top of APZCTreeManager.h.
// This is mutable to allow entering it from 'const' methods; doing otherwise
// would significantly limit what methods could be 'const'.
mutable RecursiveMutex mRecursiveMutex;
| Assignee | ||
Comment 5•7 years ago
|
||
> This needs to hold the mRecursiveMutex here, same as CanScrollWithWheel.
> Otherwise looks good.
I read every |mX| and |mY| in |AsyncPanZoomController|, and find that most of them do hold |mRecursiveMutex|, but there are exceptions:
const ParentLayerPoint AsyncPanZoomController::GetVelocityVector() const {
return ParentLayerPoint(mX.GetVelocity(), mY.GetVelocity());
}
void AsyncPanZoomController::SetVelocityVector(const ParentLayerPoint& aVelocityVector) {
mX.SetVelocity(aVelocityVector.x);
mY.SetVelocity(aVelocityVector.y);
}
So I am wondering what is the specific rule on when we should hold |mRecursiveMutex|.
Comment 6•7 years ago
|
||
Axis::CanScroll(ParentLayerCoord) calls Axis::CanScroll() [1] which calls Axis::GetPageLength() [2] which calls Axis::GetFrameMetrics() [3] which calls AsyncPanZoomController::GetFrameMetrics() [4] which asserts that we have the mutex [5]. So somewhere along this call stack the mutex needs to be held. It's not that it needs to be held for *any* call into mX or mY, but some calls. (And yeah, this is gross, and if you want to do cleanup on this, you're welcome to, but it would be better to defer that until after you're done the autodir changes, or it will be a big distraction.)
[1] https://searchfox.org/mozilla-central/rev/8fa0b32c84f924c6809c690117dbd59591f79607/gfx/layers/apz/src/Axis.cpp#347
[2] https://searchfox.org/mozilla-central/rev/8fa0b32c84f924c6809c690117dbd59591f79607/gfx/layers/apz/src/Axis.cpp#342
[3] https://searchfox.org/mozilla-central/rev/8fa0b32c84f924c6809c690117dbd59591f79607/gfx/layers/apz/src/Axis.cpp#481
[4] https://searchfox.org/mozilla-central/rev/8fa0b32c84f924c6809c690117dbd59591f79607/gfx/layers/apz/src/Axis.cpp#493
[5] https://searchfox.org/mozilla-central/rev/99df6dad057b94c2ac4d8b12f7b0b3a7fdf25d04/gfx/layers/apz/src/AsyncPanZoomController.cpp#4038
| Comment hidden (mozreview-request) |
| Assignee | ||
Comment 8•7 years ago
|
||
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #6)
> Axis::CanScroll(ParentLayerCoord) calls Axis::CanScroll() [1] which calls
> Axis::GetPageLength() [2] which calls Axis::GetFrameMetrics() [3] which
> calls AsyncPanZoomController::GetFrameMetrics() [4] which asserts that we
> have the mutex [5]. So somewhere along this call stack the mutex needs to be
> held. It's not that it needs to be held for *any* call into mX or mY, but
> some calls. (And yeah, this is gross, and if you want to do cleanup on this,
> you're welcome to, but it would be better to defer that until after you're
> done the autodir changes, or it will be a big distraction.)
>
> [1]
> https://searchfox.org/mozilla-central/rev/
> 8fa0b32c84f924c6809c690117dbd59591f79607/gfx/layers/apz/src/Axis.cpp#347
> [2]
> https://searchfox.org/mozilla-central/rev/
> 8fa0b32c84f924c6809c690117dbd59591f79607/gfx/layers/apz/src/Axis.cpp#342
> [3]
> https://searchfox.org/mozilla-central/rev/
> 8fa0b32c84f924c6809c690117dbd59591f79607/gfx/layers/apz/src/Axis.cpp#481
> [4]
> https://searchfox.org/mozilla-central/rev/
> 8fa0b32c84f924c6809c690117dbd59591f79607/gfx/layers/apz/src/Axis.cpp#493
> [5]
> https://searchfox.org/mozilla-central/rev/
> 99df6dad057b94c2ac4d8b12f7b0b3a7fdf25d04/gfx/layers/apz/src/
> AsyncPanZoomController.cpp#4038
Thank you for the information. I am not going to find all the gross relationship, I think due to the complicated relationship the list may be hard to maintain, I would prefer adding a comment alerting the indirect usage of those mRecursiveMutex-protected members when I am reforming the patch for autodir scrolling.
Pushed by kgupta@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/391be7bb77bc
Makes AsyncPanZoomController::CanScroll distinguish between wheel scrolling and non-wheel scrolling r=kats
Comment 10•7 years ago
|
||
| bugherder | ||
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
status-firefox61:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
Updated•7 years ago
|
Assignee: nobody → zjz
You need to log in
before you can comment on or make changes to this bug.
Description
•