Bug 867582 - Make the Axis overscroll correction use floats for more correctness. r=ajones

This commit is contained in:
Kartikaya Gupta 2013-05-02 09:24:16 -04:00
parent 486a935da3
commit e1795f440a
2 changed files with 4 additions and 4 deletions

View File

@ -221,7 +221,7 @@ float Axis::GetExcess() {
} }
} }
Axis::Overscroll Axis::DisplacementWillOverscroll(int32_t aDisplacement) { Axis::Overscroll Axis::DisplacementWillOverscroll(float aDisplacement) {
// If the current pan plus a displacement takes the window to the left of or // If the current pan plus a displacement takes the window to the left of or
// above the current page rect. // above the current page rect.
bool minus = GetOrigin() + aDisplacement < GetPageStart(); bool minus = GetOrigin() + aDisplacement < GetPageStart();
@ -240,7 +240,7 @@ Axis::Overscroll Axis::DisplacementWillOverscroll(int32_t aDisplacement) {
return OVERSCROLL_NONE; return OVERSCROLL_NONE;
} }
float Axis::DisplacementWillOverscrollAmount(int32_t aDisplacement) { float Axis::DisplacementWillOverscrollAmount(float aDisplacement) {
switch (DisplacementWillOverscroll(aDisplacement)) { switch (DisplacementWillOverscroll(aDisplacement)) {
case OVERSCROLL_MINUS: return (GetOrigin() + aDisplacement) - GetPageStart(); case OVERSCROLL_MINUS: return (GetOrigin() + aDisplacement) - GetPageStart();
case OVERSCROLL_PLUS: return (GetCompositionEnd() + aDisplacement) - GetPageEnd(); case OVERSCROLL_PLUS: return (GetCompositionEnd() + aDisplacement) - GetPageEnd();

View File

@ -125,13 +125,13 @@ public:
* That is to say, if the given displacement is applied, this will tell you * That is to say, if the given displacement is applied, this will tell you
* whether or not it will overscroll, and in what direction. * whether or not it will overscroll, and in what direction.
*/ */
Overscroll DisplacementWillOverscroll(int32_t aDisplacement); Overscroll DisplacementWillOverscroll(float aDisplacement);
/** /**
* If a displacement will overscroll the axis, this returns the amount and in * If a displacement will overscroll the axis, this returns the amount and in
* what direction. Similar to getExcess() but takes a displacement to apply. * what direction. Similar to getExcess() but takes a displacement to apply.
*/ */
float DisplacementWillOverscrollAmount(int32_t aDisplacement); float DisplacementWillOverscrollAmount(float aDisplacement);
/** /**
* Gets the overscroll state of the axis given a scaling of the page. That is * Gets the overscroll state of the axis given a scaling of the page. That is