зеркало из https://github.com/mozilla/gecko-dev.git
backout bug 342045
This commit is contained in:
Родитель
9dcab1cde9
Коммит
4d4bdb7fa1
|
@ -647,7 +647,8 @@ nsApplicationAccessibleWrap::AddRootAccessible(nsIAccessible *aRootAccWrap)
|
|||
AtkObject *atkAccessible = nsAccessibleWrap::GetAtkObject(aRootAccWrap);
|
||||
atk_object_set_parent(atkAccessible, mAtkObject);
|
||||
|
||||
PRUint32 count = mChildren.Count();
|
||||
PRUint32 count = 0;
|
||||
mChildren->GetLength(&count);
|
||||
g_signal_emit_by_name(mAtkObject, "children_changed::add", count - 1,
|
||||
atkAccessible, NULL);
|
||||
|
||||
|
@ -669,27 +670,36 @@ nsApplicationAccessibleWrap::RemoveRootAccessible(nsIAccessible *aRootAccWrap)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aRootAccWrap);
|
||||
|
||||
PRInt32 index = mChildren.IndexOf(aRootAccWrap);
|
||||
PRUint32 index = 0;
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
// we must use weak ref to get the index
|
||||
nsCOMPtr<nsIWeakReference> weakPtr = do_GetWeakReference(aRootAccWrap);
|
||||
rv = mChildren->IndexOf(0, weakPtr, &index);
|
||||
|
||||
AtkObject *atkAccessible = nsAccessibleWrap::GetAtkObject(aRootAccWrap);
|
||||
atk_object_set_parent(atkAccessible, NULL);
|
||||
g_signal_emit_by_name(mAtkObject, "children_changed::remove", index,
|
||||
atkAccessible, NULL);
|
||||
|
||||
nsresult rv = nsApplicationAccessible::RemoveRootAccessible(aRootAccWrap);
|
||||
|
||||
#ifdef MAI_LOGGING
|
||||
PRUint32 count = mChildren.Count();
|
||||
PRUint32 count = 0;
|
||||
mChildren->GetLength(&count);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = mChildren->RemoveElementAt(index);
|
||||
MAI_LOG_DEBUG(("\nRemove RootAcc=%p, count=%d\n",
|
||||
(void*)aRootAccWrap, (count-1)));
|
||||
}
|
||||
else
|
||||
MAI_LOG_DEBUG(("\nFail to Remove RootAcc=%p, count=%d\n",
|
||||
(void*)aRootAccWrap, count));
|
||||
#endif
|
||||
#else
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = mChildren->RemoveElementAt(index);
|
||||
|
||||
#endif
|
||||
InvalidateChildren();
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -149,12 +149,14 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(nsAccessible)
|
|||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsAccessible, nsAccessNode)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mParent)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMARRAY(mChildren)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mFirstChild)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mNextSibling)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsAccessible, nsAccessNode)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mParent)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMARRAY(mChildren)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mFirstChild)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mNextSibling)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsAccessible, nsAccessNode)
|
||||
|
@ -227,8 +229,8 @@ nsresult nsAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
}
|
||||
|
||||
nsAccessible::nsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell): nsAccessNodeWrap(aNode, aShell),
|
||||
mParent(nsnull), mRoleMapEntry(nsnull),
|
||||
mAreChildrenInitialized(PR_FALSE)
|
||||
mParent(nsnull), mFirstChild(nsnull), mNextSibling(nsnull), mRoleMapEntry(nsnull),
|
||||
mAccChildCount(eChildCountUninitialized)
|
||||
{
|
||||
#ifdef NS_DEBUG_X
|
||||
{
|
||||
|
@ -480,9 +482,39 @@ nsAccessible::GetKeyboardShortcut(nsAString& aAccessKey)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsAccessible::SetParent(nsIAccessible *aParent)
|
||||
{
|
||||
if (mParent != aParent) {
|
||||
// Adopt a child -- we allow this now. the new parent
|
||||
// may be a dom node which wasn't previously accessible but now is.
|
||||
// The old parent's children now need to be invalidated, since
|
||||
// it no longer owns the child, the new parent does
|
||||
nsRefPtr<nsAccessible> oldParent = nsAccUtils::QueryAccessible(mParent);
|
||||
if (oldParent)
|
||||
oldParent->InvalidateChildren();
|
||||
}
|
||||
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
void
|
||||
nsAccessible::SetFirstChild(nsIAccessible *aFirstChild)
|
||||
{
|
||||
mFirstChild = aFirstChild;
|
||||
}
|
||||
|
||||
void
|
||||
nsAccessible::SetNextSibling(nsIAccessible *aNextSibling)
|
||||
{
|
||||
mNextSibling = aNextSibling;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAccessible::Shutdown()
|
||||
{
|
||||
mNextSibling = nsnull;
|
||||
|
||||
// Invalidate the child count and pointers to other accessibles, also make
|
||||
// sure none of its children point to this parent
|
||||
InvalidateChildren();
|
||||
|
@ -495,110 +527,196 @@ nsAccessible::Shutdown()
|
|||
return nsAccessNodeWrap::Shutdown();
|
||||
}
|
||||
|
||||
void
|
||||
nsAccessible::InvalidateChildren()
|
||||
{
|
||||
// Document has transformed, reset our invalid children and child count
|
||||
|
||||
// Reset the sibling pointers, they will be set up again the next time
|
||||
// CacheChildren() is called.
|
||||
// Note: we don't want to start creating accessibles at this point,
|
||||
// so don't use GetNextSibling() here. (bug 387252)
|
||||
nsRefPtr<nsAccessible> child = nsAccUtils::QueryAccessible(mFirstChild);
|
||||
while (child) {
|
||||
child->mParent = nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessible> next = child->mNextSibling;
|
||||
child->mNextSibling = nsnull;
|
||||
child = nsAccUtils::QueryAccessible(next);
|
||||
}
|
||||
|
||||
mAccChildCount = eChildCountUninitialized;
|
||||
mFirstChild = nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessible::GetParent(nsIAccessible **aParent)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aParent);
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
NS_IF_ADDREF(*aParent = GetParent());
|
||||
return *aParent ? NS_OK : NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIAccessible> cachedParent = GetCachedParent();
|
||||
if (cachedParent) {
|
||||
cachedParent.swap(*aParent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAccessibleDocument> docAccessible(GetDocAccessible());
|
||||
NS_ENSURE_TRUE(docAccessible, NS_ERROR_FAILURE);
|
||||
|
||||
return docAccessible->GetAccessibleInParentChain(mDOMNode, PR_TRUE, aParent);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIAccessible>
|
||||
nsAccessible::GetCachedParent()
|
||||
{
|
||||
if (IsDefunct())
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessible> cachedParent = mParent;
|
||||
return cachedParent.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIAccessible>
|
||||
nsAccessible::GetCachedFirstChild()
|
||||
{
|
||||
if (IsDefunct())
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessible> cachedFirstChild = mFirstChild;
|
||||
return cachedFirstChild.forget();
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible nextSibling; */
|
||||
NS_IMETHODIMP
|
||||
nsAccessible::GetNextSibling(nsIAccessible **aNextSibling)
|
||||
NS_IMETHODIMP nsAccessible::GetNextSibling(nsIAccessible * *aNextSibling)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aNextSibling);
|
||||
*aNextSibling = nsnull;
|
||||
if (!mWeakShell) {
|
||||
// This node has been shut down
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (!mParent) {
|
||||
nsCOMPtr<nsIAccessible> parent(GetParent());
|
||||
if (parent) {
|
||||
PRInt32 numChildren;
|
||||
parent->GetChildCount(&numChildren); // Make sure we cache all of the children
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
NS_IF_ADDREF(*aNextSibling = GetSiblingAtOffset(1, &rv));
|
||||
return rv;
|
||||
if (mNextSibling || !mParent) {
|
||||
// If no parent, don't try to calculate a new sibling
|
||||
// It either means we're at the root or shutting down the parent
|
||||
NS_IF_ADDREF(*aNextSibling = mNextSibling);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible previousSibling; */
|
||||
NS_IMETHODIMP
|
||||
nsAccessible::GetPreviousSibling(nsIAccessible * *aPreviousSibling)
|
||||
NS_IMETHODIMP nsAccessible::GetPreviousSibling(nsIAccessible * *aPreviousSibling)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPreviousSibling);
|
||||
*aPreviousSibling = nsnull;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
NS_IF_ADDREF(*aPreviousSibling = GetSiblingAtOffset(-1, &rv));
|
||||
return rv;
|
||||
if (!mWeakShell) {
|
||||
// This node has been shut down
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
if (NS_FAILED(GetParent(getter_AddRefs(parent))) || !parent) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAccessible> testAccessible, prevSibling;
|
||||
parent->GetFirstChild(getter_AddRefs(testAccessible));
|
||||
while (testAccessible && this != testAccessible) {
|
||||
prevSibling = testAccessible;
|
||||
prevSibling->GetNextSibling(getter_AddRefs(testAccessible));
|
||||
}
|
||||
|
||||
if (!prevSibling) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_ADDREF(*aPreviousSibling = prevSibling);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible firstChild; */
|
||||
NS_IMETHODIMP
|
||||
nsAccessible::GetFirstChild(nsIAccessible **aFirstChild)
|
||||
NS_IMETHODIMP nsAccessible::GetFirstChild(nsIAccessible * *aFirstChild)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aFirstChild);
|
||||
*aFirstChild = nsnull;
|
||||
|
||||
if (gIsCacheDisabled)
|
||||
if (gIsCacheDisabled) {
|
||||
InvalidateChildren();
|
||||
}
|
||||
PRInt32 numChildren;
|
||||
GetChildCount(&numChildren); // Make sure we cache all of the children
|
||||
|
||||
PRInt32 childCount = GetChildCount();
|
||||
NS_ENSURE_TRUE(childCount != -1, NS_ERROR_FAILURE);
|
||||
#ifdef DEBUG
|
||||
nsRefPtr<nsAccessible> firstChild(nsAccUtils::QueryAccessible(mFirstChild));
|
||||
if (firstChild) {
|
||||
nsCOMPtr<nsIAccessible> realParent = firstChild->GetCachedParent();
|
||||
NS_ASSERTION(!realParent || realParent == this,
|
||||
"Two accessibles have the same first child accessible.");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (childCount > 0)
|
||||
NS_ADDREF(*aFirstChild = GetChildAt(0));
|
||||
NS_IF_ADDREF(*aFirstChild = mFirstChild);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible lastChild; */
|
||||
NS_IMETHODIMP
|
||||
nsAccessible::GetLastChild(nsIAccessible **aLastChild)
|
||||
NS_IMETHODIMP nsAccessible::GetLastChild(nsIAccessible * *aLastChild)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aLastChild);
|
||||
*aLastChild = nsnull;
|
||||
|
||||
PRInt32 childCount = GetChildCount();
|
||||
NS_ENSURE_TRUE(childCount != -1, NS_ERROR_FAILURE);
|
||||
|
||||
NS_IF_ADDREF(*aLastChild = GetChildAt(childCount - 1));
|
||||
GetChildAt(-1, aLastChild);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessible::GetChildAt(PRInt32 aChildIndex, nsIAccessible **aChild)
|
||||
NS_IMETHODIMP nsAccessible::GetChildAt(PRInt32 aChildNum, nsIAccessible **aChild)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aChild);
|
||||
*aChild = nsnull;
|
||||
// aChildNum is a zero-based index
|
||||
|
||||
PRInt32 childCount = GetChildCount();
|
||||
NS_ENSURE_TRUE(childCount != -1, NS_ERROR_FAILURE);
|
||||
PRInt32 numChildren;
|
||||
GetChildCount(&numChildren);
|
||||
|
||||
// If child index is negative, then return last child.
|
||||
// XXX: do we really need this?
|
||||
if (aChildIndex < 0)
|
||||
aChildIndex = childCount - 1;
|
||||
// If no children or aChildNum is larger than numChildren, return null
|
||||
if (aChildNum >= numChildren || numChildren == 0 || !mWeakShell) {
|
||||
*aChild = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
// If aChildNum is less than zero, set aChild to last index
|
||||
} else if (aChildNum < 0) {
|
||||
aChildNum = numChildren - 1;
|
||||
}
|
||||
|
||||
nsIAccessible* child = GetChildAt(aChildIndex);
|
||||
if (!child)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
nsCOMPtr<nsIAccessible> current(mFirstChild), nextSibling;
|
||||
PRInt32 index = 0;
|
||||
|
||||
while (current) {
|
||||
nextSibling = current;
|
||||
if (++index > aChildNum) {
|
||||
break;
|
||||
}
|
||||
nextSibling->GetNextSibling(getter_AddRefs(current));
|
||||
}
|
||||
|
||||
NS_IF_ADDREF(*aChild = nextSibling);
|
||||
|
||||
NS_ADDREF(*aChild = child);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// readonly attribute nsIArray children;
|
||||
NS_IMETHODIMP
|
||||
nsAccessible::GetChildren(nsIArray **aOutChildren)
|
||||
NS_IMETHODIMP nsAccessible::GetChildren(nsIArray **aOutChildren)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aOutChildren);
|
||||
*aOutChildren = nsnull;
|
||||
nsCOMPtr<nsIMutableArray> children = do_CreateInstance(NS_ARRAY_CONTRACTID);
|
||||
if (!children)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRInt32 childCount = GetChildCount();
|
||||
NS_ENSURE_TRUE(childCount != -1, NS_ERROR_FAILURE);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIMutableArray> children =
|
||||
do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
|
||||
nsIAccessible* child = GetChildAt(childIdx);
|
||||
children->AppendElement(child, PR_FALSE);
|
||||
nsCOMPtr<nsIAccessible> curChild;
|
||||
while (NextChild(curChild)) {
|
||||
children->AppendElement(curChild, PR_FALSE);
|
||||
}
|
||||
|
||||
NS_ADDREF(*aOutChildren = children);
|
||||
|
@ -617,6 +735,39 @@ nsIAccessible *nsAccessible::NextChild(nsCOMPtr<nsIAccessible>& aAccessible)
|
|||
return (aAccessible = nextChild);
|
||||
}
|
||||
|
||||
void nsAccessible::CacheChildren()
|
||||
{
|
||||
if (!mWeakShell) {
|
||||
// This node has been shut down
|
||||
mAccChildCount = eChildCountUninitialized;
|
||||
return;
|
||||
}
|
||||
|
||||
if (mAccChildCount == eChildCountUninitialized) {
|
||||
mAccChildCount = 0;// Prevent reentry
|
||||
PRBool allowsAnonChildren = GetAllowsAnonChildAccessibles();
|
||||
nsAccessibleTreeWalker walker(mWeakShell, mDOMNode, allowsAnonChildren);
|
||||
// Seed the frame hint early while we're still on a container node.
|
||||
// This is better than doing the GetPrimaryFrameFor() later on
|
||||
// a text node, because text nodes aren't in the frame map.
|
||||
walker.mState.frame = GetFrame();
|
||||
|
||||
nsRefPtr<nsAccessible> prevAcc;
|
||||
PRInt32 childCount = 0;
|
||||
walker.GetFirstChild();
|
||||
SetFirstChild(walker.mState.accessible);
|
||||
|
||||
while (walker.mState.accessible) {
|
||||
++ childCount;
|
||||
prevAcc = nsAccUtils::QueryAccessible(walker.mState.accessible);
|
||||
prevAcc->SetParent(this);
|
||||
walker.GetNextSibling();
|
||||
prevAcc->SetNextSibling(walker.mState.accessible);
|
||||
}
|
||||
mAccChildCount = childCount;
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsAccessible::GetAllowsAnonChildAccessibles()
|
||||
{
|
||||
|
@ -624,23 +775,73 @@ nsAccessible::GetAllowsAnonChildAccessibles()
|
|||
}
|
||||
|
||||
/* readonly attribute long childCount; */
|
||||
NS_IMETHODIMP
|
||||
nsAccessible::GetChildCount(PRInt32 *aChildCount)
|
||||
NS_IMETHODIMP nsAccessible::GetChildCount(PRInt32 *aAccChildCount)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aChildCount);
|
||||
|
||||
*aChildCount = GetChildCount();
|
||||
return *aChildCount != -1 ? NS_OK : NS_ERROR_FAILURE;
|
||||
CacheChildren();
|
||||
*aAccChildCount = mAccChildCount;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute long indexInParent; */
|
||||
NS_IMETHODIMP
|
||||
nsAccessible::GetIndexInParent(PRInt32 *aIndexInParent)
|
||||
NS_IMETHODIMP nsAccessible::GetIndexInParent(PRInt32 *aIndexInParent)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIndexInParent);
|
||||
*aIndexInParent = -1;
|
||||
if (!mWeakShell) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
*aIndexInParent = GetIndexInParent();
|
||||
return *aIndexInParent != -1 ? NS_OK : NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
GetParent(getter_AddRefs(parent));
|
||||
if (!parent) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAccessible> sibling;
|
||||
parent->GetFirstChild(getter_AddRefs(sibling));
|
||||
if (!sibling) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
*aIndexInParent = 0;
|
||||
while (sibling != this) {
|
||||
NS_ASSERTION(sibling, "Never ran into the same child that we started from");
|
||||
|
||||
if (!sibling)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
++*aIndexInParent;
|
||||
nsCOMPtr<nsIAccessible> tempAccessible;
|
||||
sibling->GetNextSibling(getter_AddRefs(tempAccessible));
|
||||
sibling = tempAccessible;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsAccessible::TestChildCache(nsIAccessible *aCachedChild)
|
||||
{
|
||||
#ifdef DEBUG_A11Y
|
||||
// All cached accessible nodes should be in the parent
|
||||
// It will assert if not all the children were created
|
||||
// when they were first cached, and no invalidation
|
||||
// ever corrected parent accessible's child cache.
|
||||
if (mAccChildCount <= 0)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIAccessible> sibling = mFirstChild;
|
||||
|
||||
while (sibling != aCachedChild) {
|
||||
NS_ASSERTION(sibling, "[TestChildCache] Never ran into the same child that we started from");
|
||||
if (!sibling)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIAccessible> tempAccessible;
|
||||
sibling->GetNextSibling(getter_AddRefs(tempAccessible));
|
||||
sibling = tempAccessible;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult nsAccessible::GetTranslatedString(const nsAString& aKey, nsAString& aStringOut)
|
||||
|
@ -2912,247 +3113,8 @@ nsAccessible::GetNameInternal(nsAString& aName)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsAccessible::SetParent(nsIAccessible *aParent)
|
||||
{
|
||||
NS_PRECONDITION(aParent, "This method isn't used to set null parent!");
|
||||
|
||||
if (mParent && mParent != aParent) {
|
||||
// Adopt a child -- we allow this now. the new parent
|
||||
// may be a dom node which wasn't previously accessible but now is.
|
||||
// The old parent's children now need to be invalidated, since
|
||||
// it no longer owns the child, the new parent does
|
||||
NS_ASSERTION(PR_FALSE, "Adopting child!");
|
||||
nsRefPtr<nsAccessible> oldParent = nsAccUtils::QueryAccessible(mParent);
|
||||
if (oldParent)
|
||||
oldParent->InvalidateChildren();
|
||||
}
|
||||
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
void
|
||||
nsAccessible::InvalidateChildren()
|
||||
{
|
||||
PRInt32 childCount = mChildren.Count();
|
||||
for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
|
||||
nsRefPtr<nsAccessible> child =
|
||||
nsAccUtils::QueryObject<nsAccessible>(mChildren.ObjectAt(childIdx));
|
||||
child->mParent = nsnull;
|
||||
}
|
||||
|
||||
mChildren.Clear();
|
||||
mAreChildrenInitialized = PR_FALSE;
|
||||
}
|
||||
|
||||
nsIAccessible*
|
||||
nsAccessible::GetParent()
|
||||
{
|
||||
if (IsDefunct())
|
||||
return nsnull;
|
||||
|
||||
if (mParent)
|
||||
return mParent;
|
||||
|
||||
nsCOMPtr<nsIAccessibleDocument> docAccessible(GetDocAccessible());
|
||||
NS_ASSERTION(docAccessible, "No document accessible for valid accessible!");
|
||||
|
||||
if (!docAccessible)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
docAccessible->GetAccessibleInParentChain(mDOMNode, PR_TRUE,
|
||||
getter_AddRefs(parent));
|
||||
|
||||
#ifdef DEBUG
|
||||
nsRefPtr<nsAccessible> parentAcc = nsAccUtils::QueryAccessible(parent);
|
||||
NS_ASSERTION(!parentAcc->IsDefunct(), "Defunct parent!");
|
||||
|
||||
parentAcc->EnsureChildren();
|
||||
if (parent != mParent)
|
||||
NS_WARNING("Bad accessible tree!");
|
||||
#endif
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
nsIAccessible*
|
||||
nsAccessible::GetChildAt(PRUint32 aIndex)
|
||||
{
|
||||
if (EnsureChildren())
|
||||
return nsnull;
|
||||
|
||||
nsIAccessible *child = mChildren.SafeObjectAt(aIndex);
|
||||
if (!child)
|
||||
return nsnull;
|
||||
|
||||
#ifdef DEBUG
|
||||
nsRefPtr<nsAccessible> childAcc = nsAccUtils::QueryAccessible(child);
|
||||
nsCOMPtr<nsIAccessible> realParent = childAcc->mParent;
|
||||
NS_ASSERTION(!realParent || realParent == this,
|
||||
"Two accessibles have the same first child accessible!");
|
||||
#endif
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsAccessible::GetChildCount()
|
||||
{
|
||||
return EnsureChildren() ? -1 : mChildren.Count();
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsAccessible::GetIndexOf(nsIAccessible *aChild)
|
||||
{
|
||||
return EnsureChildren() ? -1 : mChildren.IndexOf(aChild);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsAccessible::GetIndexInParent()
|
||||
{
|
||||
nsIAccessible *parent = GetParent();
|
||||
if (!parent)
|
||||
return -1;
|
||||
|
||||
nsRefPtr<nsAccessible> parentAcc =
|
||||
nsAccUtils::QueryObject<nsAccessible>(parent);
|
||||
return parentAcc->GetIndexOf(this);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIAccessible>
|
||||
nsAccessible::GetCachedParent()
|
||||
{
|
||||
if (IsDefunct())
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessible> cachedParent = mParent;
|
||||
return cachedParent.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIAccessible>
|
||||
nsAccessible::GetCachedFirstChild()
|
||||
{
|
||||
if (IsDefunct())
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessible> cachedFirstChild = GetChildAt(0);
|
||||
return cachedFirstChild.forget();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessible protected methods
|
||||
|
||||
void
|
||||
nsAccessible::CacheChildren()
|
||||
{
|
||||
PRBool allowsAnonChildren = GetAllowsAnonChildAccessibles();
|
||||
nsAccessibleTreeWalker walker(mWeakShell, mDOMNode, allowsAnonChildren);
|
||||
|
||||
// Seed the frame hint early while we're still on a container node.
|
||||
// This is better than doing the GetPrimaryFrameFor() later on
|
||||
// a text node, because text nodes aren't in the frame map.
|
||||
walker.mState.frame = GetFrame();
|
||||
|
||||
walker.GetFirstChild();
|
||||
while (walker.mState.accessible) {
|
||||
mChildren.AppendObject(walker.mState.accessible);
|
||||
|
||||
nsRefPtr<nsAccessible> acc =
|
||||
nsAccUtils::QueryObject<nsAccessible>(walker.mState.accessible);
|
||||
acc->SetParent(this);
|
||||
|
||||
walker.GetNextSibling();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsAccessible::TestChildCache(nsIAccessible *aCachedChild)
|
||||
{
|
||||
#ifdef DEBUG_A11Y
|
||||
// All cached accessible nodes should be in the parent
|
||||
// It will assert if not all the children were created
|
||||
// when they were first cached, and no invalidation
|
||||
// ever corrected parent accessible's child cache.
|
||||
PRUint32 childCount = mChildren.Count();
|
||||
if (childCount == 0) {
|
||||
NS_ASSERTION(mAreChildrenInitialized,
|
||||
"Children are stored but not initailzied!");
|
||||
return;
|
||||
}
|
||||
|
||||
for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
|
||||
nsIAccessible *child = GetChildAt(childIdx);
|
||||
if (child == aCachedChild)
|
||||
break;
|
||||
}
|
||||
|
||||
NS_ASSERTION(child == aCachedChild,
|
||||
"[TestChildCache] cached accessible wasn't found. Wrong accessible tree!");
|
||||
#endif
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsAccessible::EnsureChildren()
|
||||
{
|
||||
if (IsDefunct()) {
|
||||
mAreChildrenInitialized = PR_FALSE;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
if (mAreChildrenInitialized)
|
||||
return PR_FALSE;
|
||||
|
||||
mAreChildrenInitialized = PR_TRUE; // Prevent reentry
|
||||
CacheChildren();
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsIAccessible*
|
||||
nsAccessible::GetSiblingAtOffset(PRInt32 aOffset, nsresult* aError)
|
||||
{
|
||||
if (IsDefunct()) {
|
||||
if (aError)
|
||||
*aError = NS_ERROR_FAILURE;
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsIAccessible *parent = GetParent();
|
||||
if (!parent) {
|
||||
if (aError)
|
||||
*aError = NS_ERROR_UNEXPECTED;
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsRefPtr<nsAccessible> parentAcc =
|
||||
nsAccUtils::QueryObject<nsAccessible>(parent);
|
||||
|
||||
PRInt32 indexInParent = parentAcc->GetIndexOf(this);
|
||||
if (indexInParent == -1) {
|
||||
if (aError)
|
||||
*aError = NS_ERROR_UNEXPECTED;
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
if (aError) {
|
||||
PRInt32 childCount = parentAcc->GetChildCount();
|
||||
if (indexInParent + aOffset >= childCount) {
|
||||
*aError = NS_OK; // fail peacefully
|
||||
return nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
nsIAccessible *child = parentAcc->GetChildAt(indexInParent + aOffset);
|
||||
if (aError && !child)
|
||||
*aError = NS_ERROR_UNEXPECTED;
|
||||
|
||||
return child;
|
||||
}
|
||||
// nsAccessible private methods
|
||||
|
||||
already_AddRefed<nsIAccessible>
|
||||
nsAccessible::GetFirstAvailableAccessible(nsIDOMNode *aStartNode)
|
||||
|
|
|
@ -103,11 +103,11 @@ private:
|
|||
|
||||
|
||||
#define NS_ACCESSIBLE_IMPL_CID \
|
||||
{ /* 07c5a6d6-4e87-4b57-8613-4c39e1b5150a */ \
|
||||
0x07c5a6d6, \
|
||||
0x4e87, \
|
||||
0x4b57, \
|
||||
{ 0x86, 0x13, 0x4c, 0x39, 0xe1, 0xb5, 0x15, 0x0a } \
|
||||
{ /* 53cfa871-be42-47fc-b416-0033653b3151 */ \
|
||||
0x53cfa871, \
|
||||
0xbe42, \
|
||||
0x47fc, \
|
||||
{ 0xb4, 0x16, 0x00, 0x33, 0x65, 0x3b, 0x31, 0x51 } \
|
||||
}
|
||||
|
||||
class nsAccessible : public nsAccessNodeWrap,
|
||||
|
@ -199,7 +199,22 @@ public:
|
|||
nsIAccessible **aChild);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Initializing methods
|
||||
// Initializing and cache methods
|
||||
|
||||
/**
|
||||
* Set accessible parent.
|
||||
*/
|
||||
void SetParent(nsIAccessible *aParent);
|
||||
|
||||
/**
|
||||
* Set first accessible child.
|
||||
*/
|
||||
void SetFirstChild(nsIAccessible *aFirstChild);
|
||||
|
||||
/**
|
||||
* Set next sibling accessible.
|
||||
*/
|
||||
void SetNextSibling(nsIAccessible *aNextSibling);
|
||||
|
||||
/**
|
||||
* Set the ARIA role map entry for a new accessible.
|
||||
|
@ -211,45 +226,10 @@ public:
|
|||
virtual void SetRoleMapEntry(nsRoleMapEntry *aRoleMapEntry);
|
||||
|
||||
/**
|
||||
* Set accessible parent.
|
||||
*/
|
||||
void SetParent(nsIAccessible *aParent);
|
||||
|
||||
/**
|
||||
* Set the child count to -1 (unknown) and null out cached child pointers.
|
||||
* Should be called when accessible tree is changed because document has
|
||||
* transformed.
|
||||
* Set the child count to -1 (unknown) and null out cached child pointers
|
||||
*/
|
||||
virtual void InvalidateChildren();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Accessible tree traverse methods
|
||||
|
||||
/**
|
||||
* Return parent accessible.
|
||||
*/
|
||||
virtual nsIAccessible* GetParent();
|
||||
|
||||
/**
|
||||
* Return child accessible at the given index.
|
||||
*/
|
||||
virtual nsIAccessible* GetChildAt(PRUint32 aIndex);
|
||||
|
||||
/**
|
||||
* Return child accessible count.
|
||||
*/
|
||||
virtual PRInt32 GetChildCount();
|
||||
|
||||
/**
|
||||
* Return index of the given child accessible.
|
||||
*/
|
||||
virtual PRInt32 GetIndexOf(nsIAccessible *aChild);
|
||||
|
||||
/**
|
||||
* Return index in parent accessible.
|
||||
*/
|
||||
PRInt32 GetIndexInParent();
|
||||
|
||||
/**
|
||||
* Return parent accessible only if cached.
|
||||
*/
|
||||
|
@ -260,8 +240,13 @@ public:
|
|||
*/
|
||||
already_AddRefed<nsIAccessible> GetCachedFirstChild();
|
||||
|
||||
/**
|
||||
* Assert if child not in parent's cache.
|
||||
*/
|
||||
void TestChildCache(nsIAccessible *aCachedChild);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Miscellaneous methods
|
||||
// Miscellaneous methods.
|
||||
|
||||
/**
|
||||
* Fire accessible event.
|
||||
|
@ -284,41 +269,22 @@ public:
|
|||
virtual nsresult AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
|
||||
PRUint32 aLength);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Helper methods
|
||||
|
||||
already_AddRefed<nsIAccessible> GetParent() {
|
||||
nsIAccessible *parent = nsnull;
|
||||
GetParent(&parent);
|
||||
return parent;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Initializing, cache and tree traverse methods
|
||||
|
||||
/**
|
||||
* Cache accessible children.
|
||||
*/
|
||||
virtual void CacheChildren();
|
||||
|
||||
/**
|
||||
* Assert if child not in parent's cache.
|
||||
*/
|
||||
void TestChildCache(nsIAccessible *aCachedChild);
|
||||
|
||||
/**
|
||||
* Cache children if necessary. Return true if the accessible is defunct.
|
||||
*/
|
||||
PRBool EnsureChildren();
|
||||
|
||||
/**
|
||||
* Return sibling accessible at the given offset.
|
||||
*/
|
||||
virtual nsIAccessible* GetSiblingAtOffset(PRInt32 aOffset,
|
||||
nsresult* aError = nsnull);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Miscellaneous helpers
|
||||
|
||||
virtual nsIFrame* GetBoundsFrame();
|
||||
virtual void GetBoundsRect(nsRect& aRect, nsIFrame** aRelativeFrame);
|
||||
PRBool IsVisible(PRBool *aIsOffscreen);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Name helpers
|
||||
// Name helpers.
|
||||
|
||||
/**
|
||||
* Compute the name of HTML node.
|
||||
|
@ -334,6 +300,25 @@ protected:
|
|||
static nsresult GetFullKeyName(const nsAString& aModifierName, const nsAString& aKeyName, nsAString& aStringOut);
|
||||
static nsresult GetTranslatedString(const nsAString& aKey, nsAString& aStringOut);
|
||||
|
||||
/**
|
||||
* Walk into subtree and calculate the string which is used as the accessible
|
||||
* name or description.
|
||||
*
|
||||
* @param aContent [in] traversed content
|
||||
* @param aFlatString [in, out] result string
|
||||
* @param aIsRootHidden [in] specifies whether root content (we started to
|
||||
* traverse from) is hidden, in this case the result
|
||||
* string is calculated from hidden children
|
||||
* (this is used when hidden root content is explicitly
|
||||
* specified as label or description by author)
|
||||
*/
|
||||
nsresult AppendFlatStringFromSubtreeRecurse(nsIContent *aContent,
|
||||
nsAString *aFlatString,
|
||||
PRBool aIsRootHidden);
|
||||
|
||||
// Helpers for dealing with children
|
||||
virtual void CacheChildren();
|
||||
|
||||
// nsCOMPtr<>& is useful here, because getter_AddRefs() nulls the comptr's value, and NextChild
|
||||
// depends on the passed-in comptr being null or already set to a child (finding the next sibling).
|
||||
nsIAccessible *NextChild(nsCOMPtr<nsIAccessible>& aAccessible);
|
||||
|
@ -451,10 +436,11 @@ protected:
|
|||
|
||||
// Data Members
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
nsCOMArray<nsIAccessible> mChildren;
|
||||
PRBool mAreChildrenInitialized;
|
||||
nsCOMPtr<nsIAccessible> mFirstChild;
|
||||
nsCOMPtr<nsIAccessible> mNextSibling;
|
||||
|
||||
nsRoleMapEntry *mRoleMapEntry; // Non-null indicates author-supplied role; possibly state & value as well
|
||||
PRInt32 mAccChildCount;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsAccessible,
|
||||
|
|
|
@ -42,22 +42,64 @@
|
|||
|
||||
#include "nsApplicationAccessible.h"
|
||||
|
||||
#include "nsAccessibilityService.h"
|
||||
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
nsApplicationAccessible::nsApplicationAccessible() :
|
||||
nsAccessibleWrap(nsnull, nsnull)
|
||||
nsApplicationAccessible::nsApplicationAccessible():
|
||||
nsAccessibleWrap(nsnull, nsnull), mChildren(nsnull)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsISupports
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsApplicationAccessible, nsAccessible)
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsApplicationAccessible)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsApplicationAccessible,
|
||||
nsAccessible)
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
tmp->mChildren->Enumerate(getter_AddRefs(enumerator));
|
||||
|
||||
nsCOMPtr<nsIWeakReference> childWeakRef;
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
|
||||
PRBool hasMoreElements;
|
||||
while(NS_SUCCEEDED(enumerator->HasMoreElements(&hasMoreElements))
|
||||
&& hasMoreElements) {
|
||||
|
||||
enumerator->GetNext(getter_AddRefs(childWeakRef));
|
||||
accessible = do_QueryReferent(childWeakRef);
|
||||
if (accessible) {
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "nsApplicationAccessible child");
|
||||
cb.NoteXPCOMChild(accessible);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsApplicationAccessible,
|
||||
nsAccessible)
|
||||
tmp->mChildren->Clear();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsApplicationAccessible)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsAccessible)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsApplicationAccessible, nsAccessible)
|
||||
NS_IMPL_RELEASE_INHERITED(nsApplicationAccessible, nsAccessible)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIAccessNode
|
||||
|
||||
nsresult
|
||||
nsApplicationAccessible::Init()
|
||||
{
|
||||
nsresult rv;
|
||||
mChildren = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
// nsIAccessible
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -88,67 +130,19 @@ nsApplicationAccessible::GetName(nsAString& aName)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetDescription(nsAString& aValue)
|
||||
nsresult
|
||||
nsApplicationAccessible::GetRoleInternal(PRUint32 *aRole)
|
||||
{
|
||||
aValue.Truncate();
|
||||
*aRole = nsIAccessibleRole::ROLE_APP_ROOT;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetRole(PRUint32 *aRole)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRole);
|
||||
|
||||
return GetRoleInternal(aRole);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aState);
|
||||
*aState = 0;
|
||||
|
||||
if (aExtraState)
|
||||
*aExtraState = 0;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetParent(nsIAccessible **aAccessible)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAccessible);
|
||||
*aAccessible = nsnull;
|
||||
|
||||
return IsDefunct() ? NS_ERROR_FAILURE : NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessNode public methods
|
||||
|
||||
PRBool
|
||||
nsApplicationAccessible::IsDefunct()
|
||||
{
|
||||
return nsAccessibilityService::gIsShutdown;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsApplicationAccessible::Init()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessible public methods
|
||||
|
||||
nsresult
|
||||
nsApplicationAccessible::GetRoleInternal(PRUint32 *aRole)
|
||||
{
|
||||
*aRole = nsIAccessibleRole::ROLE_APP_ROOT;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsApplicationAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
|
@ -160,59 +154,124 @@ nsApplicationAccessible::GetStateInternal(PRUint32 *aState,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIAccessible*
|
||||
nsApplicationAccessible::GetParent()
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetParent(nsIAccessible **aParent)
|
||||
{
|
||||
return nsnull;
|
||||
*aParent = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsApplicationAccessible::InvalidateChildren()
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetChildAt(PRInt32 aChildNum, nsIAccessible **aChild)
|
||||
{
|
||||
// Do nothing because application children are kept updated by
|
||||
// AddRootAccessible() and RemoveRootAccessible() method calls.
|
||||
NS_ENSURE_ARG_POINTER(aChild);
|
||||
*aChild = nsnull;
|
||||
|
||||
PRUint32 count = 0;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (mChildren) {
|
||||
rv = mChildren->GetLength(&count);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
if (aChildNum >= static_cast<PRInt32>(count) || count == 0)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
if (aChildNum < 0)
|
||||
aChildNum = count - 1;
|
||||
|
||||
nsCOMPtr<nsIWeakReference> childWeakRef;
|
||||
rv = mChildren->QueryElementAt(aChildNum, NS_GET_IID(nsIWeakReference),
|
||||
getter_AddRefs(childWeakRef));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (childWeakRef) {
|
||||
nsCOMPtr<nsIAccessible> childAcc(do_QueryReferent(childWeakRef));
|
||||
NS_IF_ADDREF(*aChild = childAcc);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessible protected methods
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetNextSibling(nsIAccessible **aNextSibling)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aNextSibling);
|
||||
|
||||
*aNextSibling = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetPreviousSibling(nsIAccessible **aPreviousSibling)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPreviousSibling);
|
||||
|
||||
*aPreviousSibling = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetIndexInParent(PRInt32 *aIndexInParent)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIndexInParent);
|
||||
|
||||
*aIndexInParent = -1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsApplicationAccessible::CacheChildren()
|
||||
{
|
||||
// Nothing to do. Children are keeped up to dated by Add/RemoveRootAccessible
|
||||
// method calls.
|
||||
}
|
||||
|
||||
nsIAccessible*
|
||||
nsApplicationAccessible::GetSiblingAtOffset(PRInt32 aOffset, nsresult* aError)
|
||||
{
|
||||
if (IsDefunct()) {
|
||||
if (aError)
|
||||
*aError = NS_ERROR_FAILURE;
|
||||
|
||||
return nsnull;
|
||||
if (!mChildren) {
|
||||
mAccChildCount = eChildCountUninitialized;
|
||||
return;
|
||||
}
|
||||
|
||||
if (aError)
|
||||
*aError = NS_OK; // fail peacefully
|
||||
if (mAccChildCount == eChildCountUninitialized) {
|
||||
mAccChildCount = 0;// Prevent reentry
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
mChildren->Enumerate(getter_AddRefs(enumerator));
|
||||
|
||||
return nsnull;
|
||||
nsCOMPtr<nsIWeakReference> childWeakRef;
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
nsRefPtr<nsAccessible> prevAcc;
|
||||
PRBool hasMoreElements;
|
||||
|
||||
while(NS_SUCCEEDED(enumerator->HasMoreElements(&hasMoreElements)) &&
|
||||
hasMoreElements) {
|
||||
enumerator->GetNext(getter_AddRefs(childWeakRef));
|
||||
accessible = do_QueryReferent(childWeakRef);
|
||||
if (accessible) {
|
||||
if (prevAcc)
|
||||
prevAcc->SetNextSibling(accessible);
|
||||
else
|
||||
SetFirstChild(accessible);
|
||||
|
||||
prevAcc = nsAccUtils::QueryAccessible(accessible);
|
||||
prevAcc->SetParent(this);
|
||||
}
|
||||
}
|
||||
|
||||
PRUint32 count = 0;
|
||||
mChildren->GetLength(&count);
|
||||
mAccChildCount = static_cast<PRInt32>(count);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
// nsApplicationAccessible
|
||||
|
||||
nsresult
|
||||
nsApplicationAccessible::AddRootAccessible(nsIAccessible *aRootAccessible)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRootAccessible);
|
||||
|
||||
if (!mChildren.AppendObject(aRootAccessible))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsRefPtr<nsAccessible> rootAcc = nsAccUtils::QueryAccessible(aRootAccessible);
|
||||
rootAcc->SetParent(this);
|
||||
// add by weak reference
|
||||
nsresult rv = mChildren->AppendElement(aRootAccessible, PR_TRUE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
InvalidateChildren();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -221,8 +280,17 @@ nsApplicationAccessible::RemoveRootAccessible(nsIAccessible *aRootAccessible)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aRootAccessible);
|
||||
|
||||
// It's not needed to void root accessible parent because this method is
|
||||
// called on root accessible shutdown and its parent will be cleared
|
||||
// properly.
|
||||
return mChildren.RemoveObject(aRootAccessible) ? NS_OK : NS_ERROR_FAILURE;
|
||||
PRUint32 index = 0;
|
||||
|
||||
// we must use weak ref to get the index
|
||||
nsCOMPtr<nsIWeakReference> weakPtr = do_GetWeakReference(aRootAccessible);
|
||||
nsresult rv = mChildren->IndexOf(0, weakPtr, &index);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = mChildren->RemoveElementAt(index);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
InvalidateChildren();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,36 +63,34 @@ public:
|
|||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetName(nsAString& aName);
|
||||
NS_IMETHOD GetDescription(nsAString& aValue);
|
||||
NS_IMETHOD GetRole(PRUint32 *aRole);
|
||||
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
|
||||
NS_IMETHOD GetParent(nsIAccessible **aAccessible);
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsApplicationAccessible,
|
||||
nsAccessible)
|
||||
|
||||
// nsAccessNode
|
||||
virtual PRBool IsDefunct();
|
||||
virtual nsresult Init();
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetName(nsAString & aName);
|
||||
NS_IMETHOD GetRole(PRUint32 *aRole);
|
||||
NS_IMETHOD GetParent(nsIAccessible * *aParent);
|
||||
NS_IMETHOD GetNextSibling(nsIAccessible * *aNextSibling);
|
||||
NS_IMETHOD GetPreviousSibling(nsIAccessible **aPreviousSibling);
|
||||
NS_IMETHOD GetIndexInParent(PRInt32 *aIndexInParent);
|
||||
NS_IMETHOD GetChildAt(PRInt32 aChildNum, nsIAccessible **aChild);
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual nsIAccessible* GetParent();
|
||||
|
||||
virtual void InvalidateChildren();
|
||||
|
||||
// nsApplicationAccessible
|
||||
virtual nsresult AddRootAccessible(nsIAccessible *aRootAccWrap);
|
||||
virtual nsresult RemoveRootAccessible(nsIAccessible *aRootAccWrap);
|
||||
|
||||
protected:
|
||||
|
||||
// nsAccessible
|
||||
virtual void CacheChildren();
|
||||
virtual nsIAccessible* GetSiblingAtOffset(PRInt32 aOffset,
|
||||
nsresult *aError = nsnull);
|
||||
|
||||
nsCOMPtr<nsIMutableArray> mChildren;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -65,9 +65,7 @@ nsAccessibleWrap(aNode, aShell)
|
|||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsLeafAccessible, nsAccessible)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsLeafAccessible: nsAccessible public
|
||||
|
||||
// nsAccessible::GetChildAtPoint()
|
||||
nsresult
|
||||
nsLeafAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
PRBool aDeepestChild,
|
||||
|
@ -78,13 +76,12 @@ nsLeafAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsLeafAccessible: nsAccessible private
|
||||
|
||||
// nsAccessible::CacheChildren()
|
||||
void
|
||||
nsLeafAccessible::CacheChildren()
|
||||
{
|
||||
// No children for leaf accessible.
|
||||
mAccChildCount = IsDefunct() ? eChildCountUninitialized : 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1027,7 +1027,7 @@ nsCoreUtils::GetLastSensibleColumn(nsITreeBoxObject *aTree)
|
|||
}
|
||||
|
||||
PRUint32
|
||||
nsCoreUtils::GetSensibleColumnCount(nsITreeBoxObject *aTree)
|
||||
nsCoreUtils::GetSensiblecolumnCount(nsITreeBoxObject *aTree)
|
||||
{
|
||||
PRUint32 count = 0;
|
||||
|
||||
|
|
|
@ -413,7 +413,7 @@ public:
|
|||
/**
|
||||
* Return sensible columns count for the given tree box object.
|
||||
*/
|
||||
static PRUint32 GetSensibleColumnCount(nsITreeBoxObject *aTree);
|
||||
static PRUint32 GetSensiblecolumnCount(nsITreeBoxObject *aTree);
|
||||
|
||||
/**
|
||||
* Return sensible column at the given index for the given tree box object.
|
||||
|
|
|
@ -73,16 +73,16 @@
|
|||
#include "nsIXULDocument.h"
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Static member initialization
|
||||
//=============================//
|
||||
// nsDocAccessible //
|
||||
//=============================//
|
||||
|
||||
PRUint32 nsDocAccessible::gLastFocusedAccessiblesState = 0;
|
||||
nsIAtom *nsDocAccessible::gLastFocusedFrameType = nsnull;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor/desctructor
|
||||
|
||||
//-----------------------------------------------------
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
nsDocAccessible::nsDocAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell):
|
||||
nsHyperTextAccessibleWrap(aDOMNode, aShell), mWnd(nsnull),
|
||||
mScrollPositionChangedTicks(0), mIsContentLoaded(PR_FALSE),
|
||||
|
@ -129,13 +129,15 @@ nsDocAccessible::nsDocAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell)
|
|||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// destruction
|
||||
//-----------------------------------------------------
|
||||
nsDocAccessible::~nsDocAccessible()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsISupports
|
||||
// nsDocAccessible. nsISupports
|
||||
|
||||
static PLDHashOperator
|
||||
ElementTraverser(const void *aKey, nsIAccessNode *aAccessNode,
|
||||
|
@ -180,10 +182,6 @@ NS_INTERFACE_MAP_END_INHERITING(nsHyperTextAccessible)
|
|||
NS_IMPL_ADDREF_INHERITED(nsDocAccessible, nsHyperTextAccessible)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDocAccessible, nsHyperTextAccessible)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIAccessible
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocAccessible::GetName(nsAString& aName)
|
||||
{
|
||||
|
@ -206,7 +204,6 @@ nsDocAccessible::GetName(nsAString& aName)
|
|||
return rv;
|
||||
}
|
||||
|
||||
// nsAccessible public method
|
||||
nsresult
|
||||
nsDocAccessible::GetRoleInternal(PRUint32 *aRole)
|
||||
{
|
||||
|
@ -245,7 +242,6 @@ nsDocAccessible::GetRoleInternal(PRUint32 *aRole)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsAccessible public method
|
||||
void
|
||||
nsDocAccessible::SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry)
|
||||
{
|
||||
|
@ -286,7 +282,6 @@ nsDocAccessible::GetDescription(nsAString& aDescription)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsAccessible public method
|
||||
nsresult
|
||||
nsDocAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
{
|
||||
|
@ -337,7 +332,6 @@ nsDocAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsAccessible public method
|
||||
nsresult
|
||||
nsDocAccessible::GetARIAState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
{
|
||||
|
@ -402,9 +396,7 @@ NS_IMETHODIMP nsDocAccessible::TakeFocus()
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIAccessibleDocument
|
||||
// ------- nsIAccessibleDocument Methods (5) ---------------
|
||||
|
||||
NS_IMETHODIMP nsDocAccessible::GetURL(nsAString& aURL)
|
||||
{
|
||||
|
@ -507,7 +499,6 @@ NS_IMETHODIMP nsDocAccessible::GetDocument(nsIDOMDocument **aDOMDoc)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// nsIAccessibleHyperText method
|
||||
NS_IMETHODIMP nsDocAccessible::GetAssociatedEditor(nsIEditor **aEditor)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aEditor);
|
||||
|
@ -566,7 +557,6 @@ NS_IMETHODIMP nsDocAccessible::GetCachedAccessNode(void *aUniqueID, nsIAccessNod
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsDocAccessible public method
|
||||
void
|
||||
nsDocAccessible::CacheAccessNode(void *aUniqueID, nsIAccessNode *aAccessNode)
|
||||
{
|
||||
|
@ -584,7 +574,6 @@ nsDocAccessible::CacheAccessNode(void *aUniqueID, nsIAccessNode *aAccessNode)
|
|||
PutCacheEntry(mAccessNodeCache, aUniqueID, aAccessNode);
|
||||
}
|
||||
|
||||
// nsDocAccessible public method
|
||||
void
|
||||
nsDocAccessible::RemoveAccessNodeFromCache(nsIAccessNode *aAccessNode)
|
||||
{
|
||||
|
@ -596,8 +585,31 @@ nsDocAccessible::RemoveAccessNodeFromCache(nsIAccessNode *aAccessNode)
|
|||
mAccessNodeCache.Remove(uniqueID);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessNode
|
||||
NS_IMETHODIMP nsDocAccessible::GetParent(nsIAccessible **aParent)
|
||||
{
|
||||
// Hook up our new accessible with our parent
|
||||
*aParent = nsnull;
|
||||
NS_ENSURE_TRUE(mDocument, NS_ERROR_FAILURE);
|
||||
if (!mParent) {
|
||||
nsIDocument *parentDoc = mDocument->GetParentDocument();
|
||||
NS_ENSURE_TRUE(parentDoc, NS_ERROR_FAILURE);
|
||||
nsIContent *ownerContent = parentDoc->FindContentForSubDocument(mDocument);
|
||||
nsCOMPtr<nsIDOMNode> ownerNode(do_QueryInterface(ownerContent));
|
||||
if (ownerNode) {
|
||||
nsCOMPtr<nsIAccessibilityService> accService =
|
||||
do_GetService("@mozilla.org/accessibilityService;1");
|
||||
if (accService) {
|
||||
// XXX aaronl: ideally we would traverse the presshell chain
|
||||
// Since there's no easy way to do that, we cheat and use
|
||||
// the document hierarchy. GetAccessibleFor() is bad because
|
||||
// it doesn't support our concept of multiple presshells per doc.
|
||||
// It should be changed to use GetAccessibleInWeakShell()
|
||||
accService->GetAccessibleFor(ownerNode, getter_AddRefs(mParent));
|
||||
}
|
||||
}
|
||||
}
|
||||
return mParent ? nsAccessible::GetParent(aParent) : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDocAccessible::Init()
|
||||
|
@ -606,7 +618,8 @@ nsDocAccessible::Init()
|
|||
|
||||
AddEventListeners();
|
||||
|
||||
GetParent(); // Ensure outer doc mParent accessible.
|
||||
nsCOMPtr<nsIAccessible> parentAccessible; // Ensure outer doc mParent accessible
|
||||
GetParent(getter_AddRefs(parentAccessible));
|
||||
|
||||
nsresult rv = nsHyperTextAccessibleWrap::Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -667,7 +680,6 @@ nsDocAccessible::Shutdown()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsDocAccessible protected member
|
||||
void nsDocAccessible::ShutdownChildDocuments(nsIDocShellTreeItem *aStart)
|
||||
{
|
||||
nsCOMPtr<nsIDocShellTreeNode> treeNode(do_QueryInterface(aStart));
|
||||
|
@ -713,7 +725,6 @@ nsDocAccessible::IsDefunct()
|
|||
return !mDocument;
|
||||
}
|
||||
|
||||
// nsDocAccessible protected member
|
||||
void nsDocAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aRelativeFrame)
|
||||
{
|
||||
*aRelativeFrame = GetFrame();
|
||||
|
@ -757,7 +768,7 @@ void nsDocAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aRelativeFrame)
|
|||
}
|
||||
}
|
||||
|
||||
// nsDocAccessible protected member
|
||||
|
||||
nsresult nsDocAccessible::AddEventListeners()
|
||||
{
|
||||
// 1) Set up scroll position listener
|
||||
|
@ -803,7 +814,6 @@ nsresult nsDocAccessible::AddEventListeners()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsDocAccessible protected member
|
||||
nsresult nsDocAccessible::RemoveEventListeners()
|
||||
{
|
||||
// Remove listeners associated with content documents
|
||||
|
@ -850,7 +860,6 @@ nsresult nsDocAccessible::RemoveEventListeners()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsDocAccessible public member
|
||||
void
|
||||
nsDocAccessible::FireDocLoadEvents(PRUint32 aEventType)
|
||||
{
|
||||
|
@ -880,7 +889,8 @@ nsDocAccessible::FireDocLoadEvents(PRUint32 aEventType)
|
|||
if (isFinished) {
|
||||
// Need to wait until scrollable view is available
|
||||
AddScrollListener();
|
||||
nsRefPtr<nsAccessible> acc(nsAccUtils::QueryAccessible(GetParent()));
|
||||
nsCOMPtr<nsIAccessible> parent(nsAccessible::GetParent());
|
||||
nsRefPtr<nsAccessible> acc(nsAccUtils::QueryAccessible(parent));
|
||||
if (acc) {
|
||||
// Make the parent forget about the old document as a child
|
||||
acc->InvalidateChildren();
|
||||
|
@ -944,7 +954,6 @@ void nsDocAccessible::ScrollTimerCallback(nsITimer *aTimer, void *aClosure)
|
|||
}
|
||||
}
|
||||
|
||||
// nsDocAccessible protected member
|
||||
void nsDocAccessible::AddScrollListener()
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mWeakShell));
|
||||
|
@ -961,7 +970,6 @@ void nsDocAccessible::AddScrollListener()
|
|||
scrollableView->AddScrollPositionListener(this);
|
||||
}
|
||||
|
||||
// nsDocAccessible protected member
|
||||
void nsDocAccessible::RemoveScrollListener()
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mWeakShell));
|
||||
|
@ -978,9 +986,6 @@ void nsDocAccessible::RemoveScrollListener()
|
|||
scrollableView->RemoveScrollPositionListener(this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIScrollPositionListener
|
||||
|
||||
NS_IMETHODIMP nsDocAccessible::ScrollPositionWillChange(nsIScrollableView *aView, nscoord aX, nscoord aY)
|
||||
{
|
||||
return NS_OK;
|
||||
|
@ -1007,9 +1012,6 @@ NS_IMETHODIMP nsDocAccessible::ScrollPositionDidChange(nsIScrollableView *aScrol
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIObserver
|
||||
|
||||
NS_IMETHODIMP nsDocAccessible::Observe(nsISupports *aSubject, const char *aTopic,
|
||||
const PRUnichar *aData)
|
||||
{
|
||||
|
@ -1024,7 +1026,7 @@ NS_IMETHODIMP nsDocAccessible::Observe(nsISupports *aSubject, const char *aTopic
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// nsIDocumentObserver
|
||||
|
||||
NS_IMPL_NSIDOCUMENTOBSERVER_CORE_STUB(nsDocAccessible)
|
||||
|
@ -1060,7 +1062,7 @@ nsDocAccessible::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent,
|
|||
}
|
||||
}
|
||||
|
||||
// nsDocAccessible protected member
|
||||
|
||||
void
|
||||
nsDocAccessible::AttributeChangedImpl(nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute)
|
||||
{
|
||||
|
@ -1211,7 +1213,6 @@ nsDocAccessible::AttributeChangedImpl(nsIContent* aContent, PRInt32 aNameSpaceID
|
|||
}
|
||||
}
|
||||
|
||||
// nsDocAccessible protected member
|
||||
void
|
||||
nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
{
|
||||
|
@ -1361,7 +1362,6 @@ void nsDocAccessible::ContentAppended(nsIDocument *aDocument,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void nsDocAccessible::ContentStatesChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent1,
|
||||
nsIContent* aContent2,
|
||||
|
@ -1417,45 +1417,6 @@ nsDocAccessible::ParentChainChanged(nsIContent *aContent)
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessible
|
||||
|
||||
nsIAccessible*
|
||||
nsDocAccessible::GetParent()
|
||||
{
|
||||
if (IsDefunct())
|
||||
return nsnull;
|
||||
|
||||
if (mParent)
|
||||
return mParent;
|
||||
|
||||
nsIDocument* parentDoc = mDocument->GetParentDocument();
|
||||
if (!parentDoc)
|
||||
return nsnull;
|
||||
|
||||
nsIContent* ownerContent = parentDoc->FindContentForSubDocument(mDocument);
|
||||
nsCOMPtr<nsIDOMNode> ownerNode(do_QueryInterface(ownerContent));
|
||||
if (ownerNode) {
|
||||
nsCOMPtr<nsIAccessibilityService> accService = GetAccService();
|
||||
if (accService) {
|
||||
// XXX aaronl: ideally we would traverse the presshell chain. Since
|
||||
// there's no easy way to do that, we cheat and use the document
|
||||
// hierarchy. GetAccessibleFor() is bad because it doesn't support our
|
||||
// concept of multiple presshells per doc.
|
||||
// It should be changed to use GetAccessibleInWeakShell()
|
||||
accService->GetAccessibleFor(ownerNode, getter_AddRefs(mParent));
|
||||
}
|
||||
}
|
||||
|
||||
NS_ASSERTION(mParent, "No parent for not root document accessible!");
|
||||
return mParent;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Protected members
|
||||
|
||||
void
|
||||
nsDocAccessible::FireValueChangeForTextFields(nsIAccessible *aPossibleTextFieldAccessible)
|
||||
{
|
||||
|
@ -1611,7 +1572,6 @@ nsDocAccessible::CreateTextChangeEventForNode(nsIAccessible *aContainerAccessibl
|
|||
return event;
|
||||
}
|
||||
|
||||
// nsDocAccessible public member
|
||||
nsresult
|
||||
nsDocAccessible::FireDelayedAccessibleEvent(PRUint32 aEventType,
|
||||
nsIDOMNode *aDOMNode,
|
||||
|
@ -1625,7 +1585,6 @@ nsDocAccessible::FireDelayedAccessibleEvent(PRUint32 aEventType,
|
|||
return FireDelayedAccessibleEvent(event);
|
||||
}
|
||||
|
||||
// nsDocAccessible public member
|
||||
nsresult
|
||||
nsDocAccessible::FireDelayedAccessibleEvent(nsIAccessibleEvent *aEvent)
|
||||
{
|
||||
|
@ -1994,7 +1953,6 @@ void nsDocAccessible::RefreshNodes(nsIDOMNode *aStartNode)
|
|||
mAccessNodeCache.Remove(uniqueID);
|
||||
}
|
||||
|
||||
// nsDocAccessible public member
|
||||
void
|
||||
nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
||||
PRUint32 aChangeType)
|
||||
|
@ -2222,7 +2180,6 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
|||
FireDelayedAccessibleEvent(reorderEvent);
|
||||
}
|
||||
|
||||
// nsIAccessibleDocument method
|
||||
NS_IMETHODIMP
|
||||
nsDocAccessible::GetAccessibleInParentChain(nsIDOMNode *aNode,
|
||||
PRBool aCanCreate,
|
||||
|
|
|
@ -87,6 +87,7 @@ public:
|
|||
NS_IMETHOD GetDescription(nsAString& aDescription);
|
||||
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
|
||||
NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild);
|
||||
NS_IMETHOD GetParent(nsIAccessible **aParent);
|
||||
NS_IMETHOD TakeFocus(void);
|
||||
|
||||
// nsIScrollPositionListener
|
||||
|
@ -110,9 +111,7 @@ public:
|
|||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual nsresult GetARIAState(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
|
||||
virtual void SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry);
|
||||
virtual nsIAccessible* GetParent();
|
||||
|
||||
// nsIAccessibleText
|
||||
NS_IMETHOD GetAssociatedEditor(nsIEditor **aEditor);
|
||||
|
|
|
@ -99,11 +99,25 @@ nsOuterDocAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsOuterDocAccessible::CacheChildren()
|
||||
void nsOuterDocAccessible::CacheChildren()
|
||||
{
|
||||
// An outer doc accessible usually has 1 nsDocAccessible child, but could have
|
||||
// none if we can't get to the inner documnet.
|
||||
// An outer doc accessible usually has 1 nsDocAccessible child,
|
||||
// but could have none if we can't get to the inner documnet
|
||||
if (!mWeakShell) {
|
||||
mAccChildCount = eChildCountUninitialized;
|
||||
return; // This outer doc node has been shut down
|
||||
}
|
||||
if (mAccChildCount != eChildCountUninitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
InvalidateChildren();
|
||||
mAccChildCount = 0;
|
||||
|
||||
// In these variable names, "outer" relates to the nsOuterDocAccessible
|
||||
// as opposed to the nsDocAccessibleWrap which is "inner".
|
||||
// The outer node is a something like a <browser>, <frame>, <iframe>, <page> or
|
||||
// <editor> tag, whereas the inner node corresponds to the inner document root.
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
NS_ASSERTION(content, "No nsIContent for <browser>/<iframe>/<editor> dom node");
|
||||
|
@ -120,15 +134,18 @@ nsOuterDocAccessible::CacheChildren()
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIAccessible> innerAccessible;
|
||||
nsCOMPtr<nsIAccessibilityService> accService = GetAccService();
|
||||
nsCOMPtr<nsIAccessibilityService> accService =
|
||||
do_GetService("@mozilla.org/accessibilityService;1");
|
||||
accService->GetAccessibleFor(innerNode, getter_AddRefs(innerAccessible));
|
||||
nsRefPtr<nsAccessible> innerAcc(nsAccUtils::QueryAccessible(innerAccessible));
|
||||
if (!innerAcc)
|
||||
return;
|
||||
|
||||
// Success getting inner document as first child -- now we cache it.
|
||||
mChildren.AppendObject(innerAccessible);
|
||||
mAccChildCount = 1;
|
||||
SetFirstChild(innerAccessible); // weak ref
|
||||
innerAcc->SetParent(this);
|
||||
innerAcc->SetNextSibling(nsnull);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -42,14 +42,8 @@
|
|||
#include "nsAccessibleWrap.h"
|
||||
#include "nsIAccessible.h"
|
||||
|
||||
/**
|
||||
* Used for <browser>, <frame>, <iframe>, <page> or editor> elements.
|
||||
*
|
||||
* In these variable names, "outer" relates to the nsOuterDocAccessible as
|
||||
* opposed to the nsDocAccessibleWrap which is "inner". The outer node is
|
||||
* a something like tags listed above, whereas the inner node corresponds to
|
||||
* the inner document root.
|
||||
*/
|
||||
class nsIWeakReference;
|
||||
|
||||
class nsOuterDocAccessible : public nsAccessibleWrap
|
||||
{
|
||||
// XXX: why is it private?
|
||||
|
@ -76,7 +70,7 @@ public:
|
|||
|
||||
protected:
|
||||
// nsAccessible
|
||||
virtual void CacheChildren();
|
||||
void CacheChildren();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -84,9 +84,6 @@
|
|||
#include "nsIXULWindow.h"
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsISupports
|
||||
|
||||
// Expanded version of NS_IMPL_ISUPPORTS_INHERITED2
|
||||
// so we can QI directly to concrete nsRootAccessible
|
||||
NS_IMPL_QUERY_HEAD(nsRootAccessible)
|
||||
|
@ -99,21 +96,21 @@ NS_IMPL_QUERY_TAIL_INHERITING(nsDocAccessible)
|
|||
NS_IMPL_ADDREF_INHERITED(nsRootAccessible, nsDocAccessible)
|
||||
NS_IMPL_RELEASE_INHERITED(nsRootAccessible, nsDocAccessible)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor/desctructor
|
||||
|
||||
//-----------------------------------------------------
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
nsRootAccessible::nsRootAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell):
|
||||
nsDocAccessibleWrap(aDOMNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// destruction
|
||||
//-----------------------------------------------------
|
||||
nsRootAccessible::~nsRootAccessible()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIAccessible
|
||||
|
||||
/* readonly attribute AString name; */
|
||||
NS_IMETHODIMP
|
||||
nsRootAccessible::GetName(nsAString& aName)
|
||||
|
@ -135,6 +132,21 @@ nsRootAccessible::GetName(nsAString& aName)
|
|||
return document->GetTitle(aName);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible accParent; */
|
||||
NS_IMETHODIMP nsRootAccessible::GetParent(nsIAccessible * *aParent)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aParent);
|
||||
*aParent = nsnull;
|
||||
|
||||
if (!mParent) {
|
||||
nsRefPtr<nsApplicationAccessibleWrap> root = GetApplicationAccessible();
|
||||
mParent = root;
|
||||
}
|
||||
|
||||
NS_IF_ADDREF(*aParent = mParent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute unsigned long accRole; */
|
||||
nsresult
|
||||
nsRootAccessible::GetRoleInternal(PRUint32 *aRole)
|
||||
|
@ -160,7 +172,6 @@ nsRootAccessible::GetRoleInternal(PRUint32 *aRole)
|
|||
return nsDocAccessibleWrap::GetRoleInternal(aRole);
|
||||
}
|
||||
|
||||
// nsRootAccessible protected member
|
||||
#ifdef MOZ_XUL
|
||||
PRUint32 nsRootAccessible::GetChromeFlags()
|
||||
{
|
||||
|
@ -570,8 +581,7 @@ void nsRootAccessible::FireCurrentFocusEvent()
|
|||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIDOMEventListener
|
||||
// --------------- nsIDOMEventListener Methods (3) ------------------------
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
|
@ -585,8 +595,6 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
|||
return HandleEventWithTarget(aEvent, targetNode);
|
||||
}
|
||||
|
||||
|
||||
// nsRootAccessible protected member
|
||||
nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
|
||||
nsIDOMNode* aTargetNode)
|
||||
{
|
||||
|
@ -938,9 +946,6 @@ void nsRootAccessible::FireFocusCallback(nsITimer *aTimer, void *aClosure)
|
|||
rootAccessible->FireCurrentFocusEvent();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessNode
|
||||
|
||||
nsresult
|
||||
nsRootAccessible::Init()
|
||||
{
|
||||
|
@ -975,7 +980,6 @@ nsRootAccessible::Shutdown()
|
|||
return nsDocAccessibleWrap::Shutdown();
|
||||
}
|
||||
|
||||
// nsRootAccessible protected member
|
||||
already_AddRefed<nsIDocShellTreeItem>
|
||||
nsRootAccessible::GetContentDocShell(nsIDocShellTreeItem *aStart)
|
||||
{
|
||||
|
@ -1032,7 +1036,6 @@ nsRootAccessible::GetContentDocShell(nsIDocShellTreeItem *aStart)
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
// nsIAccessible method
|
||||
NS_IMETHODIMP
|
||||
nsRootAccessible::GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation)
|
||||
|
@ -1059,20 +1062,6 @@ nsRootAccessible::GetRelationByType(PRUint32 aRelationType,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessible
|
||||
|
||||
nsIAccessible*
|
||||
nsRootAccessible::GetParent()
|
||||
{
|
||||
// Parent has been setted in nsApplicationAccesible::AddRootAccessible()
|
||||
// when root accessible was intialized.
|
||||
return mParent;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsDocAccessible
|
||||
|
||||
void
|
||||
nsRootAccessible::FireDocLoadEvents(PRUint32 aEventType)
|
||||
{
|
||||
|
@ -1095,9 +1084,6 @@ nsRootAccessible::FireDocLoadEvents(PRUint32 aEventType)
|
|||
aEventType == nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_STOPPED);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Protected members
|
||||
|
||||
nsresult
|
||||
nsRootAccessible::HandlePopupShownEvent(nsIAccessible *aAccessible)
|
||||
{
|
||||
|
|
|
@ -74,6 +74,7 @@ public:
|
|||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetName(nsAString& aName);
|
||||
NS_IMETHOD GetParent(nsIAccessible * *aParent);
|
||||
NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation);
|
||||
|
||||
|
@ -87,7 +88,6 @@ public:
|
|||
// nsAccessible
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual nsIAccessible* GetParent();
|
||||
|
||||
// nsDocAccessible
|
||||
virtual void FireDocLoadEvents(PRUint32 aEventType);
|
||||
|
|
|
@ -70,4 +70,5 @@ void
|
|||
nsTextAccessible::CacheChildren()
|
||||
{
|
||||
// No children for text accessible.
|
||||
mAccChildCount = IsDefunct() ? eChildCountUninitialized : 0;
|
||||
}
|
||||
|
|
|
@ -155,4 +155,5 @@ void
|
|||
nsHTMLAreaAccessible::CacheChildren()
|
||||
{
|
||||
// No children for aria accessible.
|
||||
mAccChildCount = IsDefunct() ? eChildCountUninitialized : 0;
|
||||
}
|
||||
|
|
|
@ -155,28 +155,42 @@ nsHTMLImageAccessible::GetRoleInternal(PRUint32 *aRole)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLImageAccessible::CacheChildren()
|
||||
void nsHTMLImageAccessible::CacheChildren()
|
||||
{
|
||||
if (!mWeakShell) {
|
||||
// This node has been shut down
|
||||
mAccChildCount = eChildCountUninitialized;
|
||||
return;
|
||||
}
|
||||
|
||||
if (mAccChildCount != eChildCountUninitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
mAccChildCount = 0;
|
||||
nsCOMPtr<nsIDOMHTMLCollection> mapAreas = GetAreaCollection();
|
||||
if (!mapAreas)
|
||||
return;
|
||||
|
||||
PRUint32 areaCount = 0;
|
||||
mapAreas->GetLength(&areaCount);
|
||||
PRUint32 numMapAreas;
|
||||
mapAreas->GetLength(&numMapAreas);
|
||||
PRInt32 childCount = 0;
|
||||
|
||||
nsCOMPtr<nsIAccessible> areaAccessible;
|
||||
nsRefPtr<nsAccessible> areaAcc;
|
||||
nsRefPtr<nsAccessible> prevAcc;
|
||||
while (childCount < (PRInt32)numMapAreas &&
|
||||
(areaAccessible = GetAreaAccessible(mapAreas, childCount)) != nsnull) {
|
||||
if (prevAcc)
|
||||
prevAcc->SetNextSibling(areaAccessible);
|
||||
else
|
||||
SetFirstChild(areaAccessible);
|
||||
|
||||
for (PRUint32 areaIdx = 0; areaIdx < areaCount; areaIdx++) {
|
||||
areaAccessible = GetAreaAccessible(mapAreas, areaIdx);
|
||||
if (!areaAccessible)
|
||||
return;
|
||||
++ childCount;
|
||||
|
||||
mChildren.AppendObject(areaAccessible);
|
||||
areaAcc = nsAccUtils::QueryObject<nsAccessible>(areaAccessible);
|
||||
areaAcc->SetParent(this);
|
||||
prevAcc = nsAccUtils::QueryAccessible(areaAccessible);
|
||||
prevAcc->SetParent(this);
|
||||
}
|
||||
mAccChildCount = childCount;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -83,7 +83,6 @@ protected:
|
|||
// nsAccessible
|
||||
virtual void CacheChildren();
|
||||
|
||||
// nsHTMLImageAccessible
|
||||
already_AddRefed<nsIDOMHTMLCollection> GetAreaCollection();
|
||||
already_AddRefed<nsIAccessible>
|
||||
GetAreaAccessible(nsIDOMHTMLCollection* aAreaNodes, PRInt32 aAreaNum);
|
||||
|
|
|
@ -305,9 +305,7 @@ NS_IMETHODIMP nsHTMLSelectableAccessible::SelectAllSelection(PRBool *_retval)
|
|||
/** First, the common widgets */
|
||||
/** ------------------------------------------------------ */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLSelectListAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/** ----- nsHTMLSelectListAccessible ----- */
|
||||
|
||||
/** Default Constructor */
|
||||
nsHTMLSelectListAccessible::nsHTMLSelectListAccessible(nsIDOMNode* aDOMNode,
|
||||
|
@ -316,9 +314,11 @@ nsHTMLSelectListAccessible::nsHTMLSelectListAccessible(nsIDOMNode* aDOMNode,
|
|||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLSelectListAccessible: nsAccessible public
|
||||
|
||||
/**
|
||||
* As a nsHTMLSelectListAccessible we can have the following states:
|
||||
* nsIAccessibleStates::STATE_MULTISELECTABLE
|
||||
* nsIAccessibleStates::STATE_EXTSELECTABLE
|
||||
*/
|
||||
nsresult
|
||||
nsHTMLSelectListAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
|
@ -327,10 +327,6 @@ nsHTMLSelectListAccessible::GetStateInternal(PRUint32 *aState,
|
|||
aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
|
||||
// As a nsHTMLSelectListAccessible we can have the following states:
|
||||
// nsIAccessibleStates::STATE_MULTISELECTABLE
|
||||
// nsIAccessibleStates::STATE_EXTSELECTABLE
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> select (do_QueryInterface(mDOMNode));
|
||||
if (select) {
|
||||
if (*aState & nsIAccessibleStates::STATE_FOCUSED) {
|
||||
|
@ -364,63 +360,109 @@ nsHTMLSelectListAccessible::GetRoleInternal(PRUint32 *aRole)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLSelectListAccessible: nsAccessible protected
|
||||
|
||||
void
|
||||
nsHTMLSelectListAccessible::CacheChildren()
|
||||
already_AddRefed<nsIAccessible>
|
||||
nsHTMLSelectListAccessible::AccessibleForOption(nsIAccessibilityService *aAccService,
|
||||
nsIContent *aContent,
|
||||
nsIAccessible *aLastGoodAccessible,
|
||||
PRInt32 *aChildCount)
|
||||
{
|
||||
// Cache accessibles for <optgroup> and <option> DOM decendents as children,
|
||||
// as well as the accessibles for them. Avoid whitespace text nodes. We want
|
||||
// to count all the <optgroup>s and <option>s as children because we want
|
||||
// a flat tree under the Select List.
|
||||
nsCOMPtr<nsIDOMNode> domNode(do_QueryInterface(aContent));
|
||||
NS_ASSERTION(domNode, "DOM node is null");
|
||||
// Accessibility service will initialize & cache any accessibles created
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
aAccService->GetAccessibleInWeakShell(domNode, mWeakShell, getter_AddRefs(accessible));
|
||||
nsRefPtr<nsAccessible> acc(nsAccUtils::QueryAccessible(accessible));
|
||||
if (!acc)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIContent> selectContent(do_QueryInterface(mDOMNode));
|
||||
CacheOptSiblings(selectContent);
|
||||
++ *aChildCount;
|
||||
acc->SetParent(this);
|
||||
nsRefPtr<nsAccessible> prevAcc =
|
||||
nsAccUtils::QueryAccessible(aLastGoodAccessible);
|
||||
if (prevAcc)
|
||||
prevAcc->SetNextSibling(accessible);
|
||||
|
||||
if (!mFirstChild)
|
||||
mFirstChild = accessible;
|
||||
|
||||
return accessible.forget();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLSelectListAccessible protected
|
||||
|
||||
void
|
||||
nsHTMLSelectListAccessible::CacheOptSiblings(nsIContent *aParentContent)
|
||||
already_AddRefed<nsIAccessible>
|
||||
nsHTMLSelectListAccessible::CacheOptSiblings(nsIAccessibilityService *aAccService,
|
||||
nsIContent *aParentContent,
|
||||
nsIAccessible *aLastGoodAccessible,
|
||||
PRInt32 *aChildCount)
|
||||
{
|
||||
// Recursive helper for CacheChildren()
|
||||
|
||||
PRUint32 numChildren = aParentContent->GetChildCount();
|
||||
nsCOMPtr<nsIAccessible> lastGoodAccessible(aLastGoodAccessible);
|
||||
nsCOMPtr<nsIAccessible> newAccessible;
|
||||
|
||||
for (PRUint32 count = 0; count < numChildren; count ++) {
|
||||
nsIContent *childContent = aParentContent->GetChildAt(count);
|
||||
if (!childContent->IsHTML()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> tag = childContent->Tag();
|
||||
if (tag == nsAccessibilityAtoms::option ||
|
||||
tag == nsAccessibilityAtoms::optgroup) {
|
||||
|
||||
// Get an accessible for option or optgroup and cache it.
|
||||
nsCOMPtr<nsIDOMNode> childNode(do_QueryInterface(childContent));
|
||||
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
GetAccService()->GetAccessibleInWeakShell(childNode, mWeakShell,
|
||||
getter_AddRefs(accessible));
|
||||
if (accessible) {
|
||||
mChildren.AppendObject(accessible);
|
||||
|
||||
nsRefPtr<nsAccessible> acc =
|
||||
nsAccUtils::QueryObject<nsAccessible>(accessible);
|
||||
acc->SetParent(this);
|
||||
if (tag == nsAccessibilityAtoms::option || tag == nsAccessibilityAtoms::optgroup) {
|
||||
newAccessible = AccessibleForOption(aAccService,
|
||||
childContent,
|
||||
lastGoodAccessible,
|
||||
aChildCount);
|
||||
if (newAccessible) {
|
||||
lastGoodAccessible = newAccessible;
|
||||
}
|
||||
if (tag == nsAccessibilityAtoms::optgroup) {
|
||||
newAccessible = CacheOptSiblings(aAccService, childContent,
|
||||
lastGoodAccessible, aChildCount);
|
||||
if (newAccessible) {
|
||||
lastGoodAccessible = newAccessible;
|
||||
}
|
||||
}
|
||||
|
||||
// Deep down into optgroup element.
|
||||
if (tag == nsAccessibilityAtoms::optgroup)
|
||||
CacheOptSiblings(childContent);
|
||||
}
|
||||
}
|
||||
|
||||
if (lastGoodAccessible) {
|
||||
nsRefPtr<nsAccessible> lastAcc =
|
||||
nsAccUtils::QueryAccessible(lastGoodAccessible);
|
||||
lastAcc->SetNextSibling(nsnull);
|
||||
}
|
||||
|
||||
return lastGoodAccessible.forget();
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache the children and child count of a Select List Accessible. We want to count
|
||||
* all the <optgroup>s and <option>s as children because we want a
|
||||
* flat tree under the Select List.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLSelectOptionAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void nsHTMLSelectListAccessible::CacheChildren()
|
||||
{
|
||||
// Cache the number of <optgroup> and <option> DOM decendents,
|
||||
// as well as the accessibles for them. Avoid whitespace text nodes.
|
||||
|
||||
nsCOMPtr<nsIContent> selectContent(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
if (!selectContent || !accService) {
|
||||
mAccChildCount = eChildCountUninitialized;
|
||||
return;
|
||||
}
|
||||
|
||||
if (mAccChildCount != eChildCountUninitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
mAccChildCount = 0; // Avoid reentry
|
||||
PRInt32 childCount = 0;
|
||||
nsCOMPtr<nsIAccessible> lastGoodAccessible =
|
||||
CacheOptSiblings(accService, selectContent, nsnull, &childCount);
|
||||
mAccChildCount = childCount;
|
||||
}
|
||||
|
||||
/** ----- nsHTMLSelectOptionAccessible ----- */
|
||||
|
||||
/** Default Constructor */
|
||||
nsHTMLSelectOptionAccessible::nsHTMLSelectOptionAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
|
@ -843,9 +885,7 @@ nsIContent* nsHTMLSelectOptionAccessible::GetSelectState(PRUint32* aState,
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLSelectOptGroupAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/** ----- nsHTMLSelectOptGroupAccessible ----- */
|
||||
|
||||
/** Default Constructor */
|
||||
nsHTMLSelectOptGroupAccessible::nsHTMLSelectOptGroupAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
|
@ -889,26 +929,29 @@ NS_IMETHODIMP nsHTMLSelectOptGroupAccessible::GetNumActions(PRUint8 *_retval)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLSelectOptGroupAccessible: nsAccessible protected
|
||||
|
||||
void
|
||||
nsHTMLSelectOptGroupAccessible::CacheChildren()
|
||||
void nsHTMLSelectOptGroupAccessible::CacheChildren()
|
||||
{
|
||||
// XXX To do (bug 378612) - create text child for the anonymous attribute
|
||||
// content, so that nsIAccessibleText is supported for the <optgroup> as it is
|
||||
// for an <option>. Attribute content is what layout creates for
|
||||
// the label="foo" on the <optgroup>. See eStyleContentType_Attr and
|
||||
// CreateAttributeContent() in nsCSSFrameConstructor
|
||||
if (!mWeakShell) {
|
||||
// This node has been shut down
|
||||
mAccChildCount = eChildCountUninitialized;
|
||||
return;
|
||||
}
|
||||
|
||||
if (mAccChildCount == eChildCountUninitialized) {
|
||||
// XXX To do (bug 378612) - create text child for the anonymous attribute content, so that
|
||||
// nsIAccessibleText is supported for the <optgroup> as it is for an <option>
|
||||
// Attribute content is what layout creates for the label="foo" on the <optgroup>
|
||||
// See eStyleContentType_Attr and CreateAttributeContent() in nsCSSFrameConstructor
|
||||
mAccChildCount = 0;
|
||||
SetFirstChild(nsnull);
|
||||
}
|
||||
}
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
/** Finally, the Combobox widgets */
|
||||
/** ------------------------------------------------------ */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLComboboxAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/** ----- nsHTMLComboboxAccessible ----- */
|
||||
|
||||
nsHTMLComboboxAccessible::nsHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsAccessibleWrap(aDOMNode, aShell)
|
||||
|
@ -923,32 +966,46 @@ nsHTMLComboboxAccessible::GetRoleInternal(PRUint32 *aRole)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLComboboxAccessible::CacheChildren()
|
||||
void nsHTMLComboboxAccessible::CacheChildren()
|
||||
{
|
||||
nsIFrame* frame = GetFrame();
|
||||
if (!frame)
|
||||
if (!mWeakShell) {
|
||||
// This node has been shut down
|
||||
mAccChildCount = eChildCountUninitialized;
|
||||
return;
|
||||
|
||||
nsIComboboxControlFrame *comboFrame = do_QueryFrame(frame);
|
||||
if (!comboFrame)
|
||||
return;
|
||||
|
||||
nsIFrame *listFrame = comboFrame->GetDropDown();
|
||||
if (!listFrame)
|
||||
return;
|
||||
|
||||
if (!mListAccessible) {
|
||||
mListAccessible =
|
||||
new nsHTMLComboboxListAccessible(mParent, mDOMNode, mWeakShell);
|
||||
if (!mListAccessible)
|
||||
return;
|
||||
|
||||
mListAccessible->Init();
|
||||
}
|
||||
|
||||
mChildren.AppendObject(mListAccessible);
|
||||
mListAccessible->SetParent(this);
|
||||
if (mAccChildCount == eChildCountUninitialized) {
|
||||
mAccChildCount = 0;
|
||||
|
||||
nsIFrame *frame = GetFrame();
|
||||
if (!frame) {
|
||||
return;
|
||||
}
|
||||
nsIComboboxControlFrame *comboFrame = do_QueryFrame(frame);
|
||||
if (!comboFrame) {
|
||||
return;
|
||||
}
|
||||
nsIFrame *listFrame = comboFrame->GetDropDown();
|
||||
if (!listFrame) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mListAccessible) {
|
||||
mListAccessible =
|
||||
new nsHTMLComboboxListAccessible(mParent, mDOMNode, mWeakShell);
|
||||
if (!mListAccessible)
|
||||
return;
|
||||
|
||||
mListAccessible->Init();
|
||||
}
|
||||
|
||||
SetFirstChild(mListAccessible);
|
||||
|
||||
mListAccessible->SetParent(this);
|
||||
mListAccessible->SetNextSibling(nsnull);
|
||||
|
||||
++ mAccChildCount; // List accessible child successfully added
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -1097,7 +1154,6 @@ NS_IMETHODIMP nsHTMLComboboxAccessible::GetActionName(PRUint8 aIndex, nsAString&
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLComboboxListAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1149,6 +1205,13 @@ nsHTMLComboboxListAccessible::GetStateInternal(PRUint32 *aState,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/** Return our cached parent */
|
||||
NS_IMETHODIMP nsHTMLComboboxListAccessible::GetParent(nsIAccessible **aParent)
|
||||
{
|
||||
NS_IF_ADDREF(*aParent = mParent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLComboboxListAccessible::GetUniqueID(void **aUniqueID)
|
||||
{
|
||||
// Since mDOMNode is same for all tree item, use |this| pointer as the unique Id
|
||||
|
@ -1164,10 +1227,11 @@ void nsHTMLComboboxListAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aBo
|
|||
{
|
||||
*aBoundingFrame = nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessible> comboAccessible = GetParent();
|
||||
if (!comboAccessible)
|
||||
nsCOMPtr<nsIAccessible> comboAccessible;
|
||||
GetParent(getter_AddRefs(comboAccessible));
|
||||
if (!comboAccessible) {
|
||||
return;
|
||||
|
||||
}
|
||||
if (0 == (nsAccUtils::State(comboAccessible) & nsIAccessibleStates::STATE_COLLAPSED)) {
|
||||
nsHTMLSelectListAccessible::GetBoundsRect(aBounds, aBoundingFrame);
|
||||
return;
|
||||
|
@ -1195,10 +1259,3 @@ void nsHTMLComboboxListAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aBo
|
|||
*aBoundingFrame = frame->GetParent();
|
||||
aBounds = (*aBoundingFrame)->GetRect();
|
||||
}
|
||||
|
||||
// nsHTMLComboboxListAccessible. nsAccessible public mehtod
|
||||
nsIAccessible*
|
||||
nsHTMLComboboxListAccessible::GetParent()
|
||||
{
|
||||
return mParent;
|
||||
}
|
||||
|
|
|
@ -130,16 +130,18 @@ public:
|
|||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
|
||||
protected:
|
||||
void CacheChildren();
|
||||
|
||||
// nsAccessible
|
||||
virtual void CacheChildren();
|
||||
|
||||
// nsHTMLSelectListAccessible
|
||||
|
||||
/**
|
||||
* Recursive helper for CacheChildren().
|
||||
*/
|
||||
void CacheOptSiblings(nsIContent *aParentContent);
|
||||
already_AddRefed<nsIAccessible>
|
||||
AccessibleForOption(nsIAccessibilityService *aAccService,
|
||||
nsIContent *aContent,
|
||||
nsIAccessible *aLastGoodAccessible,
|
||||
PRInt32 *aChildCount);
|
||||
already_AddRefed<nsIAccessible>
|
||||
CacheOptSiblings(nsIAccessibilityService *aAccService,
|
||||
nsIContent *aParentContent,
|
||||
nsIAccessible *aLastGoodAccessible,
|
||||
PRInt32 *aChildCount);
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -199,8 +201,7 @@ public:
|
|||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
|
||||
protected:
|
||||
// nsAccessible
|
||||
virtual void CacheChildren();
|
||||
void CacheChildren();
|
||||
};
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
|
@ -235,10 +236,8 @@ public:
|
|||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
|
||||
protected:
|
||||
// nsAccessible
|
||||
virtual void CacheChildren();
|
||||
void CacheChildren();
|
||||
|
||||
// nsHTMLComboboxAccessible
|
||||
already_AddRefed<nsIAccessible> GetFocusedOptionAccessible();
|
||||
|
||||
private:
|
||||
|
@ -260,6 +259,7 @@ public:
|
|||
virtual ~nsHTMLComboboxListAccessible() {}
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetParent(nsIAccessible **aParent);
|
||||
NS_IMETHOD GetUniqueID(void **aUniqueID);
|
||||
|
||||
// nsAccessNode
|
||||
|
@ -268,7 +268,6 @@ public:
|
|||
// nsAccessible
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual void GetBoundsRect(nsRect& aBounds, nsIFrame** aBoundingFrame);
|
||||
virtual nsIAccessible* GetParent();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -455,27 +455,47 @@ NS_IMPL_ISUPPORTS_INHERITED2(nsHTMLTableAccessible, nsAccessible,
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLTableAccessible: nsAccessible implementation
|
||||
|
||||
void
|
||||
nsHTMLTableAccessible::CacheChildren()
|
||||
void nsHTMLTableAccessible::CacheChildren()
|
||||
{
|
||||
nsAccessible::CacheChildren();
|
||||
if (!mWeakShell) {
|
||||
// This node has been shut down
|
||||
mAccChildCount = eChildCountUninitialized;
|
||||
return;
|
||||
}
|
||||
|
||||
// Move caption accessible so that it's the first child.
|
||||
PRInt32 length = mChildren.Count();
|
||||
for (PRInt32 idx = 0; idx < length; idx++) {
|
||||
// Check for the first caption, because nsAccessibilityService ensures we
|
||||
// don't create accessibles for the other captions, since only the first is
|
||||
// actually visible.
|
||||
if (mAccChildCount == eChildCountUninitialized) {
|
||||
nsAccessible::CacheChildren();
|
||||
nsCOMPtr<nsIAccessible> captionAccessible;
|
||||
while (NextChild(captionAccessible)) {
|
||||
if (nsAccUtils::Role(captionAccessible) == nsIAccessibleRole::ROLE_CAPTION) {
|
||||
nsCOMPtr<nsIAccessible> captionParentAccessible;
|
||||
captionAccessible->GetParent(getter_AddRefs(captionParentAccessible));
|
||||
if (captionParentAccessible != this) {
|
||||
NS_WARNING("Should not happen: parser ensures caption is the table's child, not the tbody's");
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIAccessible> beforeCaptionAccessible;
|
||||
captionAccessible->GetPreviousSibling(getter_AddRefs(beforeCaptionAccessible));
|
||||
if (beforeCaptionAccessible) {
|
||||
// Move caption accessible so that it's the first child
|
||||
nsRefPtr<nsAccessible> acc =
|
||||
nsAccUtils::QueryAccessible(beforeCaptionAccessible);
|
||||
|
||||
nsIAccessible* child = mChildren.ObjectAt(idx);
|
||||
if (nsAccUtils::Role(child) == nsIAccessibleRole::ROLE_CAPTION) {
|
||||
if (idx == 0)
|
||||
nsCOMPtr<nsIAccessible> afterCaptionAccessible;
|
||||
captionAccessible->GetNextSibling(getter_AddRefs(afterCaptionAccessible));
|
||||
acc->SetNextSibling(afterCaptionAccessible);
|
||||
|
||||
GetFirstChild(getter_AddRefs(afterCaptionAccessible));
|
||||
SetFirstChild(captionAccessible);
|
||||
|
||||
acc = nsAccUtils::QueryAccessible(captionAccessible);
|
||||
acc->SetNextSibling(afterCaptionAccessible);
|
||||
}
|
||||
// Don't check for more captions, because nsAccessibilityService ensures
|
||||
// we don't create accessibles for the other captions, since only the
|
||||
// first is actually visible
|
||||
break;
|
||||
|
||||
nsCOMPtr<nsIAccessible> tmp = mChildren.ObjectAt(0);
|
||||
mChildren.ReplaceObjectAt(child, 0);
|
||||
mChildren.ReplaceObjectAt(tmp, idx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -263,19 +263,20 @@ NS_IMETHODIMP nsHTMLLIAccessible::GetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *wid
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLLIAccessible: nsAccessible protected
|
||||
|
||||
void
|
||||
nsHTMLLIAccessible::CacheChildren()
|
||||
void nsHTMLLIAccessible::CacheChildren()
|
||||
{
|
||||
if (mBulletAccessible) {
|
||||
mChildren.AppendObject(mBulletAccessible);
|
||||
mBulletAccessible->SetParent(this);
|
||||
if (!mWeakShell || mAccChildCount != eChildCountUninitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Cache children from subtree.
|
||||
nsAccessibleWrap::CacheChildren();
|
||||
|
||||
if (mBulletAccessible) {
|
||||
mBulletAccessible->SetNextSibling(mFirstChild);
|
||||
mBulletAccessible->SetParent(this);
|
||||
SetFirstChild(mBulletAccessible);
|
||||
++ mAccChildCount;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -331,6 +332,15 @@ nsHTMLListBulletAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraS
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLListBulletAccessible::GetParent(nsIAccessible **aParent)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aParent);
|
||||
|
||||
NS_IF_ADDREF(*aParent = mParent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLListBulletAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
|
||||
PRUint32 aLength)
|
||||
|
@ -343,12 +353,6 @@ nsHTMLListBulletAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIAccessible*
|
||||
nsHTMLListBulletAccessible::GetParent()
|
||||
{
|
||||
return mParent;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLListAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -106,6 +106,7 @@ public:
|
|||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetName(nsAString& aName);
|
||||
NS_IMETHOD GetParent(nsIAccessible **aParent);
|
||||
|
||||
// nsAccessNode
|
||||
virtual nsresult Shutdown();
|
||||
|
@ -116,8 +117,6 @@ public:
|
|||
virtual nsresult AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
|
||||
PRUint32 aLength);
|
||||
|
||||
virtual nsIAccessible* GetParent();
|
||||
|
||||
protected:
|
||||
// XXX: Ideally we'd get the bullet text directly from the bullet frame via
|
||||
// nsBulletFrame::GetListItemText(), but we'd need an interface for getting
|
||||
|
@ -162,10 +161,8 @@ public:
|
|||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
|
||||
protected:
|
||||
// nsAccessible
|
||||
virtual void CacheChildren();
|
||||
void CacheChildren(); // Include bullet accessible
|
||||
|
||||
private:
|
||||
nsRefPtr<nsHTMLListBulletAccessible> mBulletAccessible;
|
||||
};
|
||||
|
||||
|
|
|
@ -201,44 +201,49 @@ nsHyperTextAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsHyperTextAccessible::CacheChildren()
|
||||
void nsHyperTextAccessible::CacheChildren()
|
||||
{
|
||||
PRUint32 role;
|
||||
GetRoleInternal(&role);
|
||||
if (role != nsIAccessibleRole::ROLE_ENTRY &&
|
||||
role != nsIAccessibleRole::ROLE_PASSWORD_TEXT) {
|
||||
nsAccessible::CacheChildren();
|
||||
if (!mWeakShell) {
|
||||
// This node has been shut down
|
||||
mAccChildCount = eChildCountUninitialized;
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
GetAssociatedEditor(getter_AddRefs(editor));
|
||||
if (!editor) {
|
||||
nsAccessible::CacheChildren();
|
||||
return;
|
||||
}
|
||||
// Special case for text entry fields, go directly to editor's root for children
|
||||
if (mAccChildCount == eChildCountUninitialized) {
|
||||
PRUint32 role;
|
||||
GetRoleInternal(&role);
|
||||
if (role != nsIAccessibleRole::ROLE_ENTRY && role != nsIAccessibleRole::ROLE_PASSWORD_TEXT) {
|
||||
nsAccessible::CacheChildren();
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
GetAssociatedEditor(getter_AddRefs(editor));
|
||||
if (!editor) {
|
||||
nsAccessible::CacheChildren();
|
||||
return;
|
||||
}
|
||||
mAccChildCount = 0; // Avoid reentry
|
||||
nsCOMPtr<nsIDOMElement> editorRoot;
|
||||
editor->GetRootElement(getter_AddRefs(editorRoot));
|
||||
nsCOMPtr<nsIDOMNode> editorRootDOMNode = do_QueryInterface(editorRoot);
|
||||
if (!editorRootDOMNode) {
|
||||
return;
|
||||
}
|
||||
nsAccessibleTreeWalker walker(mWeakShell, editorRootDOMNode, PR_TRUE);
|
||||
nsRefPtr<nsAccessible> prevAcc;
|
||||
PRInt32 childCount = 0;
|
||||
walker.GetFirstChild();
|
||||
SetFirstChild(walker.mState.accessible);
|
||||
|
||||
// Special case for text entry fields, go directly to editor's root for
|
||||
// children.
|
||||
|
||||
nsCOMPtr<nsIDOMElement> editorRoot;
|
||||
editor->GetRootElement(getter_AddRefs(editorRoot));
|
||||
nsCOMPtr<nsIDOMNode> editorRootDOMNode = do_QueryInterface(editorRoot);
|
||||
if (!editorRootDOMNode)
|
||||
return;
|
||||
|
||||
nsAccessibleTreeWalker walker(mWeakShell, editorRootDOMNode, PR_TRUE);
|
||||
|
||||
walker.GetFirstChild();
|
||||
while (walker.mState.accessible) {
|
||||
mChildren.AppendObject(walker.mState.accessible);
|
||||
|
||||
nsRefPtr<nsAccessible> acc =
|
||||
nsAccUtils::QueryObject<nsAccessible>(walker.mState.accessible);
|
||||
acc->SetParent(this);
|
||||
|
||||
walker.GetNextSibling();
|
||||
while (walker.mState.accessible) {
|
||||
++ childCount;
|
||||
prevAcc = nsAccUtils::QueryAccessible(walker.mState.accessible);
|
||||
prevAcc->SetParent(this);
|
||||
walker.GetNextSibling();
|
||||
prevAcc->SetNextSibling(walker.mState.accessible);
|
||||
}
|
||||
mAccChildCount = childCount;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -861,11 +866,10 @@ nsHyperTextAccessible::GetRelativeOffset(nsIPresShell *aPresShell,
|
|||
hyperTextOffset = 0;
|
||||
}
|
||||
else if (aAmount == eSelectBeginLine) {
|
||||
nsIAccessible *firstChild = mChildren.SafeObjectAt(0);
|
||||
// For line selection with needsStart, set start of line exactly to line break
|
||||
if (pos.mContentOffset == 0 && firstChild &&
|
||||
nsAccUtils::Role(firstChild) == nsIAccessibleRole::ROLE_STATICTEXT &&
|
||||
nsAccUtils::TextLength(firstChild) == hyperTextOffset) {
|
||||
if (pos.mContentOffset == 0 && mFirstChild &&
|
||||
nsAccUtils::Role(mFirstChild) == nsIAccessibleRole::ROLE_STATICTEXT &&
|
||||
nsAccUtils::TextLength(mFirstChild) == hyperTextOffset) {
|
||||
// XXX Bullet hack -- we should remove this once list bullets use anonymous content
|
||||
hyperTextOffset = 0;
|
||||
}
|
||||
|
|
|
@ -86,6 +86,7 @@ public:
|
|||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
void CacheChildren();
|
||||
|
||||
// Convert content offset to rendered text offset
|
||||
static nsresult ContentToRenderedOffset(nsIFrame *aFrame, PRInt32 aContentOffset,
|
||||
|
@ -154,12 +155,6 @@ public:
|
|||
PRInt32 *aEndOffset);
|
||||
|
||||
protected:
|
||||
|
||||
// nsAccessible
|
||||
virtual void CacheChildren();
|
||||
|
||||
// nsHyperTextAccessible
|
||||
|
||||
/*
|
||||
* This does the work for nsIAccessibleText::GetText[At|Before|After]Offset
|
||||
* @param aType, eGetBefore, eGetAt, eGetAfter
|
||||
|
|
|
@ -1105,23 +1105,28 @@ __try {
|
|||
if (mEnumVARIANTPosition == kIEnumVariantDisconnected)
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
PRUint32 numElementsFetched = 0;
|
||||
for (; numElementsFetched < aNumElementsRequested;
|
||||
numElementsFetched++, mEnumVARIANTPosition++) {
|
||||
nsCOMPtr<nsIAccessible> traversedAcc;
|
||||
nsresult rv = GetChildAt(mEnumVARIANTPosition, getter_AddRefs(traversedAcc));
|
||||
if (!traversedAcc)
|
||||
return S_FALSE;
|
||||
|
||||
nsIAccessible* accessible = GetChildAt(mEnumVARIANTPosition);
|
||||
if (!accessible)
|
||||
for (PRUint32 i = 0; i < aNumElementsRequested; i++) {
|
||||
VariantInit(&aPVar[i]);
|
||||
|
||||
aPVar[i].pdispVal = NativeAccessible(traversedAcc);
|
||||
aPVar[i].vt = VT_DISPATCH;
|
||||
(*aNumElementsFetched)++;
|
||||
|
||||
nsCOMPtr<nsIAccessible> nextAcc;
|
||||
traversedAcc->GetNextSibling(getter_AddRefs(nextAcc));
|
||||
if (!nextAcc)
|
||||
break;
|
||||
|
||||
VariantInit(&aPVar[numElementsFetched]);
|
||||
|
||||
aPVar[numElementsFetched].pdispVal = NativeAccessible(accessible);
|
||||
aPVar[numElementsFetched].vt = VT_DISPATCH;
|
||||
traversedAcc = nextAcc;
|
||||
}
|
||||
|
||||
(*aNumElementsFetched) = numElementsFetched;
|
||||
|
||||
return numElementsFetched < aNumElementsRequested ? S_FALSE : S_OK;
|
||||
mEnumVARIANTPosition += *aNumElementsFetched;
|
||||
return (*aNumElementsFetched) < aNumElementsRequested ? S_FALSE : S_OK;
|
||||
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
return E_FAIL;
|
||||
|
|
|
@ -49,9 +49,6 @@ nsHTMLWin32ObjectOwnerAccessible::
|
|||
nsAccessibleWrap(aNode, aShell)
|
||||
{
|
||||
mHwnd = aHwnd;
|
||||
|
||||
// Our only child is a nsHTMLWin32ObjectAccessible object.
|
||||
mNativeAccessible = new nsHTMLWin32ObjectAccessible(mHwnd);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -65,6 +62,50 @@ nsHTMLWin32ObjectOwnerAccessible::Shutdown()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLWin32ObjectOwnerAccessible: nsIAccessible implementation
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLWin32ObjectOwnerAccessible::GetFirstChild(nsIAccessible **aFirstChild)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aFirstChild);
|
||||
*aFirstChild = nsnull;
|
||||
|
||||
// Our only child is a nsHTMLWin32ObjectAccessible object.
|
||||
if (!mNativeAccessible) {
|
||||
if (!mHwnd)
|
||||
return NS_OK;
|
||||
|
||||
mNativeAccessible = new nsHTMLWin32ObjectAccessible(mHwnd);
|
||||
NS_ENSURE_TRUE(mNativeAccessible, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
SetFirstChild(mNativeAccessible);
|
||||
}
|
||||
|
||||
*aFirstChild = mNativeAccessible;
|
||||
NS_IF_ADDREF(*aFirstChild);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLWin32ObjectOwnerAccessible::GetLastChild(nsIAccessible **aLastChild)
|
||||
{
|
||||
return GetFirstChild(aLastChild);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLWin32ObjectOwnerAccessible::GetChildCount(PRInt32 *aChildCount)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aChildCount);
|
||||
|
||||
nsCOMPtr<nsIAccessible> onlyChild;
|
||||
GetFirstChild(getter_AddRefs(onlyChild));
|
||||
*aChildCount = onlyChild ? 1 : 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLWin32ObjectOwnerAccessible: nsAccessible implementation
|
||||
|
||||
|
@ -93,21 +134,6 @@ nsHTMLWin32ObjectOwnerAccessible::GetStateInternal(PRUint32 *aState,
|
|||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLWin32ObjectOwnerAccessible: nsAccessible protected implementation
|
||||
|
||||
void
|
||||
nsHTMLWin32ObjectOwnerAccessible::CacheChildren()
|
||||
{
|
||||
if (mNativeAccessible) {
|
||||
mChildren.AppendObject(mNativeAccessible);
|
||||
|
||||
nsRefPtr<nsAccessible> nativeAcc =
|
||||
nsAccUtils::QueryObject<nsAccessible>(mNativeAccessible);
|
||||
nativeAcc->SetParent(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLWin32ObjectAccessible
|
||||
|
|
|
@ -56,6 +56,11 @@ public:
|
|||
nsHTMLWin32ObjectOwnerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell, void* aHwnd);
|
||||
virtual ~nsHTMLWin32ObjectOwnerAccessible() {}
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetFirstChild(nsIAccessible **aFirstChild);
|
||||
NS_IMETHOD GetLastChild(nsIAccessible **aLastChild);
|
||||
NS_IMETHOD GetChildCount(PRInt32 *aChildCount); // Zero or one child
|
||||
|
||||
// nsAccessNode
|
||||
virtual nsresult Shutdown();
|
||||
|
||||
|
@ -64,10 +69,6 @@ public:
|
|||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
|
||||
protected:
|
||||
|
||||
// nsAccessible
|
||||
virtual void CacheChildren();
|
||||
|
||||
void* mHwnd;
|
||||
nsCOMPtr<nsIAccessible> mNativeAccessible;
|
||||
};
|
||||
|
|
|
@ -105,6 +105,16 @@ nsXFormsAccessible::GetBoundChildElementValue(const nsAString& aTagName,
|
|||
void
|
||||
nsXFormsAccessible::CacheSelectChildren(nsIDOMNode *aContainerNode)
|
||||
{
|
||||
if (!mWeakShell) {
|
||||
// This node has been shut down
|
||||
mAccChildCount = eChildCountUninitialized;
|
||||
return;
|
||||
}
|
||||
|
||||
if (mAccChildCount != eChildCountUninitialized)
|
||||
return;
|
||||
|
||||
mAccChildCount = 0; // Avoid reentry
|
||||
nsIAccessibilityService *accService = GetAccService();
|
||||
if (!accService)
|
||||
return;
|
||||
|
@ -123,7 +133,7 @@ nsXFormsAccessible::CacheSelectChildren(nsIDOMNode *aContainerNode)
|
|||
children->GetLength(&length);
|
||||
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
nsRefPtr<nsAccessible> acc;
|
||||
nsRefPtr<nsAccessible> currAccessible, prevAccessible;
|
||||
|
||||
PRUint32 childLength = 0;
|
||||
for (PRUint32 index = 0; index < length; index++) {
|
||||
|
@ -133,13 +143,22 @@ nsXFormsAccessible::CacheSelectChildren(nsIDOMNode *aContainerNode)
|
|||
continue;
|
||||
|
||||
accService->GetAttachedAccessibleFor(child, getter_AddRefs(accessible));
|
||||
if (!accessible)
|
||||
currAccessible = nsAccUtils::QueryAccessible(accessible);
|
||||
if (!currAccessible)
|
||||
continue;
|
||||
|
||||
mChildren.AppendObject(accessible);
|
||||
acc = nsAccUtils::QueryObject<nsAccessible>(accessible);
|
||||
acc->SetParent(this);
|
||||
if (childLength == 0)
|
||||
SetFirstChild(accessible);
|
||||
|
||||
currAccessible->SetParent(this);
|
||||
if (prevAccessible) {
|
||||
prevAccessible->SetNextSibling(accessible);
|
||||
}
|
||||
currAccessible.swap(prevAccessible);
|
||||
childLength++;
|
||||
}
|
||||
|
||||
mAccChildCount = childLength;
|
||||
}
|
||||
|
||||
// nsIAccessible
|
||||
|
|
|
@ -211,10 +211,7 @@ public:
|
|||
|
||||
// nsAccessible
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
|
||||
protected:
|
||||
// nsAccessible
|
||||
virtual void CacheChildren();
|
||||
void CacheChildren();
|
||||
};
|
||||
|
||||
|
||||
|
@ -230,10 +227,7 @@ public:
|
|||
|
||||
// nsAccessible
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
|
||||
protected:
|
||||
// nsAccessible
|
||||
virtual void CacheChildren();
|
||||
void CacheChildren();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -98,8 +98,7 @@ public:
|
|||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
|
||||
protected:
|
||||
// nsAccessible
|
||||
virtual void CacheChildren();
|
||||
void CacheChildren();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -166,6 +166,16 @@ nsXULColorPickerAccessible::GetRoleInternal(PRUint32 *aRole)
|
|||
void
|
||||
nsXULColorPickerAccessible::CacheChildren()
|
||||
{
|
||||
if (IsDefunct()) {
|
||||
mAccChildCount = eChildCountUninitialized;
|
||||
return; // This outer doc node has been shut down
|
||||
}
|
||||
|
||||
if (mAccChildCount != eChildCountUninitialized)
|
||||
return;
|
||||
|
||||
mAccChildCount = 0; // Avoid reentry
|
||||
|
||||
nsCOMPtr<nsIAccessible> menupopupAccessible;
|
||||
nsAccessibleTreeWalker walker(mWeakShell, mDOMNode, PR_TRUE);
|
||||
walker.GetFirstChild();
|
||||
|
@ -173,17 +183,23 @@ nsXULColorPickerAccessible::CacheChildren()
|
|||
while (walker.mState.accessible) {
|
||||
PRUint32 role = nsAccUtils::Role(walker.mState.accessible);
|
||||
|
||||
// Get an accessbile for menupopup or panel elements.
|
||||
if (role == nsIAccessibleRole::ROLE_ALERT) {
|
||||
mChildren.AppendObject(walker.mState.accessible);
|
||||
|
||||
nsRefPtr<nsAccessible> menupopupAcc =
|
||||
nsAccUtils::QueryObject<nsAccessible>(walker.mState.accessible);
|
||||
menupopupAcc->SetParent(this);
|
||||
|
||||
return;
|
||||
// Get an accessbile for menupopup or panel elements.
|
||||
menupopupAccessible = walker.mState.accessible;
|
||||
break;
|
||||
}
|
||||
|
||||
walker.GetNextSibling();
|
||||
}
|
||||
|
||||
if (!menupopupAccessible)
|
||||
return;
|
||||
|
||||
SetFirstChild(menupopupAccessible);
|
||||
|
||||
nsRefPtr<nsAccessible> menupopupAcc =
|
||||
nsAccUtils::QueryObject<nsAccessible>(menupopupAccessible);
|
||||
menupopupAcc->SetParent(this);
|
||||
|
||||
mAccChildCount++;
|
||||
}
|
||||
|
|
|
@ -186,61 +186,78 @@ nsXULButtonAccessible::CacheChildren()
|
|||
// buttons can have button (@type="menu-button") and popup accessibles
|
||||
// (@type="menu-button" or @type="menu").
|
||||
|
||||
// XXX: no children until the button is menu button. Probably it's not
|
||||
// totally correct but in general AT wants to have leaf buttons.
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
if (!mWeakShell) {
|
||||
mAccChildCount = eChildCountUninitialized;
|
||||
return; // This outer doc node has been shut down
|
||||
}
|
||||
if (mAccChildCount == eChildCountUninitialized) {
|
||||
mAccChildCount = 0; // Avoid reentry
|
||||
|
||||
PRBool isMenu = content->AttrValueIs(kNameSpaceID_None,
|
||||
nsAccessibilityAtoms::type,
|
||||
nsAccessibilityAtoms::menu,
|
||||
eCaseMatters);
|
||||
SetFirstChild(nsnull);
|
||||
|
||||
PRBool isMenuButton = isMenu ?
|
||||
PR_FALSE :
|
||||
content->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
|
||||
nsAccessibilityAtoms::menuButton, eCaseMatters);
|
||||
// XXX: no children until the button is menu button. Probably it's not
|
||||
// totally correct but in general AT wants to have leaf buttons.
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
|
||||
if (!isMenu && !isMenuButton)
|
||||
return;
|
||||
PRBool isMenu = content->AttrValueIs(kNameSpaceID_None,
|
||||
nsAccessibilityAtoms::type,
|
||||
nsAccessibilityAtoms::menu,
|
||||
eCaseMatters);
|
||||
|
||||
nsCOMPtr<nsIAccessible> buttonAccessible;
|
||||
nsCOMPtr<nsIAccessible> menupopupAccessible;
|
||||
PRBool isMenuButton = isMenu ?
|
||||
PR_FALSE :
|
||||
content->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
|
||||
nsAccessibilityAtoms::menuButton, eCaseMatters);
|
||||
|
||||
nsAccessibleTreeWalker walker(mWeakShell, mDOMNode, PR_TRUE);
|
||||
walker.GetFirstChild();
|
||||
if (!isMenu && !isMenuButton)
|
||||
return;
|
||||
|
||||
while (walker.mState.accessible) {
|
||||
PRUint32 role = nsAccUtils::Role(walker.mState.accessible);
|
||||
nsCOMPtr<nsIAccessible> buttonAccessible;
|
||||
nsCOMPtr<nsIAccessible> menupopupAccessible;
|
||||
|
||||
if (role == nsIAccessibleRole::ROLE_MENUPOPUP) {
|
||||
// Get an accessbile for menupopup or panel elements.
|
||||
menupopupAccessible = walker.mState.accessible;
|
||||
nsAccessibleTreeWalker walker(mWeakShell, mDOMNode, PR_TRUE);
|
||||
walker.GetFirstChild();
|
||||
|
||||
} else if (isMenuButton && role == nsIAccessibleRole::ROLE_PUSHBUTTON) {
|
||||
// Button type="menu-button" contains a real button. Get an accessible
|
||||
// for it. Ignore dropmarker button what is placed as a last child.
|
||||
buttonAccessible = walker.mState.accessible;
|
||||
break;
|
||||
while (walker.mState.accessible) {
|
||||
PRUint32 role = nsAccUtils::Role(walker.mState.accessible);
|
||||
|
||||
if (role == nsIAccessibleRole::ROLE_MENUPOPUP) {
|
||||
// Get an accessbile for menupopup or panel elements.
|
||||
menupopupAccessible = walker.mState.accessible;
|
||||
|
||||
} else if (isMenuButton && role == nsIAccessibleRole::ROLE_PUSHBUTTON) {
|
||||
// Button type="menu-button" contains a real button. Get an accessible
|
||||
// for it. Ignore dropmarker button what is placed as a last child.
|
||||
buttonAccessible = walker.mState.accessible;
|
||||
break;
|
||||
}
|
||||
|
||||
walker.GetNextSibling();
|
||||
}
|
||||
|
||||
walker.GetNextSibling();
|
||||
}
|
||||
if (!menupopupAccessible)
|
||||
return;
|
||||
|
||||
if (!menupopupAccessible)
|
||||
return;
|
||||
SetFirstChild(menupopupAccessible);
|
||||
|
||||
mChildren.AppendObject(menupopupAccessible);
|
||||
nsRefPtr<nsAccessible> menupopupAcc =
|
||||
nsAccUtils::QueryObject<nsAccessible>(menupopupAccessible);
|
||||
menupopupAcc->SetParent(this);
|
||||
|
||||
nsRefPtr<nsAccessible> menupopupAcc =
|
||||
nsAccUtils::QueryObject<nsAccessible>(menupopupAccessible);
|
||||
menupopupAcc->SetParent(this);
|
||||
mAccChildCount++;
|
||||
|
||||
if (buttonAccessible) {
|
||||
mChildren.AppendObject(buttonAccessible);
|
||||
if (buttonAccessible) {
|
||||
if (menupopupAcc)
|
||||
menupopupAcc->SetNextSibling(buttonAccessible);
|
||||
else
|
||||
SetFirstChild(buttonAccessible);
|
||||
|
||||
nsRefPtr<nsAccessible> buttonAcc =
|
||||
nsAccUtils::QueryObject<nsAccessible>(buttonAccessible);
|
||||
buttonAcc->SetParent(this);
|
||||
nsRefPtr<nsAccessible> buttonAcc =
|
||||
nsAccUtils::QueryObject<nsAccessible>(buttonAccessible);
|
||||
buttonAcc->SetParent(this);
|
||||
|
||||
mAccChildCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ public:
|
|||
protected:
|
||||
|
||||
// nsAccessible
|
||||
virtual void CacheChildren();
|
||||
void CacheChildren();
|
||||
|
||||
// nsXULButtonAccessible
|
||||
PRBool ContainsMenu();
|
||||
|
|
|
@ -236,6 +236,15 @@ nsXULTabBoxAccessible::GetRoleInternal(PRUint32 *aRole)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef NEVER
|
||||
/** 2 children, tabs, tabpanels */
|
||||
NS_IMETHODIMP nsXULTabBoxAccessible::GetChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 2;
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* XUL Tabs - the s really stands for strip. this is a collection of tab objects
|
||||
*/
|
||||
|
|
|
@ -220,6 +220,83 @@ nsXULTreeAccessible::GetRoleInternal(PRUint32 *aRole)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTreeAccessible: nsIAccessible implementation
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeAccessible::GetFirstChild(nsIAccessible **aFirstChild)
|
||||
{
|
||||
nsAccessible::GetFirstChild(aFirstChild);
|
||||
|
||||
// in normal case, tree's first child should be treecols, if it is not here,
|
||||
// use the first row as tree's first child
|
||||
if (*aFirstChild == nsnull) {
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRInt32 rowCount;
|
||||
mTreeView->GetRowCount(&rowCount);
|
||||
if (rowCount > 0)
|
||||
GetTreeItemAccessible(0, aFirstChild);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeAccessible::GetLastChild(nsIAccessible **aLastChild)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aLastChild);
|
||||
*aLastChild = nsnull;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRInt32 rowCount = 0;
|
||||
mTreeView->GetRowCount(&rowCount);
|
||||
if (rowCount > 0) {
|
||||
GetTreeItemAccessible(rowCount - 1, aLastChild);
|
||||
|
||||
if (*aLastChild)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// If there is not any rows, use treecols as tree's last child.
|
||||
return nsAccessible::GetLastChild(aLastChild);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeAccessible::GetChildCount(PRInt32 *aChildCount)
|
||||
{
|
||||
// tree's children count is row count + treecols count.
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAccessible::GetChildCount(aChildCount);
|
||||
|
||||
if (*aChildCount != eChildCountUninitialized) {
|
||||
PRInt32 rowCount = 0;
|
||||
mTreeView->GetRowCount(&rowCount);
|
||||
*aChildCount += rowCount;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeAccessible::GetChildAt(PRInt32 aChildIndex, nsIAccessible **aChild)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aChild);
|
||||
*aChild = nsnull;
|
||||
|
||||
PRInt32 childCount = 0;
|
||||
nsresult rv = nsAccessible::GetChildCount(&childCount);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aChildIndex < childCount)
|
||||
return nsAccessible::GetChildAt(aChildIndex, aChild);
|
||||
|
||||
GetTreeItemAccessible(aChildIndex - childCount, aChild);
|
||||
return *aChild ? NS_OK : NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeAccessible::GetFocusedChild(nsIAccessible **aFocusedChild)
|
||||
{
|
||||
|
@ -458,56 +535,6 @@ nsXULTreeAccessible::SelectAllSelection(PRBool *aIsMultiSelectable)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTreeAccessible: nsAccessible implementation
|
||||
|
||||
nsIAccessible*
|
||||
nsXULTreeAccessible::GetChildAt(PRUint32 aIndex)
|
||||
{
|
||||
PRInt32 childCount = nsAccessible::GetChildCount();
|
||||
if (childCount == -1)
|
||||
return nsnull;
|
||||
|
||||
if (static_cast<PRInt32>(aIndex) < childCount)
|
||||
return nsAccessible::GetChildAt(aIndex);
|
||||
|
||||
nsCOMPtr<nsIAccessible> child;
|
||||
GetTreeItemAccessible(aIndex - childCount, getter_AddRefs(child));
|
||||
return child;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsXULTreeAccessible::GetChildCount()
|
||||
{
|
||||
// tree's children count is row count + treecols count.
|
||||
PRInt32 childCount = nsAccessible::GetChildCount();
|
||||
if (childCount == -1)
|
||||
return -1;
|
||||
|
||||
PRInt32 rowCount = 0;
|
||||
mTreeView->GetRowCount(&rowCount);
|
||||
childCount += rowCount;
|
||||
|
||||
return childCount;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsXULTreeAccessible::GetIndexOf(nsIAccessible *aChild)
|
||||
{
|
||||
if (IsDefunct())
|
||||
return -1;
|
||||
|
||||
nsRefPtr<nsXULTreeItemAccessibleBase> item =
|
||||
nsAccUtils::QueryObject<nsXULTreeItemAccessibleBase>(aChild);
|
||||
|
||||
// If the given child is not treeitem then it should be treecols accessible.
|
||||
if (!item)
|
||||
return nsAccessible::GetIndexOf(aChild);
|
||||
|
||||
return nsAccessible::GetChildCount() + item->GetRowIndex();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTreeAccessible: public implementation
|
||||
|
||||
|
@ -747,6 +774,67 @@ nsXULTreeItemAccessibleBase::GetUniqueID(void **aUniqueID)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTreeItemAccessibleBase: nsIAccessible implementation
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeItemAccessibleBase::GetParent(nsIAccessible **aParent)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aParent);
|
||||
*aParent = nsnull;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (mParent) {
|
||||
*aParent = mParent;
|
||||
NS_ADDREF(*aParent);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeItemAccessibleBase::GetNextSibling(nsIAccessible **aNextSibling)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aNextSibling);
|
||||
*aNextSibling = nsnull;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsRefPtr<nsXULTreeAccessible> treeAcc =
|
||||
nsAccUtils::QueryAccessibleTree(mParent);
|
||||
NS_ENSURE_STATE(treeAcc);
|
||||
|
||||
PRInt32 rowCount = 0;
|
||||
mTreeView->GetRowCount(&rowCount);
|
||||
if (mRow + 1 >= rowCount)
|
||||
return NS_OK;
|
||||
|
||||
treeAcc->GetTreeItemAccessible(mRow + 1, aNextSibling);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeItemAccessibleBase::GetPreviousSibling(nsIAccessible **aPreviousSibling)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPreviousSibling);
|
||||
*aPreviousSibling = nsnull;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsRefPtr<nsXULTreeAccessible> treeAcc =
|
||||
nsAccUtils::QueryAccessibleTree(mParent);
|
||||
NS_ENSURE_STATE(treeAcc);
|
||||
|
||||
// Get previous row accessible or tree columns accessible.
|
||||
if (mRow > 0)
|
||||
treeAcc->GetTreeItemAccessible(mRow - 1, aPreviousSibling);
|
||||
else
|
||||
treeAcc->GetFirstChild(aPreviousSibling);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeItemAccessibleBase::GetFocusedChild(nsIAccessible **aFocusedChild)
|
||||
{
|
||||
|
@ -960,7 +1048,7 @@ nsXULTreeItemAccessibleBase::Shutdown()
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTreeItemAccessibleBase: nsAccessible public methods
|
||||
// nsXULTreeItemAccessibleBase: nsAccessible implementation
|
||||
|
||||
nsresult
|
||||
nsXULTreeItemAccessibleBase::GetAttributesInternal(nsIPersistentProperties *aAttributes)
|
||||
|
@ -1070,14 +1158,8 @@ nsXULTreeItemAccessibleBase::GetStateInternal(PRUint32 *aState,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIAccessible*
|
||||
nsXULTreeItemAccessibleBase::GetParent()
|
||||
{
|
||||
return IsDefunct() ? nsnull : mParent;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTreeItemAccessibleBase: nsAccessible protected methods
|
||||
// nsXULTreeItemAccessibleBase: protected implementation
|
||||
|
||||
void
|
||||
nsXULTreeItemAccessibleBase::DispatchClickEvent(nsIContent *aContent,
|
||||
|
@ -1108,41 +1190,6 @@ nsXULTreeItemAccessibleBase::DispatchClickEvent(nsIContent *aContent,
|
|||
nsCoreUtils::DispatchClickEvent(mTree, mRow, column, pseudoElm);
|
||||
}
|
||||
|
||||
nsIAccessible*
|
||||
nsXULTreeItemAccessibleBase::GetSiblingAtOffset(PRInt32 aOffset,
|
||||
nsresult* aError)
|
||||
{
|
||||
if (mRow + aOffset < 0)
|
||||
return nsAccessible::GetSiblingAtOffset(mRow + aOffset, aError);
|
||||
|
||||
if (IsDefunct()) {
|
||||
if (aError)
|
||||
*aError = NS_ERROR_FAILURE;
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
if (aError)
|
||||
*aError = NS_OK; // fail peacefully
|
||||
|
||||
nsRefPtr<nsXULTreeAccessible> treeAcc =
|
||||
nsAccUtils::QueryAccessibleTree(mParent);
|
||||
if (!treeAcc)
|
||||
return nsnull;
|
||||
|
||||
PRInt32 rowCount = 0;
|
||||
mTreeView->GetRowCount(&rowCount);
|
||||
if (mRow + aOffset >= rowCount)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessible> sibling;
|
||||
treeAcc->GetTreeItemAccessible(mRow + aOffset, getter_AddRefs(sibling));
|
||||
return sibling;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTreeItemAccessibleBase: protected implementation
|
||||
|
||||
PRBool
|
||||
nsXULTreeItemAccessibleBase::IsExpandable()
|
||||
{
|
||||
|
@ -1183,6 +1230,33 @@ nsXULTreeItemAccessible(nsIDOMNode *aDOMNode, nsIWeakReference *aShell,
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTreeItemAccessible: nsIAccessible implementation
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeItemAccessible::GetFirstChild(nsIAccessible **aFirstChild)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aFirstChild);
|
||||
*aFirstChild = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeItemAccessible::GetLastChild(nsIAccessible **aLastChild)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aLastChild);
|
||||
*aLastChild = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeItemAccessible::GetChildCount(PRInt32 *aChildCount)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aChildCount);
|
||||
*aChildCount = 0;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeItemAccessible::GetName(nsAString& aName)
|
||||
{
|
||||
|
@ -1264,14 +1338,6 @@ nsXULTreeItemAccessible::RowInvalidated(PRInt32 aStartColIdx,
|
|||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTreeItemAccessible: nsAccessible protected implementation
|
||||
|
||||
void
|
||||
nsXULTreeItemAccessible::CacheChildren()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTreeColumnsAccessible
|
||||
|
@ -1283,22 +1349,11 @@ nsXULTreeColumnsAccessible::
|
|||
{
|
||||
}
|
||||
|
||||
nsIAccessible*
|
||||
nsXULTreeColumnsAccessible::GetSiblingAtOffset(PRInt32 aOffset,
|
||||
nsresult* aError)
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeColumnsAccessible::GetNextSibling(nsIAccessible **aNextSibling)
|
||||
{
|
||||
if (aOffset < 0)
|
||||
return nsXULColumnsAccessible::GetSiblingAtOffset(aOffset, aError);
|
||||
|
||||
if (IsDefunct()) {
|
||||
if (aError)
|
||||
*aError = NS_ERROR_FAILURE;
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
if (aError)
|
||||
*aError = NS_OK; // fail peacefully
|
||||
NS_ENSURE_ARG_POINTER(aNextSibling);
|
||||
*aNextSibling = nsnull;
|
||||
|
||||
nsCOMPtr<nsITreeBoxObject> tree;
|
||||
nsCOMPtr<nsITreeView> treeView;
|
||||
|
@ -1309,19 +1364,16 @@ nsXULTreeColumnsAccessible::GetSiblingAtOffset(PRInt32 aOffset,
|
|||
if (treeView) {
|
||||
PRInt32 rowCount = 0;
|
||||
treeView->GetRowCount(&rowCount);
|
||||
if (rowCount > 0 && aOffset <= rowCount) {
|
||||
if (rowCount > 0) {
|
||||
nsRefPtr<nsXULTreeAccessible> treeAcc =
|
||||
nsAccUtils::QueryAccessibleTree(mParent);
|
||||
NS_ENSURE_STATE(treeAcc);
|
||||
|
||||
if (treeAcc) {
|
||||
nsCOMPtr<nsIAccessible> sibling;
|
||||
treeAcc->GetTreeItemAccessible(aOffset - 1, getter_AddRefs(sibling));
|
||||
return sibling;
|
||||
}
|
||||
treeAcc->GetTreeItemAccessible(0, aNextSibling);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,6 +73,12 @@ public:
|
|||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetValue(nsAString& aValue);
|
||||
|
||||
NS_IMETHOD GetFirstChild(nsIAccessible **aFirstChild);
|
||||
NS_IMETHOD GetLastChild(nsIAccessible **aLastChild);
|
||||
NS_IMETHOD GetChildCount(PRInt32 *aChildCount);
|
||||
NS_IMETHOD GetChildAt(PRInt32 aChildIndex, nsIAccessible **aChild);
|
||||
|
||||
NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild);
|
||||
|
||||
// nsIAccessibleSelectable
|
||||
|
@ -89,10 +95,6 @@ public:
|
|||
PRBool aDeepestChild,
|
||||
nsIAccessible **aChild);
|
||||
|
||||
virtual nsIAccessible* GetChildAt(PRUint32 aIndex);
|
||||
virtual PRInt32 GetChildCount();
|
||||
virtual PRInt32 GetIndexOf(nsIAccessible *aChild);
|
||||
|
||||
// nsXULTreeAccessible
|
||||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_XULTREEACCESSIBLE_IMPL_CID)
|
||||
|
@ -176,6 +178,10 @@ public:
|
|||
NS_IMETHOD GetUniqueID(void **aUniqueID);
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetParent(nsIAccessible **aParent);
|
||||
NS_IMETHOD GetNextSibling(nsIAccessible **aNextSibling);
|
||||
NS_IMETHOD GetPreviousSibling(nsIAccessible **aPreviousSibling);
|
||||
|
||||
NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild);
|
||||
|
||||
NS_IMETHOD GetBounds(PRInt32 *aX, PRInt32 *aY,
|
||||
|
@ -198,16 +204,10 @@ public:
|
|||
// nsAccessible
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual nsIAccessible* GetParent();
|
||||
|
||||
// nsXULTreeItemAccessibleBase
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_XULTREEITEMBASEACCESSIBLE_IMPL_CID)
|
||||
|
||||
/**
|
||||
* Return row index associated with the accessible.
|
||||
*/
|
||||
PRInt32 GetRowIndex() const { return mRow; }
|
||||
|
||||
/**
|
||||
* Return cell accessible for the given column. If XUL tree accessible is not
|
||||
* accessible table then return null.
|
||||
|
@ -226,8 +226,6 @@ protected:
|
|||
|
||||
// nsAccessible
|
||||
virtual void DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex);
|
||||
virtual nsIAccessible* GetSiblingAtOffset(PRInt32 aOffset,
|
||||
nsresult* aError = nsnull);
|
||||
|
||||
// nsXULTreeItemAccessibleBase
|
||||
|
||||
|
@ -255,6 +253,11 @@ public:
|
|||
nsIAccessible *aParent, nsITreeBoxObject *aTree,
|
||||
nsITreeView *aTreeView, PRInt32 aRow);
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetFirstChild(nsIAccessible **aFirstChild);
|
||||
NS_IMETHOD GetLastChild(nsIAccessible **aLastChild);
|
||||
NS_IMETHOD GetChildCount(PRInt32 *aChildCount);
|
||||
|
||||
NS_IMETHOD GetName(nsAString& aName);
|
||||
|
||||
// nsAccessNode
|
||||
|
@ -269,11 +272,6 @@ public:
|
|||
virtual void RowInvalidated(PRInt32 aStartColIdx, PRInt32 aEndColIdx);
|
||||
|
||||
protected:
|
||||
|
||||
// nsAccessible
|
||||
virtual void CacheChildren();
|
||||
|
||||
// nsXULTreeItemAccessible
|
||||
nsCOMPtr<nsITreeColumn> mColumn;
|
||||
nsString mCachedName;
|
||||
};
|
||||
|
@ -287,10 +285,8 @@ class nsXULTreeColumnsAccessible : public nsXULColumnsAccessible
|
|||
public:
|
||||
nsXULTreeColumnsAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
|
||||
protected:
|
||||
|
||||
// nsAccessible
|
||||
nsIAccessible* GetSiblingAtOffset(PRInt32 aOffset, nsresult* aError = nsnull);
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetNextSibling(nsIAccessible **aNextSibling);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -95,15 +95,15 @@ nsXULTreeGridAccessible::GetSummary(nsAString &aSummary)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeGridAccessible::GetColumnCount(PRInt32 *aColumnCount)
|
||||
nsXULTreeGridAccessible::GetColumnCount(PRInt32 *acolumnCount)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aColumnCount);
|
||||
*aColumnCount = 0;
|
||||
NS_ENSURE_ARG_POINTER(acolumnCount);
|
||||
*acolumnCount = 0;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aColumnCount = nsCoreUtils::GetSensibleColumnCount(mTree);
|
||||
*acolumnCount = nsCoreUtils::GetSensiblecolumnCount(mTree);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -635,6 +635,77 @@ NS_IMPL_ADDREF_INHERITED(nsXULTreeGridRowAccessible,
|
|||
NS_IMPL_RELEASE_INHERITED(nsXULTreeGridRowAccessible,
|
||||
nsXULTreeItemAccessibleBase)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTreeGridRowAccessible: nsIAccessible implementation
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeGridRowAccessible::GetFirstChild(nsIAccessible **aFirstChild)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aFirstChild);
|
||||
*aFirstChild = nsnull;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsITreeColumn> column = nsCoreUtils::GetFirstSensibleColumn(mTree);
|
||||
NS_ASSERTION(column, "No column for table grid!");
|
||||
if (!column)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
GetCellAccessible(column, aFirstChild);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeGridRowAccessible::GetLastChild(nsIAccessible **aLastChild)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aLastChild);
|
||||
*aLastChild = nsnull;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsITreeColumn> column = nsCoreUtils::GetLastSensibleColumn(mTree);
|
||||
NS_ASSERTION(column, "No column for table grid!");
|
||||
if (!column)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
GetCellAccessible(column, aLastChild);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeGridRowAccessible::GetChildCount(PRInt32 *aChildCount)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aChildCount);
|
||||
*aChildCount = 0;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aChildCount = nsCoreUtils::GetSensiblecolumnCount(mTree);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeGridRowAccessible::GetChildAt(PRInt32 aChildIndex,
|
||||
nsIAccessible **aChild)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aChild);
|
||||
*aChild = nsnull;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsITreeColumn> column =
|
||||
nsCoreUtils::GetSensibleColumnAt(mTree, aChildIndex);
|
||||
if (!column)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
GetCellAccessible(column, aChild);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTreeGridRowAccessible: nsAccessNode implementation
|
||||
|
||||
|
@ -689,43 +760,6 @@ nsXULTreeGridRowAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIAccessible*
|
||||
nsXULTreeGridRowAccessible::GetChildAt(PRUint32 aIndex)
|
||||
{
|
||||
if (IsDefunct())
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsITreeColumn> column =
|
||||
nsCoreUtils::GetSensibleColumnAt(mTree, aIndex);
|
||||
if (!column)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessible> cell;
|
||||
GetCellAccessible(column, getter_AddRefs(cell));
|
||||
return cell;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsXULTreeGridRowAccessible::GetChildCount()
|
||||
{
|
||||
if (IsDefunct())
|
||||
return -1;
|
||||
|
||||
return nsCoreUtils::GetSensibleColumnCount(mTree);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsXULTreeGridRowAccessible::GetIndexOf(nsIAccessible *aChild)
|
||||
{
|
||||
if (IsDefunct())
|
||||
return -1;
|
||||
|
||||
nsRefPtr<nsXULTreeGridCellAccessible> cell =
|
||||
nsAccUtils::QueryObject<nsXULTreeGridCellAccessible>(aChild);
|
||||
|
||||
return cell ? cell->GetColumnIndex() : -1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTreeGridRowAccessible: nsXULTreeItemAccessibleBase implementation
|
||||
|
||||
|
@ -784,13 +818,6 @@ nsXULTreeGridRowAccessible::RowInvalidated(PRInt32 aStartColIdx,
|
|||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTreeGridRowAccessible: nsAccessible protected implementation
|
||||
|
||||
void
|
||||
nsXULTreeGridRowAccessible::CacheChildren()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTreeGridCellAccessible
|
||||
|
@ -830,6 +857,64 @@ nsXULTreeGridCellAccessible::GetUniqueID(void **aUniqueID)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTreeGridCellAccessible: nsIAccessible implementation
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeGridCellAccessible::GetParent(nsIAccessible **aParent)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aParent);
|
||||
*aParent = nsnull;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (mParent) {
|
||||
*aParent = mParent;
|
||||
NS_ADDREF(*aParent);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeGridCellAccessible::GetNextSibling(nsIAccessible **aNextSibling)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aNextSibling);
|
||||
*aNextSibling = nsnull;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsITreeColumn> nextColumn =
|
||||
nsCoreUtils::GetNextSensibleColumn(mColumn);
|
||||
if (!nextColumn)
|
||||
return NS_OK;
|
||||
|
||||
nsRefPtr<nsXULTreeItemAccessibleBase> rowAcc =
|
||||
nsAccUtils::QueryObject<nsXULTreeItemAccessibleBase>(mParent);
|
||||
rowAcc->GetCellAccessible(nextColumn, aNextSibling);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeGridCellAccessible::GetPreviousSibling(nsIAccessible **aPreviousSibling)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPreviousSibling);
|
||||
*aPreviousSibling = nsnull;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsITreeColumn> nextColumn =
|
||||
nsCoreUtils::GetPreviousSensibleColumn(mColumn);
|
||||
if (!nextColumn)
|
||||
return NS_OK;
|
||||
|
||||
nsRefPtr<nsXULTreeItemAccessibleBase> rowAcc =
|
||||
nsAccUtils::QueryObject<nsXULTreeItemAccessibleBase>(mParent);
|
||||
rowAcc->GetCellAccessible(nextColumn, aPreviousSibling);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeGridCellAccessible::GetFocusedChild(nsIAccessible **aFocusedChild)
|
||||
{
|
||||
|
@ -1134,7 +1219,7 @@ nsXULTreeGridCellAccessible::Init()
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTreeGridCellAccessible: nsAccessible public implementation
|
||||
// nsXULTreeGridCellAccessible: nsAccessible implementation
|
||||
|
||||
nsresult
|
||||
nsXULTreeGridCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
|
||||
|
@ -1222,12 +1307,6 @@ nsXULTreeGridCellAccessible::GetStateInternal(PRUint32 *aStates,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIAccessible*
|
||||
nsXULTreeGridCellAccessible::GetParent()
|
||||
{
|
||||
return IsDefunct() ? nsnull : mParent;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTreeGridCellAccessible: public implementation
|
||||
|
||||
|
@ -1273,46 +1352,7 @@ nsXULTreeGridCellAccessible::CellInvalidated()
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTreeGridCellAccessible: nsAccessible protected implementation
|
||||
|
||||
nsIAccessible*
|
||||
nsXULTreeGridCellAccessible::GetSiblingAtOffset(PRInt32 aOffset,
|
||||
nsresult* aError)
|
||||
{
|
||||
if (IsDefunct()) {
|
||||
if (aError)
|
||||
*aError = NS_ERROR_FAILURE;
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
if (aError)
|
||||
*aError = NS_OK; // fail peacefully
|
||||
|
||||
nsCOMPtr<nsITreeColumn> columnAtOffset(mColumn), column;
|
||||
if (aOffset < 0) {
|
||||
for (PRInt32 index = aOffset; index < 0 && columnAtOffset; index++) {
|
||||
column = nsCoreUtils::GetPreviousSensibleColumn(columnAtOffset);
|
||||
column.swap(columnAtOffset);
|
||||
}
|
||||
} else {
|
||||
for (PRInt32 index = aOffset; index > 0 && columnAtOffset; index--) {
|
||||
column = nsCoreUtils::GetNextSensibleColumn(columnAtOffset);
|
||||
column.swap(columnAtOffset);
|
||||
}
|
||||
}
|
||||
|
||||
if (!columnAtOffset)
|
||||
return nsnull;
|
||||
|
||||
nsRefPtr<nsXULTreeItemAccessibleBase> rowAcc =
|
||||
nsAccUtils::QueryObject<nsXULTreeItemAccessibleBase>(mParent);
|
||||
|
||||
nsCOMPtr<nsIAccessible> sibling;
|
||||
rowAcc->GetCellAccessible(columnAtOffset, getter_AddRefs(sibling));
|
||||
|
||||
return sibling;
|
||||
}
|
||||
// nsXULTreeGridCellAccessible: protected implementation
|
||||
|
||||
void
|
||||
nsXULTreeGridCellAccessible::DispatchClickEvent(nsIContent *aContent,
|
||||
|
@ -1324,9 +1364,6 @@ nsXULTreeGridCellAccessible::DispatchClickEvent(nsIContent *aContent,
|
|||
nsCoreUtils::DispatchClickEvent(mTree, mRow, mColumn);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTreeGridCellAccessible: protected implementation
|
||||
|
||||
PRBool
|
||||
nsXULTreeGridCellAccessible::IsEditable() const
|
||||
{
|
||||
|
|
|
@ -86,6 +86,12 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXULTreeGridRowAccessible,
|
||||
nsAccessible)
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetFirstChild(nsIAccessible **aFirstChild);
|
||||
NS_IMETHOD GetLastChild(nsIAccessible **aLastChild);
|
||||
NS_IMETHOD GetChildCount(PRInt32 *aChildCount);
|
||||
NS_IMETHOD GetChildAt(PRInt32 aChildIndex, nsIAccessible **aChild);
|
||||
|
||||
// nsAccessNode
|
||||
virtual nsresult Shutdown();
|
||||
|
||||
|
@ -95,20 +101,11 @@ public:
|
|||
PRBool aDeepestChild,
|
||||
nsIAccessible **aChild);
|
||||
|
||||
virtual nsIAccessible* GetChildAt(PRUint32 aIndex);
|
||||
virtual PRInt32 GetChildCount();
|
||||
virtual PRInt32 GetIndexOf(nsIAccessible *aChild);
|
||||
|
||||
// nsXULTreeItemAccessibleBase
|
||||
virtual void GetCellAccessible(nsITreeColumn *aColumn, nsIAccessible **aCell);
|
||||
virtual void RowInvalidated(PRInt32 aStartColIdx, PRInt32 aEndColIdx);
|
||||
|
||||
protected:
|
||||
|
||||
// nsAccessible
|
||||
virtual void CacheChildren();
|
||||
|
||||
// nsXULTreeItemAccessibleBase
|
||||
nsAccessNodeHashtable mAccessNodeCache;
|
||||
};
|
||||
|
||||
|
@ -142,6 +139,10 @@ public:
|
|||
NS_IMETHOD GetUniqueID(void **aUniqueID);
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetParent(nsIAccessible **aParent);
|
||||
NS_IMETHOD GetNextSibling(nsIAccessible **aNextSibling);
|
||||
NS_IMETHOD GetPreviousSibling(nsIAccessible **aPrevSibling);
|
||||
|
||||
NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild);
|
||||
|
||||
NS_IMETHOD GetName(nsAString& aName);
|
||||
|
@ -164,8 +165,6 @@ public:
|
|||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
|
||||
virtual nsIAccessible* GetParent();
|
||||
|
||||
// nsXULTreeGridCellAccessible
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_XULTREEGRIDCELLACCESSIBLE_IMPL_CID)
|
||||
|
||||
|
@ -182,8 +181,6 @@ public:
|
|||
|
||||
protected:
|
||||
// nsAccessible
|
||||
virtual nsIAccessible* GetSiblingAtOffset(PRInt32 aOffset,
|
||||
nsresult* aError = nsnull);
|
||||
virtual void DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex);
|
||||
|
||||
// nsXULTreeGridCellAccessible
|
||||
|
|
|
@ -108,13 +108,14 @@ _TEST_FILES =\
|
|||
test_groupattrs.xul \
|
||||
test_groupattrs.html \
|
||||
test_invalidate_accessnode.html \
|
||||
test_invalidate_elmli.html \
|
||||
test_name.html \
|
||||
test_name.xul \
|
||||
test_name_button.html \
|
||||
test_name_link.html \
|
||||
test_name_markup.html \
|
||||
test_name_nsApplicationAcc.html \
|
||||
test_name_nsRootAcc.xul \
|
||||
test_nsIAccessible_applicationAccessible.html \
|
||||
$(warning test_nsIAccessible_comboboxes.xul temporarily disabled) \
|
||||
test_nsIAccessible_selects.html \
|
||||
test_nsIAccessible_focus.html \
|
||||
|
|
|
@ -270,35 +270,6 @@ function getRootAccessible(aAccOrElmOrID)
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return application accessible.
|
||||
*/
|
||||
function getApplicationAccessible()
|
||||
{
|
||||
var acc = getAccessible(document), parent = null;
|
||||
while (acc) {
|
||||
|
||||
try {
|
||||
parent = acc.parent;
|
||||
} catch (e) {
|
||||
ok(false, "Can't get a parent for " + prettyName(acc));
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!parent) {
|
||||
if (acc.role == ROLE_APP_ROOT)
|
||||
return acc;
|
||||
|
||||
ok(false, "No application accessible!");
|
||||
return null;
|
||||
}
|
||||
|
||||
acc = parent;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run through accessible tree of the given identifier so that we ensure
|
||||
* accessible tree is created.
|
||||
|
@ -385,12 +356,6 @@ function testAccessibleTree(aAccOrElmOrID, aAccTree)
|
|||
try { parent = child.parent; } catch (e) {}
|
||||
is(parent, acc, "Wrong parent of " + prettyName(child));
|
||||
|
||||
// nsIAccessible::indexInParent
|
||||
var indexInParent = -1;
|
||||
try { indexInParent = child.indexInParent; } catch(e) {}
|
||||
is(indexInParent, i,
|
||||
"Wrong index in parent of " + prettyName(child));
|
||||
|
||||
// nsIAccessible::nextSibling
|
||||
var expectedNextSibling = (i < childCount - 1) ?
|
||||
children.queryElementAt(i + 1, nsIAccessible) : null;
|
||||
|
@ -414,84 +379,6 @@ function testAccessibleTree(aAccOrElmOrID, aAccTree)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test accessible tree for defunct accessible.
|
||||
*
|
||||
* @param aAcc [in] the defunct accessible
|
||||
* @param aNodeOrId [in] the DOM node identifier for the defunct accessible
|
||||
*/
|
||||
function testDefunctAccessible(aAcc, aNodeOrId)
|
||||
{
|
||||
if (aNodeOrId)
|
||||
ok(!isAccessible(aNodeOrId),
|
||||
"Accessible for " + aNodeOrId + " wasn't properly shut down!");
|
||||
|
||||
var msg = " doesn't fail for shut down accessible " + prettyName(aNodeOrId) + "!";
|
||||
|
||||
// firstChild
|
||||
var success = false;
|
||||
try {
|
||||
aAcc.firstChild;
|
||||
} catch (e) {
|
||||
success = (e.result == Components.results.NS_ERROR_FAILURE)
|
||||
}
|
||||
ok(success, "firstChild" + msg);
|
||||
|
||||
// lastChild
|
||||
success = false;
|
||||
try {
|
||||
aAcc.lastChild;
|
||||
} catch (e) {
|
||||
success = (e.result == Components.results.NS_ERROR_FAILURE)
|
||||
}
|
||||
ok(success, "lastChild" + msg);
|
||||
|
||||
// childCount
|
||||
success = false;
|
||||
try {
|
||||
aAcc.childCount;
|
||||
} catch (e) {
|
||||
success = (e.result == Components.results.NS_ERROR_FAILURE)
|
||||
}
|
||||
ok(success, "childCount" + msg);
|
||||
|
||||
// children
|
||||
success = false;
|
||||
try {
|
||||
aAcc.children;
|
||||
} catch (e) {
|
||||
success = (e.result == Components.results.NS_ERROR_FAILURE)
|
||||
}
|
||||
ok(success, "children" + msg);
|
||||
|
||||
// nextSibling
|
||||
success = false;
|
||||
try {
|
||||
aAcc.nextSibling;
|
||||
} catch (e) {
|
||||
success = (e.result == Components.results.NS_ERROR_FAILURE);
|
||||
}
|
||||
ok(success, "nextSibling" + msg);
|
||||
|
||||
// previousSibling
|
||||
success = false;
|
||||
try {
|
||||
aAcc.previousSibling;
|
||||
} catch (e) {
|
||||
success = (e.result == Components.results.NS_ERROR_FAILURE);
|
||||
}
|
||||
ok(success, "previousSibling" + msg);
|
||||
|
||||
// parent
|
||||
success = false;
|
||||
try {
|
||||
aAcc.parent;
|
||||
} catch (e) {
|
||||
success = (e.result == Components.results.NS_ERROR_FAILURE);
|
||||
}
|
||||
ok(success, "parent" + msg);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert role to human readable string.
|
||||
|
|
|
@ -8,7 +8,6 @@ const ROLE_AUTOCOMPLETE = nsIAccessibleRole.ROLE_AUTOCOMPLETE;
|
|||
const ROLE_BUTTONDROPDOWNGRID = nsIAccessibleRole.ROLE_BUTTONDROPDOWNGRID;
|
||||
const ROLE_CAPTION = nsIAccessibleRole.ROLE_CAPTION;
|
||||
const ROLE_CELL = nsIAccessibleRole.ROLE_CELL;
|
||||
const ROLE_CHECKBUTTON = nsIAccessibleRole.ROLE_CHECKBUTTON;
|
||||
const ROLE_CHROME_WINDOW = nsIAccessibleRole.ROLE_CHROME_WINDOW;
|
||||
const ROLE_COMBOBOX = nsIAccessibleRole.ROLE_COMBOBOX;
|
||||
const ROLE_COMBOBOX_LIST = nsIAccessibleRole.ROLE_COMBOBOX_LIST;
|
||||
|
@ -41,11 +40,9 @@ const ROLE_PARENT_MENUITEM = nsIAccessibleRole.ROLE_PARENT_MENUITEM;
|
|||
const ROLE_PASSWORD_TEXT = nsIAccessibleRole.ROLE_PASSWORD_TEXT;
|
||||
const ROLE_PROGRESSBAR = nsIAccessibleRole.ROLE_PROGRESSBAR;
|
||||
const ROLE_PUSHBUTTON = nsIAccessibleRole.ROLE_PUSHBUTTON;
|
||||
const ROLE_RADIOBUTTON = nsIAccessibleRole.ROLE_RADIOBUTTON;
|
||||
const ROLE_ROW = nsIAccessibleRole.ROLE_ROW;
|
||||
const ROLE_ROWHEADER = nsIAccessibleRole.ROLE_ROWHEADER;
|
||||
const ROLE_SECTION = nsIAccessibleRole.ROLE_SECTION;
|
||||
const ROLE_SEPARATOR = nsIAccessibleRole.ROLE_SEPARATOR;
|
||||
const ROLE_SLIDER = nsIAccessibleRole.ROLE_SLIDER;
|
||||
const ROLE_STATICTEXT = nsIAccessibleRole.ROLE_STATICTEXT;
|
||||
const ROLE_TABLE = nsIAccessibleRole.ROLE_TABLE;
|
||||
|
@ -53,7 +50,6 @@ const ROLE_TEXT_CONTAINER = nsIAccessibleRole.ROLE_TEXT_CONTAINER;
|
|||
const ROLE_TEXT_LEAF = nsIAccessibleRole.ROLE_TEXT_LEAF;
|
||||
const ROLE_TOGGLE_BUTTON = nsIAccessibleRole.ROLE_TOGGLE_BUTTON;
|
||||
const ROLE_TREE_TABLE = nsIAccessibleRole.ROLE_TREE_TABLE;
|
||||
const ROLE_WHITESPACE = nsIAccessibleRole.ROLE_WHITESPACE;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
|
|
|
@ -47,12 +47,7 @@
|
|||
var docAcc = getAccessible(document);
|
||||
while (docAcc) {
|
||||
this.mRootAcc = docAcc;
|
||||
try {
|
||||
docAcc = docAcc.parent;
|
||||
} catch (e) {
|
||||
ok(false, "Can't get parent for " + prettyName(docAcc));
|
||||
throw e;
|
||||
}
|
||||
docAcc = docAcc.parent;
|
||||
}
|
||||
|
||||
this.eventSeq = [
|
||||
|
|
|
@ -23,6 +23,47 @@
|
|||
////////////////////////////////////////////////////////////////////////////
|
||||
// Helpers
|
||||
|
||||
function testDefunctAccessible(aAcc, aNodeOrId)
|
||||
{
|
||||
if (aNodeOrId)
|
||||
ok(!isAccessible(aNodeOrId),
|
||||
"Accessible for " + aNodeOrId + " wasn't properly shut down!");
|
||||
|
||||
ok(!aAcc.firstChild, "There is first child for shut down accessible!");
|
||||
ok(!aAcc.lastChild, "There is last child for shut down accessible!");
|
||||
ok(!aAcc.children.length, "There are children for shut down accessible!");
|
||||
|
||||
// nextSibling
|
||||
var success = false;
|
||||
try {
|
||||
aAcc.nextSibling;
|
||||
} catch (e) {
|
||||
success = (e.result == Components.results.NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
ok(success, "There is next sibling for shut down accessible!");
|
||||
|
||||
// previousSibling
|
||||
var success = false;
|
||||
try {
|
||||
aAcc.previousSibling;
|
||||
} catch (e) {
|
||||
success = (e.result == Components.results.NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
ok(success, "There is previous sibling for shut down accessible!");
|
||||
|
||||
// parent
|
||||
var success = false;
|
||||
try {
|
||||
aAcc.parent;
|
||||
} catch (e) {
|
||||
success = (e.result == Components.results.NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
ok(success, "There is parent for shut down accessible!");
|
||||
}
|
||||
|
||||
function testLiAccessibleTree()
|
||||
{
|
||||
// Test accessible tree.
|
||||
|
@ -60,14 +101,12 @@
|
|||
this.onProcessed = function hideProcessor_onProcessed()
|
||||
{
|
||||
window.setTimeout(
|
||||
function(aLiAcc, aLiNode, aBulletAcc)
|
||||
function(aArg1, aArg2)
|
||||
{
|
||||
testDefunctAccessible(aLiAcc, aLiNode);
|
||||
testDefunctAccessible(aBulletAcc);
|
||||
|
||||
testDefunctAccessible(aArg1, aArg2);
|
||||
gSequence.processNext();
|
||||
},
|
||||
0, this.li, this.liNode, this.bullet
|
||||
0, this.li, this.liNode
|
||||
);
|
||||
}
|
||||
};
|
|
@ -7,20 +7,22 @@
|
|||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js">
|
||||
</script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
|
||||
src="chrome://mochikit/content/a11y/accessible/common.js" ></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function doTest()
|
||||
{
|
||||
var accessible = getApplicationAccessible();
|
||||
var accessible = getAccessible(document);
|
||||
while (accessible && accessible.parent) {
|
||||
accessible = accessible.parent;
|
||||
}
|
||||
|
||||
if (!accessible) {
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
var bundleServ = Components.classes["@mozilla.org/intl/stringbundle;1"]
|
|
@ -50,18 +50,10 @@ _TEST_FILES =\
|
|||
test_colorpicker.xul \
|
||||
test_combobox.xul \
|
||||
test_filectrl.html \
|
||||
test_formctrl.html \
|
||||
test_formctrl.xul \
|
||||
test_groupbox.xul \
|
||||
test_iframe.html \
|
||||
test_img.html \
|
||||
test_list.html \
|
||||
test_list_invalidate.html \
|
||||
test_media.html \
|
||||
test_menu.xul \
|
||||
test_select.html \
|
||||
test_tree.xul \
|
||||
test_txtcntr.html \
|
||||
test_txtctrl.html \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>HTML form controls tests</title>
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function doTest()
|
||||
{
|
||||
// input@type="checkbox"
|
||||
var accTree = {
|
||||
role: ROLE_CHECKBUTTON,
|
||||
children: [ ]
|
||||
};
|
||||
|
||||
testAccessibleTree("checkbox", accTree);
|
||||
|
||||
// input@type="radio"
|
||||
accTree = {
|
||||
role: ROLE_RADIOBUTTON,
|
||||
children: [ ]
|
||||
};
|
||||
|
||||
testAccessibleTree("radio", accTree);
|
||||
|
||||
// input@type="button" and button
|
||||
accTree = {
|
||||
role: ROLE_PUSHBUTTON,
|
||||
children: [ ]
|
||||
};
|
||||
|
||||
testAccessibleTree("btn1", accTree);
|
||||
|
||||
// button
|
||||
accTree = {
|
||||
role: ROLE_PUSHBUTTON,
|
||||
children: [
|
||||
{
|
||||
role: ROLE_TEXT_LEAF
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
testAccessibleTree("btn2", accTree);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a target="_blank"
|
||||
title="Fix O(n^2) access to all the children of a container"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=342045">
|
||||
Mozilla Bug 342045
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<input type="checkbox" id="checkbox">
|
||||
<input type="radio" id="radio">
|
||||
<input type="button" value="button" id="btn1">
|
||||
<button id="btn2">button</button>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,83 +0,0 @@
|
|||
<?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="Accessible XUL checkbox and radio hierarchy tests">
|
||||
|
||||
<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/a11y/accessible/common.js" />
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/role.js" />
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Test
|
||||
|
||||
function doTest()
|
||||
{
|
||||
// checkbox
|
||||
var accTree = {
|
||||
role: ROLE_CHECKBUTTON,
|
||||
children: [ ]
|
||||
};
|
||||
|
||||
testAccessibleTree("checkbox", accTree);
|
||||
|
||||
// radiogroup
|
||||
accTree = {
|
||||
role: ROLE_GROUPING,
|
||||
children: [
|
||||
{
|
||||
role: ROLE_RADIOBUTTON,
|
||||
children: [ ]
|
||||
},
|
||||
{
|
||||
role: ROLE_RADIOBUTTON,
|
||||
children: [ ]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
testAccessibleTree("radiogroup", accTree);
|
||||
|
||||
SimpleTest.finish()
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
]]>
|
||||
</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=342045"
|
||||
title="Fix O(n^2) access to all the children of a container">
|
||||
Mozilla Bug 342045
|
||||
</a><br/>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
|
||||
<vbox flex="1">
|
||||
<checkbox id="checkbox" label="checkbox"/>
|
||||
<radiogroup id="radiogroup">
|
||||
<radio label="radio1"/>
|
||||
<radio label="radio2"/>
|
||||
</radiogroup>
|
||||
</vbox>
|
||||
</hbox>
|
||||
|
||||
</window>
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
<?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="Accessible XUL groupbox hierarchy tests">
|
||||
|
||||
<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/a11y/accessible/common.js" />
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/role.js" />
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Test
|
||||
|
||||
function doTest()
|
||||
{
|
||||
accTree = {
|
||||
role: ROLE_GROUPING,
|
||||
children: [
|
||||
{
|
||||
role: ROLE_LABEL,
|
||||
children: [ ]
|
||||
},
|
||||
{
|
||||
role: ROLE_CHECKBUTTON,
|
||||
children: [ ]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
testAccessibleTree("groupbox", accTree);
|
||||
|
||||
SimpleTest.finish()
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
]]>
|
||||
</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=342045"
|
||||
title="Fix O(n^2) access to all the children of a container">
|
||||
Mozilla Bug 342045
|
||||
</a><br/>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
|
||||
<vbox flex="1">
|
||||
<groupbox id="groupbox">
|
||||
<caption label="Some caption" />
|
||||
<checkbox label="some checkbox label" />
|
||||
</groupbox>
|
||||
</vbox>
|
||||
</hbox>
|
||||
|
||||
</window>
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Outer document accessible tests</title>
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function doTest()
|
||||
{
|
||||
var accTree = {
|
||||
role: ROLE_INTERNAL_FRAME,
|
||||
children: [
|
||||
{
|
||||
role: ROLE_DOCUMENT
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
testAccessibleTree("iframe", accTree);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a target="_blank"
|
||||
title="Fix O(n^2) access to all the children of a container"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=342045">
|
||||
Mozilla Bug 342045
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<iframe id="iframe" src="about:mozilla">
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,79 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML img tests</title>
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function doTest()
|
||||
{
|
||||
// image map
|
||||
var accTree = {
|
||||
role: ROLE_IMAGE_MAP,
|
||||
children: [
|
||||
{
|
||||
role: ROLE_LINK,
|
||||
children: []
|
||||
},
|
||||
{
|
||||
role: ROLE_LINK,
|
||||
children: []
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
testAccessibleTree("imgmap", accTree);
|
||||
|
||||
// img
|
||||
accTree = {
|
||||
role: ROLE_GRAPHIC,
|
||||
children: []
|
||||
};
|
||||
|
||||
testAccessibleTree("img", accTree);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a target="_blank"
|
||||
title="Fix O(n^2) access to all the children of a container"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=342045">
|
||||
Mozilla Bug 342045
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<map name="atoz_map">
|
||||
<area href="http://www.bbc.co.uk/radio4/atoz/index.shtml#b"
|
||||
coords="17,0,30,14" alt="b" shape="rect">
|
||||
<area href="http://www.bbc.co.uk/radio4/atoz/index.shtml#a"
|
||||
coords="0,0,13,14" alt="a" shape="rect">
|
||||
</map>
|
||||
|
||||
<img id="imgmap" width="447" height="15"
|
||||
usemap="#atoz_map"
|
||||
src="chrome://mochikit/content/a11y/accessible/letters.gif">
|
||||
|
||||
<img id="img" src="chrome://mochikit/content/a11y/accessible/moz.png">
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,105 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML ul/li element tests</title>
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function listItemTree(aBulletText, aName, aSubtree)
|
||||
{
|
||||
var obj = {
|
||||
role: ROLE_LISTITEM,
|
||||
children: [
|
||||
{
|
||||
role: ROLE_STATICTEXT,
|
||||
name: aBulletText
|
||||
},
|
||||
{
|
||||
role: ROLE_TEXT_LEAF,
|
||||
name: aName
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
if (aSubtree)
|
||||
obj.children.push(aSubtree);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function doTest()
|
||||
{
|
||||
var bulletText = String.fromCharCode(0x2022) + " ";
|
||||
|
||||
// list1
|
||||
var accTree = {
|
||||
role: ROLE_LIST,
|
||||
children: [
|
||||
new listItemTree(bulletText, "Oranges"),
|
||||
new listItemTree(bulletText, "Apples"),
|
||||
new listItemTree(bulletText, "Bananas")
|
||||
]
|
||||
};
|
||||
|
||||
testAccessibleTree("list1", accTree);
|
||||
|
||||
// list2
|
||||
accTree = {
|
||||
role: ROLE_LIST,
|
||||
children: [
|
||||
new listItemTree("1. ", "Oranges"),
|
||||
new listItemTree("2. ", "Apples"),
|
||||
new listItemTree("3. ", "Bananas", accTree)
|
||||
]
|
||||
};
|
||||
|
||||
testAccessibleTree("list2", accTree);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a target="_blank"
|
||||
title="Fix O(n^2) access to all the children of a container"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=342045">
|
||||
Mozilla Bug 342045
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<ul id="list1">
|
||||
<li id="li1">Oranges</li>
|
||||
<li id="li2">Apples</li>
|
||||
<li id="li3">Bananas</li>
|
||||
</ul>
|
||||
|
||||
<ol id="list2">
|
||||
<li id="li4">Oranges</li>
|
||||
<li id="li5">Apples</li>
|
||||
<li id="li6">Bananas<ul>
|
||||
<li id="n_li4">Oranges</li>
|
||||
<li id="n_li5">Apples</li>
|
||||
<li id="n_li6">Bananas</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
</body>
|
||||
</html>
|
|
@ -1,102 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>HTML text containers tests</title>
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function doTest()
|
||||
{
|
||||
var accTree = {
|
||||
role: ROLE_SECTION,
|
||||
children: [
|
||||
{ // text child
|
||||
role: ROLE_TEXT_LEAF,
|
||||
children: []
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
testAccessibleTree("c1", accTree);
|
||||
testAccessibleTree("c2", accTree);
|
||||
|
||||
accTree = {
|
||||
role: ROLE_SECTION,
|
||||
children: [
|
||||
{
|
||||
role: ROLE_TEXT_LEAF,
|
||||
name: "Hello1"
|
||||
},
|
||||
{
|
||||
role: ROLE_WHITESPACE
|
||||
},
|
||||
{
|
||||
role: ROLE_TEXT_LEAF,
|
||||
name: "Hello2"
|
||||
},
|
||||
{
|
||||
role: ROLE_SEPARATOR
|
||||
},
|
||||
{
|
||||
role: ROLE_TEXT_LEAF,
|
||||
name: "Hello3 "
|
||||
},
|
||||
{
|
||||
role: ROLE_PARAGRAPH,
|
||||
children: [
|
||||
{
|
||||
role: ROLE_TEXT_LEAF,
|
||||
name: "Hello4 "
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
testAccessibleTree("c3", accTree);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a target="_blank"
|
||||
title="overflowed content doesn't expose child text accessibles"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=489306">Mozilla Bug 489306</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<div id="c1" style="width: 100px; height: 100px; overflow: auto;">
|
||||
1hellohello 2hellohello 3hellohello 4hellohello 5hellohello 6hellohello 7hellohello
|
||||
</div>
|
||||
<div id="c2">
|
||||
1hellohello 2hellohello 3hellohello 4hellohello 5hellohello 6hellohello 7hellohello
|
||||
</div>
|
||||
<div id="c3">
|
||||
Hello1<br>
|
||||
Hello2<hr>
|
||||
Hello3
|
||||
<p>
|
||||
Hello4
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -2,9 +2,8 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<title>HTML text controls tests</title>
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
<title>HTML text containers tests</title>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
|
@ -19,58 +18,17 @@
|
|||
<script type="application/javascript">
|
||||
function doTest()
|
||||
{
|
||||
// editable div
|
||||
var accTree = {
|
||||
role: ROLE_SECTION,
|
||||
children: [
|
||||
{ // text child
|
||||
role: ROLE_TEXT_LEAF,
|
||||
children: []
|
||||
role: ROLE_TEXT_LEAF
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
testAccessibleTree("txc1", accTree);
|
||||
|
||||
// input@type="text"
|
||||
accTree = {
|
||||
role: ROLE_ENTRY,
|
||||
children: [
|
||||
{ // text child
|
||||
role: ROLE_TEXT_LEAF,
|
||||
children: []
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
testAccessibleTree("txc2", accTree);
|
||||
|
||||
// textarea
|
||||
accTree = {
|
||||
role: ROLE_ENTRY,
|
||||
children: [
|
||||
{
|
||||
role: ROLE_TEXT_LEAF // hello1 text
|
||||
},
|
||||
{
|
||||
role: ROLE_WHITESPACE
|
||||
},
|
||||
{
|
||||
role: ROLE_TEXT_LEAF, // hello2 text
|
||||
},
|
||||
{
|
||||
role: ROLE_WHITESPACE
|
||||
},
|
||||
{
|
||||
role: ROLE_TEXT_LEAF, // whitepsace text
|
||||
},
|
||||
{
|
||||
role: ROLE_WHITESPACE
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
testAccessibleTree("txc3", accTree);
|
||||
testAccessibleTree("c1", accTree);
|
||||
testAccessibleTree("c2", accTree);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
@ -89,14 +47,11 @@
|
|||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<div id="txc1" contentEditable="true">
|
||||
1hellohello
|
||||
<div id="c1" style="width: 100px; height: 100px; overflow: auto;">
|
||||
1hellohello 2hellohello 3hellohello 4hellohello 5hellohello 6hellohello 7hellohello
|
||||
</div>
|
||||
<div id="c2">
|
||||
1hellohello 2hellohello 3hellohello 4hellohello 5hellohello 6hellohello 7hellohello
|
||||
</div>
|
||||
<input id="txc2" value="hello">
|
||||
<textarea id="txc3">
|
||||
hello1
|
||||
hello2
|
||||
</textarea>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
Загрузка…
Ссылка в новой задаче