mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 417564 - "protect against Obj-C exceptions in 'accessible' top-level directory". r=josh, sr=roc, a=blocking1.9+.
This commit is contained in:
parent
12f713ce65
commit
84b66071ff
@ -44,6 +44,7 @@
|
|||||||
|
|
||||||
#include "nsRect.h"
|
#include "nsRect.h"
|
||||||
#include "nsCoord.h"
|
#include "nsCoord.h"
|
||||||
|
#include "nsObjCExceptions.h"
|
||||||
|
|
||||||
#include "nsIAccessible.h"
|
#include "nsIAccessible.h"
|
||||||
#include "nsIAccessibleText.h"
|
#include "nsIAccessibleText.h"
|
||||||
@ -73,9 +74,13 @@ ConvertCocoaToGeckoPoint(NSPoint &aInPoint, nsPoint &aOutPoint)
|
|||||||
static inline id <mozAccessible>
|
static inline id <mozAccessible>
|
||||||
GetObjectOrRepresentedView(id <mozAccessible> anObject)
|
GetObjectOrRepresentedView(id <mozAccessible> anObject)
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
if ([anObject hasRepresentedView])
|
if ([anObject hasRepresentedView])
|
||||||
return [anObject representedView];
|
return [anObject representedView];
|
||||||
return anObject;
|
return anObject;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns the passed in object if it is not ignored. if it's ignored, will return
|
// returns the passed in object if it is not ignored. if it's ignored, will return
|
||||||
@ -83,6 +88,8 @@ GetObjectOrRepresentedView(id <mozAccessible> anObject)
|
|||||||
static inline id
|
static inline id
|
||||||
GetClosestInterestingAccessible(id anObject)
|
GetClosestInterestingAccessible(id anObject)
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
// this object is not ignored, so let's return it.
|
// this object is not ignored, so let's return it.
|
||||||
if (![anObject accessibilityIsIgnored])
|
if (![anObject accessibilityIsIgnored])
|
||||||
return GetObjectOrRepresentedView(anObject);
|
return GetObjectOrRepresentedView(anObject);
|
||||||
@ -101,14 +108,20 @@ GetClosestInterestingAccessible(id anObject)
|
|||||||
return GetObjectOrRepresentedView(unignoredObject);
|
return GetObjectOrRepresentedView(unignoredObject);
|
||||||
|
|
||||||
return unignoredObject;
|
return unignoredObject;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline mozAccessible*
|
static inline mozAccessible*
|
||||||
GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
|
GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSNULL;
|
||||||
|
|
||||||
mozAccessible *native = nil;
|
mozAccessible *native = nil;
|
||||||
anAccessible->GetNativeInterface ((void**)&native);
|
anAccessible->GetNativeInterface ((void**)&native);
|
||||||
return native;
|
return native;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NSNULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
@ -117,6 +130,8 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
|
|||||||
|
|
||||||
- (id)initWithAccessible:(nsAccessibleWrap*)geckoAccessible
|
- (id)initWithAccessible:(nsAccessibleWrap*)geckoAccessible
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
if ((self = [super init])) {
|
if ((self = [super init])) {
|
||||||
mGeckoAccessible = geckoAccessible;
|
mGeckoAccessible = geckoAccessible;
|
||||||
mIsExpired = NO;
|
mIsExpired = NO;
|
||||||
@ -128,25 +143,37 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||||
|
|
||||||
[mChildren release];
|
[mChildren release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
- (BOOL)accessibilityIsIgnored
|
- (BOOL)accessibilityIsIgnored
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||||
|
|
||||||
// unknown (either unimplemented, or irrelevant) elements are marked as ignored
|
// unknown (either unimplemented, or irrelevant) elements are marked as ignored
|
||||||
// as well as expired elements.
|
// as well as expired elements.
|
||||||
return mIsExpired || [[self role] isEqualToString:NSAccessibilityUnknownRole];
|
return mIsExpired || [[self role] isEqualToString:NSAccessibilityUnknownRole];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(NO);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray*)accessibilityAttributeNames
|
- (NSArray*)accessibilityAttributeNames
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
// if we're expired, we don't support any attributes.
|
// if we're expired, we don't support any attributes.
|
||||||
if (mIsExpired)
|
if (mIsExpired)
|
||||||
return [NSArray array];
|
return [NSArray array];
|
||||||
@ -177,10 +204,14 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return generalAttributes;
|
return generalAttributes;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)accessibilityAttributeValue:(NSString*)attribute
|
- (id)accessibilityAttributeValue:(NSString*)attribute
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
if (mIsExpired)
|
if (mIsExpired)
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
@ -227,18 +258,26 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
|
|||||||
NSLog (@"!!! %@ can't respond to attribute %@", self, attribute);
|
NSLog (@"!!! %@ can't respond to attribute %@", self, attribute);
|
||||||
#endif
|
#endif
|
||||||
return nil; // be nice and return empty string instead?
|
return nil; // be nice and return empty string instead?
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)accessibilityIsAttributeSettable:(NSString*)attribute
|
- (BOOL)accessibilityIsAttributeSettable:(NSString*)attribute
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||||
|
|
||||||
if ([attribute isEqualToString:NSAccessibilityFocusedAttribute])
|
if ([attribute isEqualToString:NSAccessibilityFocusedAttribute])
|
||||||
return [self canBeFocused];
|
return [self canBeFocused];
|
||||||
|
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(NO);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute
|
- (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||||
|
|
||||||
#ifdef DEBUG_hakan
|
#ifdef DEBUG_hakan
|
||||||
NSLog (@"[%@] %@='%@'", self, attribute, value);
|
NSLog (@"[%@] %@='%@'", self, attribute, value);
|
||||||
#endif
|
#endif
|
||||||
@ -246,6 +285,8 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
|
|||||||
// we only support focusing elements so far.
|
// we only support focusing elements so far.
|
||||||
if ([attribute isEqualToString:NSAccessibilityFocusedAttribute] && [value boolValue])
|
if ([attribute isEqualToString:NSAccessibilityFocusedAttribute] && [value boolValue])
|
||||||
[self focus];
|
[self focus];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)accessibilityHitTest:(NSPoint)point
|
- (id)accessibilityHitTest:(NSPoint)point
|
||||||
@ -315,6 +356,8 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
|
|||||||
|
|
||||||
- (id <mozAccessible>)parent
|
- (id <mozAccessible>)parent
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
nsCOMPtr<nsIAccessible> accessibleParent(mGeckoAccessible->GetUnignoredParent());
|
nsCOMPtr<nsIAccessible> accessibleParent(mGeckoAccessible->GetUnignoredParent());
|
||||||
if (accessibleParent) {
|
if (accessibleParent) {
|
||||||
id nativeParent = GetNativeFromGeckoAccessible(accessibleParent);
|
id nativeParent = GetNativeFromGeckoAccessible(accessibleParent);
|
||||||
@ -332,6 +375,8 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
|
|||||||
NSAssert1 (nativeParent, @"!!! we can't find a parent for %@", self);
|
NSAssert1 (nativeParent, @"!!! we can't find a parent for %@", self);
|
||||||
|
|
||||||
return GetClosestInterestingAccessible(nativeParent);
|
return GetClosestInterestingAccessible(nativeParent);
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)hasRepresentedView
|
- (BOOL)hasRepresentedView
|
||||||
@ -353,6 +398,8 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
|
|||||||
// returns nil when there are no children.
|
// returns nil when there are no children.
|
||||||
- (NSArray*)children
|
- (NSArray*)children
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
if (mChildren)
|
if (mChildren)
|
||||||
return mChildren;
|
return mChildren;
|
||||||
|
|
||||||
@ -385,10 +432,14 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
return mChildren;
|
return mChildren;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSValue*)position
|
- (NSValue*)position
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
PRInt32 x, y, width, height;
|
PRInt32 x, y, width, height;
|
||||||
mGeckoAccessible->GetBounds (&x, &y, &width, &height);
|
mGeckoAccessible->GetBounds (&x, &y, &width, &height);
|
||||||
NSPoint p = NSMakePoint (x, y);
|
NSPoint p = NSMakePoint (x, y);
|
||||||
@ -404,13 +455,19 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
|
|||||||
p.y = mainScreenHeight - p.y - height;
|
p.y = mainScreenHeight - p.y - height;
|
||||||
|
|
||||||
return [NSValue valueWithPoint:p];
|
return [NSValue valueWithPoint:p];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSValue*)size
|
- (NSValue*)size
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
PRInt32 x, y, width, height;
|
PRInt32 x, y, width, height;
|
||||||
mGeckoAccessible->GetBounds (&x, &y, &width, &height);
|
mGeckoAccessible->GetBounds (&x, &y, &width, &height);
|
||||||
return [NSValue valueWithSize:NSMakeSize (width, height)];
|
return [NSValue valueWithSize:NSMakeSize (width, height)];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString*)role
|
- (NSString*)role
|
||||||
@ -428,45 +485,69 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
|
|||||||
|
|
||||||
- (NSString*)title
|
- (NSString*)title
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
nsAutoString title;
|
nsAutoString title;
|
||||||
mGeckoAccessible->GetName (title);
|
mGeckoAccessible->GetName (title);
|
||||||
return title.IsEmpty() ? nil : [NSString stringWithCharacters:title.BeginReading() length:title.Length()];
|
return title.IsEmpty() ? nil : [NSString stringWithCharacters:title.BeginReading() length:title.Length()];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)value
|
- (id)value
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
mGeckoAccessible->GetValue (value);
|
mGeckoAccessible->GetValue (value);
|
||||||
return value.IsEmpty() ? nil : [NSString stringWithCharacters:value.BeginReading() length:value.Length()];
|
return value.IsEmpty() ? nil : [NSString stringWithCharacters:value.BeginReading() length:value.Length()];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)valueDidChange
|
- (void)valueDidChange
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||||
|
|
||||||
#ifdef DEBUG_hakan
|
#ifdef DEBUG_hakan
|
||||||
NSLog(@"%@'s value changed!", self);
|
NSLog(@"%@'s value changed!", self);
|
||||||
#endif
|
#endif
|
||||||
// sending out a notification is expensive, so we don't do it other than for really important objects,
|
// sending out a notification is expensive, so we don't do it other than for really important objects,
|
||||||
// like mozTextAccessible.
|
// like mozTextAccessible.
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString*)customDescription
|
- (NSString*)customDescription
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
nsAutoString desc;
|
nsAutoString desc;
|
||||||
mGeckoAccessible->GetDescription (desc);
|
mGeckoAccessible->GetDescription (desc);
|
||||||
return desc.IsEmpty() ? nil : [NSString stringWithCharacters:desc.BeginReading() length:desc.Length()];
|
return desc.IsEmpty() ? nil : [NSString stringWithCharacters:desc.BeginReading() length:desc.Length()];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString*)help
|
- (NSString*)help
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
nsAutoString helpText;
|
nsAutoString helpText;
|
||||||
mGeckoAccessible->GetHelp (helpText);
|
mGeckoAccessible->GetHelp (helpText);
|
||||||
return helpText.IsEmpty() ? nil : [NSString stringWithCharacters:helpText.BeginReading() length:helpText.Length()];
|
return helpText.IsEmpty() ? nil : [NSString stringWithCharacters:helpText.BeginReading() length:helpText.Length()];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// objc-style description (from NSObject); not to be confused with the accessible description above.
|
// objc-style description (from NSObject); not to be confused with the accessible description above.
|
||||||
- (NSString*)description
|
- (NSString*)description
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
return [NSString stringWithFormat:@"(%p) %@", self, [self role]];
|
return [NSString stringWithFormat:@"(%p) %@", self, [self role]];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)isFocused
|
- (BOOL)isFocused
|
||||||
@ -500,35 +581,51 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
|
|||||||
// changed to us.
|
// changed to us.
|
||||||
- (void)didReceiveFocus
|
- (void)didReceiveFocus
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||||
|
|
||||||
#ifdef DEBUG_hakan
|
#ifdef DEBUG_hakan
|
||||||
NSLog (@"%@ received focus!", self);
|
NSLog (@"%@ received focus!", self);
|
||||||
#endif
|
#endif
|
||||||
NSAssert1(![self accessibilityIsIgnored], @"trying to set focus to ignored element! (%@)", self);
|
NSAssert1(![self accessibilityIsIgnored], @"trying to set focus to ignored element! (%@)", self);
|
||||||
NSAccessibilityPostNotification(GetObjectOrRepresentedView(self),
|
NSAccessibilityPostNotification(GetObjectOrRepresentedView(self),
|
||||||
NSAccessibilityFocusedUIElementChangedNotification);
|
NSAccessibilityFocusedUIElementChangedNotification);
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSWindow*)window
|
- (NSWindow*)window
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
nsAccessibleWrap *accWrap = static_cast<nsAccessibleWrap*>(mGeckoAccessible);
|
nsAccessibleWrap *accWrap = static_cast<nsAccessibleWrap*>(mGeckoAccessible);
|
||||||
NSWindow *nativeWindow = nil;
|
NSWindow *nativeWindow = nil;
|
||||||
accWrap->GetNativeWindow ((void**)&nativeWindow);
|
accWrap->GetNativeWindow ((void**)&nativeWindow);
|
||||||
|
|
||||||
NSAssert1(nativeWindow, @"Could not get native window for %@", self);
|
NSAssert1(nativeWindow, @"Could not get native window for %@", self);
|
||||||
return nativeWindow;
|
return nativeWindow;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)invalidateChildren
|
- (void)invalidateChildren
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||||
|
|
||||||
// make room for new children
|
// make room for new children
|
||||||
[mChildren release];
|
[mChildren release];
|
||||||
mChildren = nil;
|
mChildren = nil;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)expire
|
- (void)expire
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||||
|
|
||||||
[self invalidateChildren];
|
[self invalidateChildren];
|
||||||
mIsExpired = YES;
|
mIsExpired = YES;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)isExpired
|
- (BOOL)isExpired
|
||||||
@ -546,6 +643,8 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
|
|||||||
// parent.
|
// parent.
|
||||||
- (void)sanityCheckChildren:(NSArray *)children
|
- (void)sanityCheckChildren:(NSArray *)children
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||||
|
|
||||||
NSAssert(![self accessibilityIsIgnored], @"can't sanity check children of an ignored accessible!");
|
NSAssert(![self accessibilityIsIgnored], @"can't sanity check children of an ignored accessible!");
|
||||||
NSEnumerator *iter = [children objectEnumerator];
|
NSEnumerator *iter = [children objectEnumerator];
|
||||||
mozAccessible *curObj = nil;
|
mozAccessible *curObj = nil;
|
||||||
@ -558,20 +657,32 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
|
|||||||
NSAssert2([curObj parent] == realSelf,
|
NSAssert2([curObj parent] == realSelf,
|
||||||
@"!!! %@ not returning %@ as AXParent, even though it is a AXChild of it!", curObj, realSelf);
|
@"!!! %@ not returning %@ as AXParent, even though it is a AXChild of it!", curObj, realSelf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)sanityCheckChildren
|
- (void)sanityCheckChildren
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||||
|
|
||||||
[self sanityCheckChildren:[self children]];
|
[self sanityCheckChildren:[self children]];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)printHierarchy
|
- (void)printHierarchy
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||||
|
|
||||||
[self printHierarchyWithLevel:0];
|
[self printHierarchyWithLevel:0];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)printHierarchyWithLevel:(unsigned)level
|
- (void)printHierarchyWithLevel:(unsigned)level
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||||
|
|
||||||
NSAssert(![self isExpired], @"!!! trying to print hierarchy of expired object!");
|
NSAssert(![self isExpired], @"!!! trying to print hierarchy of expired object!");
|
||||||
|
|
||||||
// print this node
|
// print this node
|
||||||
@ -597,6 +708,8 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
|
|||||||
// print every child node's subtree, increasing the indenting
|
// print every child node's subtree, increasing the indenting
|
||||||
// by two for every level.
|
// by two for every level.
|
||||||
[object printHierarchyWithLevel:(level+1)];
|
[object printHierarchyWithLevel:(level+1)];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
@ -38,6 +38,8 @@
|
|||||||
|
|
||||||
#include "nsAccessibleWrap.h"
|
#include "nsAccessibleWrap.h"
|
||||||
|
|
||||||
|
#include "nsObjCExceptions.h"
|
||||||
|
|
||||||
#import "mozAccessible.h"
|
#import "mozAccessible.h"
|
||||||
|
|
||||||
/* Wrapper class.
|
/* Wrapper class.
|
||||||
@ -56,15 +58,23 @@
|
|||||||
struct AccessibleWrapper {
|
struct AccessibleWrapper {
|
||||||
mozAccessible *object;
|
mozAccessible *object;
|
||||||
AccessibleWrapper (nsAccessibleWrap *parent, Class classType) {
|
AccessibleWrapper (nsAccessibleWrap *parent, Class classType) {
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||||
|
|
||||||
object = (mozAccessible*)[[classType alloc] initWithAccessible:parent];
|
object = (mozAccessible*)[[classType alloc] initWithAccessible:parent];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
~AccessibleWrapper () {
|
~AccessibleWrapper () {
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||||
|
|
||||||
// if some third-party still holds on to the object, it's important that it is marked
|
// if some third-party still holds on to the object, it's important that it is marked
|
||||||
// as expired, so it can't do any harm (e.g., walk into an expired hierarchy of nodes).
|
// as expired, so it can't do any harm (e.g., walk into an expired hierarchy of nodes).
|
||||||
[object expire];
|
[object expire];
|
||||||
|
|
||||||
[object release];
|
[object release];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
mozAccessible* getNativeObject () {
|
mozAccessible* getNativeObject () {
|
||||||
@ -72,6 +82,10 @@ struct AccessibleWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PRBool isIgnored () {
|
PRBool isIgnored () {
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||||
|
|
||||||
return (PRBool)[object accessibilityIsIgnored];
|
return (PRBool)[object accessibilityIsIgnored];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(PR_FALSE);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -39,6 +39,8 @@
|
|||||||
#import "mozActionElements.h"
|
#import "mozActionElements.h"
|
||||||
#import "nsIAccessible.h"
|
#import "nsIAccessible.h"
|
||||||
|
|
||||||
|
#include "nsObjCExceptions.h"
|
||||||
|
|
||||||
extern const NSString *kInstanceDescriptionAttribute; // NSAccessibilityDescriptionAttribute
|
extern const NSString *kInstanceDescriptionAttribute; // NSAccessibilityDescriptionAttribute
|
||||||
extern const NSString *kTopLevelUIElementAttribute; // NSAccessibilityTopLevelUIElementAttribute
|
extern const NSString *kTopLevelUIElementAttribute; // NSAccessibilityTopLevelUIElementAttribute
|
||||||
|
|
||||||
@ -53,6 +55,8 @@ enum CheckboxValue {
|
|||||||
|
|
||||||
- (NSArray*)accessibilityAttributeNames
|
- (NSArray*)accessibilityAttributeNames
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
static NSArray *attributes = nil;
|
static NSArray *attributes = nil;
|
||||||
if (!attributes) {
|
if (!attributes) {
|
||||||
attributes = [[NSArray alloc] initWithObjects:NSAccessibilityParentAttribute, // required
|
attributes = [[NSArray alloc] initWithObjects:NSAccessibilityParentAttribute, // required
|
||||||
@ -70,13 +74,19 @@ enum CheckboxValue {
|
|||||||
nil];
|
nil];
|
||||||
}
|
}
|
||||||
return attributes;
|
return attributes;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)accessibilityAttributeValue:(NSString *)attribute
|
- (id)accessibilityAttributeValue:(NSString *)attribute
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
if ([attribute isEqualToString:NSAccessibilityChildrenAttribute])
|
if ([attribute isEqualToString:NSAccessibilityChildrenAttribute])
|
||||||
return nil;
|
return nil;
|
||||||
return [super accessibilityAttributeValue:attribute];
|
return [super accessibilityAttributeValue:attribute];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)accessibilityIsIgnored
|
- (BOOL)accessibilityIsIgnored
|
||||||
@ -86,24 +96,36 @@ enum CheckboxValue {
|
|||||||
|
|
||||||
- (NSArray*)accessibilityActionNames
|
- (NSArray*)accessibilityActionNames
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
if ([self isEnabled])
|
if ([self isEnabled])
|
||||||
return [NSArray arrayWithObject:NSAccessibilityPressAction];
|
return [NSArray arrayWithObject:NSAccessibilityPressAction];
|
||||||
|
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString*)accessibilityActionDescription:(NSString*)action
|
- (NSString*)accessibilityActionDescription:(NSString*)action
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
if ([action isEqualToString:NSAccessibilityPressAction])
|
if ([action isEqualToString:NSAccessibilityPressAction])
|
||||||
return @"press button"; // XXX: localize this later?
|
return @"press button"; // XXX: localize this later?
|
||||||
|
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)accessibilityPerformAction:(NSString*)action
|
- (void)accessibilityPerformAction:(NSString*)action
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||||
|
|
||||||
if ([action isEqualToString:NSAccessibilityPressAction])
|
if ([action isEqualToString:NSAccessibilityPressAction])
|
||||||
[self click];
|
[self click];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)click
|
- (void)click
|
||||||
@ -119,6 +141,8 @@ enum CheckboxValue {
|
|||||||
|
|
||||||
- (NSString*)accessibilityActionDescription:(NSString*)action
|
- (NSString*)accessibilityActionDescription:(NSString*)action
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
if ([action isEqualToString:NSAccessibilityPressAction]) {
|
if ([action isEqualToString:NSAccessibilityPressAction]) {
|
||||||
if ([self isChecked] != kUnchecked)
|
if ([self isChecked] != kUnchecked)
|
||||||
return @"uncheck checkbox"; // XXX: localize this later?
|
return @"uncheck checkbox"; // XXX: localize this later?
|
||||||
@ -127,6 +151,8 @@ enum CheckboxValue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int)isChecked
|
- (int)isChecked
|
||||||
@ -144,7 +170,11 @@ enum CheckboxValue {
|
|||||||
|
|
||||||
- (id)value
|
- (id)value
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
return [NSNumber numberWithInt:[self isChecked]];
|
return [NSNumber numberWithInt:[self isChecked]];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@ -153,6 +183,8 @@ enum CheckboxValue {
|
|||||||
|
|
||||||
- (NSArray *)accessibilityAttributeNames
|
- (NSArray *)accessibilityAttributeNames
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
static NSArray *attributes = nil;
|
static NSArray *attributes = nil;
|
||||||
|
|
||||||
if (!attributes) {
|
if (!attributes) {
|
||||||
@ -171,18 +203,26 @@ enum CheckboxValue {
|
|||||||
nil];
|
nil];
|
||||||
}
|
}
|
||||||
return attributes;
|
return attributes;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)accessibilityAttributeValue:(NSString *)attribute
|
- (id)accessibilityAttributeValue:(NSString *)attribute
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) {
|
if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) {
|
||||||
return [super children];
|
return [super children];
|
||||||
}
|
}
|
||||||
return [super accessibilityAttributeValue:attribute];
|
return [super accessibilityAttributeValue:attribute];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)accessibilityActionNames
|
- (NSArray *)accessibilityActionNames
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
if ([self isEnabled]) {
|
if ([self isEnabled]) {
|
||||||
return [NSArray arrayWithObjects:NSAccessibilityPressAction,
|
return [NSArray arrayWithObjects:NSAccessibilityPressAction,
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
||||||
@ -191,19 +231,27 @@ enum CheckboxValue {
|
|||||||
nil];
|
nil];
|
||||||
}
|
}
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *)accessibilityActionDescription:(NSString *)action
|
- (NSString *)accessibilityActionDescription:(NSString *)action
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
||||||
if ([action isEqualToString:NSAccessibilityShowMenuAction])
|
if ([action isEqualToString:NSAccessibilityShowMenuAction])
|
||||||
return @"show menu";
|
return @"show menu";
|
||||||
#endif
|
#endif
|
||||||
return [super accessibilityActionDescription:action];
|
return [super accessibilityActionDescription:action];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)accessibilityPerformAction:(NSString *)action
|
- (void)accessibilityPerformAction:(NSString *)action
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||||
|
|
||||||
// both the ShowMenu and Click action do the same thing.
|
// both the ShowMenu and Click action do the same thing.
|
||||||
if ([self isEnabled]) {
|
if ([self isEnabled]) {
|
||||||
// TODO: this should bring up the menu, but currently doesn't.
|
// TODO: this should bring up the menu, but currently doesn't.
|
||||||
@ -211,6 +259,8 @@ enum CheckboxValue {
|
|||||||
// the action needed to show the menu.
|
// the action needed to show the menu.
|
||||||
[super click];
|
[super click];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
#include "nsRootAccessibleWrap.h"
|
#include "nsRootAccessibleWrap.h"
|
||||||
|
#include "nsObjCExceptions.h"
|
||||||
|
|
||||||
#import "mozDocAccessible.h"
|
#import "mozDocAccessible.h"
|
||||||
|
|
||||||
@ -57,6 +58,8 @@ static id <mozAccessible, mozView> getNativeViewFromRootAccessible (nsAccessible
|
|||||||
// return the AXParent that our parallell NSView tells us about.
|
// return the AXParent that our parallell NSView tells us about.
|
||||||
- (id)parent
|
- (id)parent
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
if (!mParallelView)
|
if (!mParallelView)
|
||||||
mParallelView = (id<mozView, mozAccessible>)[self representedView];
|
mParallelView = (id<mozView, mozAccessible>)[self representedView];
|
||||||
|
|
||||||
@ -65,6 +68,8 @@ static id <mozAccessible, mozView> getNativeViewFromRootAccessible (nsAccessible
|
|||||||
|
|
||||||
NSAssert(mParallelView, @"we're a root accessible w/o native view?");
|
NSAssert(mParallelView, @"we're a root accessible w/o native view?");
|
||||||
return [super parent];
|
return [super parent];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)hasRepresentedView
|
- (BOOL)hasRepresentedView
|
||||||
@ -75,6 +80,8 @@ static id <mozAccessible, mozView> getNativeViewFromRootAccessible (nsAccessible
|
|||||||
// this will return our parallell NSView. see mozDocAccessible.h
|
// this will return our parallell NSView. see mozDocAccessible.h
|
||||||
- (id)representedView
|
- (id)representedView
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
if (mParallelView)
|
if (mParallelView)
|
||||||
return (id)mParallelView;
|
return (id)mParallelView;
|
||||||
|
|
||||||
@ -82,6 +89,8 @@ static id <mozAccessible, mozView> getNativeViewFromRootAccessible (nsAccessible
|
|||||||
|
|
||||||
NSAssert(mParallelView, @"can't return root accessible's native parallel view.");
|
NSAssert(mParallelView, @"can't return root accessible's native parallel view.");
|
||||||
return mParallelView;
|
return mParallelView;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)isRoot
|
- (BOOL)isRoot
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "nsAccessibleWrap.h"
|
#include "nsAccessibleWrap.h"
|
||||||
|
#include "nsObjCExceptions.h"
|
||||||
|
|
||||||
#import "mozTextAccessible.h"
|
#import "mozTextAccessible.h"
|
||||||
|
|
||||||
@ -18,11 +19,15 @@ extern const NSString *kTopLevelUIElementAttribute; // NSAccessibilityTopLevel
|
|||||||
|
|
||||||
- (id)initWithAccessible:(nsAccessibleWrap*)accessible
|
- (id)initWithAccessible:(nsAccessibleWrap*)accessible
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
if ((self = [super initWithAccessible:accessible])) {
|
if ((self = [super initWithAccessible:accessible])) {
|
||||||
CallQueryInterface(accessible, &mGeckoTextAccessible);
|
CallQueryInterface(accessible, &mGeckoTextAccessible);
|
||||||
CallQueryInterface(accessible, &mGeckoEditableTextAccessible);
|
CallQueryInterface(accessible, &mGeckoEditableTextAccessible);
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)accessibilityIsIgnored
|
- (BOOL)accessibilityIsIgnored
|
||||||
@ -32,6 +37,8 @@ extern const NSString *kTopLevelUIElementAttribute; // NSAccessibilityTopLevel
|
|||||||
|
|
||||||
- (NSArray*)accessibilityAttributeNames
|
- (NSArray*)accessibilityAttributeNames
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
static NSArray *supportedAttributes = nil;
|
static NSArray *supportedAttributes = nil;
|
||||||
if (!supportedAttributes) {
|
if (!supportedAttributes) {
|
||||||
// standard attributes that are shared and supported by all generic elements.
|
// standard attributes that are shared and supported by all generic elements.
|
||||||
@ -59,10 +66,14 @@ extern const NSString *kTopLevelUIElementAttribute; // NSAccessibilityTopLevel
|
|||||||
nil];
|
nil];
|
||||||
}
|
}
|
||||||
return supportedAttributes;
|
return supportedAttributes;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)accessibilityAttributeValue:(NSString*)attribute
|
- (id)accessibilityAttributeValue:(NSString*)attribute
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
if ([attribute isEqualToString:NSAccessibilityNumberOfCharactersAttribute])
|
if ([attribute isEqualToString:NSAccessibilityNumberOfCharactersAttribute])
|
||||||
return [NSNumber numberWithInt:[self textLength]];
|
return [NSNumber numberWithInt:[self textLength]];
|
||||||
if ([attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute])
|
if ([attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute])
|
||||||
@ -72,23 +83,33 @@ extern const NSString *kTopLevelUIElementAttribute; // NSAccessibilityTopLevel
|
|||||||
|
|
||||||
// let mozAccessible handle all other attributes
|
// let mozAccessible handle all other attributes
|
||||||
return [super accessibilityAttributeValue:attribute];
|
return [super accessibilityAttributeValue:attribute];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)accessibilityIsAttributeSettable:(NSString*)attribute
|
- (BOOL)accessibilityIsAttributeSettable:(NSString*)attribute
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||||
|
|
||||||
if ([attribute isEqualToString:NSAccessibilityValueAttribute])
|
if ([attribute isEqualToString:NSAccessibilityValueAttribute])
|
||||||
return [self isReadOnly];
|
return [self isReadOnly];
|
||||||
|
|
||||||
return [super accessibilityIsAttributeSettable:attribute];
|
return [super accessibilityIsAttributeSettable:attribute];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(NO);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)accessibilitySetValue:(id)value forAttribute:(NSString *)attribute
|
- (void)accessibilitySetValue:(id)value forAttribute:(NSString *)attribute
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||||
|
|
||||||
if ([attribute isEqualToString:NSAccessibilityValueAttribute]) {
|
if ([attribute isEqualToString:NSAccessibilityValueAttribute]) {
|
||||||
if ([value isKindOfClass:[NSString class]])
|
if ([value isKindOfClass:[NSString class]])
|
||||||
[self setText:(NSString*)value];
|
[self setText:(NSString*)value];
|
||||||
} else
|
} else
|
||||||
[super accessibilitySetValue:value forAttribute:attribute];
|
[super accessibilitySetValue:value forAttribute:attribute];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString*)subrole
|
- (NSString*)subrole
|
||||||
@ -99,15 +120,21 @@ extern const NSString *kTopLevelUIElementAttribute; // NSAccessibilityTopLevel
|
|||||||
|
|
||||||
- (void)expire
|
- (void)expire
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||||
|
|
||||||
NS_IF_RELEASE(mGeckoTextAccessible);
|
NS_IF_RELEASE(mGeckoTextAccessible);
|
||||||
NS_IF_RELEASE(mGeckoEditableTextAccessible);
|
NS_IF_RELEASE(mGeckoEditableTextAccessible);
|
||||||
[super expire];
|
[super expire];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
- (BOOL)isReadOnly
|
- (BOOL)isReadOnly
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||||
|
|
||||||
if ([[self role] isEqualToString:NSAccessibilityStaticTextRole])
|
if ([[self role] isEqualToString:NSAccessibilityStaticTextRole])
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
@ -118,27 +145,39 @@ extern const NSString *kTopLevelUIElementAttribute; // NSAccessibilityTopLevel
|
|||||||
}
|
}
|
||||||
|
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(NO);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setText:(NSString*)newString
|
- (void)setText:(NSString*)newString
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||||
|
|
||||||
if (mGeckoEditableTextAccessible) {
|
if (mGeckoEditableTextAccessible) {
|
||||||
mGeckoEditableTextAccessible->SetTextContents(NS_ConvertUTF8toUTF16([newString UTF8String]));
|
mGeckoEditableTextAccessible->SetTextContents(NS_ConvertUTF8toUTF16([newString UTF8String]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (long)textLength
|
- (long)textLength
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||||
|
|
||||||
if (mGeckoTextAccessible) {
|
if (mGeckoTextAccessible) {
|
||||||
PRInt32 charCount = 0;
|
PRInt32 charCount = 0;
|
||||||
mGeckoTextAccessible->GetCharacterCount(&charCount);
|
mGeckoTextAccessible->GetCharacterCount(&charCount);
|
||||||
return charCount;
|
return charCount;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (long)selectedTextLength
|
- (long)selectedTextLength
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||||
|
|
||||||
if (mGeckoTextAccessible) {
|
if (mGeckoTextAccessible) {
|
||||||
PRInt32 start, end;
|
PRInt32 start, end;
|
||||||
start = end = 0;
|
start = end = 0;
|
||||||
@ -146,10 +185,14 @@ extern const NSString *kTopLevelUIElementAttribute; // NSAccessibilityTopLevel
|
|||||||
return (end - start);
|
return (end - start);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString*)selectedText
|
- (NSString*)selectedText
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
if (mGeckoTextAccessible) {
|
if (mGeckoTextAccessible) {
|
||||||
PRInt32 start, end;
|
PRInt32 start, end;
|
||||||
start = end = 0;
|
start = end = 0;
|
||||||
@ -161,10 +204,14 @@ extern const NSString *kTopLevelUIElementAttribute; // NSAccessibilityTopLevel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSValue*)selectedTextRange
|
- (NSValue*)selectedTextRange
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
if (mGeckoTextAccessible) {
|
if (mGeckoTextAccessible) {
|
||||||
PRInt32 start, end;
|
PRInt32 start, end;
|
||||||
start = end = 0;
|
start = end = 0;
|
||||||
@ -172,14 +219,20 @@ extern const NSString *kTopLevelUIElementAttribute; // NSAccessibilityTopLevel
|
|||||||
return [NSValue valueWithRange:NSMakeRange(start, start-end)];
|
return [NSValue valueWithRange:NSMakeRange(start, start-end)];
|
||||||
}
|
}
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
- (void)valueDidChange
|
- (void)valueDidChange
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||||
|
|
||||||
NSAccessibilityPostNotification([self hasRepresentedView] ? [self representedView] : self,
|
NSAccessibilityPostNotification([self hasRepresentedView] ? [self representedView] : self,
|
||||||
NSAccessibilityValueChangedNotification);
|
NSAccessibilityValueChangedNotification);
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@ -188,6 +241,8 @@ extern const NSString *kTopLevelUIElementAttribute; // NSAccessibilityTopLevel
|
|||||||
|
|
||||||
- (NSArray*)accessibilityAttributeNames
|
- (NSArray*)accessibilityAttributeNames
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
static NSArray *supportedAttributes = nil;
|
static NSArray *supportedAttributes = nil;
|
||||||
if (!supportedAttributes) {
|
if (!supportedAttributes) {
|
||||||
// standard attributes that are shared and supported by all generic elements.
|
// standard attributes that are shared and supported by all generic elements.
|
||||||
@ -218,10 +273,14 @@ extern const NSString *kTopLevelUIElementAttribute; // NSAccessibilityTopLevel
|
|||||||
nil];
|
nil];
|
||||||
}
|
}
|
||||||
return supportedAttributes;
|
return supportedAttributes;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)accessibilityActionNames
|
- (NSArray *)accessibilityActionNames
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
if ([self isEnabled]) {
|
if ([self isEnabled]) {
|
||||||
return [NSArray arrayWithObjects:NSAccessibilityConfirmAction,
|
return [NSArray arrayWithObjects:NSAccessibilityConfirmAction,
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
||||||
@ -230,10 +289,14 @@ extern const NSString *kTopLevelUIElementAttribute; // NSAccessibilityTopLevel
|
|||||||
nil];
|
nil];
|
||||||
}
|
}
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *)accessibilityActionDescription:(NSString *)action
|
- (NSString *)accessibilityActionDescription:(NSString *)action
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
||||||
if ([action isEqualToString:NSAccessibilityShowMenuAction])
|
if ([action isEqualToString:NSAccessibilityShowMenuAction])
|
||||||
return @"show menu";
|
return @"show menu";
|
||||||
@ -242,10 +305,14 @@ extern const NSString *kTopLevelUIElementAttribute; // NSAccessibilityTopLevel
|
|||||||
return @"confirm";
|
return @"confirm";
|
||||||
|
|
||||||
return [super accessibilityActionDescription:action];
|
return [super accessibilityActionDescription:action];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)accessibilityPerformAction:(NSString *)action
|
- (void)accessibilityPerformAction:(NSString *)action
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||||
|
|
||||||
// both the ShowMenu and Click action do the same thing.
|
// both the ShowMenu and Click action do the same thing.
|
||||||
if ([self isEnabled]) {
|
if ([self isEnabled]) {
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
||||||
@ -255,6 +322,8 @@ extern const NSString *kTopLevelUIElementAttribute; // NSAccessibilityTopLevel
|
|||||||
if ([action isEqualToString:NSAccessibilityConfirmAction])
|
if ([action isEqualToString:NSAccessibilityConfirmAction])
|
||||||
[self confirm];
|
[self confirm];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)showMenu
|
- (void)showMenu
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include "nsAccessibleWrap.h"
|
#include "nsAccessibleWrap.h"
|
||||||
#include "nsIAccessibleDocument.h"
|
#include "nsIAccessibleDocument.h"
|
||||||
#include "nsIAccessibleText.h"
|
#include "nsIAccessibleText.h"
|
||||||
|
#include "nsObjCExceptions.h"
|
||||||
|
|
||||||
#import "nsRoleMap.h"
|
#import "nsRoleMap.h"
|
||||||
|
|
||||||
@ -100,6 +101,8 @@ nsAccessibleWrap::GetNativeWindow (void **aOutNativeWindow)
|
|||||||
objc_class*
|
objc_class*
|
||||||
nsAccessibleWrap::GetNativeType ()
|
nsAccessibleWrap::GetNativeType ()
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
PRUint32 role = Role(this);
|
PRUint32 role = Role(this);
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case nsIAccessibleRole::ROLE_PUSHBUTTON:
|
case nsIAccessibleRole::ROLE_PUSHBUTTON:
|
||||||
@ -138,6 +141,8 @@ nsAccessibleWrap::GetNativeType ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this method is very important. it is fired when an accessible object "dies". after this point
|
// this method is very important. it is fired when an accessible object "dies". after this point
|
||||||
@ -157,6 +162,8 @@ nsAccessibleWrap::Shutdown ()
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
|
nsAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||||
|
|
||||||
NS_ENSURE_ARG_POINTER(aEvent);
|
NS_ENSURE_ARG_POINTER(aEvent);
|
||||||
|
|
||||||
nsresult rv = nsAccessible::FireAccessibleEvent(aEvent);
|
nsresult rv = nsAccessible::FireAccessibleEvent(aEvent);
|
||||||
@ -190,16 +197,22 @@ nsAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsAccessibleWrap::InvalidateChildren ()
|
nsAccessibleWrap::InvalidateChildren ()
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||||
|
|
||||||
if (mNativeWrapper) {
|
if (mNativeWrapper) {
|
||||||
mozAccessible *object = mNativeWrapper->getNativeObject();
|
mozAccessible *object = mNativeWrapper->getNativeObject();
|
||||||
[object invalidateChildren];
|
[object invalidateChildren];
|
||||||
}
|
}
|
||||||
return nsAccessible::InvalidateChildren();
|
return nsAccessible::InvalidateChildren();
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRInt32
|
PRInt32
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include "mozDocAccessible.h"
|
#include "mozDocAccessible.h"
|
||||||
|
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
#include "nsObjCExceptions.h"
|
||||||
#include "nsIWidget.h"
|
#include "nsIWidget.h"
|
||||||
#include "nsIViewManager.h"
|
#include "nsIViewManager.h"
|
||||||
|
|
||||||
@ -59,7 +60,11 @@ nsRootAccessibleWrap::~nsRootAccessibleWrap()
|
|||||||
objc_class*
|
objc_class*
|
||||||
nsRootAccessibleWrap::GetNativeType ()
|
nsRootAccessibleWrap::GetNativeType ()
|
||||||
{
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
return [mozRootAccessible class];
|
return [mozRootAccessible class];
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user