diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index fdfddc4bfede..7fbc616c418e 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -1543,6 +1543,7 @@ nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) { MOZ_ASSERT(Metrics().IsRootContent()); MOZ_ASSERT(Metrics().GetZoom().AreScalesSame()); + // TODO: Need to handle different x-and y-scales. CSSToParentLayerScale userZoom = Metrics().GetZoom().ToScaleFactor(); ParentLayerPoint focusPoint = aEvent.mLocalFocusPoint - Metrics().GetCompositionBounds().TopLeft(); @@ -5224,6 +5225,7 @@ void AsyncPanZoomController::ZoomToRect(CSSRect aRect, const uint32_t aFlags) { ParentLayerRect compositionBounds = Metrics().GetCompositionBounds(); CSSRect cssPageRect = Metrics().GetScrollableRect(); CSSPoint scrollOffset = Metrics().GetVisualScrollOffset(); + // TODO: Need to handle different x-and y-scales. CSSToParentLayerScale currentZoom = Metrics().GetZoom().ToScaleFactor(); CSSToParentLayerScale targetZoom; diff --git a/gfx/layers/apz/src/Axis.cpp b/gfx/layers/apz/src/Axis.cpp index c880426d3af6..daeacff54ae0 100644 --- a/gfx/layers/apz/src/Axis.cpp +++ b/gfx/layers/apz/src/Axis.cpp @@ -318,7 +318,7 @@ ParentLayerCoord Axis::DisplacementWillOverscrollAmount( CSSCoord Axis::ScaleWillOverscrollAmount(float aScale, CSSCoord aFocus) const { // Internally, do computations in ParentLayer coordinates *before* the scale // is applied. - CSSToParentLayerScale zoom = GetFrameMetrics().GetZoom().ToScaleFactor(); + CSSToParentLayerScale zoom = GetAxisScale(GetFrameMetrics().GetZoom()); ParentLayerCoord focus = aFocus * zoom; ParentLayerCoord originAfterScale = (GetOrigin() + focus) - (focus / aScale); @@ -433,6 +433,11 @@ ParentLayerCoord AxisX::GetPointOffset(const ParentLayerPoint& aPoint) const { return aPoint.x; } +CSSToParentLayerScale AxisX::GetAxisScale( + const CSSToParentLayerScale2D& aScale) const { + return CSSToParentLayerScale(aScale.xScale); +} + ParentLayerCoord AxisX::GetRectLength(const ParentLayerRect& aRect) const { return aRect.Width(); } @@ -475,6 +480,11 @@ ParentLayerCoord AxisY::GetPointOffset(const ParentLayerPoint& aPoint) const { return aPoint.y; } +CSSToParentLayerScale AxisY::GetAxisScale( + const CSSToParentLayerScale2D& aScale) const { + return CSSToParentLayerScale(aScale.yScale); +} + ParentLayerCoord AxisY::GetRectLength(const ParentLayerRect& aRect) const { return aRect.Height(); } diff --git a/gfx/layers/apz/src/Axis.h b/gfx/layers/apz/src/Axis.h index 77dd302a9fa1..bd1025ffd79c 100644 --- a/gfx/layers/apz/src/Axis.h +++ b/gfx/layers/apz/src/Axis.h @@ -273,6 +273,8 @@ class Axis { bool OverscrollBehaviorAllowsHandoff() const; bool OverscrollBehaviorAllowsOverscrollEffect() const; + virtual CSSToParentLayerScale GetAxisScale( + const CSSToParentLayerScale2D& aScale) const = 0; virtual ParentLayerCoord GetPointOffset( const ParentLayerPoint& aPoint) const = 0; virtual ParentLayerCoord GetRectLength( @@ -340,6 +342,8 @@ class Axis { class AxisX : public Axis { public: explicit AxisX(AsyncPanZoomController* mAsyncPanZoomController); + CSSToParentLayerScale GetAxisScale( + const CSSToParentLayerScale2D& aScale) const override; ParentLayerCoord GetPointOffset( const ParentLayerPoint& aPoint) const override; ParentLayerCoord GetRectLength(const ParentLayerRect& aRect) const override; @@ -359,6 +363,8 @@ class AxisY : public Axis { explicit AxisY(AsyncPanZoomController* mAsyncPanZoomController); ParentLayerCoord GetPointOffset( const ParentLayerPoint& aPoint) const override; + CSSToParentLayerScale GetAxisScale( + const CSSToParentLayerScale2D& aScale) const override; ParentLayerCoord GetRectLength(const ParentLayerRect& aRect) const override; ParentLayerCoord GetRectOffset(const ParentLayerRect& aRect) const override; CSSToParentLayerScale GetScaleForAxis( diff --git a/gfx/layers/ipc/UiCompositorControllerParent.cpp b/gfx/layers/ipc/UiCompositorControllerParent.cpp index 9cf60df6e1db..7da97c54bd3c 100644 --- a/gfx/layers/ipc/UiCompositorControllerParent.cpp +++ b/gfx/layers/ipc/UiCompositorControllerParent.cpp @@ -217,6 +217,7 @@ void UiCompositorControllerParent::NotifyFirstPaint() { void UiCompositorControllerParent::NotifyUpdateScreenMetrics( const GeckoViewMetrics& aMetrics) { #if defined(MOZ_WIDGET_ANDROID) + // TODO: Need to handle different x-and y-scales. CSSToScreenScale scale = ViewTargetAs( aMetrics.mZoom.ToScaleFactor(), PixelCastJustification::ScreenIsParentLayerForRoot);