diff options
author | mrmr1993 | 2014-12-22 11:51:06 +0000 |
---|---|---|
committer | mrmr1993 | 2014-12-22 11:51:06 +0000 |
commit | 56ba56622c529d570285f42732f4f1ed29830987 (patch) | |
tree | 82e98710486331eb4bcaf23d818b5727eb7fe984 /lib/dom_utils.coffee | |
parent | 3a688f754ebd647ce56b33d18c5744759c5efe95 (diff) | |
download | vimium-56ba56622c529d570285f42732f4f1ed29830987.tar.bz2 |
Support small <area>s with link hints
This is primarily to deal with our calculated rects being too small for
the `<area shape="poly">` on
http://www.mapsofindia.com/worldmap/clickable-world-map.html
Diffstat (limited to 'lib/dom_utils.coffee')
-rw-r--r-- | lib/dom_utils.coffee | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee index 7fd126b8..8bb099a1 100644 --- a/lib/dom_utils.coffee +++ b/lib/dom_utils.coffee @@ -59,13 +59,13 @@ DomUtils = continue if (computedStyle.getPropertyValue('float') == 'none' && computedStyle.getPropertyValue('position') != 'absolute') childClientRect = @getVisibleClientRect(child) - continue if (childClientRect == null) + continue if clientRect == null return childClientRect else clientRect = @cropRectToVisible clientRect - continue unless clientRect + continue if clientRect == null or clientRect.width < 3 or clientRect.height < 3 # eliminate invisible elements (see test_harnesses/visibility_test.html) computedStyle = window.getComputedStyle(element, null) @@ -83,12 +83,12 @@ DomUtils = # cropRectToVisible: (rect) -> boundedRect = Rect.create( - Math.max(rect.left, 0), - Math.max(rect.top, 0), - Math.min(rect.right, window.innerWidth), - Math.min(rect.bottom, window.innerHeight) + Math.max(rect.left, 0) + Math.max(rect.top, 0) + rect.right + rect.bottom ) - if boundedRect.width < 3 or boundedRect.height < 3 + if boundedRect.top >= window.innerHeight - 4 or boundedRect.left >= window.innerWidth - 4 null else boundedRect |