diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index f6abbf6fb045..400f37bb8c56 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -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; }