diff options
| author | mrmr1993 | 2014-12-15 19:12:41 +0000 | 
|---|---|---|
| committer | mrmr1993 | 2014-12-15 19:12:41 +0000 | 
| commit | 8a2f7bf9db05342bab2442f6b761f855fb0ca209 (patch) | |
| tree | f3edc0e90f7c6c86fe36f4939f42b8590942d492 | |
| parent | 5ec7f490b5e9e68bddb415b66b6cae86841a3d52 (diff) | |
| download | vimium-8a2f7bf9db05342bab2442f6b761f855fb0ca209.tar.bz2 | |
Skip over tiny frames when calling focusThisFrame
GMail and Google Inbox both use a large number of small (typically 0x0
or 1x1 frames) which we have to pass over with nextFrame to get to the
frames we want. We avoid this issue by ignoring all frames with height
or width < 3, since these will be essentially invisible to the user
anyway.
| -rw-r--r-- | background_scripts/main.coffee | 1 | ||||
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 4 | 
2 files changed, 5 insertions, 0 deletions
| diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 3ec618c9..647923c0 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -633,6 +633,7 @@ sendRequestHandlers =    registerFrame: registerFrame,    unregisterFrame: unregisterFrame,    frameFocused: handleFrameFocused, +  nextFrame: (request) -> BackgroundCommands.nextFrame 1, request.frameId    upgradeNotificationClosed: upgradeNotificationClosed,    updateScrollPosition: handleUpdateScrollPosition,    copyToClipboard: copyToClipboard, diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 31f0eab5..cd7a7605 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -225,6 +225,10 @@ setScrollPosition = (scrollX, scrollY) ->  # Called from the backend in order to change frame focus.  #  window.focusThisFrame = (shouldHighlight) -> +  if window.innerWidth < 3 or window.innerHeight < 3 +    # This frame is too small to focus. Cancel and tell the background frame to focus the next one instead. +    chrome.runtime.sendMessage({ handler: "nextFrame", frameId: frameId }) +    return    window.focus()    if (document.body && shouldHighlight)      borderWas = document.body.style.border | 
