Bug 1688680 - Don't include AXTextStateSync in read-only collapsed text selection events. r=morgan.

Differential Revision: https://phabricator.services.mozilla.com/D102948
This commit is contained in:
Eitan Isaacson 2021-01-25 17:58:52 +00:00
parent 0921a6cd36
commit 92f8f50dd8
2 changed files with 8 additions and 8 deletions

View File

@ -84,16 +84,16 @@ static nsDataHashtable<nsUint64HashKey, MOXTextMarkerDelegate*> sDelegates;
- (NSDictionary*)selectionChangeInfo {
GeckoTextMarkerRange selectedGeckoRange =
GeckoTextMarkerRange(mGeckoDocAccessible, mSelection);
int32_t stateChangeType = selectedGeckoRange.mStart == selectedGeckoRange.mEnd
? AXTextStateChangeTypeSelectionMove
: AXTextStateChangeTypeSelectionExtend;
// This is the base info object, includes the selected marker range and
// the change type depending on the collapsed state of the selection.
NSMutableDictionary* info = [@{
@"AXSelectedTextMarkerRange" : selectedGeckoRange.IsValid() ? mSelection
: [NSNull null],
@"AXTextStateChangeType" :
selectedGeckoRange.mStart == selectedGeckoRange.mEnd
? @(AXTextStateChangeTypeSelectionMove)
: @(AXTextStateChangeTypeSelectionExtend)
@"AXTextStateChangeType" : @(stateChangeType),
} mutableCopy];
GeckoTextMarker caretMarker(mGeckoDocAccessible, mCaret);
@ -107,7 +107,7 @@ static nsDataHashtable<nsUint64HashKey, MOXTextMarkerDelegate*> sDelegates;
[GetNativeFromGeckoAccessible(caretMarker.mContainer)
moxEditableAncestor];
if (!caretEditable) {
if (!caretEditable && stateChangeType == AXTextStateChangeTypeSelectionMove) {
// If we are not in an editable, VO expects AXTextStateSync to be present
// and true.
info[@"AXTextStateSync"] = @YES;

View File

@ -22,7 +22,7 @@ addAccessibleTask(`<p id="p">Hello World</p>`, async (browser, accDoc) => {
let evt = waitForMacEventWithInfo("AXSelectedTextChanged", (elem, info) => {
return (
info.AXTextStateSync &&
!info.AXTextStateSync &&
info.AXTextStateChangeType == AXTextStateChangeTypeSelectionExtend &&
elem.getAttributeValue("AXRole") == "AXWebArea"
);
@ -49,7 +49,7 @@ addAccessibleTask(`<p id="p">Hello World</p>`, async (browser, accDoc) => {
evt = waitForMacEventWithInfo("AXSelectedTextChanged", (elem, info) => {
return (
info.AXTextStateSync &&
!info.AXTextStateSync &&
info.AXTextStateChangeType == AXTextStateChangeTypeSelectionExtend &&
elem.getAttributeValue("AXRole") == "AXWebArea"
);
@ -146,7 +146,7 @@ addAccessibleTask(
let evt = waitForMacEventWithInfo("AXSelectedTextChanged", (elem, info) => {
return (
info.AXTextStateSync &&
!info.AXTextStateSync &&
info.AXTextStateChangeType == AXTextStateChangeTypeSelectionExtend &&
elem.getAttributeValue("AXRole") == "AXWebArea"
);