From 34f05dcc98c89ce64f242f46f57d95b4da4b77aa Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sun, 3 Apr 2016 08:37:51 +0100 Subject: Keep showLinkText local for link hints. We only need showLinkText in the hint's local frame, so do not transmit it to remote frames. --- content_scripts/link_hints.coffee | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index 4229d549..4d9a02b8 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}, localIndex) -> - {linkText, showLinkText, hasHref, frameId, localIndex} + @localHints.map ({linkText, hasHref}, localIndex) -> + {linkText, 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 @@ -187,19 +187,22 @@ class LinkHintsMode createMarkerFor: (desc) -> marker = if desc.frameId == frameId + localHintDescriptor = HintCoordinator.getLocalHintMarker desc el = DomUtils.createElement "div" - el.rect = HintCoordinator.getLocalHintMarker(desc).rect + el.rect = localHintDescriptor.rect el.style.left = el.rect.left + window.scrollX + "px" el.style.top = el.rect.top + window.scrollY + "px" - extend el, className: "vimiumReset internalVimiumHintMarker vimiumHintMarker" + extend el, + className: "vimiumReset internalVimiumHintMarker vimiumHintMarker" + showLinkText: localHintDescriptor.showLinkText + localHintDescriptor: localHintDescriptor else {} extend marker, hintDescriptor: desc - linkText: desc.linkText - showLinkText: desc.showLinkText isLocalMarker: desc.frameId == frameId + linkText: desc.linkText stableSortCount: ++@stableSortCount # Handles and . @@ -295,10 +298,10 @@ class LinkHintsMode # selectively pushing the appropriate HintCoordinator.onExit handlers. activateLink: (linkMatched, userMightOverType=false) -> @removeHintMarkers() - localHintDescriptor = HintCoordinator.getLocalHintMarker linkMatched.hintDescriptor - clickEl = localHintDescriptor?.element - if clickEl? + if linkMatched.isLocalMarker + localHintDescriptor = linkMatched.localHintDescriptor + clickEl = localHintDescriptor.element HintCoordinator.onExit.push (isSuccess) => if isSuccess if localHintDescriptor.reason == "Frame." -- cgit v1.2.3