diff options
| author | Phil Crosby | 2009-12-06 00:19:01 -0800 | 
|---|---|---|
| committer | Phil Crosby | 2009-12-06 00:19:01 -0800 | 
| commit | 88d8247dc79f082ca6215670fbe512500cc8fb36 (patch) | |
| tree | 43e629aa8a7030bc233053f2c031216d065897a4 /linkHints.js | |
| parent | b578214f49d65791705d11be58993478a7636a3e (diff) | |
| download | vimium-88d8247dc79f082ca6215670fbe512500cc8fb36.tar.bz2 | |
Use the center of a link's bounding box instead of its upper-left corner to detect if its visible.
This is a slightly more accurate heuristic and fixes #17.
Diffstat (limited to 'linkHints.js')
| -rw-r--r-- | linkHints.js | 7 | 
1 files changed, 5 insertions, 2 deletions
diff --git a/linkHints.js b/linkHints.js index da33f202..fdafa1ed 100644 --- a/linkHints.js +++ b/linkHints.js @@ -82,8 +82,11 @@ function getVisibleClickableElements() {        continue;      // Using getElementFromPoint will omit elements which have visibility=hidden or display=none, and -    // elements inside of containers that are also hidden. -    if (!elementOccupiesPoint(element, boundingRect.left, boundingRect.top)) +    // elements inside of containers that are also hidden. Check for whether the element occupies the center +    // of its bounding box instead of simply the upper-left corner of that box because this is more accurate +    // when inline links have vertical padding, like in the links ("Source", "Commits") at the top of github.com. +    if (!elementOccupiesPoint(element, boundingRect.left + boundingRect.width / 2, +          boundingRect.top + boundingRect.height / 2))        continue;      visibleElements.push(element);  | 
