aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/mode_key_handler.coffee
diff options
context:
space:
mode:
authorStephen Blott2016-03-30 13:07:05 +0100
committerStephen Blott2016-03-30 14:58:46 +0100
commit21da3fcafbb29540788037dbcdbdce79ad14e650 (patch)
tree0d4ff357c8cfd25226cb8dd6bf07d398ed3dfb03 /content_scripts/mode_key_handler.coffee
parenta2fba970e089254adae2631a5b154e6bd92ec1e2 (diff)
downloadvimium-21da3fcafbb29540788037dbcdbdce79ad14e650.tar.bz2
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.
Diffstat (limited to 'content_scripts/mode_key_handler.coffee')
-rw-r--r--content_scripts/mode_key_handler.coffee10
1 files changed, 5 insertions, 5 deletions
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) ->