зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 47667fbae734 (bug 1654679) for causing failures in browser_text_input.js
This commit is contained in:
Родитель
4569cc4aa1
Коммит
13e26846d7
|
@ -166,8 +166,7 @@ nsresult AccessibleWrap::HandleAccEvent(AccEvent* aEvent) {
|
||||||
// If the selection is collapsed, invalidate our text selection cache.
|
// If the selection is collapsed, invalidate our text selection cache.
|
||||||
MOXTextMarkerDelegate* delegate =
|
MOXTextMarkerDelegate* delegate =
|
||||||
[MOXTextMarkerDelegate getOrCreateForDoc:aEvent->Document()];
|
[MOXTextMarkerDelegate getOrCreateForDoc:aEvent->Document()];
|
||||||
int32_t caretOffset = event->GetCaretOffset();
|
[delegate invalidateSelection];
|
||||||
[delegate setSelectionFrom:eventTarget at:caretOffset to:eventTarget at:caretOffset];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[nativeAcc handleAccessibleEvent:eventType];
|
[nativeAcc handleAccessibleEvent:eventType];
|
||||||
|
|
|
@ -100,7 +100,7 @@ void ProxyCaretMoveEvent(ProxyAccessible* aTarget, int32_t aOffset, bool aIsSele
|
||||||
if (aIsSelectionCollapsed) {
|
if (aIsSelectionCollapsed) {
|
||||||
// If selection is collapsed, invalidate selection.
|
// If selection is collapsed, invalidate selection.
|
||||||
MOXTextMarkerDelegate* delegate = [MOXTextMarkerDelegate getOrCreateForDoc:aTarget->Document()];
|
MOXTextMarkerDelegate* delegate = [MOXTextMarkerDelegate getOrCreateForDoc:aTarget->Document()];
|
||||||
[delegate setSelectionFrom:aTarget at:aOffset to:aTarget at:aOffset];
|
[delegate invalidateSelection];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wrapper) {
|
if (wrapper) {
|
||||||
|
|
|
@ -840,21 +840,10 @@ enum AXTextStateChangeType {
|
||||||
case nsIAccessibleEvent::EVENT_SELECTION_WITHIN:
|
case nsIAccessibleEvent::EVENT_SELECTION_WITHIN:
|
||||||
[self moxPostNotification:NSAccessibilitySelectedChildrenChangedNotification];
|
[self moxPostNotification:NSAccessibilitySelectedChildrenChangedNotification];
|
||||||
break;
|
break;
|
||||||
case nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED: {
|
case nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED:
|
||||||
// We consider any caret move event to be a selected text change event.
|
case nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED:
|
||||||
// So dispatching an event for EVENT_TEXT_SELECTION_CHANGED would be reduntant.
|
[self moxPostNotification:NSAccessibilitySelectedTextChangedNotification];
|
||||||
id<MOXTextMarkerSupport> delegate = [self moxTextMarkerDelegate];
|
|
||||||
id selectedRange = [delegate moxSelectedTextMarkerRange];
|
|
||||||
NSDictionary* userInfo = @{
|
|
||||||
@"AXTextChangeElement": self,
|
|
||||||
@"AXSelectedTextMarkerRange": (selectedRange ? selectedRange : [NSNull null])
|
|
||||||
};
|
|
||||||
|
|
||||||
mozAccessible* webArea = GetNativeFromGeckoAccessible([self geckoDocument]);
|
|
||||||
[webArea moxPostNotification:NSAccessibilitySelectedTextChangedNotification withUserInfo:userInfo];
|
|
||||||
[self moxPostNotification:NSAccessibilitySelectedTextChangedNotification withUserInfo:userInfo];
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,54 +64,7 @@ function testValueChangedEventData(
|
||||||
is(str, expectedWordAtLeft);
|
is(str, expectedWordAtLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
function eventDuoPromise(eventName, expectedId) {
|
async function synthKeyAndTestEvent(
|
||||||
return [
|
|
||||||
waitForMacEventWithInfo(eventName, (iface, data) => {
|
|
||||||
return (
|
|
||||||
iface.getAttributeValue("AXRole") == "AXWebArea" &&
|
|
||||||
!!data &&
|
|
||||||
data.AXTextChangeElement.getAttributeValue("AXDOMIdentifier") ==
|
|
||||||
expectedId
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
waitForMacEventWithInfo(
|
|
||||||
eventName,
|
|
||||||
(iface, data) =>
|
|
||||||
iface.getAttributeValue("AXDOMIdentifier") == expectedId && !!data
|
|
||||||
),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
async function synthKeyAndTestSelectionChanged(
|
|
||||||
synthKey,
|
|
||||||
synthEvent,
|
|
||||||
expectedId,
|
|
||||||
expectedSelectionString
|
|
||||||
) {
|
|
||||||
let valueChangedEvents = Promise.all(
|
|
||||||
eventDuoPromise("AXSelectedTextChanged", expectedId)
|
|
||||||
);
|
|
||||||
|
|
||||||
EventUtils.synthesizeKey(synthKey, synthEvent);
|
|
||||||
let [, inputEvent] = await valueChangedEvents;
|
|
||||||
is(
|
|
||||||
inputEvent.data.AXTextChangeElement.getAttributeValue("AXDOMIdentifier"),
|
|
||||||
expectedId,
|
|
||||||
"Correct AXTextChangeElement"
|
|
||||||
);
|
|
||||||
|
|
||||||
let rangeString = inputEvent.macIface.getParameterizedAttributeValue(
|
|
||||||
"AXStringForTextMarkerRange",
|
|
||||||
inputEvent.data.AXSelectedTextMarkerRange
|
|
||||||
);
|
|
||||||
is(
|
|
||||||
rangeString,
|
|
||||||
expectedSelectionString,
|
|
||||||
`selection has correct value (${expectedSelectionString})`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function synthKeyAndTestValueChanged(
|
|
||||||
synthKey,
|
synthKey,
|
||||||
synthEvent,
|
synthEvent,
|
||||||
expectedId,
|
expectedId,
|
||||||
|
@ -119,14 +72,23 @@ async function synthKeyAndTestValueChanged(
|
||||||
expectedEditType,
|
expectedEditType,
|
||||||
expectedWordAtLeft
|
expectedWordAtLeft
|
||||||
) {
|
) {
|
||||||
let valueChangedEvents = Promise.all(
|
let valueChangedEvents = Promise.all([
|
||||||
eventDuoPromise("AXSelectedTextChanged", expectedId).concat(
|
waitForMacEventWithInfo("AXValueChanged", (iface, data) => {
|
||||||
eventDuoPromise("AXValueChanged", expectedId)
|
return (
|
||||||
)
|
iface.getAttributeValue("AXRole") == "AXWebArea" &&
|
||||||
);
|
!!data &&
|
||||||
|
data.AXTextChangeElement.getAttributeValue("AXDOMIdentifier") == "input"
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
waitForMacEventWithInfo(
|
||||||
|
"AXValueChanged",
|
||||||
|
(iface, data) =>
|
||||||
|
iface.getAttributeValue("AXDOMIdentifier") == "input" && !!data
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
|
||||||
EventUtils.synthesizeKey(synthKey, synthEvent);
|
EventUtils.synthesizeKey(synthKey, synthEvent);
|
||||||
let [, , webareaEvent, inputEvent] = await valueChangedEvents;
|
let [webareaEvent, inputEvent] = await valueChangedEvents;
|
||||||
|
|
||||||
testValueChangedEventData(
|
testValueChangedEventData(
|
||||||
webareaEvent.macIface,
|
webareaEvent.macIface,
|
||||||
|
@ -165,7 +127,7 @@ addAccessibleTask(
|
||||||
expectedChangeValue,
|
expectedChangeValue,
|
||||||
expectedWordAtLeft
|
expectedWordAtLeft
|
||||||
) {
|
) {
|
||||||
await synthKeyAndTestValueChanged(
|
await synthKeyAndTestEvent(
|
||||||
synthKey,
|
synthKey,
|
||||||
null,
|
null,
|
||||||
"input",
|
"input",
|
||||||
|
@ -191,7 +153,7 @@ addAccessibleTask(
|
||||||
await testTextInput("d", "d", "world");
|
await testTextInput("d", "d", "world");
|
||||||
|
|
||||||
async function testTextDelete(expectedChangeValue, expectedWordAtLeft) {
|
async function testTextDelete(expectedChangeValue, expectedWordAtLeft) {
|
||||||
await synthKeyAndTestValueChanged(
|
await synthKeyAndTestEvent(
|
||||||
"KEY_Backspace",
|
"KEY_Backspace",
|
||||||
null,
|
null,
|
||||||
"input",
|
"input",
|
||||||
|
@ -203,33 +165,5 @@ addAccessibleTask(
|
||||||
|
|
||||||
await testTextDelete("d", "worl");
|
await testTextDelete("d", "worl");
|
||||||
await testTextDelete("l", "wor");
|
await testTextDelete("l", "wor");
|
||||||
|
|
||||||
await synthKeyAndTestSelectionChanged("KEY_ArrowLeft", null, "input", "");
|
|
||||||
await synthKeyAndTestSelectionChanged(
|
|
||||||
"KEY_ArrowLeft",
|
|
||||||
{ shiftKey: true },
|
|
||||||
"input",
|
|
||||||
"o"
|
|
||||||
);
|
|
||||||
await synthKeyAndTestSelectionChanged(
|
|
||||||
"KEY_ArrowLeft",
|
|
||||||
{ shiftKey: true },
|
|
||||||
"input",
|
|
||||||
"wo"
|
|
||||||
);
|
|
||||||
await synthKeyAndTestSelectionChanged("KEY_ArrowLeft", null, "input", "");
|
|
||||||
await synthKeyAndTestSelectionChanged(
|
|
||||||
"KEY_Home",
|
|
||||||
{ shiftKey: true },
|
|
||||||
"input",
|
|
||||||
"hello "
|
|
||||||
);
|
|
||||||
await synthKeyAndTestSelectionChanged("KEY_ArrowLeft", null, "input", "");
|
|
||||||
await synthKeyAndTestSelectionChanged(
|
|
||||||
"KEY_ArrowRight",
|
|
||||||
{ shiftKey: true, altKey: true },
|
|
||||||
"input",
|
|
||||||
"hello"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче