aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2014-12-22 12:31:40 +0000
committerStephen Blott2014-12-22 12:31:40 +0000
commit58191de5302f5bf52852c686777c385965013c07 (patch)
treee32b28f4def2e39ba86c506c1d7078b259581f6a
parentffe22c01f26cc94524d4f7e3deb7ac6901583e42 (diff)
parent76af56da84753163adc4dbf943374a10f0cb8321 (diff)
downloadvimium-58191de5302f5bf52852c686777c385965013c07.tar.bz2
Merge branch 'link-hints-overlap' of https://github.com/mrmr1993/vimium into mrmr1993-link-hints-overlap
-rw-r--r--content_scripts/link_hints.coffee4
-rw-r--r--lib/dom_utils.coffee14
2 files changed, 9 insertions, 9 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee
index 9eb7b87c..c4bf3f96 100644
--- a/content_scripts/link_hints.coffee
+++ b/content_scripts/link_hints.coffee
@@ -149,8 +149,8 @@ LinkHints =
map = document.querySelector "map[name=\"#{mapName}\"]"
if map and imgClientRects.length > 0
areas = map.getElementsByTagName "area"
- areaRects = DomUtils.getClientRectsForAreas imgClientRects[0], areas
- visibleElements = visibleElements.concat areaRects
+ areasAndRects = DomUtils.getClientRectsForAreas imgClientRects[0], areas
+ visibleElements.push areasAndRects...
# Check aria properties to see if the element should be ignored.
if (element.getAttribute("aria-hidden")?.toLowerCase() in ["", "true"] or
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