Bug 719320 part.8-9 Handle WheelEvent.deltaZ in ESM r=smaug

This commit is contained in:
Masayuki Nakano 2012-08-12 10:42:36 +09:00
parent ea44597fdd
commit 3ceb17b583
3 changed files with 19 additions and 3 deletions

View File

@ -5311,6 +5311,14 @@ nsEventStateManager::WheelPrefs::Init(
mMultiplierY[aIndex] = mMultiplierY[aIndex] < 0.0 ? -1.0 : 1.0;
}
nsCAutoString prefNameZ(basePrefName);
prefNameZ.AppendLiteral("delta_multiplier_z");
mMultiplierZ[aIndex] =
static_cast<double>(Preferences::GetInt(prefNameZ.get(), 100)) / 100;
if (mMultiplierZ[aIndex] < 1.0 && mMultiplierZ[aIndex] > -1.0) {
mMultiplierZ[aIndex] = mMultiplierZ[aIndex] < 0.0 ? -1.0 : 1.0;
}
nsCAutoString prefNameAction(basePrefName);
prefNameAction.AppendLiteral("action");
mActions[aIndex] =
@ -5331,12 +5339,12 @@ nsEventStateManager::WheelPrefs::ApplyUserPrefsToDelta(
aEvent->deltaX *= mMultiplierX[index];
aEvent->deltaY *= mMultiplierY[index];
aEvent->deltaZ *= mMultiplierZ[index];
// If the multiplier is 1.0 or -1.0, i.e., it doesn't change the absolute
// value, we should use lineOrPageDelta values which were set by widget.
// Otherwise, we need to compute them from accumulated delta values.
if ((mMultiplierX[index] == 1.0 || mMultiplierX[index] == -1.0) &&
(mMultiplierY[index] == 1.0 || mMultiplierY[index] == -1.0)) {
if (!NeedToComputeLineOrPageDelta(aEvent)) {
aEvent->lineOrPageDeltaX *= static_cast<PRInt32>(mMultiplierX[index]);
aEvent->lineOrPageDeltaY *= static_cast<PRInt32>(mMultiplierY[index]);
} else {
@ -5345,7 +5353,8 @@ nsEventStateManager::WheelPrefs::ApplyUserPrefsToDelta(
}
aEvent->customizedByUserPrefs =
((mMultiplierX[index] != 1.0) || (mMultiplierY[index] != 1.0));
((mMultiplierX[index] != 1.0) || (mMultiplierY[index] != 1.0) ||
(mMultiplierZ[index] != 1.0));
}
nsEventStateManager::WheelPrefs::Action

View File

@ -401,6 +401,7 @@ protected:
bool mInit[COUNT_OF_MULTIPLIERS];
double mMultiplierX[COUNT_OF_MULTIPLIERS];
double mMultiplierY[COUNT_OF_MULTIPLIERS];
double mMultiplierZ[COUNT_OF_MULTIPLIERS];
Action mActions[COUNT_OF_MULTIPLIERS];
static WheelPrefs* sInstance;

View File

@ -1400,16 +1400,22 @@ pref("mousewheel.with_win.action", 1);
// reverted. The absolue value must be 100 or larger.
pref("mousewheel.default.delta_multiplier_x", 100);
pref("mousewheel.default.delta_multiplier_y", 100);
pref("mousewheel.default.delta_multiplier_z", 100);
pref("mousewheel.with_alt.delta_multiplier_x", 100);
pref("mousewheel.with_alt.delta_multiplier_y", 100);
pref("mousewheel.with_alt.delta_multiplier_z", 100);
pref("mousewheel.with_control.delta_multiplier_x", 100);
pref("mousewheel.with_control.delta_multiplier_y", 100);
pref("mousewheel.with_control.delta_multiplier_z", 100);
pref("mousewheel.with_meta.delta_multiplier_x", 100); // command key on Mac
pref("mousewheel.with_meta.delta_multiplier_y", 100); // command key on Mac
pref("mousewheel.with_meta.delta_multiplier_z", 100); // command key on Mac
pref("mousewheel.with_shift.delta_multiplier_x", 100);
pref("mousewheel.with_shift.delta_multiplier_y", 100);
pref("mousewheel.with_shift.delta_multiplier_z", 100);
pref("mousewheel.with_win.delta_multiplier_x", 100);
pref("mousewheel.with_win.delta_multiplier_y", 100);
pref("mousewheel.with_win.delta_multiplier_z", 100);
// These define the smooth scroll behavior (min ms, max ms) for different triggers
// Some triggers: