aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2016-04-03 08:37:51 +0100
committerStephen Blott2016-04-04 06:15:52 +0100
commit34f05dcc98c89ce64f242f46f57d95b4da4b77aa (patch)
tree2c9fb836011508fb6a8f706bc682016d3aac2dcc
parentf8f29c0ea1801be68cec47fa86861afab9cc9055 (diff)
downloadvimium-34f05dcc98c89ce64f242f46f57d95b4da4b77aa.tar.bz2
Keep showLinkText local for link hints.
We only need showLinkText in the hint's local frame, so do not transmit it to remote frames.
-rw-r--r--content_scripts/link_hints.coffee21
1 files 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 <Shift> and <Ctrl>.
@@ -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."