From 21da3fcafbb29540788037dbcdbdce79ad14e650 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Wed, 30 Mar 2016 13:07:05 +0100 Subject: Rename handlerStack constants. Problems: - The meanings of some of the Mode/handlerStack constant names is far from obvious. - The same thing is named different things in different places. This changes various constant names such that: - the names used in the handler stack and in the modes are the same. - ditto vis-a-vis DomUtils. Also, break out the core of the handler stacks' `bubbleEvent` method into a switch statements. This makes it more obvious that the cases are mutually exclusive. --- content_scripts/mode_key_handler.coffee | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'content_scripts/mode_key_handler.coffee') diff --git a/content_scripts/mode_key_handler.coffee b/content_scripts/mode_key_handler.coffee index 96792306..ca20be46 100644 --- a/content_scripts/mode_key_handler.coffee +++ b/content_scripts/mode_key_handler.coffee @@ -40,12 +40,12 @@ class KeyHandlerMode extends Mode if isEscape and (@countPrefix != 0 or @keyState.length != 1) @keydownEvents[event.keyCode] = true @reset() - false # Suppress event. + @suppressEvent # If the help dialog loses the focus, then Escape should hide it; see point 2 in #2045. else if isEscape and HelpDialog?.showing @keydownEvents[event.keyCode] = true HelpDialog.hide() - false # Suppress event. + @suppressEvent else if isEscape @continueBubbling else if @isMappedKey keyChar @@ -57,7 +57,7 @@ class KeyHandlerMode extends Mode # prevent triggering page event listeners (e.g. Google instant Search). @keydownEvents[event.keyCode] = true DomUtils.suppressPropagation event - @stopBubblingAndTrue + @passEventToPage else @continueBubbling @@ -68,7 +68,7 @@ class KeyHandlerMode extends Mode else if @isCountKey keyChar digit = parseInt keyChar @reset if @keyState.length == 1 then @countPrefix * 10 + digit else digit - false # Suppress event. + @suppressEvent else @reset() @continueBubbling @@ -77,7 +77,7 @@ class KeyHandlerMode extends Mode return @continueBubbling unless event.keyCode of @keydownEvents delete @keydownEvents[event.keyCode] DomUtils.suppressPropagation event - @stopBubblingAndTrue + @passEventToPage # This tests whether there is a mapping of keyChar in the current key state (and accounts for pass keys). isMappedKey: (keyChar) -> -- cgit v1.2.3