Bug 349860. Magnifier doesn't follow input or caret navigation. r=evan.yan

This commit is contained in:
aaronleventhal%moonset.net 2006-09-18 17:50:33 +00:00
parent 65db450837
commit 66c8957aa5
2 changed files with 38 additions and 0 deletions

View File

@ -311,6 +311,43 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible::Shutdown()
return nsHyperTextAccessible::Shutdown();
}
void nsHTMLTextFieldAccessible::CacheChildren()
{
if (!mWeakShell) {
// This node has been shut down
mAccChildCount = eChildCountUninitialized;
return;
}
if (mAccChildCount == eChildCountUninitialized) {
nsCOMPtr<nsIEditor> editor = GetEditor();
if (!editor) {
nsAccessible::CacheChildren();
return;
}
nsCOMPtr<nsIDOMElement> editorRoot;
editor->GetRootElement(getter_AddRefs(editorRoot));
nsCOMPtr<nsIDOMNode> editorRootDOMNode = do_QueryInterface(editorRoot);
if (!editorRootDOMNode) {
return;
}
nsAccessibleTreeWalker walker(mWeakShell, editorRootDOMNode, PR_TRUE);
nsCOMPtr<nsPIAccessible> privatePrevAccessible;
PRInt32 childCount = 0;
walker.GetFirstChild();
SetFirstChild(walker.mState.accessible);
while (walker.mState.accessible) {
++ childCount;
privatePrevAccessible = do_QueryInterface(walker.mState.accessible);
privatePrevAccessible->SetParent(this);
walker.GetNextSibling();
privatePrevAccessible->SetNextSibling(walker.mState.accessible);
}
mAccChildCount = childCount;
}
}
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetRole(PRUint32 *aRole)
{
*aRole = ROLE_ENTRY;

View File

@ -110,6 +110,7 @@ public:
NS_IMETHOD GetActionName(PRUint8 index, nsAString& _retval);
NS_IMETHOD DoAction(PRUint8 index);
NS_IMETHOD GetExtState(PRUint32 *aExtState);
void CacheChildren();
protected:
// Editor helpers, subclasses of nsHyperTextAccessible may have editor