diff options
| author | Stephen Blott | 2016-04-02 13:09:21 +0100 |
|---|---|---|
| committer | Stephen Blott | 2016-04-02 13:09:27 +0100 |
| commit | eb1b9ee9b4db56068cdc6b7864a6ff1a0fbf1ee4 (patch) | |
| tree | 09809016ecf95cf0e1751cd8388a363982d9f4a5 | |
| parent | 57c3cae5abd5c796b093ad02661b040b2c877fc4 (diff) | |
| download | vimium-eb1b9ee9b4db56068cdc6b7864a6ff1a0fbf1ee4.tar.bz2 | |
Make document.body selectable as scrollable.
Previously, we could select divs, uls, and ols for scrolling, but we
couldn't get back to scrolling the document body.
This makes it possible to select document.body for scrolling.
Unfortunately, sometimes the hint appears in a rather odd place (because
it's "on top of" something else which is clickable.
| -rw-r--r-- | content_scripts/link_hints.coffee | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index 0739d621..01ed6de5 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -68,8 +68,8 @@ HintCoordinator = Settings.onLoaded => @localHints = LocalHints.getLocalHints() @sendMessage "postHintDescriptors", hintDescriptors: - @localHints.map ({rect, linkText, showLinkText, hasHref}, localIndex) -> - {rect, linkText, showLinkText, hasHref, frameId, localIndex} + @localHints.map ({rect, linkText, showLinkText, hasHref, reason}, localIndex) -> + {rect, linkText, showLinkText, hasHref, reason, frameId, localIndex} # We activate LinkHintsMode() in every frame and provide every frame with exactly the same hint descriptors. # We also propagate the key state between frames. Therefore, the hint-selection process proceeds in lock @@ -283,8 +283,11 @@ class LinkHintsMode if clickEl? HintCoordinator.onExit.push (isSuccess) => if isSuccess - if clickEl == document.body + if linkMatched.hintDescriptor.reason == "Frame." Utils.nextTick -> focusThisFrame highlight: true + else if linkMatched.hintDescriptor.reason == "Scroll." + # Tell the scroller that this is the activated element. + handlerStack.bubbleEvent "DOMActivate", target: clickEl else if DomUtils.isSelectable clickEl window.focus() DomUtils.simulateSelect clickEl @@ -576,6 +579,9 @@ LocalHints = window.innerWidth > 3 and window.innerHeight > 3 and document.body?.tagName.toLowerCase() != "frameset" reason = "Frame." + isClickable ||= + if element == document.body and document.hasFocus() and Scroller.isScrollableElement element + reason = "Scroll." when "div", "ol", "ul" isClickable ||= if element.clientHeight < element.scrollHeight and Scroller.isScrollableElement element |
