Bug 998025 - Factor out an Axis::GetFrameMetrics() helper. r=kats

--HG--
extra : rebase_source : d19c09863bb5f6e83198460747f9f4727d822456
This commit is contained in:
Botond Ballo 2014-05-21 17:26:06 -04:00
parent 7ddcf4420c
commit c0a1f7b506
2 changed files with 12 additions and 6 deletions

View File

@ -187,27 +187,26 @@ float Axis::GetPageEnd() const {
}
float Axis::GetOrigin() const {
CSSPoint origin = mAsyncPanZoomController->GetFrameMetrics().GetScrollOffset();
CSSPoint origin = GetFrameMetrics().GetScrollOffset();
return GetPointOffset(origin);
}
float Axis::GetCompositionLength() const {
const FrameMetrics& metrics = mAsyncPanZoomController->GetFrameMetrics();
return GetRectLength(metrics.CalculateCompositedRectInCssPixels());
return GetRectLength(GetFrameMetrics().CalculateCompositedRectInCssPixels());
}
float Axis::GetPageStart() const {
CSSRect pageRect = mAsyncPanZoomController->GetFrameMetrics().GetExpandedScrollableRect();
CSSRect pageRect = GetFrameMetrics().GetExpandedScrollableRect();
return GetRectOffset(pageRect);
}
float Axis::GetPageLength() const {
CSSRect pageRect = mAsyncPanZoomController->GetFrameMetrics().GetExpandedScrollableRect();
CSSRect pageRect = GetFrameMetrics().GetExpandedScrollableRect();
return GetRectLength(pageRect);
}
bool Axis::ScaleWillOverscrollBothSides(float aScale) {
const FrameMetrics& metrics = mAsyncPanZoomController->GetFrameMetrics();
const FrameMetrics& metrics = GetFrameMetrics();
CSSToParentLayerScale scale(metrics.GetZoomToParent().scale * aScale);
CSSRect cssCompositionBounds = metrics.mCompositionBounds / scale;
@ -220,6 +219,10 @@ bool Axis::HasRoomToPan() const {
|| GetCompositionEnd() < GetPageEnd();
}
const FrameMetrics& Axis::GetFrameMetrics() const {
return mAsyncPanZoomController->GetFrameMetrics();
}
AxisX::AxisX(AsyncPanZoomController* aAsyncPanZoomController)
: Axis(aAsyncPanZoomController)

View File

@ -17,6 +17,7 @@ namespace layers {
const float EPSILON = 0.0001f;
class FrameMetrics;
class AsyncPanZoomController;
/**
@ -180,6 +181,8 @@ protected:
bool mAxisLocked; // Whether movement on this axis is locked.
AsyncPanZoomController* mAsyncPanZoomController;
nsTArray<float> mVelocityQueue;
const FrameMetrics& GetFrameMetrics() const;
};
class AxisX : public Axis {