diff --git a/accessible/src/base/nsRootAccessible.cpp b/accessible/src/base/nsRootAccessible.cpp
index be728770ccc..f74fcb007af 100644
--- a/accessible/src/base/nsRootAccessible.cpp
+++ b/accessible/src/base/nsRootAccessible.cpp
@@ -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);
}
}
diff --git a/accessible/tests/mochitest/events.js b/accessible/tests/mochitest/events.js
index 527772a0ddd..12020c811ae 100644
--- a/accessible/tests/mochitest/events.js
+++ b/accessible/tests/mochitest/events.js
@@ -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.
////////////////////////////////////////////////////////////////////////////////
diff --git a/accessible/tests/mochitest/events/Makefile.in b/accessible/tests/mochitest/events/Makefile.in
index a4c7ab4d66f..8fc99edcd6b 100644
--- a/accessible/tests/mochitest/events/Makefile.in
+++ b/accessible/tests/mochitest/events/Makefile.in
@@ -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 \
diff --git a/accessible/tests/mochitest/events/test_caretmove.html b/accessible/tests/mochitest/events/test_caretmove.html
index 7a3bcf1d042..106f73992c1 100644
--- a/accessible/tests/mochitest/events/test_caretmove.html
+++ b/accessible/tests/mochitest/events/test_caretmove.html
@@ -19,25 +19,12 @@
src="../events.js">
+
+
+
+
+ Mozilla Bug 634240
+
+
+
+
+
+
+
+
+
+
+
+
+
+