diff options
| author | Stephen Blott | 2016-04-02 08:48:00 +0100 | 
|---|---|---|
| committer | Stephen Blott | 2016-04-02 08:54:59 +0100 | 
| commit | 03e010f0aeb835778664438549f168ccae297d7c (patch) | |
| tree | dc6d5fb8b13e58480ba508344985df7e33b62c8d | |
| parent | 3d7b6e1f548da2f76fe0828e902fbe0a02e2c70d (diff) | |
| download | vimium-03e010f0aeb835778664438549f168ccae297d7c.tar.bz2 | |
Move the test for small windows to DomUtils.
The reason for doing this is that we will be using the same test to
decide whether or not to register a frame.
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 2 | ||||
| -rw-r--r-- | lib/dom_utils.coffee | 4 | 
2 files changed, 5 insertions, 1 deletions
| diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index b1e82a75..fb8742e0 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -264,7 +264,7 @@ DomUtils.documentReady ->  #  focusThisFrame = (request) ->    unless request.forceFocusThisFrame -    if window.innerWidth < 3 or window.innerHeight < 3 or document.body?.tagName.toLowerCase() == "frameset" +    if DomUtils.windowIsTooSmall() or document.body?.tagName.toLowerCase() == "frameset"        # This frame is too small to focus or it's a frameset. Cancel and tell the background page to focus the        # next frame instead.  This affects sites like Google Inbox, which have many tiny iframes. See #1317.        chrome.runtime.sendMessage handler: "nextFrame" diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee index 014a1f50..eb11e295 100644 --- a/lib/dom_utils.coffee +++ b/lib/dom_utils.coffee @@ -322,5 +322,9 @@ DomUtils =    getContainingElement: (element) ->      element.getDestinationInsertionPoints()[0] or element.parentElement +  # This tests whether a window is too small to be useful. +  windowIsTooSmall: -> +    return window.innerWidth < 3 or window.innerHeight < 3 +  root = exports ? window  root.DomUtils = DomUtils | 
