From 4f5667c427a1d14fc8c6eb3477eb58c69b467bf9 Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Sat, 11 Nov 2017 16:51:47 +0000 Subject: Unify link hint flash codepaths --- content_scripts/link_hints.coffee | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'content_scripts/link_hints.coffee') diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index e3e96ffe..d919dae1 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -385,15 +385,15 @@ class LinkHintsMode clickEl.focus() linkActivator clickEl + if linkMatched.isLocalMarker + {top: viewportTop, left: viewportLeft} = DomUtils.getViewportTopLeft() + for rect in clickEl.getClientRects() + flashEl = DomUtils.addFlashRect Rect.translate rect, viewportLeft, viewportTop + do (flashEl) -> HintCoordinator.onExit.push -> DomUtils.removeElement flashEl + # If we're using a keyboard blocker, then the frame with the focus sends the "exit" message, otherwise the # frame containing the matched link does. if userMightOverType - if linkMatched.isLocalMarker - {top: viewportTop, left: viewportLeft} = DomUtils.getViewportTopLeft() - for rect in clickEl.getClientRects() - flashEl = DomUtils.addFlashRect Rect.translate rect, viewportLeft, viewportTop - do (flashEl) -> HintCoordinator.onExit.push -> DomUtils.removeElement flashEl - if windowIsFocused() callback = (isSuccess) -> HintCoordinator.sendMessage "exit", {isSuccess} if Settings.get "waitForEnterForFilteredHints" @@ -401,7 +401,6 @@ class LinkHintsMode else new TypingProtector 200, callback else if linkMatched.isLocalMarker - DomUtils.flashRect linkMatched.rect HintCoordinator.sendMessage "exit", isSuccess: true # -- cgit v1.2.3