aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdh19952016-10-07 01:51:49 +0800
committergdh19952016-10-08 00:38:07 +0800
commitd14ec3b571df2d0581506e329e593d5cd2344aa7 (patch)
tree85c51c91229db2a8bcd49fb7e91e9ddf86812958
parent49194546a00ba5d9540b252fb10a699319c0d64d (diff)
downloadvimium-d14ec3b571df2d0581506e329e593d5cd2344aa7.tar.bz2
handle documentElement's top 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) =>