Bug 1255634 - APZ should scroll by more than a page with large values of mousewheel.default.delta_multiplier_{x,y}. r=masayuki,kats

The constants in doTestWholeScroll() have to be reduced because
otherwise some subtests end up returning results that are off by a few
pixels with e10s, presumably due to differences in floating point
precision in APZ compared to non-APZ.

MozReview-Commit-ID: BxmqHrcN8IL
This commit is contained in:
Andrew McCreight 2016-04-12 00:06:49 -04:00
Родитель ad71ab8eb2
Коммит 2175118c7d
3 изменённых файлов: 25 добавлений и 13 удалений

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

@ -294,6 +294,15 @@ public:
static nsWeakPtr sPointerLockedElement;
static nsWeakPtr sPointerLockedDoc;
/**
* If the absolute values of mMultiplierX and/or mMultiplierY are equal or
* larger than this value, the computed scroll amount isn't rounded down to
* the page width or height.
*/
enum {
MIN_MULTIPLIER_VALUE_ALLOWING_OVER_ONE_PAGE_SCROLL = 1000
};
protected:
/**
* Prefs class capsules preference management.
@ -560,15 +569,6 @@ protected:
void Reset();
/**
* If the abosolute values of mMultiplierX and/or mMultiplierY are equals or
* larger than this value, the computed scroll amount isn't rounded down to
* the page width or height.
*/
enum {
MIN_MULTIPLIER_VALUE_ALLOWING_OVER_ONE_PAGE_SCROLL = 1000
};
bool mInit[COUNT_OF_MULTIPLIERS];
double mMultiplierX[COUNT_OF_MULTIPLIERS];
double mMultiplierY[COUNT_OF_MULTIPLIERS];

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

@ -1352,8 +1352,8 @@ function doTestZoomedScroll(aCallback)
function doTestWholeScroll(aCallback)
{
SpecialPowers.pushPrefEnv({"set": [
["mousewheel.default.delta_multiplier_x", 99999999],
["mousewheel.default.delta_multiplier_y", 99999999]]},
["mousewheel.default.delta_multiplier_x", 999999],
["mousewheel.default.delta_multiplier_y", 999999]]},
function() { doTestWholeScroll2(aCallback); });
}

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

@ -1650,6 +1650,14 @@ AsyncPanZoomController::ConvertToGecko(const ScreenIntPoint& aPoint, CSSPoint* a
return false;
}
static bool
AllowsScrollingMoreThanOnePage(double aMultiplier)
{
const int32_t kMinAllowPageScroll =
EventStateManager::MIN_MULTIPLIER_VALUE_ALLOWING_OVER_ONE_PAGE_SCROLL;
return Abs(aMultiplier) >= kMinAllowPageScroll;
}
ParentLayerPoint
AsyncPanZoomController::GetScrollWheelDelta(const ScrollWheelInput& aEvent) const
{
@ -1720,12 +1728,16 @@ AsyncPanZoomController::GetScrollWheelDelta(const ScrollWheelInput& aEvent) cons
}
}
if (Abs(delta.x) > pageScrollSize.width) {
// We shouldn't scroll more than one page at once except when the
// user preference is large.
if (!AllowsScrollingMoreThanOnePage(aEvent.mUserDeltaMultiplierX) &&
Abs(delta.x) > pageScrollSize.width) {
delta.x = (delta.x >= 0)
? pageScrollSize.width
: -pageScrollSize.width;
}
if (Abs(delta.y) > pageScrollSize.height) {
if (!AllowsScrollingMoreThanOnePage(aEvent.mUserDeltaMultiplierY) &&
Abs(delta.y) > pageScrollSize.height) {
delta.y = (delta.y >= 0)
? pageScrollSize.height
: -pageScrollSize.height;