Bug 1669599 - Support AXEditableAncestor and make it text event target. r=morgan

Depends on D92689

Differential Revision: https://phabricator.services.mozilla.com/D92690
This commit is contained in:
Eitan Isaacson 2020-10-07 00:13:34 +00:00
Родитель c173a1f486
Коммит f050b91638
4 изменённых файлов: 32 добавлений и 4 удалений

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

@ -261,6 +261,9 @@
// AXInsertionPointLineNumber
- (NSNumber* _Nullable)moxInsertionPointLineNumber;
// AXEditableAncestor
- (id _Nullable)moxEditableAncestor;
#pragma mark - AttributeSetters
// AXValue

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

@ -187,6 +187,9 @@ inline mozAccessible* GetNativeFromGeckoAccessible(
// override
- (NSNumber*)moxRequired;
// override
- (id)moxEditableAncestor;
// override
- (NSArray*)moxUIElementsForSearchPredicate:(NSDictionary*)searchPredicate;

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

@ -10,6 +10,7 @@
#import "MacUtils.h"
#import "mozView.h"
#import "MOXSearchInfo.h"
#import "mozTextAccessible.h"
#include "Accessible-inl.h"
#include "nsAccUtils.h"
@ -768,6 +769,17 @@ struct RoleDescrComparator {
return nil;
}
- (id)moxEditableAncestor {
for (id element = self; [element conformsToProtocol:@protocol(MOXAccessible)];
element = [element moxUnignoredParent]) {
if ([element isKindOfClass:[mozTextAccessible class]]) {
return element;
}
}
return nil;
}
- (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
@ -899,8 +911,10 @@ struct RoleDescrComparator {
// reduntant.
id<MOXTextMarkerSupport> delegate = [self moxTextMarkerDelegate];
id selectedRange = [delegate moxSelectedTextMarkerRange];
id editableAncestor = [self moxEditableAncestor];
id textChangeElement = editableAncestor ? editableAncestor : self;
NSDictionary* userInfo = @{
@"AXTextChangeElement" : self,
@"AXTextChangeElement" : textChangeElement,
@"AXSelectedTextMarkerRange" :
(selectedRange ? selectedRange : [NSNull null])
};
@ -909,8 +923,9 @@ struct RoleDescrComparator {
[webArea
moxPostNotification:NSAccessibilitySelectedTextChangedNotification
withUserInfo:userInfo];
[self moxPostNotification:NSAccessibilitySelectedTextChangedNotification
withUserInfo:userInfo];
[textChangeElement
moxPostNotification:NSAccessibilitySelectedTextChangedNotification
withUserInfo:userInfo];
break;
}
}

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

@ -271,7 +271,14 @@ addAccessibleTask(
addAccessibleTask(
`<div id="input" contentEditable="true" tabindex="0" role="textbox" aria-multiline="true"><div id="inner"><br /></div></div>`,
async (browser, accDoc) => {
await focusIntoInputAndType(accDoc, "input", "inner");
const inner = getNativeInterface(accDoc, "inner");
const editableAncestor = inner.getAttributeValue("AXEditableAncestor");
is(
editableAncestor.getAttributeValue("AXDOMIdentifier"),
"input",
"Editable ancestor is input"
);
await focusIntoInputAndType(accDoc, "input");
}
);