Bug 357032. XUL textfields not exposing nsIAccessibleText correctly. r=ginn.chen

This commit is contained in:
aaronleventhal%moonset.net 2006-11-02 14:25:29 +00:00
Родитель 0a71174b7a
Коммит 5e99b76b37
4 изменённых файлов: 38 добавлений и 38 удалений

Просмотреть файл

@ -303,43 +303,6 @@ 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;

Просмотреть файл

@ -113,7 +113,6 @@ 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

Просмотреть файл

@ -196,6 +196,43 @@ NS_IMETHODIMP nsHyperTextAccessible::GetExtState(PRUint32 *aExtState)
return rv;
}
void nsHyperTextAccessible::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;
}
}
// Substring must be entirely within the same text node
nsIntRect nsHyperTextAccessible::GetBoundsForString(nsIFrame *aFrame, PRInt32 aStartOffset, PRInt32 aLength)
{

Просмотреть файл

@ -77,6 +77,7 @@ public:
NS_IMETHOD GetRole(PRUint32 *aRole);
NS_IMETHOD GetExtState(PRUint32 *aState);
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
void CacheChildren();
protected:
PRBool IsHyperText();