Bug 719320 part.8-11 Cancel applying delta multipliers from overflowDelta r=smaug

This commit is contained in:
Masayuki Nakano 2012-08-12 10:42:36 +09:00
Родитель 6c70546f8f
Коммит 19179bc9fe
2 изменённых файлов: 23 добавлений и 0 удалений

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

@ -2814,6 +2814,7 @@ nsEventStateManager::DoScrollText(nsIScrollableFrame* aScrollableFrame,
aEvent->overflowDeltaX = aEvent->deltaX;
aEvent->overflowDeltaY = aEvent->deltaY;
WheelPrefs::GetInstance()->CancelApplyingUserPrefsFromOverflowDelta(aEvent);
nsIFrame* scrollFrame = do_QueryFrame(aScrollableFrame);
MOZ_ASSERT(scrollFrame);
@ -2938,6 +2939,7 @@ nsEventStateManager::DoScrollText(nsIScrollableFrame* aScrollableFrame,
aEvent->overflowDeltaY =
static_cast<double>(overflow.y) / scrollAmountInDevPixels.height;
}
WheelPrefs::GetInstance()->CancelApplyingUserPrefsFromOverflowDelta(aEvent);
}
void
@ -5357,6 +5359,19 @@ nsEventStateManager::WheelPrefs::ApplyUserPrefsToDelta(
(mMultiplierZ[index] != 1.0));
}
void
nsEventStateManager::WheelPrefs::CancelApplyingUserPrefsFromOverflowDelta(
widget::WheelEvent* aEvent)
{
Index index = GetIndexFor(aEvent);
Init(index);
NS_ASSERTION(mMultiplierX[index] && mMultiplierY[index],
"The absolute values of both multipliers must be 1 or larger");
aEvent->overflowDeltaX /= mMultiplierX[index];
aEvent->overflowDeltaY /= mMultiplierY[index];
}
nsEventStateManager::WheelPrefs::Action
nsEventStateManager::WheelPrefs::ComputeActionFor(widget::WheelEvent* aEvent)
{

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

@ -338,6 +338,14 @@ protected:
*/
void ApplyUserPrefsToDelta(mozilla::widget::WheelEvent* aEvent);
/**
* If ApplyUserPrefsToDelta() changed the delta values with customized
* prefs, the overflowDelta values would be inflated.
* CancelApplyingUserPrefsFromOverflowDelta() cancels the inflation.
*/
void CancelApplyingUserPrefsFromOverflowDelta(
mozilla::widget::WheelEvent* aEvent);
/**
* Computes the default action for the aEvent with the prefs.
*/