mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Prefix members with 'm' per review comment. b=342146
NPODB
This commit is contained in:
parent
d53a42fd13
commit
5cabbd4fd3
@ -47,14 +47,14 @@
|
||||
|
||||
@interface mozAccessible : NSObject <mozAccessible>
|
||||
{
|
||||
nsAccessible *geckoAccessible; // weak reference; it owns us.
|
||||
NSMutableArray *children; // strong ref to array of children
|
||||
nsAccessible *mGeckoAccessible; // weak reference; it owns us.
|
||||
NSMutableArray *mChildren; // strong ref to array of children
|
||||
|
||||
// we can be marked as 'expired' if Shutdown() is called on our geckoAccessible.
|
||||
// since we might still be retained by some third-party, we need to do cleanup
|
||||
// in |expire|, and prevent any potential harm that could come from someone using us
|
||||
// after this point.
|
||||
BOOL isExpired;
|
||||
BOOL mIsExpired;
|
||||
}
|
||||
|
||||
// inits with the gecko owner.
|
||||
|
@ -83,8 +83,8 @@ ObjectOrUnignoredAncestor(id anObject)
|
||||
- (id)initWithAccessible:(nsAccessible*)accessible
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
geckoAccessible = accessible;
|
||||
isExpired = NO;
|
||||
mGeckoAccessible = accessible;
|
||||
mIsExpired = NO;
|
||||
}
|
||||
|
||||
return self;
|
||||
@ -92,7 +92,7 @@ ObjectOrUnignoredAncestor(id anObject)
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[children release];
|
||||
[mChildren release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@ -100,13 +100,13 @@ ObjectOrUnignoredAncestor(id anObject)
|
||||
|
||||
- (BOOL)accessibilityIsIgnored
|
||||
{
|
||||
return isExpired;
|
||||
return mIsExpired;
|
||||
}
|
||||
|
||||
- (NSArray*)accessibilityAttributeNames
|
||||
{
|
||||
// if we're expired, we don't support any attributes.
|
||||
if (isExpired)
|
||||
if (mIsExpired)
|
||||
return [NSArray array];
|
||||
|
||||
static NSArray *supportedAttributes = nil;
|
||||
@ -134,7 +134,7 @@ ObjectOrUnignoredAncestor(id anObject)
|
||||
|
||||
- (id)accessibilityAttributeValue:(NSString*)attribute
|
||||
{
|
||||
if (isExpired)
|
||||
if (mIsExpired)
|
||||
return nil;
|
||||
|
||||
if ([attribute isEqualToString:NSAccessibilityChildrenAttribute])
|
||||
@ -195,7 +195,7 @@ ObjectOrUnignoredAncestor(id anObject)
|
||||
|
||||
- (id)accessibilityHitTest:(NSPoint)point
|
||||
{
|
||||
if (isExpired)
|
||||
if (mIsExpired)
|
||||
return nil;
|
||||
|
||||
#ifdef DEBUG_hakan
|
||||
@ -208,7 +208,7 @@ ObjectOrUnignoredAncestor(id anObject)
|
||||
|
||||
// see if we can find an accessible at that point.
|
||||
nsCOMPtr<nsIAccessible> foundChild;
|
||||
geckoAccessible->GetChildAtPoint ((PRInt32)geckoPoint.x, (PRInt32)geckoPoint.y, getter_AddRefs (foundChild));
|
||||
mGeckoAccessible->GetChildAtPoint ((PRInt32)geckoPoint.x, (PRInt32)geckoPoint.y, getter_AddRefs (foundChild));
|
||||
|
||||
if (foundChild) {
|
||||
// if we found something, return its native accessible.
|
||||
@ -237,11 +237,11 @@ ObjectOrUnignoredAncestor(id anObject)
|
||||
|
||||
- (id)accessibilityFocusedUIElement
|
||||
{
|
||||
if (isExpired)
|
||||
if (mIsExpired)
|
||||
return nil;
|
||||
|
||||
nsCOMPtr<nsIAccessible> focusedGeckoChild;
|
||||
geckoAccessible->GetFocusedChild (getter_AddRefs (focusedGeckoChild));
|
||||
mGeckoAccessible->GetFocusedChild (getter_AddRefs (focusedGeckoChild));
|
||||
|
||||
if (focusedGeckoChild) {
|
||||
mozAccessible *focusedChild = [self getNativeFromGeckoAccessible:focusedGeckoChild];
|
||||
@ -258,7 +258,7 @@ ObjectOrUnignoredAncestor(id anObject)
|
||||
- (id <mozAccessible>)parent
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> accessibleParent;
|
||||
nsresult rv = geckoAccessible->GetParent (getter_AddRefs (accessibleParent));
|
||||
nsresult rv = mGeckoAccessible->GetParent (getter_AddRefs (accessibleParent));
|
||||
if (accessibleParent && NS_SUCCEEDED (rv)) {
|
||||
mozAccessible *nativeParent = [self getNativeFromGeckoAccessible:accessibleParent];
|
||||
if (nativeParent)
|
||||
@ -285,20 +285,20 @@ ObjectOrUnignoredAncestor(id anObject)
|
||||
// into a children array instead? then we could avoid this (quite expensive)
|
||||
// check.
|
||||
PRInt32 count=0;
|
||||
geckoAccessible->GetChildCount (&count);
|
||||
mGeckoAccessible->GetChildCount (&count);
|
||||
|
||||
// short-circuit here. if we already have a children
|
||||
// array, and the count hasn't changed, just return our
|
||||
// cached version.
|
||||
if (children && ([children count] == (unsigned)count))
|
||||
return children;
|
||||
if (mChildren && ([mChildren count] == (unsigned)count))
|
||||
return mChildren;
|
||||
|
||||
if (!children)
|
||||
children = [[NSMutableArray alloc] initWithCapacity:count];
|
||||
if (!mChildren)
|
||||
mChildren = [[NSMutableArray alloc] initWithCapacity:count];
|
||||
|
||||
// get the array of children.
|
||||
nsCOMPtr<nsIArray> childrenArray;
|
||||
geckoAccessible->GetChildren(getter_AddRefs(childrenArray));
|
||||
mGeckoAccessible->GetChildren(getter_AddRefs(childrenArray));
|
||||
|
||||
if (childrenArray) {
|
||||
// get an enumerator for this array.
|
||||
@ -317,18 +317,18 @@ ObjectOrUnignoredAncestor(id anObject)
|
||||
if (accessible) {
|
||||
curNative = [self getNativeFromGeckoAccessible:accessible];
|
||||
if (curNative)
|
||||
[children addObject:curNative];
|
||||
[mChildren addObject:curNative];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return children;
|
||||
return mChildren;
|
||||
}
|
||||
|
||||
- (NSValue*)position
|
||||
{
|
||||
PRInt32 x, y, width, height;
|
||||
geckoAccessible->GetBounds (&x, &y, &width, &height);
|
||||
mGeckoAccessible->GetBounds (&x, &y, &width, &height);
|
||||
NSPoint p = NSMakePoint (x, y);
|
||||
|
||||
// the coords we get here should be top-left.
|
||||
@ -349,35 +349,35 @@ ObjectOrUnignoredAncestor(id anObject)
|
||||
- (NSValue*)size
|
||||
{
|
||||
PRInt32 x, y, width, height;
|
||||
geckoAccessible->GetBounds (&x, &y, &width, &height);
|
||||
mGeckoAccessible->GetBounds (&x, &y, &width, &height);
|
||||
return [NSValue valueWithSize:NSMakeSize (width, height)];
|
||||
}
|
||||
|
||||
- (NSString*)role
|
||||
{
|
||||
PRUint32 roleInt = 0;
|
||||
geckoAccessible->GetFinalRole (&roleInt);
|
||||
mGeckoAccessible->GetFinalRole (&roleInt);
|
||||
return AXRoles[roleInt]; // see nsRoleMap.h
|
||||
}
|
||||
|
||||
- (NSString*)title
|
||||
{
|
||||
nsAutoString title;
|
||||
geckoAccessible->GetName (title);
|
||||
mGeckoAccessible->GetName (title);
|
||||
return [NSString stringWithCharacters:title.BeginReading() length:title.Length()];
|
||||
}
|
||||
|
||||
- (NSString*)value
|
||||
{
|
||||
nsAutoString value;
|
||||
geckoAccessible->GetValue (value);
|
||||
mGeckoAccessible->GetValue (value);
|
||||
return [NSString stringWithCharacters:value.BeginReading() length:value.Length()];
|
||||
}
|
||||
|
||||
- (NSString*)customDescription
|
||||
{
|
||||
nsAutoString desc;
|
||||
geckoAccessible->GetDescription (desc);
|
||||
mGeckoAccessible->GetDescription (desc);
|
||||
return [NSString stringWithCharacters:desc.BeginReading() length:desc.Length()];
|
||||
}
|
||||
|
||||
@ -390,27 +390,27 @@ ObjectOrUnignoredAncestor(id anObject)
|
||||
- (BOOL)isFocused
|
||||
{
|
||||
PRUint32 state = 0;
|
||||
geckoAccessible->GetFinalState (&state);
|
||||
mGeckoAccessible->GetFinalState (&state);
|
||||
return (state & nsIAccessible::STATE_FOCUSED) != 0;
|
||||
}
|
||||
|
||||
- (BOOL)canBeFocused
|
||||
{
|
||||
PRUint32 state = 0;
|
||||
geckoAccessible->GetFinalState (&state);
|
||||
mGeckoAccessible->GetFinalState (&state);
|
||||
return (state & nsIAccessible::STATE_FOCUSABLE) != 0;
|
||||
}
|
||||
|
||||
// should only be called if canBeFocused returns YES.
|
||||
- (BOOL)focus
|
||||
{
|
||||
nsresult rv = geckoAccessible->TakeFocus();
|
||||
nsresult rv = mGeckoAccessible->TakeFocus();
|
||||
return NS_SUCCEEDED (rv);
|
||||
}
|
||||
|
||||
- (NSWindow*)window
|
||||
{
|
||||
nsAccessibleWrap *accWrap = NS_STATIC_CAST (nsAccessibleWrap*, geckoAccessible);
|
||||
nsAccessibleWrap *accWrap = NS_STATIC_CAST (nsAccessibleWrap*, mGeckoAccessible);
|
||||
NSWindow *nativeWindow = nil;
|
||||
accWrap->GetNativeWindow ((void**)&nativeWindow);
|
||||
|
||||
@ -431,13 +431,13 @@ ObjectOrUnignoredAncestor(id anObject)
|
||||
|
||||
- (void)invalidateChildren
|
||||
{
|
||||
[children removeAllObjects];
|
||||
[mChildren removeAllObjects];
|
||||
}
|
||||
|
||||
- (void)expire
|
||||
{
|
||||
[self invalidateChildren];
|
||||
isExpired = YES;
|
||||
mIsExpired = YES;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
@ -68,6 +68,6 @@
|
||||
// party tools that we do this!
|
||||
//
|
||||
// /hwaara
|
||||
id <mozView, mozAccessible> parallelView; // weak ref
|
||||
id <mozView, mozAccessible> mParallelView; // weak ref
|
||||
}
|
||||
@end
|
||||
|
@ -66,25 +66,25 @@ static id <mozAccessible, mozView> getNativeViewFromRootAccessible (nsAccessible
|
||||
// return the AXParent that our parallell NSView tells us about.
|
||||
- (id)parent
|
||||
{
|
||||
if (!parallelView)
|
||||
parallelView = (id<mozView, mozAccessible>)[self ourself];
|
||||
if (!mParallelView)
|
||||
mParallelView = (id<mozView, mozAccessible>)[self ourself];
|
||||
|
||||
return [parallelView accessibilityAttributeValue:NSAccessibilityParentAttribute];
|
||||
return [mParallelView accessibilityAttributeValue:NSAccessibilityParentAttribute];
|
||||
}
|
||||
|
||||
// this will return our parallell NSView. see mozDocAccessible.h
|
||||
- (id)ourself
|
||||
{
|
||||
if (parallelView)
|
||||
return (id)parallelView;
|
||||
if (mParallelView)
|
||||
return (id)mParallelView;
|
||||
|
||||
parallelView = getNativeViewFromRootAccessible (geckoAccessible);
|
||||
mParallelView = getNativeViewFromRootAccessible (mGeckoAccessible);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (!parallelView)
|
||||
if (!mParallelView)
|
||||
NSLog (@"!!! can't return root accessible's native parallel view.");
|
||||
#endif
|
||||
return parallelView;
|
||||
return mParallelView;
|
||||
}
|
||||
|
||||
- (NSString*)role
|
||||
|
Loading…
Reference in New Issue
Block a user