mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 10:00:54 +00:00
Bug 784410. Fix mousewheel scrolling to avoid scrolling frames that can't be scrolled by at least one device pixel. r=mats
This commit is contained in:
parent
a84827280d
commit
f936b8b283
@ -383,11 +383,13 @@ CanScrollOn(nsIScrollableFrame* aScrollFrame, double aDeltaX, double aDeltaY)
|
||||
|
||||
nsPoint scrollPt = aScrollFrame->GetScrollPosition();
|
||||
nsRect scrollRange = aScrollFrame->GetScrollRange();
|
||||
nscoord oneDevPixel =
|
||||
aScrollFrame->GetScrolledFrame()->PresContext()->AppUnitsPerDevPixel();
|
||||
|
||||
return ((aDeltaX && CanScrollInRange(scrollRange.x, scrollPt.x,
|
||||
scrollRange.XMost(), aDeltaX)) ||
|
||||
(aDeltaY && CanScrollInRange(scrollRange.y, scrollPt.y,
|
||||
scrollRange.YMost(), aDeltaY)));
|
||||
return (aDeltaX && scrollRange.width >= oneDevPixel &&
|
||||
CanScrollInRange(scrollRange.x, scrollPt.x, scrollRange.XMost(), aDeltaX)) ||
|
||||
(aDeltaY && scrollRange.height >= oneDevPixel &&
|
||||
CanScrollInRange(scrollRange.y, scrollPt.y, scrollRange.YMost(), aDeltaY));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -27,16 +27,28 @@ function innerScrollOffset() {
|
||||
}
|
||||
var innerStartScrollOffset = innerScrollOffset();
|
||||
|
||||
var done = false;
|
||||
var step = 0;
|
||||
function doneScroll() {
|
||||
if (done) {
|
||||
return;
|
||||
++step;
|
||||
switch (step) {
|
||||
case 1:
|
||||
is(innerScrollOffset(), innerStartScrollOffset, "Inner element should not have scrolled down");
|
||||
ok(outer.scrollTop > 0, "Outer element should have scrolled down");
|
||||
|
||||
outer.scrollTop = 0;
|
||||
break;
|
||||
case 2:
|
||||
synthesizeWheel(inner, 4, 4,
|
||||
{ deltaMode: WheelEvent.DOM_DELTA_LINE, deltaY: 1 });
|
||||
break;
|
||||
case 3:
|
||||
is(innerScrollOffset(), innerStartScrollOffset, "Inner element should not have scrolled down");
|
||||
ok(outer.scrollTop > 0, "Outer element should have scrolled down");
|
||||
|
||||
SpecialPowers.clearUserPref(smoothScrollPref);
|
||||
SimpleTest.finish();
|
||||
break;
|
||||
}
|
||||
done = true;
|
||||
is(innerScrollOffset(), innerStartScrollOffset, "Inner element should not have scrolled down");
|
||||
ok(outer.scrollTop > 0, "Outer element should have scrolled down");
|
||||
SpecialPowers.clearUserPref(smoothScrollPref);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function test() {
|
||||
|
Loading…
Reference in New Issue
Block a user