mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-02 06:22:20 +00:00
Bug 1669595 - Use top AXWebArea as text event source. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D92688
This commit is contained in:
parent
c04e8879a7
commit
16d2fdfadc
@ -101,6 +101,9 @@ inline mozAccessible* GetNativeFromGeckoAccessible(
|
||||
// Invalidate cached state.
|
||||
- (void)invalidateState;
|
||||
|
||||
// Get top level (tab) web area.
|
||||
- (mozAccessible*)topWebArea;
|
||||
|
||||
#pragma mark - mozAccessible protocol / widget
|
||||
|
||||
// override
|
||||
|
@ -746,6 +746,28 @@ struct RoleDescrComparator {
|
||||
return @([self stateWithMask:states::REQUIRED] != 0);
|
||||
}
|
||||
|
||||
- (mozAccessible*)topWebArea {
|
||||
AccessibleOrProxy doc = [self geckoDocument];
|
||||
while (!doc.IsNull()) {
|
||||
if (doc.IsAccessible()) {
|
||||
DocAccessible* docAcc = doc.AsAccessible()->AsDoc();
|
||||
if (docAcc->DocumentNode()->GetBrowsingContext()->IsTopContent()) {
|
||||
return GetNativeFromGeckoAccessible(docAcc);
|
||||
}
|
||||
|
||||
doc = docAcc->ParentDocument();
|
||||
} else {
|
||||
DocAccessibleParent* docProxy = doc.AsProxy()->AsDoc();
|
||||
if (docProxy->IsTopLevel()) {
|
||||
return GetNativeFromGeckoAccessible(docProxy);
|
||||
}
|
||||
doc = docProxy->ParentDoc();
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
@ -883,8 +905,7 @@ struct RoleDescrComparator {
|
||||
(selectedRange ? selectedRange : [NSNull null])
|
||||
};
|
||||
|
||||
mozAccessible* webArea =
|
||||
GetNativeFromGeckoAccessible([self geckoDocument]);
|
||||
mozAccessible* webArea = [self topWebArea];
|
||||
[webArea
|
||||
moxPostNotification:NSAccessibilitySelectedTextChangedNotification
|
||||
withUserInfo:userInfo];
|
||||
|
@ -407,7 +407,7 @@ enum AXTextStateChangeType {
|
||||
} ]
|
||||
};
|
||||
|
||||
mozAccessible* webArea = GetNativeFromGeckoAccessible([self geckoDocument]);
|
||||
mozAccessible* webArea = [self topWebArea];
|
||||
[webArea moxPostNotification:NSAccessibilityValueChangedNotification
|
||||
withUserInfo:userInfo];
|
||||
[self moxPostNotification:NSAccessibilityValueChangedNotification
|
||||
|
@ -56,6 +56,10 @@ function testValueChangedEventData(
|
||||
"AXLeftWordTextMarkerRangeForTextMarker",
|
||||
textMarker
|
||||
);
|
||||
if (!range) {
|
||||
todo(!!range, "Bug 1669596");
|
||||
return;
|
||||
}
|
||||
let str = macIface.getParameterizedAttributeValue(
|
||||
"AXStringForTextMarkerRange",
|
||||
range,
|
||||
@ -92,7 +96,7 @@ async function synthKeyAndTestSelectionChanged(
|
||||
]);
|
||||
|
||||
EventUtils.synthesizeKey(synthKey, synthEvent);
|
||||
let [, inputEvent] = await selectionChangedEvents;
|
||||
let [webareaEvent, inputEvent] = await selectionChangedEvents;
|
||||
is(
|
||||
inputEvent.data.AXTextChangeElement.getAttributeValue("AXDOMIdentifier"),
|
||||
expectedId,
|
||||
@ -108,6 +112,12 @@ async function synthKeyAndTestSelectionChanged(
|
||||
expectedSelectionString,
|
||||
`selection has correct value (${expectedSelectionString})`
|
||||
);
|
||||
|
||||
is(
|
||||
webareaEvent.macIface.getAttributeValue("AXDOMIdentifier"),
|
||||
"body",
|
||||
"Input event target is top-level WebArea"
|
||||
);
|
||||
}
|
||||
|
||||
async function synthKeyAndTestValueChanged(
|
||||
@ -259,3 +269,12 @@ addAccessibleTask(
|
||||
await focusIntoInputAndType(accDoc, "input", "inner");
|
||||
}
|
||||
);
|
||||
|
||||
// Test text input in iframe
|
||||
addAccessibleTask(
|
||||
`<a href="#">link</a> <input id="input">`,
|
||||
async (browser, accDoc) => {
|
||||
await focusIntoInputAndType(accDoc, "input");
|
||||
},
|
||||
{ iframe: true }
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user