From f8f29c0ea1801be68cec47fa86861afab9cc9055 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sun, 3 Apr 2016 08:32:42 +0100 Subject: Keep reason local for link hints. The "reason" a hint is available is only ever needed in the hint's own frame, so there's no need to pass it to other frames. --- content_scripts/link_hints.coffee | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index c3a4046b..4229d549 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -79,8 +79,8 @@ HintCoordinator = @localHints = LocalHints.getLocalHints() console.log "getHintDescriptors", frameId, "[#{@localHints.length}]" if @debug @sendMessage "postHintDescriptors", hintDescriptors: - @localHints.map ({linkText, showLinkText, hasHref, reason}, localIndex) -> - {linkText, showLinkText, hasHref, reason, frameId, localIndex} + @localHints.map ({linkText, showLinkText, hasHref}, localIndex) -> + {linkText, showLinkText, hasHref, 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 @@ -295,14 +295,15 @@ class LinkHintsMode # selectively pushing the appropriate HintCoordinator.onExit handlers. activateLink: (linkMatched, userMightOverType=false) -> @removeHintMarkers() - clickEl = HintCoordinator.getLocalHintMarker(linkMatched.hintDescriptor)?.element + localHintDescriptor = HintCoordinator.getLocalHintMarker linkMatched.hintDescriptor + clickEl = localHintDescriptor?.element if clickEl? HintCoordinator.onExit.push (isSuccess) => if isSuccess - if linkMatched.hintDescriptor.reason == "Frame." + if localHintDescriptor.reason == "Frame." Utils.nextTick -> focusThisFrame highlight: true - else if linkMatched.hintDescriptor.reason == "Scroll." + else if localHintDescriptor.reason == "Scroll." # Tell the scroller that this is the activated element. handlerStack.bubbleEvent "DOMActivate", target: clickEl else if DomUtils.isSelectable clickEl -- cgit v1.2.3