зеркало из https://github.com/mozilla/gecko-dev.git
Bug 879011 - Turn some ints into floats to avoid rounding error. r=kentuckyfriendtakahe
This commit is contained in:
Родитель
b36947dfb0
Коммит
72ed97fb7b
|
@ -530,7 +530,7 @@ nsEventStatus AsyncPanZoomController::OnScaleBegin(const PinchGestureInput& aEve
|
|||
}
|
||||
|
||||
SetState(PINCHING);
|
||||
mLastZoomFocus = aEvent.mFocusPoint;
|
||||
mLastZoomFocus = gfx::Point(aEvent.mFocusPoint.x, aEvent.mFocusPoint.y);
|
||||
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
@ -553,7 +553,7 @@ nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) {
|
|||
|
||||
gfxFloat resolution = CalculateResolution(mFrameMetrics).width;
|
||||
gfxFloat userZoom = mFrameMetrics.mZoom.width;
|
||||
nsIntPoint focusPoint = aEvent.mFocusPoint;
|
||||
gfx::Point focusPoint = gfx::Point(aEvent.mFocusPoint.x, aEvent.mFocusPoint.y);
|
||||
gfxFloat xFocusChange = (mLastZoomFocus.x - focusPoint.x) / resolution;
|
||||
gfxFloat yFocusChange = (mLastZoomFocus.y - focusPoint.y) / resolution;
|
||||
// If displacing by the change in focus point will take us off page bounds,
|
||||
|
@ -833,7 +833,7 @@ void AsyncPanZoomController::ScrollBy(const gfx::Point& aOffset) {
|
|||
}
|
||||
|
||||
void AsyncPanZoomController::ScaleWithFocus(float aZoom,
|
||||
const nsIntPoint& aFocus) {
|
||||
const gfx::Point& aFocus) {
|
||||
float zoomFactor = aZoom / mFrameMetrics.mZoom.width;
|
||||
gfxFloat resolution = CalculateResolution(mFrameMetrics).width;
|
||||
|
||||
|
|
|
@ -342,7 +342,7 @@ protected:
|
|||
*
|
||||
* XXX: Fix focus point calculations.
|
||||
*/
|
||||
void ScaleWithFocus(float aScale, const nsIntPoint& aFocus);
|
||||
void ScaleWithFocus(float aScale, const gfx::Point& aFocus);
|
||||
|
||||
/**
|
||||
* Schedules a composite on the compositor thread. Wrapper for
|
||||
|
@ -546,7 +546,7 @@ private:
|
|||
|
||||
// Stores the previous focus point if there is a pinch gesture happening. Used
|
||||
// to allow panning by moving multiple fingers (thus moving the focus point).
|
||||
nsIntPoint mLastZoomFocus;
|
||||
gfx::Point mLastZoomFocus;
|
||||
|
||||
// Stores the state of panning and zooming this frame. This is protected by
|
||||
// |mMonitor|; that is, it should be held whenever this is updated.
|
||||
|
|
|
@ -245,7 +245,7 @@ float Axis::DisplacementWillOverscrollAmount(float aDisplacement) {
|
|||
}
|
||||
}
|
||||
|
||||
Axis::Overscroll Axis::ScaleWillOverscroll(float aScale, int32_t aFocus) {
|
||||
Axis::Overscroll Axis::ScaleWillOverscroll(float aScale, float aFocus) {
|
||||
float originAfterScale = (GetOrigin() + aFocus) * aScale - aFocus;
|
||||
|
||||
bool both = ScaleWillOverscrollBothSides(aScale);
|
||||
|
@ -264,7 +264,7 @@ Axis::Overscroll Axis::ScaleWillOverscroll(float aScale, int32_t aFocus) {
|
|||
return OVERSCROLL_NONE;
|
||||
}
|
||||
|
||||
float Axis::ScaleWillOverscrollAmount(float aScale, int32_t aFocus) {
|
||||
float Axis::ScaleWillOverscrollAmount(float aScale, float aFocus) {
|
||||
float originAfterScale = (GetOrigin() + aFocus) * aScale - aFocus;
|
||||
switch (ScaleWillOverscroll(aScale, aFocus)) {
|
||||
case OVERSCROLL_MINUS: return originAfterScale - GetPageStart() * aScale;
|
||||
|
|
|
@ -143,7 +143,7 @@ public:
|
|||
* scroll offset in such a way that it remains in the same place on the page
|
||||
* relative.
|
||||
*/
|
||||
Overscroll ScaleWillOverscroll(float aScale, int32_t aFocus);
|
||||
Overscroll ScaleWillOverscroll(float aScale, float aFocus);
|
||||
|
||||
/**
|
||||
* If a scale will overscroll the axis, this returns the amount and in what
|
||||
|
@ -153,7 +153,7 @@ public:
|
|||
* scroll offset in such a way that it remains in the same place on the page
|
||||
* relative.
|
||||
*/
|
||||
float ScaleWillOverscrollAmount(float aScale, int32_t aFocus);
|
||||
float ScaleWillOverscrollAmount(float aScale, float aFocus);
|
||||
|
||||
/**
|
||||
* Checks if an axis will overscroll in both directions by computing the
|
||||
|
|
Загрузка…
Ссылка в новой задаче