Skip to content

Commit

Permalink
Bug 657648 Don't use high resolution scrolling when acceleration is e…
Browse files Browse the repository at this point in the history
…nabled r=smaug
  • Loading branch information
masayuki-nakano committed May 18, 2011
1 parent 423502f commit 2412735
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions content/events/src/nsEventStateManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ class nsMouseWheelTransaction {
static PRInt32 AccelerateWheelDelta(PRInt32 aScrollLines,
PRBool aIsHorizontal, PRBool aAllowScrollSpeedOverride,
nsIScrollableFrame::ScrollUnit *aScrollQuantity);
static PRBool IsAccelerationEnabled();

enum {
kScrollSeriesTimeout = 80
Expand Down Expand Up @@ -651,6 +652,12 @@ nsMouseWheelTransaction::GetIgnoreMoveDelayTime()
nsContentUtils::GetIntPref("mousewheel.transaction.ignoremovedelay", 100);
}

PRBool
nsMouseWheelTransaction::IsAccelerationEnabled()
{
return GetAccelerationStart() >= 0 && GetAccelerationFactor() > 0;
}

PRInt32
nsMouseWheelTransaction::AccelerateWheelDelta(PRInt32 aScrollLines,
PRBool aIsHorizontal,
Expand Down Expand Up @@ -2651,6 +2658,12 @@ nsEventStateManager::DoScrollText(nsIFrame* aTargetFrame,

if (!passToParent && frameToScroll) {
if (aQueryEvent) {
// If acceleration is enabled, pixel scroll shouldn't be used for
// high resolution scrolling.
if (nsMouseWheelTransaction::IsAccelerationEnabled()) {
return NS_OK;
}

nscoord appUnitsPerDevPixel =
aTargetFrame->PresContext()->AppUnitsPerDevPixel();
aQueryEvent->mReply.mLineHeight =
Expand Down

0 comments on commit 2412735

Please sign in to comment.