Bug 1043859 - Expose the APZC overscroll transform as a separate function. r=botond

This commit is contained in:
Kartikaya Gupta 2014-10-01 17:49:31 -04:00
parent f6dd5109c3
commit c0ef7b508e
4 changed files with 20 additions and 32 deletions

View File

@ -2453,7 +2453,11 @@ bool AsyncPanZoomController::UpdateAnimation(const TimeStamp& aSampleTime,
return false;
}
void AsyncPanZoomController::GetOverscrollTransform(Matrix4x4* aTransform) const {
Matrix4x4 AsyncPanZoomController::GetOverscrollTransform() const {
if (!IsOverscrolled()) {
return Matrix4x4();
}
// The overscroll effect is a uniform stretch along the overscrolled axis,
// with the edge of the content where we have reached the end of the
// scrollable area pinned into place.
@ -2488,8 +2492,8 @@ void AsyncPanZoomController::GetOverscrollTransform(Matrix4x4* aTransform) const
}
// Combine the transformations into a matrix.
*aTransform = Matrix4x4().Scale(scaleX, scaleY, 1)
.PostTranslate(translation.x, translation.y, 0);
return Matrix4x4().Scale(scaleX, scaleY, 1)
.PostTranslate(translation.x, translation.y, 0);
}
bool AsyncPanZoomController::AdvanceAnimations(const TimeStamp& aSampleTime)
@ -2565,19 +2569,12 @@ bool AsyncPanZoomController::AdvanceAnimations(const TimeStamp& aSampleTime)
}
void AsyncPanZoomController::SampleContentTransformForFrame(ViewTransform* aOutTransform,
ScreenPoint& aScrollOffset,
Matrix4x4* aOutOverscrollTransform)
ScreenPoint& aScrollOffset)
{
ReentrantMonitorAutoEnter lock(mMonitor);
aScrollOffset = mFrameMetrics.GetScrollOffset() * mFrameMetrics.GetZoom();
*aOutTransform = GetCurrentAsyncTransform();
// If we are overscrolled, we would like the compositor to apply an
// additional transform that produces an overscroll effect.
if (aOutOverscrollTransform && IsOverscrolled()) {
GetOverscrollTransform(aOutOverscrollTransform);
}
}
ViewTransform AsyncPanZoomController::GetCurrentAsyncTransform() const {

View File

@ -166,18 +166,17 @@ public:
/**
* Query the transforms that should be applied to the layer corresponding
* to this APZC due to asynchronous panning and zooming.
* This function returns two transforms via out parameters:
* |aOutTransform| is the transform due to regular panning and zooming
* |aOverscrollTransform| is the transform due to overscrolling
* The two are separated because some clients want to ignore the overscroll
* transform for some purposes (and for convenience to these clients, the
* overscroll transform parameter may be nullptr). Clients who do not want
* to ignore the overscroll transform should multiply the two transforms
* together.
* This function returns the async transform via the |aOutTransform|
* out parameter.
*/
void SampleContentTransformForFrame(ViewTransform* aOutTransform,
ScreenPoint& aScrollOffset,
Matrix4x4* aOutOverscrollTransform);
ScreenPoint& aScrollOffset);
/**
* Return a visual effect that reflects this apzc's
* overscrolled state, if any.
*/
Matrix4x4 GetOverscrollTransform() const;
/**
* A shadow layer update has arrived. |aLayerMetrics| is the new FrameMetrics
@ -595,12 +594,6 @@ private:
*/
bool ConvertToGecko(const ScreenPoint& aPoint, CSSPoint* aOut);
/**
* Return in |aTransform| a visual effect that reflects this apzc's
* overscrolled state, if any.
*/
void GetOverscrollTransform(Matrix4x4* aTransform) const;
enum AxisLockMode {
FREE, /* No locking at all */
STANDARD, /* Default axis locking mode that remains locked until pan ends*/

View File

@ -586,11 +586,10 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer)
hasAsyncTransform = true;
ViewTransform asyncTransformWithoutOverscroll;
Matrix4x4 overscrollTransform;
ScreenPoint scrollOffset;
controller->SampleContentTransformForFrame(&asyncTransformWithoutOverscroll,
scrollOffset,
&overscrollTransform);
scrollOffset);
Matrix4x4 overscrollTransform = controller->GetOverscrollTransform();
if (!aLayer->IsScrollInfoLayer()) {
controller->MarkAsyncTransformAppliedToContent();

View File

@ -162,10 +162,9 @@ public:
bool SampleContentTransformForFrame(const TimeStamp& aSampleTime,
ViewTransform* aOutTransform,
ScreenPoint& aScrollOffset) {
Matrix4x4 aOverscrollTransform; // ignored
bool ret = AdvanceAnimations(aSampleTime);
AsyncPanZoomController::SampleContentTransformForFrame(
aOutTransform, aScrollOffset, &aOverscrollTransform);
aOutTransform, aScrollOffset);
return ret;
}
};