mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1672803 - Add AXMozDebugDescription and override NSObject description when logging. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D94473
This commit is contained in:
parent
1cd845aa11
commit
617e00d069
@ -125,6 +125,8 @@ inline id<mozAccessible> GetObjectOrRepresentedView(id<mozAccessible> aObject) {
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (NSString*)description;
|
||||
|
||||
- (BOOL)isExpired;
|
||||
|
||||
// makes ourselves "expired". after this point, we might be around if someone
|
||||
|
@ -175,12 +175,12 @@ mozilla::LogModule* GetMacAccessibilityLog() {
|
||||
|
||||
if (MOZ_LOG_TEST(GetMacAccessibilityLog(), LogLevel::Debug)) {
|
||||
if (MOZ_LOG_TEST(GetMacAccessibilityLog(), LogLevel::Verbose)) {
|
||||
LOG(LogLevel::Verbose, @"[%@] attributeValue %@ => %@", self, attribute,
|
||||
LOG(LogLevel::Verbose, @"%@ attributeValue %@ => %@", self, attribute,
|
||||
value);
|
||||
} else if (![attribute isEqualToString:@"AXParent"] &&
|
||||
![attribute isEqualToString:@"AXRole"] &&
|
||||
![attribute isEqualToString:@"AXChildren"]) {
|
||||
LOG(LogLevel::Debug, @"[%@] attributeValue %@", self, attribute);
|
||||
LOG(LogLevel::Debug, @"%@ attributeValue %@", self, attribute);
|
||||
}
|
||||
}
|
||||
|
||||
@ -352,10 +352,10 @@ mozilla::LogModule* GetMacAccessibilityLog() {
|
||||
}
|
||||
|
||||
if (MOZ_LOG_TEST(GetMacAccessibilityLog(), LogLevel::Verbose)) {
|
||||
LOG(LogLevel::Verbose, @"[%@] attributeValueForParam %@(%@) => %@", self,
|
||||
LOG(LogLevel::Verbose, @"%@ attributeValueForParam %@(%@) => %@", self,
|
||||
attribute, parameter, value);
|
||||
} else {
|
||||
LOG(LogLevel::Debug, @"[%@] attributeValueForParam %@", self, attribute);
|
||||
LOG(LogLevel::Debug, @"%@ attributeValueForParam %@", self, attribute);
|
||||
}
|
||||
|
||||
return value;
|
||||
@ -421,9 +421,9 @@ mozilla::LogModule* GetMacAccessibilityLog() {
|
||||
- (void)moxPostNotification:(NSString*)notification
|
||||
withUserInfo:(NSDictionary*)userInfo {
|
||||
if (MOZ_LOG_TEST(GetMacAccessibilityLog(), LogLevel::Verbose)) {
|
||||
LOG(LogLevel::Verbose, @"[%@] notify %@ %@", self, notification, userInfo);
|
||||
LOG(LogLevel::Verbose, @"%@ notify %@ %@", self, notification, userInfo);
|
||||
} else {
|
||||
LOG(LogLevel::Debug, @"[%@] notify %@", self, notification);
|
||||
LOG(LogLevel::Debug, @"%@ notify %@", self, notification);
|
||||
}
|
||||
|
||||
// This sends events via nsIObserverService to be consumed by our mochitests.
|
||||
@ -504,6 +504,20 @@ mozilla::LogModule* GetMacAccessibilityLog() {
|
||||
|
||||
#pragma mark -
|
||||
|
||||
// objc-style description (from NSObject); not to be confused with the
|
||||
// accessible description above.
|
||||
- (NSString*)description {
|
||||
if (MOZ_LOG_TEST(GetMacAccessibilityLog(), LogLevel::Debug)) {
|
||||
if ([self isSelectorSupported:@selector(moxMozDebugDescription)]) {
|
||||
return [self moxMozDebugDescription];
|
||||
}
|
||||
}
|
||||
|
||||
return [NSString stringWithFormat:@"<%@: %p %@>",
|
||||
NSStringFromClass([self class]), self,
|
||||
[self moxRole]];
|
||||
}
|
||||
|
||||
- (BOOL)isExpired {
|
||||
return mIsExpired;
|
||||
}
|
||||
|
@ -264,6 +264,9 @@
|
||||
// AXEditableAncestor
|
||||
- (id _Nullable)moxEditableAncestor;
|
||||
|
||||
// AXMozDebugDescription
|
||||
- (NSString* _Nullable)moxMozDebugDescription;
|
||||
|
||||
#pragma mark - AttributeSetters
|
||||
|
||||
// AXValue
|
||||
|
@ -195,6 +195,11 @@ inline mozAccessible* GetNativeFromGeckoAccessible(
|
||||
// override
|
||||
- (id)moxEditableAncestor;
|
||||
|
||||
#ifndef RELEASE_OR_BETA
|
||||
// override
|
||||
- (NSString*)moxMozDebugDescription;
|
||||
#endif
|
||||
|
||||
// override
|
||||
- (NSArray*)moxUIElementsForSearchPredicate:(NSDictionary*)searchPredicate;
|
||||
|
||||
@ -228,9 +233,4 @@ inline mozAccessible* GetNativeFromGeckoAccessible(
|
||||
// override
|
||||
- (BOOL)isExpired;
|
||||
|
||||
// ---- NSAccessibility methods ---- //
|
||||
|
||||
// override
|
||||
- (NSString*)description;
|
||||
|
||||
@end
|
||||
|
@ -798,6 +798,33 @@ struct RoleDescrComparator {
|
||||
return nil;
|
||||
}
|
||||
|
||||
#ifndef RELEASE_OR_BETA
|
||||
- (NSString*)moxMozDebugDescription {
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
|
||||
NSMutableString* domInfo = [NSMutableString string];
|
||||
if (NSString* tagName = utils::GetAccAttr(self, "tag")) {
|
||||
[domInfo appendFormat:@" %@", tagName];
|
||||
NSString* domID = [self moxDOMIdentifier];
|
||||
if ([domID length]) {
|
||||
[domInfo appendFormat:@"#%@", domID];
|
||||
}
|
||||
if (NSString* className = utils::GetAccAttr(self, "class")) {
|
||||
[domInfo
|
||||
appendFormat:@".%@",
|
||||
[className stringByReplacingOccurrencesOfString:@" "
|
||||
withString:@"."]];
|
||||
}
|
||||
}
|
||||
|
||||
return [NSString stringWithFormat:@"<%@: %p %@%@>",
|
||||
NSStringFromClass([self class]), self,
|
||||
[self moxRole], domInfo];
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
}
|
||||
#endif
|
||||
|
||||
- (NSArray*)moxUIElementsForSearchPredicate:(NSDictionary*)searchPredicate {
|
||||
// Create our search object and set it up with the searchPredicate
|
||||
// params. The init function does additional parsing. We pass a
|
||||
@ -883,16 +910,6 @@ struct RoleDescrComparator {
|
||||
|
||||
#pragma mark -
|
||||
|
||||
// objc-style description (from NSObject); not to be confused with the
|
||||
// accessible description above.
|
||||
- (NSString*)description {
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
|
||||
return [NSString stringWithFormat:@"(%p) %@", self, [self moxRole]];
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
}
|
||||
|
||||
- (BOOL)disableChild:(mozAccessible*)child {
|
||||
return NO;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user