aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts
diff options
context:
space:
mode:
authorStephen Blott2014-12-19 11:25:51 +0000
committerStephen Blott2014-12-19 11:25:51 +0000
commit5f4ae0f11340c0c7385d8a91228941128a9731da (patch)
treedeab7b4ecc962af5c4e8a4fcca0f6327358f7b6f /content_scripts
parent24b968943acddd224dd795c1e26425d3b75520e2 (diff)
downloadvimium-5f4ae0f11340c0c7385d8a91228941128a9731da.tar.bz2
Also test negative direction when initializing scroller.
The right scrollable element to choose may be scrolled to the bottom, so we won't find it if we only test scrolling down. We need to test scrolling up as well.
Diffstat (limited to 'content_scripts')
-rw-r--r--content_scripts/scroller.coffee4
1 files changed, 2 insertions, 2 deletions
diff --git a/content_scripts/scroller.coffee b/content_scripts/scroller.coffee
index 3692a002..fdfb7ddc 100644
--- a/content_scripts/scroller.coffee
+++ b/content_scripts/scroller.coffee
@@ -67,7 +67,7 @@ shouldScroll = (element, direction) ->
# Instead, we scroll the element by 1 or -1 and see if it moved (then put it back). :factor is the factor by
# which :scrollBy and :scrollTo will later scale the scroll amount. :factor can be negative, so we need it
# here in order to decide whether we should test a forward scroll or a backward scroll.
-# Bug verified in Chrome 38.0.2125.104.
+# Bug last verified in Chrome 38.0.2125.104.
doesScroll = (element, direction, amount, factor) ->
# amount is treated as a relative amount, which is correct for relative scrolls. For absolute scrolls (only
# gg, G, and friends), amount can be either a string ("max" or "viewSize") or zero. In the former case,
@@ -87,7 +87,7 @@ findScrollableElement = (element, direction, amount, factor) ->
# On some pages, document.body is not scrollable. Here, we search the document for the largest visible
# element which does scroll vertically. This is used to initialize activatedElement. See #1358.
firstScrollableElement = (element=document.body) ->
- if doesScroll element, "y", 1, 1
+ if doesScroll(element, "y", 1, 1) or doesScroll(element, "y", -1, 1)
element
else
children = ({element: child, rect: DomUtils.getVisibleClientRect(child)} for child in element.children)