зеркало из https://github.com/mozilla/gecko-dev.git
Backout 41722f2e0c33 (bug 422132), 69da5f098237 (bug 782903), 5c601428c70b (bug 422132) for bug 782903
This commit is contained in:
Родитель
d9e4955e8a
Коммит
ffb9a0ff15
|
@ -2516,13 +2516,6 @@ nsEventStateManager::DispatchLegacyMouseScrollEvents(nsIFrame* aTargetFrame,
|
||||||
nsPresContext::AppUnitsToIntCSSPixels(scrollAmount.width),
|
nsPresContext::AppUnitsToIntCSSPixels(scrollAmount.width),
|
||||||
nsPresContext::AppUnitsToIntCSSPixels(scrollAmount.height));
|
nsPresContext::AppUnitsToIntCSSPixels(scrollAmount.height));
|
||||||
|
|
||||||
// XXX We don't deal with fractional amount in legacy event, though the
|
|
||||||
// default action handler (DoScrollText()) deals with it.
|
|
||||||
// If we implemented such strict computation, we would need additional
|
|
||||||
// accumulated delta values. It would made the code more complicated.
|
|
||||||
// And also it would compute different delta values from the older
|
|
||||||
// version. It doesn't make sense to implement such code for legacy
|
|
||||||
// events and rare cases.
|
|
||||||
PRInt32 scrollDeltaX, scrollDeltaY, pixelDeltaX, pixelDeltaY;
|
PRInt32 scrollDeltaX, scrollDeltaY, pixelDeltaX, pixelDeltaY;
|
||||||
switch (aEvent->deltaMode) {
|
switch (aEvent->deltaMode) {
|
||||||
case nsIDOMWheelEvent::DOM_DELTA_PAGE:
|
case nsIDOMWheelEvent::DOM_DELTA_PAGE:
|
||||||
|
@ -2741,23 +2734,26 @@ nsEventStateManager::ComputeScrollTarget(nsIFrame* aTargetFrame,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For default action, we should climb up the tree if cannot scroll it
|
// Check if the scrollable view can be scrolled any further.
|
||||||
// by the event actually.
|
if (frameToScroll->GetLineScrollAmount().height) {
|
||||||
bool canScroll = CanScrollOn(frameToScroll,
|
// For default action, we should climb up the tree if cannot scroll it
|
||||||
aEvent->deltaX, aEvent->deltaY);
|
// by the event actually.
|
||||||
// Comboboxes need special care.
|
bool canScroll = CanScrollOn(frameToScroll,
|
||||||
nsIComboboxControlFrame* comboBox = do_QueryFrame(scrollFrame);
|
aEvent->deltaX, aEvent->deltaY);
|
||||||
if (comboBox) {
|
// Comboboxes need special care.
|
||||||
if (comboBox->IsDroppedDown()) {
|
nsIComboboxControlFrame* comboBox = do_QueryFrame(scrollFrame);
|
||||||
// Don't propagate to parent when drop down menu is active.
|
if (comboBox) {
|
||||||
return canScroll ? frameToScroll : nullptr;
|
if (comboBox->IsDroppedDown()) {
|
||||||
|
// Don't propagate to parent when drop down menu is active.
|
||||||
|
return canScroll ? frameToScroll : nullptr;
|
||||||
|
}
|
||||||
|
// Always propagate when not dropped down (even if focused).
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
// Always propagate when not dropped down (even if focused).
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (canScroll) {
|
if (canScroll) {
|
||||||
return frameToScroll;
|
return frameToScroll;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2829,6 +2825,18 @@ nsEventStateManager::DoScrollText(nsIScrollableFrame* aScrollableFrame,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the wheel event is line scroll and the delta value is computed from
|
||||||
|
// system settings, allow to override the system speed.
|
||||||
|
bool allowScrollSpeedOverride =
|
||||||
|
(!aEvent->customizedByUserPrefs &&
|
||||||
|
aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_LINE);
|
||||||
|
DeltaValues acceleratedDelta =
|
||||||
|
nsMouseWheelTransaction::AccelerateWheelDelta(aEvent,
|
||||||
|
allowScrollSpeedOverride);
|
||||||
|
|
||||||
|
bool isDeltaModePixel =
|
||||||
|
(aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_PIXEL);
|
||||||
|
|
||||||
// Default action's actual scroll amount should be computed from device
|
// Default action's actual scroll amount should be computed from device
|
||||||
// pixels.
|
// pixels.
|
||||||
nsPresContext* pc = scrollFrame->PresContext();
|
nsPresContext* pc = scrollFrame->PresContext();
|
||||||
|
@ -2836,9 +2844,17 @@ nsEventStateManager::DoScrollText(nsIScrollableFrame* aScrollableFrame,
|
||||||
nsIntSize scrollAmountInDevPixels(
|
nsIntSize scrollAmountInDevPixels(
|
||||||
pc->AppUnitsToDevPixels(scrollAmount.width),
|
pc->AppUnitsToDevPixels(scrollAmount.width),
|
||||||
pc->AppUnitsToDevPixels(scrollAmount.height));
|
pc->AppUnitsToDevPixels(scrollAmount.height));
|
||||||
nsIntPoint actualDevPixelScrollAmount =
|
|
||||||
DeltaAccumulator::GetInstance()->
|
nsIntPoint actualDevPixelScrollAmount(0, 0);
|
||||||
ComputeScrollAmountForDefaultAction(aEvent, scrollAmountInDevPixels);
|
if (isDeltaModePixel) {
|
||||||
|
actualDevPixelScrollAmount.x = RoundDown(acceleratedDelta.deltaX);
|
||||||
|
actualDevPixelScrollAmount.y = RoundDown(acceleratedDelta.deltaY);
|
||||||
|
} else {
|
||||||
|
actualDevPixelScrollAmount.x =
|
||||||
|
RoundDown(scrollAmountInDevPixels.width * acceleratedDelta.deltaX);
|
||||||
|
actualDevPixelScrollAmount.y =
|
||||||
|
RoundDown(scrollAmountInDevPixels.height * acceleratedDelta.deltaY);
|
||||||
|
}
|
||||||
|
|
||||||
nsIAtom* origin = nullptr;
|
nsIAtom* origin = nullptr;
|
||||||
switch (aEvent->deltaMode) {
|
switch (aEvent->deltaMode) {
|
||||||
|
@ -2872,9 +2888,6 @@ nsEventStateManager::DoScrollText(nsIScrollableFrame* aScrollableFrame,
|
||||||
-devPixelPageSize.height;
|
-devPixelPageSize.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isDeltaModePixel =
|
|
||||||
(aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_PIXEL);
|
|
||||||
|
|
||||||
nsIScrollableFrame::ScrollMode mode;
|
nsIScrollableFrame::ScrollMode mode;
|
||||||
switch (aEvent->scrollType) {
|
switch (aEvent->scrollType) {
|
||||||
case widget::WheelEvent::SCROLL_DEFAULT:
|
case widget::WheelEvent::SCROLL_DEFAULT:
|
||||||
|
@ -5074,6 +5087,13 @@ nsEventStateManager::DeltaAccumulator::InitLineOrPageDelta(
|
||||||
MOZ_ASSERT(aESM);
|
MOZ_ASSERT(aESM);
|
||||||
MOZ_ASSERT(aEvent);
|
MOZ_ASSERT(aEvent);
|
||||||
|
|
||||||
|
if (!(aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_PIXEL &&
|
||||||
|
aEvent->isPixelOnlyDevice) &&
|
||||||
|
!WheelPrefs::GetInstance()->NeedToComputeLineOrPageDelta(aEvent)) {
|
||||||
|
Reset();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Reset if the previous wheel event is too old.
|
// Reset if the previous wheel event is too old.
|
||||||
if (!mLastTime.IsNull()) {
|
if (!mLastTime.IsNull()) {
|
||||||
TimeDuration duration = TimeStamp::Now() - mLastTime;
|
TimeDuration duration = TimeStamp::Now() - mLastTime;
|
||||||
|
@ -5082,7 +5102,7 @@ nsEventStateManager::DeltaAccumulator::InitLineOrPageDelta(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If we have accumulated delta, we may need to reset it.
|
// If we have accumulated delta, we may need to reset it.
|
||||||
if (IsInTransaction()) {
|
if (mHandlingDeltaMode != PR_UINT32_MAX) {
|
||||||
// If wheel event type is changed, reset the values.
|
// If wheel event type is changed, reset the values.
|
||||||
if (mHandlingDeltaMode != aEvent->deltaMode ||
|
if (mHandlingDeltaMode != aEvent->deltaMode ||
|
||||||
mHandlingPixelOnlyDevice != aEvent->isPixelOnlyDevice) {
|
mHandlingPixelOnlyDevice != aEvent->isPixelOnlyDevice) {
|
||||||
|
@ -5091,10 +5111,10 @@ nsEventStateManager::DeltaAccumulator::InitLineOrPageDelta(
|
||||||
// If the delta direction is changed, we should reset only the
|
// If the delta direction is changed, we should reset only the
|
||||||
// accumulated values.
|
// accumulated values.
|
||||||
if (mX && aEvent->deltaX && ((aEvent->deltaX > 0.0) != (mX > 0.0))) {
|
if (mX && aEvent->deltaX && ((aEvent->deltaX > 0.0) != (mX > 0.0))) {
|
||||||
mX = mPendingScrollAmountX = 0.0;
|
mX = 0.0;
|
||||||
}
|
}
|
||||||
if (mY && aEvent->deltaY && ((aEvent->deltaY > 0.0) != (mY > 0.0))) {
|
if (mY && aEvent->deltaY && ((aEvent->deltaY > 0.0) != (mY > 0.0))) {
|
||||||
mY = mPendingScrollAmountY = 0.0;
|
mY = 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5102,28 +5122,6 @@ nsEventStateManager::DeltaAccumulator::InitLineOrPageDelta(
|
||||||
mHandlingDeltaMode = aEvent->deltaMode;
|
mHandlingDeltaMode = aEvent->deltaMode;
|
||||||
mHandlingPixelOnlyDevice = aEvent->isPixelOnlyDevice;
|
mHandlingPixelOnlyDevice = aEvent->isPixelOnlyDevice;
|
||||||
|
|
||||||
// If it's handling neither pixel scroll mode for pixel only device nor
|
|
||||||
// delta values multiplied by prefs, we must not modify lineOrPageDelta
|
|
||||||
// values.
|
|
||||||
if (!(mHandlingDeltaMode == nsIDOMWheelEvent::DOM_DELTA_PIXEL &&
|
|
||||||
mHandlingPixelOnlyDevice) &&
|
|
||||||
!nsEventStateManager::WheelPrefs::GetInstance()->
|
|
||||||
NeedToComputeLineOrPageDelta(aEvent)) {
|
|
||||||
// Set the delta values to mX and mY. They would be used when above block
|
|
||||||
// resets mX/mY/mPendingScrollAmountX/mPendingScrollAmountY if the direction
|
|
||||||
// is changed.
|
|
||||||
// NOTE: We shouldn't accumulate the delta values, it might could cause
|
|
||||||
// overflow even though it's not a realistic situation.
|
|
||||||
if (aEvent->deltaX) {
|
|
||||||
mX = aEvent->deltaX;
|
|
||||||
}
|
|
||||||
if (aEvent->deltaY) {
|
|
||||||
mY = aEvent->deltaY;
|
|
||||||
}
|
|
||||||
mLastTime = TimeStamp::Now();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mX += aEvent->deltaX;
|
mX += aEvent->deltaX;
|
||||||
mY += aEvent->deltaY;
|
mY += aEvent->deltaY;
|
||||||
|
|
||||||
|
@ -5164,45 +5162,10 @@ void
|
||||||
nsEventStateManager::DeltaAccumulator::Reset()
|
nsEventStateManager::DeltaAccumulator::Reset()
|
||||||
{
|
{
|
||||||
mX = mY = 0.0;
|
mX = mY = 0.0;
|
||||||
mPendingScrollAmountX = mPendingScrollAmountY = 0.0;
|
|
||||||
mHandlingDeltaMode = PR_UINT32_MAX;
|
mHandlingDeltaMode = PR_UINT32_MAX;
|
||||||
mHandlingPixelOnlyDevice = false;
|
mHandlingPixelOnlyDevice = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIntPoint
|
|
||||||
nsEventStateManager::DeltaAccumulator::ComputeScrollAmountForDefaultAction(
|
|
||||||
widget::WheelEvent* aEvent,
|
|
||||||
const nsIntSize& aScrollAmountInDevPixels)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aEvent);
|
|
||||||
|
|
||||||
// If the wheel event is line scroll and the delta value is computed from
|
|
||||||
// system settings, allow to override the system speed.
|
|
||||||
bool allowScrollSpeedOverride =
|
|
||||||
(!aEvent->customizedByUserPrefs &&
|
|
||||||
aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_LINE);
|
|
||||||
DeltaValues acceleratedDelta =
|
|
||||||
nsMouseWheelTransaction::AccelerateWheelDelta(aEvent,
|
|
||||||
allowScrollSpeedOverride);
|
|
||||||
|
|
||||||
nsIntPoint result(0, 0);
|
|
||||||
if (aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_PIXEL) {
|
|
||||||
mPendingScrollAmountX += acceleratedDelta.deltaX;
|
|
||||||
mPendingScrollAmountY += acceleratedDelta.deltaY;
|
|
||||||
} else {
|
|
||||||
mPendingScrollAmountX +=
|
|
||||||
aScrollAmountInDevPixels.width * acceleratedDelta.deltaX;
|
|
||||||
mPendingScrollAmountY +=
|
|
||||||
aScrollAmountInDevPixels.height * acceleratedDelta.deltaY;
|
|
||||||
}
|
|
||||||
result.x = RoundDown(mPendingScrollAmountX);
|
|
||||||
result.y = RoundDown(mPendingScrollAmountY);
|
|
||||||
mPendingScrollAmountX -= result.x;
|
|
||||||
mPendingScrollAmountY -= result.y;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
/* nsEventStateManager::WheelPrefs */
|
/* nsEventStateManager::WheelPrefs */
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
|
@ -529,8 +529,6 @@ protected:
|
||||||
sInstance = nullptr;
|
sInstance = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsInTransaction() { return mHandlingDeltaMode != PR_UINT32_MAX; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* InitLineOrPageDelta() stores pixel delta values of WheelEvents which are
|
* InitLineOrPageDelta() stores pixel delta values of WheelEvents which are
|
||||||
* caused if it's needed. And if the accumulated delta becomes a
|
* caused if it's needed. And if the accumulated delta becomes a
|
||||||
|
@ -541,34 +539,19 @@ protected:
|
||||||
mozilla::widget::WheelEvent* aEvent);
|
mozilla::widget::WheelEvent* aEvent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset() resets all members.
|
* Reset() resets both delta values.
|
||||||
*/
|
*/
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
/**
|
|
||||||
* ComputeScrollAmountForDefaultAction() computes the default action's
|
|
||||||
* scroll amount in device pixels with mPendingScrollAmount*.
|
|
||||||
*/
|
|
||||||
nsIntPoint ComputeScrollAmountForDefaultAction(
|
|
||||||
mozilla::widget::WheelEvent* aEvent,
|
|
||||||
const nsIntSize& aScrollAmountInDevPixels);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeltaAccumulator() :
|
DeltaAccumulator() :
|
||||||
mX(0.0), mY(0.0), mPendingScrollAmountX(0.0), mPendingScrollAmountY(0.0),
|
mX(0.0), mY(0.0), mHandlingDeltaMode(PR_UINT32_MAX),
|
||||||
mHandlingDeltaMode(PR_UINT32_MAX), mHandlingPixelOnlyDevice(false)
|
mHandlingPixelOnlyDevice(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
double mX;
|
double mX;
|
||||||
double mY;
|
double mY;
|
||||||
|
|
||||||
// When default action of a wheel event is scroll but some delta values
|
|
||||||
// are ignored because the computed amount values are not integer, the
|
|
||||||
// fractional values are saved by these members.
|
|
||||||
double mPendingScrollAmountX;
|
|
||||||
double mPendingScrollAmountY;
|
|
||||||
|
|
||||||
TimeStamp mLastTime;
|
TimeStamp mLastTime;
|
||||||
|
|
||||||
PRUint32 mHandlingDeltaMode;
|
PRUint32 mHandlingDeltaMode;
|
||||||
|
|
|
@ -34,7 +34,6 @@ MOCHITEST_FILES = \
|
||||||
test_bug405632.html \
|
test_bug405632.html \
|
||||||
test_bug409604.html \
|
test_bug409604.html \
|
||||||
test_bug412567.html \
|
test_bug412567.html \
|
||||||
test_bug422132.html \
|
|
||||||
test_bug426082.html \
|
test_bug426082.html \
|
||||||
test_bug427537.html \
|
test_bug427537.html \
|
||||||
test_bug432698.html \
|
test_bug432698.html \
|
||||||
|
|
|
@ -1,94 +0,0 @@
|
||||||
<!DOCTYPE HTML>
|
|
||||||
<html>
|
|
||||||
<!--
|
|
||||||
https://bugzilla.mozilla.org/show_bug.cgi?id=422132
|
|
||||||
-->
|
|
||||||
<head>
|
|
||||||
<title>Test for Bug 422132</title>
|
|
||||||
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
|
||||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
||||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=422132">Mozilla Bug 422132</a>
|
|
||||||
<p id="display"></p>
|
|
||||||
<div id="target" style="font-size: 0; width: 200px; height: 200px; overflow: auto;">
|
|
||||||
<div style="width: 1000px; height: 1000px;"></div>
|
|
||||||
</div>
|
|
||||||
<div id="content" style="display: none">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<pre id="test">
|
|
||||||
<script class="testbody" type="text/javascript">
|
|
||||||
|
|
||||||
/** Test for Bug 422132 **/
|
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
|
||||||
SimpleTest.waitForFocus(runTests, window);
|
|
||||||
|
|
||||||
function hitEventLoop(aFunc, aTimes)
|
|
||||||
{
|
|
||||||
if (--aTimes) {
|
|
||||||
setTimeout(hitEventLoop, 0, aFunc, aTimes);
|
|
||||||
} else {
|
|
||||||
setTimeout(aFunc, 20);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function runTests()
|
|
||||||
{
|
|
||||||
SpecialPowers.setIntPref("mousewheel.min_line_scroll_amount", 1);
|
|
||||||
SpecialPowers.setIntPref("mousewheel.transaction.timeout", 100000);
|
|
||||||
|
|
||||||
var target = document.getElementById("target");
|
|
||||||
|
|
||||||
var scrollLeft = target.scrollLeft;
|
|
||||||
var scrollTop = target.scrollTop;
|
|
||||||
synthesizeWheel(target, 10, 10,
|
|
||||||
{ deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
||||||
deltaX: 0.5, deltaY: 0.5, lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 });
|
|
||||||
hitEventLoop(function () {
|
|
||||||
is(target.scrollLeft, scrollLeft, "scrolled to right by 0.5px delta value");
|
|
||||||
is(target.scrollTop, scrollTop, "scrolled to bottom by 0.5px delta value");
|
|
||||||
scrollLeft = target.scrollLeft;
|
|
||||||
scrollTop = target.scrollTop;
|
|
||||||
synthesizeWheel(target, 10, 10,
|
|
||||||
{ deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
||||||
deltaX: 0.5, deltaY: 0.5, lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 });
|
|
||||||
hitEventLoop(function () {
|
|
||||||
ok(target.scrollLeft > scrollLeft,
|
|
||||||
"not scrolled to right by 0.5px delta value with pending 0.5px delta");
|
|
||||||
ok(target.scrollTop > scrollTop,
|
|
||||||
"not scrolled to bottom by 0.5px delta value with pending 0.5px delta");
|
|
||||||
scrollLeft = target.scrollLeft;
|
|
||||||
scrollTop = target.scrollTop;
|
|
||||||
synthesizeWheel(target, 10, 10,
|
|
||||||
{ deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
||||||
deltaX: 0.5, deltaY: 0.5, lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 });
|
|
||||||
hitEventLoop(function () {
|
|
||||||
is(target.scrollLeft, scrollLeft, "scrolled to right by 0.5 line delta value");
|
|
||||||
is(target.scrollTop, scrollTop, "scrolled to bottom by 0.5 line delta value");
|
|
||||||
scrollLeft = target.scrollLeft;
|
|
||||||
scrollTop = target.scrollTop;
|
|
||||||
synthesizeWheel(target, 10, 10,
|
|
||||||
{ deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
||||||
deltaX: 0.5, deltaY: 0.5, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 });
|
|
||||||
hitEventLoop(function () {
|
|
||||||
ok(target.scrollLeft > scrollLeft,
|
|
||||||
"not scrolled to right by 0.5 line delta value with pending 0.5 line delta");
|
|
||||||
ok(target.scrollTop > scrollTop,
|
|
||||||
"not scrolled to bottom by 0.5 line delta value with pending 0.5 line delta");
|
|
||||||
SpecialPowers.clearUserPref("mousewheel.min_line_scroll_amount");
|
|
||||||
SpecialPowers.clearUserPref("mousewheel.transaction.timeout");
|
|
||||||
SimpleTest.finish();
|
|
||||||
}, 20);
|
|
||||||
}, 20);
|
|
||||||
}, 20);
|
|
||||||
}, 20);
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</pre>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -2548,16 +2548,9 @@ nsGfxScrollFrameInner::GetLineScrollAmount() const
|
||||||
nsLayoutUtils::GetFontMetricsForFrame(mOuter, getter_AddRefs(fm),
|
nsLayoutUtils::GetFontMetricsForFrame(mOuter, getter_AddRefs(fm),
|
||||||
nsLayoutUtils::FontSizeInflationFor(mOuter));
|
nsLayoutUtils::FontSizeInflationFor(mOuter));
|
||||||
NS_ASSERTION(fm, "FontMetrics is null, assuming fontHeight == 1 appunit");
|
NS_ASSERTION(fm, "FontMetrics is null, assuming fontHeight == 1 appunit");
|
||||||
static nscoord sMinLineScrollAmountInPixels = -1;
|
nscoord fontHeight = 1;
|
||||||
if (sMinLineScrollAmountInPixels < 0) {
|
|
||||||
Preferences::AddIntVarCache(&sMinLineScrollAmountInPixels,
|
|
||||||
"mousewheel.min_line_scroll_amount", 1);
|
|
||||||
}
|
|
||||||
PRUint32 appUnitsPerDevPixel = mOuter->PresContext()->AppUnitsPerDevPixel();
|
|
||||||
nscoord fontHeight =
|
|
||||||
NS_MAX(1, sMinLineScrollAmountInPixels) * appUnitsPerDevPixel;
|
|
||||||
if (fm) {
|
if (fm) {
|
||||||
fontHeight = NS_MAX(fm->MaxHeight(), fontHeight);
|
fontHeight = fm->MaxHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
return nsSize(fontHeight, fontHeight);
|
return nsSize(fontHeight, fontHeight);
|
||||||
|
|
|
@ -1417,10 +1417,6 @@ pref("mousewheel.with_win.delta_multiplier_x", 100);
|
||||||
pref("mousewheel.with_win.delta_multiplier_y", 100);
|
pref("mousewheel.with_win.delta_multiplier_y", 100);
|
||||||
pref("mousewheel.with_win.delta_multiplier_z", 100);
|
pref("mousewheel.with_win.delta_multiplier_z", 100);
|
||||||
|
|
||||||
// If line-height is lower than this value (in device pixels), 1 line scroll
|
|
||||||
// scrolls this height.
|
|
||||||
pref("mousewheel.min_line_scroll_amount", 5);
|
|
||||||
|
|
||||||
// These define the smooth scroll behavior (min ms, max ms) for different triggers
|
// These define the smooth scroll behavior (min ms, max ms) for different triggers
|
||||||
// Some triggers:
|
// Some triggers:
|
||||||
// mouseWheel: Discrete mouse wheel events, Synaptics touchpads on windows (generate wheel events)
|
// mouseWheel: Discrete mouse wheel events, Synaptics touchpads on windows (generate wheel events)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче