mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-18 04:29:22 +00:00
Fixed: views from other windows could be set as next/previous key view.
Previously, no check was done to ensure a next/previous key view belonged to the same window as the view to which it was being chained. This could lead to an infinite loop. This commit will only set the next/previous key view if the proposed's views window is either nil or is the same as the receiver's window. Closes pull request #1851
This commit is contained in:
1 parent
720b61f4f6
commit
8d2077fc5d
1 file changed
+23
-9
+23
-9
@@ -2559,21 +2559,35 @@ setBoundsOrigin:
|
||||
|
||||
- (void)_setPreviousKeyView:(CPView)previous
|
||||
{
|
||||
if ([previous isEqual:self])
|
||||
_previousKeyView = nil;
|
||||
else
|
||||
_previousKeyView = previous;
|
||||
if (![previous isEqual:self])
|
||||
{
|
||||
var previousWindow = [previous window];
|
||||
|
||||
if (!previousWindow || previousWindow === _window)
|
||||
{
|
||||
_previousKeyView = previous;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_previousKeyView = nil;
|
||||
}
|
||||
|
||||
- (void)setNextKeyView:(CPView)next
|
||||
{
|
||||
if ([next isEqual:self])
|
||||
_nextKeyView = nil;
|
||||
else
|
||||
if (![next isEqual:self])
|
||||
{
|
||||
_nextKeyView = next;
|
||||
[_nextKeyView _setPreviousKeyView:self];
|
||||
var nextWindow = [next window];
|
||||
|
||||
if (!nextWindow || nextWindow === _window)
|
||||
{
|
||||
_nextKeyView = next;
|
||||
[_nextKeyView _setPreviousKeyView:self];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_nextKeyView = nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in new issue
Block a user