mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 634240 - No caret move events are fired for XUL textbox accessible, r=davidb, f=marcoz, a=final+
This commit is contained in:
parent
b7209c3c54
commit
854b0d9536
@ -517,6 +517,9 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
nsINode* targetNode = accessible->GetNode();
|
||||
nsIContent* targetContent = targetNode->IsElement() ?
|
||||
targetNode->AsElement() : nsnull;
|
||||
nsIContent* origTargetContent = origTargetNode->IsElement() ?
|
||||
origTargetNode->AsElement() : nsnull;
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
PRBool isTree = targetContent ?
|
||||
targetContent->NodeInfo()->Equals(nsAccessibilityAtoms::tree,
|
||||
@ -562,7 +565,7 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
nsEventShell::FireEvent(accEvent);
|
||||
|
||||
if (isEnabled)
|
||||
FireAccessibleFocusEvent(accessible, targetContent);
|
||||
FireAccessibleFocusEvent(accessible, origTargetContent);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -666,7 +669,7 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
FireAccessibleFocusEvent(accessible, targetContent);
|
||||
FireAccessibleFocusEvent(accessible, origTargetContent);
|
||||
}
|
||||
else if (eventType.EqualsLiteral("blur")) {
|
||||
NS_IF_RELEASE(gLastFocusedNode);
|
||||
@ -740,7 +743,7 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
}
|
||||
if (fireFocus) {
|
||||
// Always asynch, always from user input.
|
||||
FireAccessibleFocusEvent(accessible, targetContent, PR_TRUE,
|
||||
FireAccessibleFocusEvent(accessible, origTargetContent, PR_TRUE,
|
||||
eFromUserInput);
|
||||
}
|
||||
}
|
||||
|
@ -870,10 +870,13 @@ function synthSelectAll(aNodeOrID, aCheckerOrEventSeq, aEventType)
|
||||
|
||||
this.invoke = function synthSelectAll_invoke()
|
||||
{
|
||||
if (this.DOMNode instanceof Components.interfaces.nsIDOMHTMLInputElement)
|
||||
if (this.DOMNode instanceof Components.interfaces.nsIDOMHTMLInputElement ||
|
||||
this.DOMNode instanceof Components.interfaces.nsIDOMXULTextBoxElement) {
|
||||
this.DOMNode.select();
|
||||
else
|
||||
|
||||
} else {
|
||||
window.getSelection().selectAllChildren(this.DOMNode);
|
||||
}
|
||||
}
|
||||
|
||||
this.getID = function synthSelectAll_getID()
|
||||
@ -951,6 +954,19 @@ function textChangeChecker(aID, aStart, aEnd, aTextOrFunc, aIsInserted)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Caret move events checker.
|
||||
*/
|
||||
function caretMoveChecker(aCaretOffset)
|
||||
{
|
||||
this.check = function caretMoveChecker_check(aEvent)
|
||||
{
|
||||
is(aEvent.QueryInterface(nsIAccessibleCaretMoveEvent).caretOffset,
|
||||
aCaretOffset,
|
||||
"Wrong caret offset for " + prettyName(aEvent.accessible));
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Private implementation details.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -56,6 +56,7 @@ _TEST_FILES =\
|
||||
test_aria_statechange.html \
|
||||
test_attrs.html \
|
||||
test_caretmove.html \
|
||||
test_caretmove.xul \
|
||||
test_coalescence.html \
|
||||
test_contextmenu.html \
|
||||
test_docload.html \
|
||||
|
@ -19,25 +19,12 @@
|
||||
src="../events.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
/**
|
||||
* Generic checker.
|
||||
*/
|
||||
function checker(aCaretOffset)
|
||||
{
|
||||
this.check = function checker_check(aEvent)
|
||||
{
|
||||
is(aEvent.QueryInterface(nsIAccessibleCaretMoveEvent).caretOffset,
|
||||
aCaretOffset,
|
||||
"Wrong caret offset for " + prettyName(aEvent.accessible));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Click checker.
|
||||
*/
|
||||
function clickChecker(aCaretOffset, aExtraNodeOrID, aExtraCaretOffset)
|
||||
{
|
||||
this.__proto__ = new checker(aCaretOffset);
|
||||
this.__proto__ = new caretMoveChecker(aCaretOffset);
|
||||
|
||||
this.extraNode = getNode(aExtraNodeOrID);
|
||||
|
||||
@ -59,6 +46,7 @@
|
||||
var gQueue = null;
|
||||
|
||||
// gA11yEventDumpID = "eventdump"; // debug stuff
|
||||
//gA11yEventDumpToConsole = true;
|
||||
|
||||
function testCaretOffset(aAccOrElmOrID, aCaretOffset)
|
||||
{
|
||||
@ -79,27 +67,27 @@
|
||||
gQueue = new eventQueue(EVENT_TEXT_CARET_MOVED);
|
||||
|
||||
var id = "textbox";
|
||||
gQueue.push(new synthFocus(id, new checker(5)));
|
||||
gQueue.push(new synthSelectAll(id, new checker(5)));
|
||||
gQueue.push(new synthClick(id, new checker(0)));
|
||||
gQueue.push(new synthRightKey(id, new checker(1)));
|
||||
gQueue.push(new synthFocus(id, new caretMoveChecker(5)));
|
||||
gQueue.push(new synthSelectAll(id, new caretMoveChecker(5)));
|
||||
gQueue.push(new synthClick(id, new caretMoveChecker(0)));
|
||||
gQueue.push(new synthRightKey(id, new caretMoveChecker(1)));
|
||||
|
||||
id = "textarea";
|
||||
gQueue.push(new synthClick(id, new checker(0)));
|
||||
gQueue.push(new synthRightKey(id, new checker(1)));
|
||||
gQueue.push(new synthDownKey(id, new checker(12)));
|
||||
gQueue.push(new synthClick(id, new caretMoveChecker(0)));
|
||||
gQueue.push(new synthRightKey(id, new caretMoveChecker(1)));
|
||||
gQueue.push(new synthDownKey(id, new caretMoveChecker(12)));
|
||||
|
||||
id = "p";
|
||||
gQueue.push(new synthClick(id, new checker(0)));
|
||||
gQueue.push(new synthRightKey(id, new checker(1)));
|
||||
gQueue.push(new synthDownKey(id, new checker(6)));
|
||||
gQueue.push(new synthClick(id, new caretMoveChecker(0)));
|
||||
gQueue.push(new synthRightKey(id, new caretMoveChecker(1)));
|
||||
gQueue.push(new synthDownKey(id, new caretMoveChecker(6)));
|
||||
|
||||
gQueue.push(new synthClick("p1_in_div",
|
||||
new clickChecker(0, "p2_in_div", -1)));
|
||||
|
||||
gQueue.push(new synthShiftTab("p", new checker(0)));
|
||||
gQueue.push(new synthShiftTab("textarea", new checker(12)));
|
||||
gQueue.push(new synthTab("p", new checker(0)));
|
||||
gQueue.push(new synthShiftTab("p", new caretMoveChecker(0)));
|
||||
gQueue.push(new synthShiftTab("textarea", new caretMoveChecker(12)));
|
||||
gQueue.push(new synthTab("p", new caretMoveChecker(0)));
|
||||
|
||||
gQueue.invoke(); // Will call SimpleTest.finish();
|
||||
}
|
||||
|
67
accessible/tests/mochitest/events/test_caretmove.xul
Normal file
67
accessible/tests/mochitest/events/test_caretmove.xul
Normal file
@ -0,0 +1,67 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
||||
type="text/css"?>
|
||||
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="Caret move event testing">
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js" />
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="../common.js" />
|
||||
<script type="application/javascript"
|
||||
src="../events.js" />
|
||||
|
||||
<script type="application/javascript">
|
||||
/**
|
||||
* Do tests.
|
||||
*/
|
||||
|
||||
//gA11yEventDumpID = "eventdump"; // debug stuff
|
||||
gA11yEventDumpToConsole = true;
|
||||
|
||||
var gQueue = null;
|
||||
|
||||
function doTests()
|
||||
{
|
||||
gQueue = new eventQueue(EVENT_TEXT_CARET_MOVED);
|
||||
|
||||
var id = "textbox";
|
||||
gQueue.push(new synthFocus(id, new caretMoveChecker(5)));
|
||||
gQueue.push(new synthSelectAll(id, new caretMoveChecker(5)));
|
||||
gQueue.push(new synthHomeKey(id, new caretMoveChecker(0)));
|
||||
gQueue.push(new synthRightKey(id, new caretMoveChecker(1)));
|
||||
|
||||
gQueue.invoke(); // Will call SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTests);
|
||||
</script>
|
||||
|
||||
<hbox flex="1" style="overflow: auto;">
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=634240"
|
||||
title="No caret move events are fired for XUL textbox accessible">
|
||||
Mozilla Bug 634240
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
|
||||
<vbox flex="1">
|
||||
<textbox id="textbox" value="hello"/>
|
||||
|
||||
<vbox id="eventdump"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
</window>
|
Loading…
Reference in New Issue
Block a user