Bug 703770 - mozRootAccessible need to return a different set of properties. r=surkov

This commit is contained in:
Hub Figuiere 2011-12-08 16:19:29 -05:00
Родитель ec5523388f
Коммит 14c7c2d6bf
2 изменённых файлов: 47 добавлений и 3 удалений

Просмотреть файл

@ -47,8 +47,10 @@
#include "nsObjCExceptions.h"
#include "nsIAccessible.h"
#include "nsIAccessibleRelation.h"
#include "nsIAccessibleText.h"
#include "nsIAccessibleEditableText.h"
#include "Relation.h"
#include "nsRootAccessible.h"
@ -246,16 +248,20 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
return [self window];
if ([attribute isEqualToString: (NSString*) kTopLevelUIElementAttribute])
return [self window];
if ([attribute isEqualToString:NSAccessibilityTitleAttribute] ||
[attribute isEqualToString:NSAccessibilityTitleUIElementAttribute])
if ([attribute isEqualToString:NSAccessibilityTitleAttribute])
return [self title];
if ([attribute isEqualToString:NSAccessibilityTitleUIElementAttribute]) {
Relation rel = mGeckoAccessible->RelationByType(nsIAccessibleRelation::RELATION_LABELLED_BY);
nsAccessible* tempAcc = rel.Next();
return tempAcc ? GetNativeFromGeckoAccessible(tempAcc) : nil;
}
if ([attribute isEqualToString:NSAccessibilityHelpAttribute])
return [self help];
#ifdef DEBUG
NSLog (@"!!! %@ can't respond to attribute %@", self, attribute);
#endif
return nil; // be nice and return empty string instead?
return nil;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}

Просмотреть файл

@ -55,6 +55,44 @@ static id <mozAccessible, mozView> getNativeViewFromRootAccessible (nsAccessible
@implementation mozRootAccessible
- (NSArray*)accessibilityAttributeNames
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
// if we're expired, we don't support any attributes.
if (mIsExpired)
return [NSArray array];
// standard attributes that are shared and supported by root accessible (AXMain) elements.
static NSMutableArray* attributes = nil;
if (!attributes) {
attributes = [[super accessibilityAttributeNames] mutableCopy];
[attributes addObject:NSAccessibilityMainAttribute];
[attributes addObject:NSAccessibilityMinimizedAttribute];
}
return attributes;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
- (id)accessibilityAttributeValue:(NSString *)attribute
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
if ([attribute isEqualToString:NSAccessibilityMainAttribute]) {
return [NSNumber numberWithBool:[[self window] isMainWindow]];
}
if ([attribute isEqualToString:NSAccessibilityMinimizedAttribute]) {
return [NSNumber numberWithBool:[[self window] isMiniaturized]];
}
return [super accessibilityAttributeValue:attribute];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
// return the AXParent that our parallell NSView tells us about.
- (id)parent
{