Bug 1063224 - Const-correctness improvements in APZ classes. r=kats

--HG--
extra : source : 2d5e9cefe9931c97f544e23e14dc5de44ac352e7
This commit is contained in:
Botond Ballo 2014-09-05 18:37:51 -04:00
Родитель 06ef0fa68b
Коммит f9d0811336
6 изменённых файлов: 20 добавлений и 19 удалений

Просмотреть файл

@ -1315,8 +1315,8 @@ APZCTreeManager::GetAPZCAtPoint(AsyncPanZoomController* aApzc,
required can be generated.
*/
void
APZCTreeManager::GetInputTransforms(AsyncPanZoomController *aApzc, Matrix4x4& aTransformToApzcOut,
Matrix4x4& aTransformToGeckoOut)
APZCTreeManager::GetInputTransforms(const AsyncPanZoomController *aApzc, Matrix4x4& aTransformToApzcOut,
Matrix4x4& aTransformToGeckoOut) const
{
MonitorAutoLock lock(mTreeLock);

Просмотреть файл

@ -361,8 +361,9 @@ public:
already_AddRefed<AsyncPanZoomController> GetTargetAPZC(const ScrollableLayerGuid& aGuid);
already_AddRefed<AsyncPanZoomController> GetTargetAPZC(const ScreenPoint& aPoint,
bool* aOutInOverscrolledApzc);
void GetInputTransforms(AsyncPanZoomController *aApzc, gfx::Matrix4x4& aTransformToApzcOut,
gfx::Matrix4x4& aTransformToGeckoOut);
void GetInputTransforms(const AsyncPanZoomController *aApzc,
gfx::Matrix4x4& aTransformToApzcOut,
gfx::Matrix4x4& aTransformToGeckoOut) const;
private:
/* Helpers */
AsyncPanZoomController* FindTargetAPZC(AsyncPanZoomController* aApzc, FrameMetrics::ViewID aScrollId);
@ -417,7 +418,7 @@ private:
* is considered part of the APZC tree management state.
* Finally, the lock needs to be held when accessing mOverscrollHandoffChain.
* IMPORTANT: See the note about lock ordering at the top of this file. */
mozilla::Monitor mTreeLock;
mutable mozilla::Monitor mTreeLock;
nsRefPtr<AsyncPanZoomController> mRootApzc;
/* This tracks the APZC that should receive all inputs for the current input event block.
* This allows touch points to move outside the thing they started on, but still have the

Просмотреть файл

@ -927,7 +927,7 @@ AsyncPanZoomController::Destroy()
}
bool
AsyncPanZoomController::IsDestroyed()
AsyncPanZoomController::IsDestroyed() const
{
return mTreeManager == nullptr;
}
@ -1694,7 +1694,7 @@ nsEventStatus AsyncPanZoomController::OnCancelTap(const TapGestureInput& aEvent)
return nsEventStatus_eIgnore;
}
float AsyncPanZoomController::PanDistance() {
float AsyncPanZoomController::PanDistance() const {
ReentrantMonitorAutoEnter lock(mMonitor);
return NS_hypot(mX.PanDistance(), mY.PanDistance());
}
@ -2465,7 +2465,7 @@ void AsyncPanZoomController::SampleContentTransformForFrame(ViewTransform* aOutT
}
}
ViewTransform AsyncPanZoomController::GetCurrentAsyncTransform() {
ViewTransform AsyncPanZoomController::GetCurrentAsyncTransform() const {
ReentrantMonitorAutoEnter lock(mMonitor);
CSSPoint lastPaintScrollOffset;
@ -2503,14 +2503,14 @@ ViewTransform AsyncPanZoomController::GetCurrentAsyncTransform() {
return ViewTransform(scale, -translation);
}
Matrix4x4 AsyncPanZoomController::GetNontransientAsyncTransform() {
Matrix4x4 AsyncPanZoomController::GetNontransientAsyncTransform() const {
ReentrantMonitorAutoEnter lock(mMonitor);
return Matrix4x4().Scale(mLastContentPaintMetrics.mResolution.scale,
mLastContentPaintMetrics.mResolution.scale,
1.0f);
}
Matrix4x4 AsyncPanZoomController::GetTransformToLastDispatchedPaint() {
Matrix4x4 AsyncPanZoomController::GetTransformToLastDispatchedPaint() const {
ReentrantMonitorAutoEnter lock(mMonitor);
// Technically we should be taking the scroll delta in the coordinate space

Просмотреть файл

@ -212,7 +212,7 @@ public:
/**
* Returns true if Destroy() has already been called on this APZC instance.
*/
bool IsDestroyed();
bool IsDestroyed() const;
/**
* Returns the incremental transformation corresponding to the async pan/zoom
@ -220,14 +220,14 @@ public:
* existing transform, it will make the layer appear with the desired pan/zoom
* amount.
*/
ViewTransform GetCurrentAsyncTransform();
ViewTransform GetCurrentAsyncTransform() const;
/**
* Returns the part of the async transform that will remain once Gecko does a
* repaint at the desired metrics. That is, in the steady state:
* Matrix4x4(GetCurrentAsyncTransform()) === GetNontransientAsyncTransform()
*/
Matrix4x4 GetNontransientAsyncTransform();
Matrix4x4 GetNontransientAsyncTransform() const;
/**
* Returns the transform to take something from the coordinate space of the
@ -236,7 +236,7 @@ public:
* processed, this is needed to transform input events properly into a space
* gecko will understand.
*/
Matrix4x4 GetTransformToLastDispatchedPaint();
Matrix4x4 GetTransformToLastDispatchedPaint() const;
/**
* Recalculates the displayport. Ideally, this should paint an area bigger
@ -464,7 +464,7 @@ protected:
* current touch (this only makes sense if a touch is currently happening and
* OnTouchMove() is being invoked).
*/
float PanDistance();
float PanDistance() const;
/**
* Gets a vector of the velocities of each axis.

Просмотреть файл

@ -207,11 +207,11 @@ void Axis::ClearOverscroll() {
mOverscroll = 0;
}
float Axis::PanDistance() {
float Axis::PanDistance() const {
return fabsf((mPos - mStartPos).value);
}
float Axis::PanDistance(ScreenCoord aPos) {
float Axis::PanDistance(ScreenCoord aPos) const {
return fabsf((aPos - mStartPos).value);
}

Просмотреть файл

@ -123,13 +123,13 @@ public:
* startTouch() and the current touch from the last
* updateWithTouchAtDevicePoint().
*/
float PanDistance();
float PanDistance() const;
/**
* Gets the distance between the starting position of the touch supplied in
* startTouch() and the supplied position.
*/
float PanDistance(ScreenCoord aPos);
float PanDistance(ScreenCoord aPos) const;
/**
* Applies friction during a fling, or cancels the fling if the velocity is