aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/scroller.coffee
diff options
context:
space:
mode:
authorStephen Blott2015-01-31 08:02:46 +0000
committerStephen Blott2015-01-31 08:08:52 +0000
commitfebe30806b9c2e4e4a82ea8552b060fcbdd6cc5e (patch)
treeed462457ce0db04a07523dd7f6e3120df10be519 /content_scripts/scroller.coffee
parent0c9b69a319e272727474ab6e1dabb3461927323d (diff)
downloadvimium-febe30806b9c2e4e4a82ea8552b060fcbdd6cc5e.tar.bz2
Fix scrolling issue.
On this page: - http://www.steephill.tv/dubai-tour/ I was seeing a scrolling problem in my live browser (j/k didn't work until I clicked on the page), but couldn't reproduce it directly in my test browser. That's worrying. Nevertheless, what was happening was that we succeeded in scrolling a test amount in one direction, but the scroll to revert failed. The consequence was that we concluded (incorrectly) that the element doesn't scroll. And j/k scrolling is broken as a result. How can it be that a scroll in one direction succeeds, but the reverse does not? This fixes the problem by not checking whether we are able to undo the scroll of our test amount.
Diffstat (limited to 'content_scripts/scroller.coffee')
-rw-r--r--content_scripts/scroller.coffee6
1 files changed, 5 insertions, 1 deletions
diff --git a/content_scripts/scroller.coffee b/content_scripts/scroller.coffee
index f26f0b73..17a49464 100644
--- a/content_scripts/scroller.coffee
+++ b/content_scripts/scroller.coffee
@@ -75,7 +75,11 @@ doesScroll = (element, direction, amount, factor) ->
# definitely scrolling backwards, so a delta of -1 will do. For absolute scrolls, factor is always 1.
delta = factor * getDimension(element, direction, amount) || -1
delta = getSign delta # 1 or -1
- performScroll(element, direction, delta) and performScroll(element, direction, -delta)
+ for change in [ delta, -delta ]
+ if performScroll element, direction, change
+ performScroll element, direction, -change
+ return true
+ false
# From element and its parents, find the first which we should scroll and which does scroll.
findScrollableElement = (element, direction, amount, factor) ->