diff options
| author | Stephen Blott | 2015-02-09 11:40:53 +0000 |
|---|---|---|
| committer | Stephen Blott | 2015-02-09 11:40:53 +0000 |
| commit | 0bf605a934115083e700f5de090f39841417482a (patch) | |
| tree | 408c191bd702da6847bca9943f6eba93ad28b209 /lib/handler_stack.coffee | |
| parent | ac648a0e9f53c2fc359daa68309c25dd8c9db031 (diff) | |
| parent | ed306994697f6f9f5e13f9d018b5c7ffa2fff680 (diff) | |
| download | vimium-0bf605a934115083e700f5de090f39841417482a.tar.bz2 | |
Merge branch 'visual-and-edit-modes'
Conflicts:
background_scripts/main.coffee
content_scripts/vimium_frontend.coffee
lib/keyboard_utils.coffee
Diffstat (limited to 'lib/handler_stack.coffee')
| -rw-r--r-- | lib/handler_stack.coffee | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/handler_stack.coffee b/lib/handler_stack.coffee index 3d635005..b0fefc7d 100644 --- a/lib/handler_stack.coffee +++ b/lib/handler_stack.coffee @@ -38,6 +38,7 @@ class HandlerStack # @stopBubblingAndTrue. bubbleEvent: (type, event) -> @eventNumber += 1 + eventNumber = @eventNumber # We take a copy of the array in order to avoid interference from concurrent removes (for example, to # avoid calling the same handler twice, because elements have been spliced out of the array by remove). for handler in @stack[..].reverse() @@ -45,13 +46,15 @@ class HandlerStack if handler?.id and handler[type] @currentId = handler.id result = handler[type].call @, event - @logResult type, event, handler, result if @debug + @logResult eventNumber, type, event, handler, result if @debug if not result DomUtils.suppressEvent event if @isChromeEvent event return false return true if result == @stopBubblingAndTrue return false if result == @stopBubblingAndFalse return @bubbleEvent type, event if result == @restartBubbling + else + @logResult eventNumber, type, event, handler, "skip" if @debug true remove: (id = @currentId) -> @@ -80,7 +83,7 @@ class HandlerStack false # Debugging. - logResult: (type, event, handler, result) -> + logResult: (eventNumber, type, event, handler, result) -> # FIXME(smblott). Badge updating is too noisy, so we filter it out. However, we do need to look at how # many badge update events are happening. It seems to be more than necessary. We also filter out # registerKeyQueue as unnecessarily noisy and not particularly helpful. @@ -90,9 +93,15 @@ class HandlerStack when @stopBubblingAndTrue then "stop/true" when @stopBubblingAndFalse then "stop/false" when @restartBubbling then "rebubble" + when "skip" then "skip" when true then "continue" label ||= if result then "continue/truthy" else "suppress" - console.log "#{@eventNumber}", type, handler._name, label + console.log "#{eventNumber}", type, handler._name, label + + show: -> + console.log "#{@eventNumber}:" + for handler in @stack[..].reverse() + console.log " ", handler._name # For tests only. reset: -> |
