From: <ho...@us...> - 2013-04-24 09:33:38
|
Revision: 8042 http://skim-app.svn.sourceforge.net/skim-app/?rev=8042&view=rev Author: hofman Date: 2013-04-24 09:33:29 +0000 (Wed, 24 Apr 2013) Log Message: ----------- some sanity checks for accessibility children Modified Paths: -------------- trunk/SKColorSwatch.m Modified: trunk/SKColorSwatch.m =================================================================== --- trunk/SKColorSwatch.m 2013-04-23 20:29:24 UTC (rev 8041) +++ trunk/SKColorSwatch.m 2013-04-24 09:33:29 UTC (rev 8042) @@ -500,15 +500,20 @@ } - (id)valueForFauxUIElement:(SKAccessibilityFauxUIElement *)element { + if ([element index] >= (NSInteger)[[self colors] count]) + return nil; return [[[self colors] objectAtIndex:[element index]] accessibilityValue]; } - (NSRect)screenRectForFauxUIElement:(SKAccessibilityFauxUIElement *)element { - NSRect rect = NSInsetRect([self bounds], 1.0, 1.0); - rect.size.width = NSHeight(rect); - rect.origin.x += [element index] * (NSWidth(rect) - 1.0); - rect = [self convertRect:rect toView:nil]; - rect.origin = [[self window] convertBaseToScreen:rect.origin]; + NSRect rect = NSZeroRect; + if ([element index] < (NSInteger)[[self colors] count]) { + rect = NSInsetRect([self bounds], 1.0, 1.0); + rect.size.width = NSHeight(rect); + rect.origin.x += [element index] * (NSWidth(rect) - 1.0); + rect = [self convertRect:rect toView:nil]; + rect.origin = [[self window] convertBaseToScreen:rect.origin]; + } return rect; } @@ -517,7 +522,7 @@ } - (void)fauxUIElement:(SKAccessibilityFauxUIElement *)element setFocused:(BOOL)focused { - if (focused) { + if (focused && [element index] < (NSInteger)[[self colors] count]) { [[self window] makeFirstResponder:self]; focusedIndex = [element index]; [self setKeyboardFocusRingNeedsDisplayInRect:[self bounds]]; @@ -525,7 +530,8 @@ } - (void)pressFauxUIElement:(SKAccessibilityFauxUIElement *)element { - [self performClickAtIndex:[element index]]; + if ([element index] < (NSInteger)[[self colors] count]) + [self performClickAtIndex:[element index]]; } @end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |