mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 740725 - Add down-casting to nsXULTreeAccessible, r=tbsaunde, f=surkov
This commit is contained in:
parent
c9eb168ef6
commit
a647b4f38c
@ -605,7 +605,7 @@ nsAccessibilityService::TreeViewChanged(nsIPresShell* aPresShell,
|
||||
if (document) {
|
||||
nsAccessible* accessible = document->GetAccessible(aContent);
|
||||
if (accessible) {
|
||||
nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(accessible);
|
||||
nsXULTreeAccessible* treeAcc = accessible->AsXULTree();
|
||||
if (treeAcc)
|
||||
treeAcc->TreeViewChanged(aView);
|
||||
}
|
||||
|
@ -72,6 +72,7 @@ class TableAccessible;
|
||||
}
|
||||
}
|
||||
class nsTextAccessible;
|
||||
class nsXULTreeAccessible;
|
||||
|
||||
struct nsRect;
|
||||
class nsIContent;
|
||||
@ -467,6 +468,9 @@ public:
|
||||
bool IsImageMapAccessible() const { return mFlags & eImageMapAccessible; }
|
||||
nsHTMLImageMapAccessible* AsImageMap();
|
||||
|
||||
inline bool IsXULTree() const { return mFlags & eXULTreeAccessible; }
|
||||
nsXULTreeAccessible* AsXULTree();
|
||||
|
||||
inline bool IsListControl() const { return mFlags & eListControlAccessible; }
|
||||
|
||||
inline bool IsMenuButton() const { return mFlags & eMenuButtonAccessible; }
|
||||
@ -718,7 +722,8 @@ protected:
|
||||
eMenuButtonAccessible = 1 << 14,
|
||||
eMenuPopupAccessible = 1 << 15,
|
||||
eRootAccessible = 1 << 16,
|
||||
eTextLeafAccessible = 1 << 17
|
||||
eTextLeafAccessible = 1 << 17,
|
||||
eXULTreeAccessible = 1 << 18
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -386,21 +386,16 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
nsINode* targetNode = accessible->GetNode();
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
nsRefPtr<nsXULTreeAccessible> treeAcc;
|
||||
if (targetNode->IsElement() &&
|
||||
targetNode->AsElement()->NodeInfo()->Equals(nsGkAtoms::tree,
|
||||
kNameSpaceID_XUL)) {
|
||||
treeAcc = do_QueryObject(accessible);
|
||||
if (treeAcc) {
|
||||
if (eventType.EqualsLiteral("TreeRowCountChanged")) {
|
||||
HandleTreeRowCountChangedEvent(aDOMEvent, treeAcc);
|
||||
return;
|
||||
}
|
||||
nsXULTreeAccessible* treeAcc = accessible->AsXULTree();
|
||||
if (treeAcc) {
|
||||
if (eventType.EqualsLiteral("TreeRowCountChanged")) {
|
||||
HandleTreeRowCountChangedEvent(aDOMEvent, treeAcc);
|
||||
return;
|
||||
}
|
||||
|
||||
if (eventType.EqualsLiteral("TreeInvalidated")) {
|
||||
HandleTreeInvalidatedEvent(aDOMEvent, treeAcc);
|
||||
return;
|
||||
}
|
||||
if (eventType.EqualsLiteral("TreeInvalidated")) {
|
||||
HandleTreeInvalidatedEvent(aDOMEvent, treeAcc);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -68,6 +68,8 @@ nsXULTreeAccessible::
|
||||
nsXULTreeAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
|
||||
nsAccessibleWrap(aContent, aDoc)
|
||||
{
|
||||
mFlags |= eXULTreeAccessible;
|
||||
|
||||
mTree = nsCoreUtils::GetTreeBoxObject(aContent);
|
||||
if (mTree)
|
||||
mTree->GetView(getter_AddRefs(mTreeView));
|
||||
@ -863,7 +865,7 @@ nsXULTreeItemAccessibleBase::RelationByType(PRUint32 aType)
|
||||
if (parentIndex == -1)
|
||||
return Relation(mParent);
|
||||
|
||||
nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(mParent);
|
||||
nsXULTreeAccessible* treeAcc = mParent->AsXULTree();
|
||||
return Relation(treeAcc->GetTreeItemAccessible(parentIndex));
|
||||
}
|
||||
|
||||
@ -1283,7 +1285,7 @@ nsXULTreeColumnsAccessible::GetSiblingAtOffset(PRInt32 aOffset,
|
||||
PRInt32 rowCount = 0;
|
||||
treeView->GetRowCount(&rowCount);
|
||||
if (rowCount > 0 && aOffset <= rowCount) {
|
||||
nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(Parent());
|
||||
nsXULTreeAccessible* treeAcc = Parent()->AsXULTree();
|
||||
|
||||
if (treeAcc)
|
||||
return treeAcc->GetTreeItemAccessible(aOffset - 1);
|
||||
|
@ -320,4 +320,14 @@ protected:
|
||||
nsresult *aError = nsnull) const;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessible downcasting method
|
||||
|
||||
inline nsXULTreeAccessible*
|
||||
nsAccessible::AsXULTree()
|
||||
{
|
||||
return IsXULTree() ?
|
||||
static_cast<nsXULTreeAccessible*>(this) : nsnull;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user