Prevent infinitely forwarding navigation events. Fixes #13251.
authorZachary West <zacw@adium.im>
Sun Nov 01 11:15:19 2009 -0500 (2009-11-01)
changeset 27236fa58273701e
parent 2722 79837511a894
child 2724 165b2bbc8f20
Prevent infinitely forwarding navigation events. Fixes #13251.
Plugins/WebKit Message View/ESWebView.m
     1.1 --- a/Plugins/WebKit Message View/ESWebView.m	Sat Oct 31 23:36:14 2009 -0400
     1.2 +++ b/Plugins/WebKit Message View/ESWebView.m	Sun Nov 01 11:15:19 2009 -0500
     1.3 @@ -93,9 +93,22 @@
     1.4  //into this view.
     1.5  - (void)keyDown:(NSEvent *)theEvent
     1.6  {
     1.7 +	BOOL forwarded = YES;
     1.8 +	
     1.9  	if (shouldForwardEvents) {
    1.10 -		[self forwardSelector:@selector(keyDown:) withObject:theEvent];
    1.11 -	} else {
    1.12 +		unichar		 inChar = [[theEvent charactersIgnoringModifiers] characterAtIndex:0];
    1.13 +		
    1.14 +		// Don't forward navigation key events. If we're receiving them, it's because
    1.15 +		// the frame itself didn't support them.
    1.16 +		if (inChar != NSUpArrowFunctionKey && inChar != NSDownArrowFunctionKey &&
    1.17 +			inChar != NSPageUpFunctionKey && inChar != NSPageDownFunctionKey)
    1.18 +		{
    1.19 +			[self forwardSelector:@selector(keyDown:) withObject:theEvent];
    1.20 +			forwarded = YES;
    1.21 +		}
    1.22 +	}
    1.23 +	
    1.24 +	if (!forwarded) {
    1.25  		[super keyDown:theEvent];
    1.26  	}
    1.27  }