aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2016-10-08 14:03:22 +0100
committerGitHub2016-10-08 14:03:22 +0100
commit219298f7f418f51721ce6a673ffb956ec00c1633 (patch)
tree608abd9a8add808d0eb79fdbb80480672ba9d238
parent71612af7eb81fa77c0be98a2a69e4852f4003e66 (diff)
parentd14ec3b571df2d0581506e329e593d5cd2344aa7 (diff)
downloadvimium-219298f7f418f51721ce6a673ffb956ec00c1633.tar.bz2
Merge pull request #2301 from gdh1995/documentElement-offset
handle documentElement's top/left margin correctly
-rw-r--r--content_scripts/link_hints.coffee11
1 files changed, 9 insertions, 2 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee
index c86eabf1..b5fa527d 100644
--- a/content_scripts/link_hints.coffee
+++ b/content_scripts/link_hints.coffee
@@ -811,9 +811,16 @@ LocalHints =
nonOverlappingElements.push visibleElement unless visibleElement.secondClassCitizen
# Position the rects within the window.
+ if getComputedStyle(document.documentElement).position == "static"
+ top = window.scrollY
+ left = window.scrollX
+ else
+ rect = document.documentElement.getBoundingClientRect()
+ top = -rect.top
+ left = -rect.left
for hint in nonOverlappingElements
- hint.rect.top += window.scrollY
- hint.rect.left += window.scrollX
+ hint.rect.top += top
+ hint.rect.left += left
if Settings.get "filterLinkHints"
@withLabelMap (labelMap) =>