aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dom_utils.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dom_utils.coffee')
-rw-r--r--lib/dom_utils.coffee11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee
index 500332e0..690d9969 100644
--- a/lib/dom_utils.coffee
+++ b/lib/dom_utils.coffee
@@ -289,11 +289,14 @@ DomUtils =
setTimeout((-> DomUtils.removeElement flashEl), 400)
getViewportTopLeft: ->
- if getComputedStyle(document.documentElement).position == "static"
- top: window.scrollY, left: window.scrollX
+ box = document.documentElement
+ style = getComputedStyle box
+ if style.position == "static" and not /content|paint|strict/.test(style.contain or "")
+ zoom = +style.zoom || 1
+ top: Math.ceil(window.scrollY / zoom), left: Math.ceil(window.scrollX / zoom)
else
- rect = document.documentElement.getBoundingClientRect()
- top: -rect.top, left: -rect.left
+ rect = box.getBoundingClientRect()
+ top: -rect.top - box.clientTop, left: -rect.left - box.clientLeft
suppressPropagation: (event) ->
event.stopImmediatePropagation()