Skip to content

Commit

Permalink
Fixed: browser propagation control when not in browser.
Browse files Browse the repository at this point in the history
This would lead to a `[CPPlatformWindow _willPropagateCurrentDOMEvent] unrecognized selector sent to instance` error if an event was sent in a non DOM environment.
  • Loading branch information
aljungberg committed Jul 13, 2012
1 parent 9abb79d commit b038b6b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions AppKit/CPApplication.j
Expand Up @@ -576,27 +576,33 @@ CPRunContinuesResponse = -1002;
{
_currentEvent = anEvent;

#if PLATFORM(DOM)
var willPropagate = [[[anEvent window] platformWindow] _willPropagateCurrentDOMEvent];

// temporarily pretend we won't propagate the event. we'll restore the saved value later
// we do this outside the if so that changes user code might make in _handleKeyEquiv. are preserved
[[[anEvent window] platformWindow] _propagateCurrentDOMEvent:NO];
#endif

// Check if this is a candidate for key equivalent...
if ([anEvent _couldBeKeyEquivalent] && [self _handleKeyEquivalent:anEvent])
{
#if PLATFORM(DOM)
var characters = [anEvent characters],
modifierFlags = [anEvent modifierFlags];

// Unconditionally propagate on these keys to solve browser copy paste bugs
if ((characters == "c" || characters == "x" || characters == "v") && (modifierFlags & CPPlatformActionKeyMask))
[[[anEvent window] platformWindow] _propagateCurrentDOMEvent:YES];
#endif

return;
}

#if PLATFORM(DOM)
// if we make it this far, then restore the original willPropagate value
[[[anEvent window] platformWindow] _propagateCurrentDOMEvent:willPropagate];
#endif

if (_eventListeners.length)
{
Expand Down

0 comments on commit b038b6b

Please sign in to comment.