aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorStephen Blott2016-10-08 14:14:37 +0100
committerStephen Blott2016-10-08 14:14:37 +0100
commitda2be746332c69326b008f555aec2f1a166de7b0 (patch)
tree7f9654d05b7d741fc897a939ebf58afb72f5d8b8 /lib
parent219298f7f418f51721ce6a673ffb956ec00c1633 (diff)
downloadvimium-da2be746332c69326b008f555aec2f1a166de7b0.tar.bz2
Better positioning of link-hints flash rect.
When an <a> spans the end of a line and the start of the next line, we now highlight both parts of the link (instead of just the first). Also, refactor code for calculating the position of the viewport into a separate utility in DomUtils.
Diffstat (limited to 'lib')
-rw-r--r--lib/dom_utils.coffee7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee
index 8e953405..82c13287 100644
--- a/lib/dom_utils.coffee
+++ b/lib/dom_utils.coffee
@@ -288,6 +288,13 @@ DomUtils =
flashEl = @addFlashRect rect
setTimeout((-> DomUtils.removeElement flashEl), 400)
+ getViewportTopLeft: ->
+ if getComputedStyle(document.documentElement).position == "static"
+ top: window.scrollY, left: window.scrollX
+ else
+ rect = document.documentElement.getBoundingClientRect()
+ top: -rect.top, left: -rect.left
+
suppressPropagation: (event) ->
event.stopImmediatePropagation()