Bug 1221593 - Don't reset other axis' scroll position during APZ drag. r=kats

--HG--
extra : commitid : Lrtt64KrpO3
extra : rebase_source : 9c2962a1cdfc42ff17e784d5ffab88185439ceec
This commit is contained in:
Benoit Girard 2015-11-04 13:00:56 -05:00
parent 73b313f3b4
commit cf1035b664

View File

@ -1013,8 +1013,8 @@ nsEventStatus AsyncPanZoomController::HandleDragEvent(const MouseInput& aEvent,
CSSPoint scrollFramePoint = aEvent.mLocalOrigin / GetFrameMetrics().GetZoom();
// The scrollbar can be transformed with the frame but the pres shell
// resolution is only applied to the scroll frame.
CSSPoint scrollbarPoint = scrollFramePoint * GetFrameMetrics().GetPresShellResolution();
CSSRect cssCompositionBound = GetFrameMetrics().GetCompositionBounds() / GetFrameMetrics().GetZoom();
CSSPoint scrollbarPoint = scrollFramePoint * mFrameMetrics.GetPresShellResolution();
CSSRect cssCompositionBound = mFrameMetrics.CalculateCompositedRectInCssPixels();
float mousePosition = GetAxisStart(aDragMetrics.mDirection, scrollbarPoint) -
aDragMetrics.mScrollbarDragOffset -
@ -1023,34 +1023,31 @@ nsEventStatus AsyncPanZoomController::HandleDragEvent(const MouseInput& aEvent,
float scrollMax = GetAxisEnd(aDragMetrics.mDirection, aDragMetrics.mScrollTrack);
scrollMax -= node->GetScrollSize() /
GetAxisScale(aDragMetrics.mDirection, GetFrameMetrics().GetZoom()) *
GetFrameMetrics().GetPresShellResolution();
GetAxisScale(aDragMetrics.mDirection, mFrameMetrics.GetZoom()) *
mFrameMetrics.GetPresShellResolution();
float scrollPercent = mousePosition / scrollMax;
float minScrollPosition =
GetAxisStart(aDragMetrics.mDirection, GetFrameMetrics().GetScrollableRect().TopLeft());
GetAxisStart(aDragMetrics.mDirection, mFrameMetrics.GetScrollableRect().TopLeft());
float maxScrollPosition =
GetAxisSize(aDragMetrics.mDirection, GetFrameMetrics().GetScrollableRect()) -
GetAxisSize(aDragMetrics.mDirection, GetFrameMetrics().GetCompositionBounds());
GetAxisSize(aDragMetrics.mDirection, mFrameMetrics.GetScrollableRect()) -
GetAxisSize(aDragMetrics.mDirection, mFrameMetrics.GetCompositionBounds());
float scrollPosition = scrollPercent * maxScrollPosition;
scrollPosition = std::max(scrollPosition, minScrollPosition);
scrollPosition = std::min(scrollPosition, maxScrollPosition);
CSSPoint scrollOffset;
CSSPoint scrollOffset = mFrameMetrics.GetScrollOffset();
if (aDragMetrics.mDirection == AsyncDragMetrics::HORIZONTAL) {
scrollOffset = CSSPoint(scrollPosition, 0);
scrollOffset.x = scrollPosition;
} else {
scrollOffset = CSSPoint(0, scrollPosition);
scrollOffset.y = scrollPosition;
}
mFrameMetrics.SetScrollOffset(scrollOffset);
ScheduleCompositeAndMaybeRepaint();
UpdateSharedCompositorFrameMetrics();
// Here we consume the events. This means that the content scrollbars
// will only see the initial mouse down and the final mouse up.
// APZ will still update the scroll position.
return nsEventStatus_eConsumeNoDefault;
}