зеркало из https://github.com/mozilla/gecko-dev.git
Bug 555728 - Fire a11y event based on HTML5 constraint validation. r=surkov,marcoz a=davidb
This commit is contained in:
Родитель
9cd1f7a88f
Коммит
4a22706dfd
|
@ -1243,12 +1243,17 @@ void nsDocAccessible::ContentStatesChanged(nsIDocument* aDocument,
|
|||
nsIContent* aContent2,
|
||||
nsEventStates aStateMask)
|
||||
{
|
||||
if (!aStateMask.HasState(NS_EVENT_STATE_CHECKED)) {
|
||||
return;
|
||||
if (aStateMask.HasState(NS_EVENT_STATE_CHECKED)) {
|
||||
nsHTMLSelectOptionAccessible::SelectionChangedIfOption(aContent1);
|
||||
nsHTMLSelectOptionAccessible::SelectionChangedIfOption(aContent2);
|
||||
}
|
||||
|
||||
nsHTMLSelectOptionAccessible::SelectionChangedIfOption(aContent1);
|
||||
nsHTMLSelectOptionAccessible::SelectionChangedIfOption(aContent2);
|
||||
if (aStateMask.HasState(NS_EVENT_STATE_INVALID)) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent1, nsIAccessibleStates::STATE_INVALID,
|
||||
PR_FALSE, PR_TRUE);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void nsDocAccessible::DocumentStatesChanged(nsIDocument* aDocument,
|
||||
|
|
|
@ -26,10 +26,6 @@
|
|||
{
|
||||
this.DOMNode = aDocNode;
|
||||
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_STATE_CHANGE, getAccessible(this.DOMNode))
|
||||
];
|
||||
|
||||
this.invoke = function editabledoc_invoke() {
|
||||
// Note: this should fire an EVENT_STATE_CHANGE
|
||||
this.DOMNode.designMode = 'on';
|
||||
|
@ -58,6 +54,24 @@
|
|||
};
|
||||
}
|
||||
|
||||
function invalidInput(aNodeOrID)
|
||||
{
|
||||
this.DOMNode = getNode(aNodeOrID);
|
||||
|
||||
this.invoke = function invalidInput_invoke() {
|
||||
// Note: this should fire an EVENT_STATE_CHANGE
|
||||
this.DOMNode.value = "I am too long";
|
||||
};
|
||||
|
||||
this.check = function invalidInput_check() {
|
||||
testStates(aNodeOrID, STATE_INVALID);
|
||||
};
|
||||
|
||||
this.getID = function invalidInput_getID() {
|
||||
return prettyName(aNodeOrID) + " became invalid";
|
||||
};
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Do tests
|
||||
|
||||
|
@ -67,12 +81,15 @@
|
|||
|
||||
function doTests()
|
||||
{
|
||||
gQueue = new eventQueue();
|
||||
gQueue = new eventQueue(nsIAccessibleEvent.EVENT_STATE_CHANGE);
|
||||
|
||||
// Test delayed editable state change
|
||||
var doc = document.getElementById("iframe").contentDocument;
|
||||
gQueue.push(new makeEditableDoc(doc));
|
||||
|
||||
// invalid state change
|
||||
gQueue.push(new invalidInput("maxlength"));
|
||||
|
||||
gQueue.invoke(); // Will call SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
@ -87,6 +104,11 @@
|
|||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=564471"
|
||||
title="Make state change events async">
|
||||
Mozilla Bug 564471
|
||||
</a><br>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=555728"
|
||||
title="Fire a11y event based on HTML5 constraint validation">
|
||||
Mozilla Bug 555728
|
||||
</a>
|
||||
|
||||
<p id="display"></p>
|
||||
|
@ -97,6 +119,9 @@
|
|||
<div id="testContainer">
|
||||
<iframe id="iframe"></iframe>
|
||||
</div>
|
||||
|
||||
<input id="maxlength" maxlength="1">
|
||||
|
||||
<div id="eventdump"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Загрузка…
Ссылка в новой задаче