Bug 1321885 - Expose the current async scroll offset in CSS pixels. r=kats
Some consumers want to use the async scroll offset in CSS pixels, and
it's pointless to convert to ParentLayer pixels only to have the consumer
convert it back.
MozReview-Commit-ID: B8nq3LUPM6Q
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -3130,16 +3130,27 @@ AsyncPanZoomController::GetCurrentAsyncS
if (aMode == RESPECT_FORCE_DISABLE && mScrollMetadata.IsApzForceDisabled()) {
return mLastContentPaintMetrics.GetScrollOffset() * mLastContentPaintMetrics.GetZoom();
}
return (mFrameMetrics.GetScrollOffset() + mTestAsyncScrollOffset)
* mFrameMetrics.GetZoom() * mTestAsyncZoom.scale;
}
+CSSPoint
+AsyncPanZoomController::GetCurrentAsyncScrollOffsetInCssPixels(AsyncMode aMode) const {
+ ReentrantMonitorAutoEnter lock(mMonitor);
+
+ if (aMode == RESPECT_FORCE_DISABLE && mScrollMetadata.IsApzForceDisabled()) {
+ return mLastContentPaintMetrics.GetScrollOffset();
+ }
+
+ return mFrameMetrics.GetScrollOffset() + mTestAsyncScrollOffset;
+}
+
AsyncTransform
AsyncPanZoomController::GetCurrentAsyncTransform(AsyncMode aMode) const
{
ReentrantMonitorAutoEnter lock(mMonitor);
if (aMode == RESPECT_FORCE_DISABLE && mScrollMetadata.IsApzForceDisabled()) {
return AsyncTransform();
}
--- a/gfx/layers/apz/src/AsyncPanZoomController.h
+++ b/gfx/layers/apz/src/AsyncPanZoomController.h
@@ -754,16 +754,23 @@ public:
/**
* Get the current scroll offset of the scrollable frame corresponding
* to this APZC, including the effects of any asynchronous panning and
* zooming, in ParentLayer pixels.
*/
ParentLayerPoint GetCurrentAsyncScrollOffset(AsyncMode aMode) const;
/**
+ * Get the current scroll offset of the scrollable frame corresponding
+ * to this APZC, including the effects of any asynchronous panning, in
+ * CSS pixels.
+ */
+ CSSPoint GetCurrentAsyncScrollOffsetInCssPixels(AsyncMode aMode) const;
+
+ /**
* Return a visual effect that reflects this apzc's
* overscrolled state, if any.
*/
AsyncTransformComponentMatrix GetOverscrollTransform(AsyncMode aMode) const;
/**
* Returns the incremental transformation corresponding to the async pan/zoom
* in progress. That is, when this transform is multiplied with the layer's