diff options
| author | Stephen Blott | 2017-03-04 07:59:01 +0000 | 
|---|---|---|
| committer | GitHub | 2017-03-04 07:59:01 +0000 | 
| commit | ea9622a3819d376a575c8d4d0cf64e3165d5eafd (patch) | |
| tree | 95a633110b8849c68f1eafcef8b6b7d516de517b /lib/dom_utils.coffee | |
| parent | 5cdaf6b8fa341ff9f1a3c2c7c21416deb1724d08 (diff) | |
| parent | a6ee639ecaf758fbe4652b5d70beaa607821ca04 (diff) | |
| download | vimium-ea9622a3819d376a575c8d4d0cf64e3165d5eafd.tar.bz2 | |
Merge pull request #2369 from gdh1995/zoomed-docEl-offset
getViewportTopLeft: support zoomed static documentElement
Diffstat (limited to 'lib/dom_utils.coffee')
| -rw-r--r-- | lib/dom_utils.coffee | 11 | 
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() | 
