Bug 544600 - Accessibility should check for the bogus br node used by the editor directly; r=davidb

This commit is contained in:
Ehsan Akhgari 2010-02-08 16:02:18 -05:00
parent 00e5ae8a6f
commit 96a1565ef9
2 changed files with 10 additions and 10 deletions

View File

@ -262,6 +262,8 @@ ACCESSIBILITY_ATOM(aria_valuetext, "aria-valuetext")
// a form property used to obtain the default label
// of an HTML button from the button frame
ACCESSIBILITY_ATOM(defaultLabel, "defaultLabel")
// the attribute specifying the editor's bogus br node
ACCESSIBILITY_ATOM(mozeditorbogusnode, "_moz_editor_bogus_node")
// Object attributes
ACCESSIBILITY_ATOM(tableCellIndex, "table-cell-index")

View File

@ -586,16 +586,14 @@ nsresult nsHyperTextAccessible::DOMPointToHypertextOffset(nsIDOMNode* aNode, PRI
if (findNode) {
nsCOMPtr<nsIContent> findContent = do_QueryInterface(findNode);
if (findContent->IsHTML() &&
findContent->NodeInfo()->Equals(nsAccessibilityAtoms::br)) {
nsIContent *parent = findContent->GetParent();
if (parent &&
parent->IsRootOfNativeAnonymousSubtree() &&
parent->GetChildCount() == 1) {
// This <br> is the only node in a text control, therefore it is the hacky
// "bogus node" used when there is no text in a control
*aHyperTextOffset = 0;
return NS_OK;
}
findContent->NodeInfo()->Equals(nsAccessibilityAtoms::br) &&
findContent->AttrValueIs(kNameSpaceID_None,
nsAccessibilityAtoms::mozeditorbogusnode,
nsAccessibilityAtoms::_true,
eIgnoreCase)) {
// This <br> is the hacky "bogus node" used when there is no text in a control
*aHyperTextOffset = 0;
return NS_OK;
}
descendantAccessible = GetFirstAvailableAccessible(findNode);
}