зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1049109 - Clear overscroll along entire handoff chain at end of pinch. r=kats
--HG-- extra : rebase_source : fc10f5f0fd176fa91c825805f1180dc8af3f67ad
This commit is contained in:
Родитель
8fd17e2a57
Коммит
5af91ec9b3
|
@ -902,10 +902,6 @@ APZCTreeManager::DispatchScroll(AsyncPanZoomController* aPrev,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (next->GetGuid().mLayersId != aPrev->GetGuid().mLayersId) {
|
||||
NS_WARNING("Handing off scroll across a layer tree boundary; may need to revise approach to bug 1031067");
|
||||
}
|
||||
|
||||
// Convert the start and end points from |aPrev|'s coordinate space to
|
||||
// |next|'s coordinate space. Since |aPrev| may be the same as |next|
|
||||
// (if |aPrev| is the APZC that is initiating the scroll and there is no
|
||||
|
|
|
@ -1316,8 +1316,10 @@ nsEventStatus AsyncPanZoomController::OnScaleEnd(const PinchGestureInput& aEvent
|
|||
// that into a pinch by increasing the span sufficiently. In such a case,
|
||||
// there is no snap-back animation to get us out of overscroll, so we need
|
||||
// to get out of it somehow.
|
||||
mX.ClearOverscroll();
|
||||
mY.ClearOverscroll();
|
||||
// Moreover, in cases of scroll handoff, the overscroll can be on an APZC
|
||||
// further up in the handoff chain rather than on the current APZC, so
|
||||
// we need to clear overscroll along the entire handoff chain.
|
||||
CurrentTouchBlock()->GetOverscrollHandoffChain()->ClearOverscroll();
|
||||
|
||||
ScheduleComposite();
|
||||
RequestContentRepaint();
|
||||
|
@ -1897,14 +1899,19 @@ void AsyncPanZoomController::CancelAnimation() {
|
|||
// preempt normal mechanisms for relieving overscroll, so we need to clear
|
||||
// overscroll here.
|
||||
if (mX.IsOverscrolled() || mY.IsOverscrolled()) {
|
||||
mX.ClearOverscroll();
|
||||
mY.ClearOverscroll();
|
||||
ClearOverscroll();
|
||||
RequestContentRepaint();
|
||||
ScheduleComposite();
|
||||
UpdateSharedCompositorFrameMetrics();
|
||||
}
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::ClearOverscroll() {
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
mX.ClearOverscroll();
|
||||
mY.ClearOverscroll();
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::SetCompositorParent(CompositorParent* aCompositorParent) {
|
||||
mCompositorParent = aCompositorParent;
|
||||
}
|
||||
|
|
|
@ -288,12 +288,15 @@ public:
|
|||
void StartAnimation(AsyncPanZoomAnimation* aAnimation);
|
||||
|
||||
/**
|
||||
* Cancels any currently running animation. Note that all this does is set the
|
||||
* state of the AsyncPanZoomController back to NOTHING, but it is the
|
||||
* animation's responsibility to check this before advancing.
|
||||
* Cancels any currently running animation.
|
||||
*/
|
||||
void CancelAnimation();
|
||||
|
||||
/**
|
||||
* Clear any overscroll on this APZC.
|
||||
*/
|
||||
void ClearOverscroll();
|
||||
|
||||
/**
|
||||
* Returns allowed touch behavior for the given point on the scrollable layer.
|
||||
* Internally performs a kind of hit testing based on the regions constructed
|
||||
|
|
|
@ -61,21 +61,30 @@ OverscrollHandoffChain::IndexOf(const AsyncPanZoomController* aApzc) const
|
|||
}
|
||||
|
||||
void
|
||||
OverscrollHandoffChain::FlushRepaints() const
|
||||
OverscrollHandoffChain::ForEachApzc(APZCMethod aMethod) const
|
||||
{
|
||||
MOZ_ASSERT(Length() > 0);
|
||||
for (uint32_t i = 0; i < Length(); ++i) {
|
||||
mChain[i]->FlushRepaintForOverscrollHandoff();
|
||||
(mChain[i]->*aMethod)();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
OverscrollHandoffChain::FlushRepaints() const
|
||||
{
|
||||
ForEachApzc(&AsyncPanZoomController::FlushRepaintForOverscrollHandoff);
|
||||
}
|
||||
|
||||
void
|
||||
OverscrollHandoffChain::CancelAnimations() const
|
||||
{
|
||||
MOZ_ASSERT(Length() > 0);
|
||||
for (uint32_t i = 0; i < Length(); ++i) {
|
||||
mChain[i]->CancelAnimation();
|
||||
}
|
||||
ForEachApzc(&AsyncPanZoomController::CancelAnimation);
|
||||
}
|
||||
|
||||
void
|
||||
OverscrollHandoffChain::ClearOverscroll() const
|
||||
{
|
||||
ForEachApzc(&AsyncPanZoomController::ClearOverscroll);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -94,6 +94,9 @@ public:
|
|||
// Cancel animations all the way up the chain.
|
||||
void CancelAnimations() const;
|
||||
|
||||
// Clear overscroll all the way up the chain.
|
||||
void ClearOverscroll() const;
|
||||
|
||||
// Snap back the APZC that is overscrolled, if any.
|
||||
void SnapBackOverscrolledApzc() const;
|
||||
|
||||
|
@ -102,6 +105,9 @@ public:
|
|||
bool CanBePanned(const AsyncPanZoomController* aApzc) const;
|
||||
private:
|
||||
std::vector<nsRefPtr<AsyncPanZoomController>> mChain;
|
||||
|
||||
typedef void (AsyncPanZoomController::*APZCMethod)();
|
||||
void ForEachApzc(APZCMethod aMethod) const;
|
||||
};
|
||||
|
||||
// Don't pollute other files with this macro for now.
|
||||
|
|
Загрузка…
Ссылка в новой задаче