diff options
| author | mrmr1993 | 2017-09-14 20:22:09 +0100 |
|---|---|---|
| committer | mrmr1993 | 2017-09-14 20:22:09 +0100 |
| commit | 09abac4c4c6be7a567478f726dab5f2456ee433d (patch) | |
| tree | c6fb4ad4789ba0020e10f742cfc1b4e7366b6165 | |
| parent | 12826329347221b46496c6ff5dfa390c20a01585 (diff) | |
| download | vimium-09abac4c4c6be7a567478f726dab5f2456ee433d.tar.bz2 | |
FF: Tweak getViewportTopLeft to use borderTop/Left for clientTop/Left
| -rw-r--r-- | lib/dom_utils.coffee | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee index 21a80330..b3fc981b 100644 --- a/lib/dom_utils.coffee +++ b/lib/dom_utils.coffee @@ -292,13 +292,18 @@ DomUtils = box = document.documentElement style = getComputedStyle box rect = box.getBoundingClientRect() - {clientTop, clientLeft} = box if style.position == "static" and not /content|paint|strict/.test(style.contain or "") # The margin is included in the client rect, so we need to subtract it back out. marginTop = parseInt style.marginTop marginLeft = parseInt style.marginLeft top: -rect.top + marginTop, left: -rect.left + marginLeft else + if Utils.isFirefox() + # These are always 0 for documentElement on Firefox, so we derive them from CSS border. + clientTop = parseInt style.borderTopWidth + clientLeft = parseInt style.borderLeftWidth + else + {clientTop, clientLeft} = box top: -rect.top - clientTop, left: -rect.left - clientLeft |
