bug 1213402 - separate value change events into text value changes and numeric value changes r=davidb

Arguably these are different things, and it will be easier to proxy events for
atk this way because atk only wants the numeric value changes.
This commit is contained in:
Trevor Saunders 2015-11-02 15:34:51 -05:00
parent 9e1abdb98c
commit 4871fe153a
20 changed files with 54 additions and 23 deletions

View File

@ -1245,6 +1245,7 @@ AccessibleWrap::HandleAccEvent(AccEvent* aEvent)
}
case nsIAccessibleEvent::EVENT_VALUE_CHANGE:
case nsIAccessibleEvent::EVENT_TEXT_VALUE_CHANGE:
if (accessible->HasNumericValue()) {
// Make sure this is a numeric value. Don't fire for string value changes
// (e.g. text editing) ATK values are always numeric.

View File

@ -385,6 +385,7 @@ static const char kEventTypeNames[][40] = {
"hypertext links count changed", // EVENT_HYPERTEXT_NLINKS_CHANGED
"object attribute changed", // EVENT_OBJECT_ATTRIBUTE_CHANGED
"virtual cursor changed" // EVENT_VIRTUALCURSOR_CHANGED
"text value change", // EVENT_TEXT_VALUE_CHANGE
};
#endif /* __nsIAccessibilityService_h__ */

View File

@ -124,7 +124,7 @@ DocAccessible::MaybeNotifyOfValueChange(Accessible* aAccessible)
{
a11y::role role = aAccessible->Role();
if (role == roles::ENTRY || role == roles::COMBOBOX)
FireDelayedEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible);
FireDelayedEvent(nsIAccessibleEvent::EVENT_TEXT_VALUE_CHANGE, aAccessible);
}
inline Accessible*

View File

@ -1039,13 +1039,18 @@ DocAccessible::ARIAAttributeChanged(Accessible* aAccessible, nsIAtom* aAttribute
return;
}
// Fire value change event whenever aria-valuetext is changed, or
// when aria-valuenow is changed and aria-valuetext is empty
if (aAttribute == nsGkAtoms::aria_valuetext ||
(aAttribute == nsGkAtoms::aria_valuenow &&
(!elm->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_valuetext) ||
elm->AttrValueIs(kNameSpaceID_None, nsGkAtoms::aria_valuetext,
nsGkAtoms::_empty, eCaseMatters)))) {
// Fire text value change event whenever aria-valuetext is changed.
if (aAttribute == nsGkAtoms::aria_valuetext) {
FireDelayedEvent(nsIAccessibleEvent::EVENT_TEXT_VALUE_CHANGE, aAccessible);
return;
}
// Fire numeric value change event when aria-valuenow is changed and
// aria-valuetext is empty
if (aAttribute == nsGkAtoms::aria_valuenow &&
(!elm->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_valuetext) ||
elm->AttrValueIs(kNameSpaceID_None, nsGkAtoms::aria_valuetext,
nsGkAtoms::_empty, eCaseMatters))) {
FireDelayedEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible);
return;
}

View File

@ -452,8 +452,10 @@ RootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
}
else if (accessible->NeedsDOMUIEvent() &&
eventType.EqualsLiteral("ValueChange")) {
targetDocument->FireDelayedEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
accessible);
uint32_t event = accessible->HasNumericValue()
? nsIAccessibleEvent::EVENT_VALUE_CHANGE
: nsIAccessibleEvent::EVENT_TEXT_VALUE_CHANGE;
targetDocument->FireDelayedEvent(event, accessible);
}
#ifdef DEBUG_DRAGDROPSTART
else if (eventType.EqualsLiteral("mouseover")) {

View File

@ -8,7 +8,7 @@
/**
* Fired when the caret changes position in text.
*/
[scriptable, builtinclass, uuid(5675c486-a230-4d85-a4bd-33670826d5ff)]
[scriptable, builtinclass, uuid(ed1982e4-57d7-41a8-8cd8-9023f809383e)]
interface nsIAccessibleCaretMoveEvent: nsIAccessibleEvent
{
/**

View File

@ -25,7 +25,7 @@ interface nsIDOMNode;
* if (NS_SUCCEEDED(rv))
* rv = observerService->AddObserver(this, "accessible-event", PR_TRUE);
*/
[scriptable, builtinclass, uuid(7f66a33a-9ed7-4fd4-87a8-e431b0f43368)]
[scriptable, builtinclass, uuid(20c69a40-6c2c-42a3-a578-6f4473aab9dd)]
interface nsIAccessibleEvent : nsISupports
{
/**
@ -75,7 +75,7 @@ interface nsIAccessibleEvent : nsISupports
const unsigned long EVENT_DESCRIPTION_CHANGE = 0x0009;
/**
* An object's Value property has changed.
* An object's numeric Value has changed.
*/
const unsigned long EVENT_VALUE_CHANGE = 0x000A;
@ -412,10 +412,15 @@ interface nsIAccessibleEvent : nsISupports
*/
const unsigned long EVENT_VIRTUALCURSOR_CHANGED = 0x0056;
/**
* An object's text Value has changed.
*/
const unsigned long EVENT_TEXT_VALUE_CHANGE = 0x0057;
/**
* Help make sure event map does not get out-of-line.
*/
const unsigned long EVENT_LAST_ENTRY = 0x0057;
const unsigned long EVENT_LAST_ENTRY = 0x0058;
/**
* The type of event, based on the enumerated event values

View File

@ -8,7 +8,7 @@
/**
* Fired when a accessible and its subtree are removed from the tree.
*/
[scriptable, builtinclass, uuid(a2bd2eca-3afa-489b-afb2-f93ef32ad99c)]
[scriptable, builtinclass, uuid(2051709a-4e0d-4be5-873d-b49d1dee35fa)]
interface nsIAccessibleHideEvent: nsIAccessibleEvent
{
/**

View File

@ -11,7 +11,7 @@ interface nsIAtom;
/**
* Fired when an attribute of an accessible changes.
*/
[scriptable, builtinclass, uuid(4CA96609-23C8-4771-86E7-77C8B651CA24)]
[scriptable, builtinclass, uuid(ce41add2-096e-4606-b1ca-7408c6d5b4c3)]
interface nsIAccessibleObjectAttributeChangedEvent : nsIAccessibleEvent
{
/**

View File

@ -8,7 +8,7 @@
/**
* Fired when a state of an accessible changes.
*/
[scriptable, builtinclass, uuid(0d2d77c5-7b16-4a15-8b20-c484ceb5ac0d)]
[scriptable, builtinclass, uuid(58b74954-1835-46ed-9ccd-c906490106f6)]
interface nsIAccessibleStateChangeEvent : nsIAccessibleEvent
{
/**

View File

@ -5,7 +5,7 @@
#include "nsIAccessibleEvent.idl"
[scriptable, builtinclass, uuid(df517997-ed52-4ea2-b310-2f8e0fe64572)]
[scriptable, builtinclass, uuid(9fb3a8a4-d254-43d3-80a5-20e171d52b21)]
interface nsIAccessibleTableChangeEvent: nsIAccessibleEvent
{
/**

View File

@ -8,7 +8,7 @@
/**
* Fired when an accessible's text changes.
*/
[scriptable, builtinclass, uuid(21e0f8bd-5638-4964-870b-3c8e944ac4c4)]
[scriptable, builtinclass, uuid(1fcc0dfa-93e6-48f4-bbd4-f80eb1d9f2e6)]
interface nsIAccessibleTextChangeEvent : nsIAccessibleEvent
{
/**

View File

@ -9,7 +9,7 @@
* An interface for virtual cursor changed events.
* Passes previous cursor position and text offsets.
*/
[scriptable, builtinclass, uuid(370e8b9b-2bbc-4bff-a9c7-16ddc54aea21)]
[scriptable, builtinclass, uuid(a58693b1-009e-4cc9-ae93-9c7d8f85cfdf)]
interface nsIAccessibleVirtualCursorChangeEvent : nsIAccessibleEvent
{
/**

View File

@ -302,6 +302,7 @@ this.EventManager.prototype = {
break;
}
case Events.VALUE_CHANGE:
case Events.TEXT_VALUE_CHANGE:
{
let position = this.contentControl.vc.position;
let target = aEvent.accessible;

View File

@ -114,6 +114,7 @@ AccessibleWrap::HandleAccEvent(AccEvent* aEvent)
// and document load complete events for now.
if (eventType != nsIAccessibleEvent::EVENT_FOCUS &&
eventType != nsIAccessibleEvent::EVENT_VALUE_CHANGE &&
eventType != nsIAccessibleEvent::EVENT_TEXT_VALUE_CHANGE &&
eventType != nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED &&
eventType != nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED &&
eventType != nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE)
@ -248,6 +249,7 @@ a11y::FireNativeEvent(mozAccessible* aNativeAcc, uint32_t aEventType)
[aNativeAcc didReceiveFocus];
break;
case nsIAccessibleEvent::EVENT_VALUE_CHANGE:
case nsIAccessibleEvent::EVENT_TEXT_VALUE_CHANGE:
[aNativeAcc valueDidChange];
break;
case nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED:

View File

@ -72,6 +72,7 @@ ProxyEvent(ProxyAccessible* aProxy, uint32_t aEventType)
// events for now.
if (aEventType != nsIAccessibleEvent::EVENT_FOCUS &&
aEventType != nsIAccessibleEvent::EVENT_VALUE_CHANGE &&
aEventType != nsIAccessibleEvent::EVENT_TEXT_VALUE_CHANGE &&
aEventType != nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED &&
aEventType != nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED)
return;

View File

@ -28,6 +28,7 @@ const EVENT_TEXT_INSERTED = nsIAccessibleEvent.EVENT_TEXT_INSERTED;
const EVENT_TEXT_REMOVED = nsIAccessibleEvent.EVENT_TEXT_REMOVED;
const EVENT_TEXT_SELECTION_CHANGED = nsIAccessibleEvent.EVENT_TEXT_SELECTION_CHANGED;
const EVENT_VALUE_CHANGE = nsIAccessibleEvent.EVENT_VALUE_CHANGE;
const EVENT_TEXT_VALUE_CHANGE = nsIAccessibleEvent.EVENT_TEXT_VALUE_CHANGE;
const EVENT_VIRTUALCURSOR_CHANGED = nsIAccessibleEvent.EVENT_VIRTUALCURSOR_CHANGED;
const kNotFromUserInput = 0;

View File

@ -180,7 +180,8 @@
{
this.__proto__ = new textRemoveInvoker(aID, aStart, aEnd, aText);
this.eventSeq.push(new invokerChecker(EVENT_VALUE_CHANGE, this.DOMNode));
this.eventSeq.push(new invokerChecker(EVENT_TEXT_VALUE_CHANGE,
this.DOMNode));
this.invoke = function removeTextFromInput_invoke()
{
@ -207,7 +208,8 @@
{
this.__proto__ = new textInsertInvoker(aID, aStart, aEnd, aText);
this.eventSeq.push(new invokerChecker(EVENT_VALUE_CHANGE, this.DOMNode));
this.eventSeq.push(new invokerChecker(EVENT_TEXT_VALUE_CHANGE,
this.DOMNode));
this.invoke = function insertTextIntoInput_invoke()
{

View File

@ -31,6 +31,10 @@
function changeARIAValue(aNodeOrID, aValuenow, aValuetext)
{
this.DOMNode = getNode(aNodeOrID);
this.eventSeq = [ new invokerChecker(aValuetext ?
EVENT_TEXT_VALUE_CHANGE :
EVENT_VALUE_CHANGE, this.DOMNode)
];
this.invoke = function changeARIAValue_invoke() {
@ -63,6 +67,9 @@
function changeValue(aID, aValue)
{
this.DOMNode = getNode(aID);
this.eventSeq = [new invokerChecker(EVENT_TEXT_VALUE_CHANGE,
this.DOMNode)
];
this.invoke = function changeValue_invoke()
{
@ -84,6 +91,7 @@
function changeProgressValue(aID, aValue)
{
this.DOMNode = getNode(aID);
this.eventSeq = [new invokerChecker(EVENT_VALUE_CHANGE, this.DOMNode)];
this.invoke = function changeProgressValue_invoke()
{
@ -105,6 +113,7 @@
function changeRangeValue(aID)
{
this.DOMNode = getNode(aID);
this.eventSeq = [new invokerChecker(EVENT_VALUE_CHANGE, this.DOMNode)];
this.invoke = function changeRangeValue_invoke()
{
@ -134,7 +143,7 @@
testValue("range", "6", 6, 0, 10, 1);
// Test value change events
gQueue = new eventQueue(nsIAccessibleEvent.EVENT_VALUE_CHANGE);
gQueue = new eventQueue();
gQueue.push(new changeARIAValue("slider_vn", "6", undefined));
gQueue.push(new changeARIAValue("slider_vt", undefined, "hey!"));

View File

@ -98,5 +98,6 @@ static const uint32_t gWinEventMap[] = {
IA2_EVENT_HYPERTEXT_NLINKS_CHANGED, // nsIAccessibleEvent::EVENT_HYPERTEXT_NLINKS_CHANGED
IA2_EVENT_OBJECT_ATTRIBUTE_CHANGED, // nsIAccessibleEvent::EVENT_OBJECT_ATTRIBUTE_CHANGED
kEVENT_WIN_UNKNOWN // nsIAccessibleEvent::EVENT_VIRTUALCURSOR_CHANGED
EVENT_OBJECT_VALUECHANGE, // nsIAccessibleEvent::EVENT_TEXT_VALUE_CHANGE
};