зеркало из https://github.com/mozilla/pjs.git
Bug 541618 - nsINode should be used instead nsIDOMNode by nsAccessNode, r=marcoz, davidb
This commit is contained in:
Родитель
b38485775c
Коммит
47348afc2e
|
@ -44,16 +44,17 @@
|
|||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Class nsAccessNodeWrap
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessNodeWrap
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//-----------------------------------------------------
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
|
||||
nsAccessNodeWrap::nsAccessNodeWrap(nsIDOMNode *aNode, nsIWeakReference* aShell):
|
||||
nsAccessNode(aNode, aShell)
|
||||
nsAccessNodeWrap::
|
||||
nsAccessNodeWrap(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsAccessNode(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
class nsAccessNodeWrap : public nsAccessNode
|
||||
{
|
||||
public: // construction, destruction
|
||||
nsAccessNodeWrap(nsIDOMNode *aNode, nsIWeakReference* aShell);
|
||||
nsAccessNodeWrap(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
virtual ~nsAccessNodeWrap();
|
||||
|
||||
static void InitAccessibility();
|
||||
|
|
|
@ -270,10 +270,9 @@ PRInt32 nsAccessibleWrap::mAccWrapCreated = 0;
|
|||
PRInt32 nsAccessibleWrap::mAccWrapDeleted = 0;
|
||||
#endif
|
||||
|
||||
nsAccessibleWrap::nsAccessibleWrap(nsIDOMNode* aNode,
|
||||
nsIWeakReference *aShell)
|
||||
: nsAccessible(aNode, aShell),
|
||||
mAtkObject(nsnull)
|
||||
nsAccessibleWrap::
|
||||
nsAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsAccessible(aContent, aShell), mAtkObject(nsnull)
|
||||
{
|
||||
#ifdef MAI_LOGGING
|
||||
++mAccWrapCreated;
|
||||
|
@ -562,7 +561,7 @@ GetUniqueMaiAtkTypeName(PRUint16 interfacesBits)
|
|||
PRBool nsAccessibleWrap::IsValidObject()
|
||||
{
|
||||
// to ensure we are not shut down
|
||||
return (mDOMNode != nsnull);
|
||||
return !IsDefunct();
|
||||
}
|
||||
|
||||
/* static functions for ATK callbacks */
|
||||
|
|
|
@ -85,7 +85,7 @@ class MaiHyperlink;
|
|||
class nsAccessibleWrap: public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsAccessibleWrap(nsIDOMNode*, nsIWeakReference *aShell);
|
||||
nsAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
virtual ~nsAccessibleWrap();
|
||||
void ShutdownAtkObject();
|
||||
|
||||
|
|
|
@ -43,11 +43,14 @@
|
|||
#include "nsMai.h"
|
||||
#include "nsDocAccessibleWrap.h"
|
||||
|
||||
//----- nsDocAccessibleWrap -----
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsDocAccessibleWrap
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsDocAccessibleWrap::nsDocAccessibleWrap(nsIDOMNode *aDOMNode,
|
||||
nsIWeakReference *aShell):
|
||||
nsDocAccessible(aDOMNode, aShell), mActivated(PR_FALSE)
|
||||
nsDocAccessibleWrap::
|
||||
nsDocAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
|
||||
nsIWeakReference *aShell) :
|
||||
nsDocAccessible(aDocument, aRootContent, aShell), mActivated(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,8 @@
|
|||
class nsDocAccessibleWrap: public nsDocAccessible
|
||||
{
|
||||
public:
|
||||
nsDocAccessibleWrap(nsIDOMNode *aNode, nsIWeakReference *aShell);
|
||||
nsDocAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
|
||||
nsIWeakReference *aShell);
|
||||
virtual ~nsDocAccessibleWrap();
|
||||
|
||||
PRBool mActivated;
|
||||
|
|
|
@ -78,9 +78,8 @@ refAccessibleAtPointCB(AtkComponent *aComponent,
|
|||
|
||||
// nsIAccessible getChildAtPoint (x,y) is in screen pixels.
|
||||
if (aCoordType == ATK_XY_WINDOW) {
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
accWrap->GetDOMNode(getter_AddRefs(domNode));
|
||||
nsIntPoint winCoords = nsCoreUtils::GetScreenCoordsForWindow(domNode);
|
||||
nsIntPoint winCoords =
|
||||
nsCoreUtils::GetScreenCoordsForWindow(accWrap->GetNode());
|
||||
aAccX += winCoords.x;
|
||||
aAccY += winCoords.y;
|
||||
}
|
||||
|
@ -119,9 +118,8 @@ getExtentsCB(AtkComponent *aComponent,
|
|||
if (NS_FAILED(rv))
|
||||
return;
|
||||
if (aCoordType == ATK_XY_WINDOW) {
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
accWrap->GetDOMNode(getter_AddRefs(domNode));
|
||||
nsIntPoint winCoords = nsCoreUtils::GetScreenCoordsForWindow(domNode);
|
||||
nsIntPoint winCoords =
|
||||
nsCoreUtils::GetScreenCoordsForWindow(accWrap->GetNode());
|
||||
nsAccX -= winCoords.x;
|
||||
nsAccY -= winCoords.y;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "nsRootAccessibleWrap.h"
|
||||
|
||||
nsNativeRootAccessibleWrap::nsNativeRootAccessibleWrap(AtkObject *aAccessible):
|
||||
nsRootAccessible(nsnull, nsnull)
|
||||
nsRootAccessible(nsnull, nsnull, nsnull)
|
||||
{
|
||||
g_object_ref(aAccessible);
|
||||
mAtkObject = aAccessible;
|
||||
|
|
|
@ -51,9 +51,9 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
|
||||
nsARIAGridAccessible::nsARIAGridAccessible(nsIDOMNode* aDomNode,
|
||||
nsIWeakReference* aShell) :
|
||||
nsAccessibleWrap(aDomNode, aShell)
|
||||
nsARIAGridAccessible::
|
||||
nsARIAGridAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsAccessibleWrap(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -756,7 +756,7 @@ nsresult
|
|||
nsARIAGridAccessible::SetARIASelected(nsAccessible *aAccessible,
|
||||
PRBool aIsSelected, PRBool aNotify)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aAccessible->GetDOMNode()));
|
||||
nsIContent *content = aAccessible->GetContent();
|
||||
NS_ENSURE_STATE(content);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -897,9 +897,9 @@ nsARIAGridAccessible::GetSelectedColumnsArray(PRUint32 *acolumnCount,
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
|
||||
nsARIAGridCellAccessible::nsARIAGridCellAccessible(nsIDOMNode* aDomNode,
|
||||
nsIWeakReference* aShell) :
|
||||
nsHyperTextAccessibleWrap(aDomNode, aShell)
|
||||
nsARIAGridCellAccessible::
|
||||
nsARIAGridCellAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsHyperTextAccessibleWrap(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ class nsARIAGridAccessible : public nsAccessibleWrap,
|
|||
public nsIAccessibleTable
|
||||
{
|
||||
public:
|
||||
nsARIAGridAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
nsARIAGridAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
@ -110,7 +110,7 @@ class nsARIAGridCellAccessible : public nsHyperTextAccessibleWrap,
|
|||
public nsIAccessibleTableCell
|
||||
{
|
||||
public:
|
||||
nsARIAGridCellAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
nsARIAGridCellAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
|
|
@ -202,8 +202,6 @@ nsAccDocManager::OnStateChange(nsIWebProgress *aWebProgress,
|
|||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(webNav));
|
||||
NS_ENSURE_STATE(docShell);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode = do_QueryInterface(document);
|
||||
|
||||
// Fire reload and state busy events on existing document accessible while
|
||||
// event from user input flag can be calculated properly and accessible
|
||||
// is alive. When new document gets loaded then this one is destroyed.
|
||||
|
@ -223,7 +221,7 @@ nsAccDocManager::OnStateChange(nsIWebProgress *aWebProgress,
|
|||
// Fire state busy change event. Use delayed event since we don't care
|
||||
// actually if event isn't delivered when the document goes away like a shot.
|
||||
nsRefPtr<nsAccEvent> stateEvent =
|
||||
new nsAccStateChangeEvent(DOMNode, nsIAccessibleStates::STATE_BUSY,
|
||||
new nsAccStateChangeEvent(document, nsIAccessibleStates::STATE_BUSY,
|
||||
PR_FALSE, PR_TRUE);
|
||||
docAcc->FireDelayedAccessibleEvent(stateEvent);
|
||||
|
||||
|
@ -357,15 +355,14 @@ nsAccDocManager::HandleDOMDocumentLoad(nsIDocument *aDocument,
|
|||
}
|
||||
|
||||
// Fire complete/load stopped if the load event type is given.
|
||||
nsCOMPtr<nsIDOMNode> DOMNode = do_QueryInterface(aDocument);
|
||||
if (aLoadEventType) {
|
||||
nsRefPtr<nsAccEvent> loadEvent = new nsAccEvent(aLoadEventType, DOMNode);
|
||||
nsRefPtr<nsAccEvent> loadEvent = new nsAccEvent(aLoadEventType, aDocument);
|
||||
docAcc->FireDelayedAccessibleEvent(loadEvent);
|
||||
}
|
||||
|
||||
// Fire busy state change event.
|
||||
nsRefPtr<nsAccEvent> stateEvent =
|
||||
new nsAccStateChangeEvent(DOMNode, nsIAccessibleStates::STATE_BUSY,
|
||||
new nsAccStateChangeEvent(aDocument, nsIAccessibleStates::STATE_BUSY,
|
||||
PR_FALSE, PR_FALSE);
|
||||
docAcc->FireDelayedAccessibleEvent(stateEvent);
|
||||
}
|
||||
|
@ -453,9 +450,9 @@ nsAccDocManager::CreateDocOrRootAccessible(nsIDocument *aDocument)
|
|||
|
||||
// Do not create document accessible until role content is loaded, otherwise
|
||||
// we get accessible document with wrong role.
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(aDocument));
|
||||
if (!nsCoreUtils::GetRoleContent(DOMNode))
|
||||
return NS_OK;
|
||||
nsIContent *rootElm = nsCoreUtils::GetRoleContent(aDocument);
|
||||
if (!rootElm)
|
||||
return nsnull;
|
||||
|
||||
PRBool isRootDoc = nsCoreUtils::IsRootDocument(aDocument);
|
||||
|
||||
|
@ -468,8 +465,7 @@ nsAccDocManager::CreateDocOrRootAccessible(nsIDocument *aDocument)
|
|||
return nsnull;
|
||||
|
||||
nsIContent* ownerContent = parentDoc->FindContentForSubDocument(aDocument);
|
||||
nsCOMPtr<nsIDOMNode> ownerNode(do_QueryInterface(ownerContent));
|
||||
if (!ownerNode)
|
||||
if (!ownerContent)
|
||||
return nsnull;
|
||||
|
||||
// XXXaaronl: ideally we would traverse the presshell chain. Since there's
|
||||
|
@ -477,7 +473,7 @@ nsAccDocManager::CreateDocOrRootAccessible(nsIDocument *aDocument)
|
|||
// GetAccessible() is bad because it doesn't support our concept of multiple
|
||||
// presshells per doc. It should be changed to use
|
||||
// GetAccessibleInWeakShell().
|
||||
outerDocAcc = GetAccService()->GetAccessible(ownerNode);
|
||||
outerDocAcc = GetAccService()->GetAccessible(ownerContent);
|
||||
if (!outerDocAcc)
|
||||
return nsnull;
|
||||
}
|
||||
|
@ -487,8 +483,8 @@ nsAccDocManager::CreateDocOrRootAccessible(nsIDocument *aDocument)
|
|||
// We only create root accessibles for the true root, otherwise create a
|
||||
// doc accessible.
|
||||
nsDocAccessible *docAcc = isRootDoc ?
|
||||
new nsRootAccessibleWrap(DOMNode, weakShell) :
|
||||
new nsDocAccessibleWrap(DOMNode, weakShell);
|
||||
new nsRootAccessibleWrap(aDocument, rootElm, weakShell) :
|
||||
new nsDocAccessibleWrap(aDocument, rootElm, weakShell);
|
||||
|
||||
if (!docAcc)
|
||||
return nsnull;
|
||||
|
@ -509,7 +505,7 @@ nsAccDocManager::CreateDocOrRootAccessible(nsIDocument *aDocument)
|
|||
}
|
||||
|
||||
if (!GetAccService()->InitAccessible(docAcc,
|
||||
nsAccUtils::GetRoleMapEntry(DOMNode))) {
|
||||
nsAccUtils::GetRoleMapEntry(aDocument))) {
|
||||
mDocAccessibleCache.Remove(static_cast<void*>(aDocument));
|
||||
return nsnull;
|
||||
}
|
||||
|
|
|
@ -88,11 +88,11 @@ nsAccEvent::nsAccEvent(PRUint32 aEventType, nsIAccessible *aAccessible,
|
|||
CaptureIsFromUserInput(aIsFromUserInput);
|
||||
}
|
||||
|
||||
nsAccEvent::nsAccEvent(PRUint32 aEventType, nsIDOMNode *aDOMNode,
|
||||
nsAccEvent::nsAccEvent(PRUint32 aEventType, nsINode *aNode,
|
||||
PRBool aIsAsync, EIsFromUserInput aIsFromUserInput,
|
||||
EEventRule aEventRule) :
|
||||
mEventType(aEventType), mEventRule(aEventRule), mIsAsync(aIsAsync),
|
||||
mNode(do_QueryInterface(aDOMNode))
|
||||
mNode(aNode)
|
||||
{
|
||||
CaptureIsFromUserInput(aIsFromUserInput);
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ nsAccEvent::GetAccessible(nsIAccessible **aAccessible)
|
|||
*aAccessible = nsnull;
|
||||
|
||||
if (!mAccessible)
|
||||
mAccessible = GetAccessibleByNode();
|
||||
mAccessible = GetAccessibleForNode();
|
||||
|
||||
NS_IF_ADDREF(*aAccessible = mAccessible);
|
||||
return NS_OK;
|
||||
|
@ -165,14 +165,9 @@ nsINode*
|
|||
nsAccEvent::GetNode()
|
||||
{
|
||||
if (!mNode) {
|
||||
nsCOMPtr<nsIAccessNode> accessNode(do_QueryInterface(mAccessible));
|
||||
if (!accessNode)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode;
|
||||
accessNode->GetDOMNode(getter_AddRefs(DOMNode));
|
||||
|
||||
mNode = do_QueryInterface(DOMNode);
|
||||
nsRefPtr<nsAccessNode> accessNode(do_QueryObject(mAccessible));
|
||||
if (accessNode)
|
||||
mNode = accessNode->GetNode();
|
||||
}
|
||||
|
||||
return mNode;
|
||||
|
@ -191,16 +186,13 @@ nsAccEvent::GetDocAccessible()
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccEvent: protected methods
|
||||
|
||||
already_AddRefed<nsIAccessible>
|
||||
nsAccEvent::GetAccessibleByNode()
|
||||
nsAccessible *
|
||||
nsAccEvent::GetAccessibleForNode() const
|
||||
{
|
||||
if (!mNode)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mNode));
|
||||
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
GetAccService()->GetAccessibleFor(DOMNode, getter_AddRefs(accessible));
|
||||
nsAccessible *accessible = GetAccService()->GetAccessible(mNode);
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
// hack for xul tree table. We need a better way for firing delayed event
|
||||
|
@ -220,20 +212,19 @@ nsAccEvent::GetAccessibleByNode()
|
|||
if (treeIndex >= 0) {
|
||||
nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(accessible);
|
||||
if (treeAcc)
|
||||
accessible = treeAcc->GetTreeItemAccessible(treeIndex);
|
||||
return treeAcc->GetTreeItemAccessible(treeIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return accessible.forget();
|
||||
return accessible;
|
||||
}
|
||||
|
||||
void
|
||||
nsAccEvent::CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> targetNode;
|
||||
GetDOMNode(getter_AddRefs(targetNode));
|
||||
nsINode *targetNode = GetNode();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (!targetNode) {
|
||||
|
@ -282,7 +273,7 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsAccReorderEvent, nsAccEvent,
|
|||
nsAccReorderEvent::nsAccReorderEvent(nsIAccessible *aAccTarget,
|
||||
PRBool aIsAsynch,
|
||||
PRBool aIsUnconditional,
|
||||
nsIDOMNode *aReasonNode) :
|
||||
nsINode *aReasonNode) :
|
||||
nsAccEvent(::nsIAccessibleEvent::EVENT_REORDER, aAccTarget,
|
||||
aIsAsynch, eAutoDetect, nsAccEvent::eCoalesceFromSameSubtree),
|
||||
mUnconditionalEvent(aIsUnconditional), mReasonNode(aReasonNode)
|
||||
|
@ -301,9 +292,7 @@ nsAccReorderEvent::HasAccessibleInReasonSubtree()
|
|||
if (!mReasonNode)
|
||||
return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
GetAccService()->GetAccessibleFor(mReasonNode, getter_AddRefs(accessible));
|
||||
|
||||
nsAccessible *accessible = GetAccService()->GetAccessible(mReasonNode);
|
||||
return accessible || nsAccUtils::HasAccessibleChildren(mReasonNode);
|
||||
}
|
||||
|
||||
|
@ -329,8 +318,7 @@ nsAccStateChangeEvent::
|
|||
}
|
||||
|
||||
nsAccStateChangeEvent::
|
||||
nsAccStateChangeEvent(nsIDOMNode *aNode,
|
||||
PRUint32 aState, PRBool aIsExtraState,
|
||||
nsAccStateChangeEvent(nsINode *aNode, PRUint32 aState, PRBool aIsExtraState,
|
||||
PRBool aIsEnabled):
|
||||
nsAccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode),
|
||||
mState(aState), mIsExtraState(aIsExtraState), mIsEnabled(aIsEnabled)
|
||||
|
@ -338,15 +326,14 @@ nsAccStateChangeEvent::
|
|||
}
|
||||
|
||||
nsAccStateChangeEvent::
|
||||
nsAccStateChangeEvent(nsIDOMNode *aNode,
|
||||
PRUint32 aState, PRBool aIsExtraState):
|
||||
nsAccStateChangeEvent(nsINode *aNode, PRUint32 aState, PRBool aIsExtraState) :
|
||||
nsAccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode),
|
||||
mState(aState), mIsExtraState(aIsExtraState)
|
||||
{
|
||||
// Use GetAccessibleByNode() because we do not want to store an accessible
|
||||
// Use GetAccessibleForNode() because we do not want to store an accessible
|
||||
// since it leads to problems with delayed events in the case when
|
||||
// an accessible gets reorder event before delayed event is processed.
|
||||
nsCOMPtr<nsIAccessible> accessible(GetAccessibleByNode());
|
||||
nsAccessible *accessible = GetAccessibleForNode();
|
||||
if (accessible) {
|
||||
PRUint32 state = 0, extraState = 0;
|
||||
accessible->GetState(&state, mIsExtraState ? &extraState : nsnull);
|
||||
|
@ -447,7 +434,7 @@ nsAccCaretMoveEvent::
|
|||
}
|
||||
|
||||
nsAccCaretMoveEvent::
|
||||
nsAccCaretMoveEvent(nsIDOMNode *aNode) :
|
||||
nsAccCaretMoveEvent(nsINode *aNode) :
|
||||
nsAccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aNode, PR_TRUE), // Currently always asynch
|
||||
mCaretOffset(-1)
|
||||
{
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "nsINode.h"
|
||||
#include "nsIDOMNode.h"
|
||||
|
||||
class nsAccessible;
|
||||
class nsDocAccessible;
|
||||
|
||||
// Constants used to point whether the event is from user input.
|
||||
|
@ -108,8 +109,7 @@ public:
|
|||
EIsFromUserInput aIsFromUserInput = eAutoDetect,
|
||||
EEventRule aEventRule = eRemoveDupes);
|
||||
// Initialize with an nsIDOMNode
|
||||
nsAccEvent(PRUint32 aEventType, nsIDOMNode *aDOMNode,
|
||||
PRBool aIsAsynch = PR_FALSE,
|
||||
nsAccEvent(PRUint32 aEventType, nsINode *aNode, PRBool aIsAsynch = PR_FALSE,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect,
|
||||
EEventRule aEventRule = eRemoveDupes);
|
||||
virtual ~nsAccEvent() {}
|
||||
|
@ -133,7 +133,7 @@ protected:
|
|||
/**
|
||||
* Get an accessible from event target node.
|
||||
*/
|
||||
already_AddRefed<nsIAccessible> GetAccessibleByNode();
|
||||
nsAccessible *GetAccessibleForNode() const;
|
||||
|
||||
/**
|
||||
* Determine whether the event is from user input by event state manager if
|
||||
|
@ -168,7 +168,7 @@ class nsAccReorderEvent : public nsAccEvent
|
|||
public:
|
||||
|
||||
nsAccReorderEvent(nsIAccessible *aAccTarget, PRBool aIsAsynch,
|
||||
PRBool aIsUnconditional, nsIDOMNode *aReasonNode);
|
||||
PRBool aIsUnconditional, nsINode *aReasonNode);
|
||||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ACCREORDEREVENT_IMPL_CID)
|
||||
|
||||
|
@ -186,7 +186,7 @@ public:
|
|||
|
||||
private:
|
||||
PRBool mUnconditionalEvent;
|
||||
nsCOMPtr<nsIDOMNode> mReasonNode;
|
||||
nsCOMPtr<nsINode> mReasonNode;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsAccReorderEvent, NS_ACCREORDEREVENT_IMPL_CID)
|
||||
|
@ -201,12 +201,10 @@ public:
|
|||
PRBool aIsEnabled, PRBool aIsAsynch = PR_FALSE,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect);
|
||||
|
||||
nsAccStateChangeEvent(nsIDOMNode *aNode,
|
||||
PRUint32 aState, PRBool aIsExtraState,
|
||||
nsAccStateChangeEvent(nsINode *aNode, PRUint32 aState, PRBool aIsExtraState,
|
||||
PRBool aIsEnabled);
|
||||
|
||||
nsAccStateChangeEvent(nsIDOMNode *aNode,
|
||||
PRUint32 aState, PRBool aIsExtraState);
|
||||
nsAccStateChangeEvent(nsINode *aNode, PRUint32 aState, PRBool aIsExtraState);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLESTATECHANGEEVENT
|
||||
|
@ -241,7 +239,7 @@ class nsAccCaretMoveEvent: public nsAccEvent,
|
|||
{
|
||||
public:
|
||||
nsAccCaretMoveEvent(nsIAccessible *aAccessible, PRInt32 aCaretOffset);
|
||||
nsAccCaretMoveEvent(nsIDOMNode *aNode);
|
||||
nsAccCaretMoveEvent(nsINode *aNode);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLECARETMOVEEVENT
|
||||
|
|
|
@ -112,9 +112,8 @@ nsAccTreeWalker::GetNextChildInternal(PRBool aNoWalkUp)
|
|||
mState->childIdx++;
|
||||
|
||||
PRBool isHidden = PR_FALSE;
|
||||
nsCOMPtr<nsIDOMNode> childDOMNode(do_QueryInterface(childNode));
|
||||
nsRefPtr<nsAccessible> accessible =
|
||||
GetAccService()->GetAccessible(childDOMNode, presShell, mWeakShell,
|
||||
GetAccService()->GetAccessible(childNode, presShell, mWeakShell,
|
||||
&isHidden);
|
||||
|
||||
if (accessible)
|
||||
|
|
|
@ -141,11 +141,11 @@ nsAccUtils::GetARIAOrDefaultLevel(nsIAccessible *aAcc)
|
|||
}
|
||||
|
||||
void
|
||||
nsAccUtils::GetPositionAndSizeForXULSelectControlItem(nsIDOMNode *aNode,
|
||||
nsAccUtils::GetPositionAndSizeForXULSelectControlItem(nsIContent *aContent,
|
||||
PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize)
|
||||
{
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> item(do_QueryInterface(aNode));
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> item(do_QueryInterface(aContent));
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
|
@ -182,11 +182,11 @@ nsAccUtils::GetPositionAndSizeForXULSelectControlItem(nsIDOMNode *aNode,
|
|||
}
|
||||
|
||||
void
|
||||
nsAccUtils::GetPositionAndSizeForXULContainerItem(nsIDOMNode *aNode,
|
||||
nsAccUtils::GetPositionAndSizeForXULContainerItem(nsIContent *aContent,
|
||||
PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize)
|
||||
{
|
||||
nsCOMPtr<nsIDOMXULContainerItemElement> item(do_QueryInterface(aNode));
|
||||
nsCOMPtr<nsIDOMXULContainerItemElement> item(do_QueryInterface(aContent));
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
|
@ -246,9 +246,9 @@ nsAccUtils::GetPositionAndSizeForXULContainerItem(nsIDOMNode *aNode,
|
|||
}
|
||||
|
||||
PRInt32
|
||||
nsAccUtils::GetLevelForXULContainerItem(nsIDOMNode *aNode)
|
||||
nsAccUtils::GetLevelForXULContainerItem(nsIContent *aContent)
|
||||
{
|
||||
nsCOMPtr<nsIDOMXULContainerItemElement> item(do_QueryInterface(aNode));
|
||||
nsCOMPtr<nsIDOMXULContainerItemElement> item(do_QueryInterface(aContent));
|
||||
if (!item)
|
||||
return 0;
|
||||
|
||||
|
@ -287,8 +287,7 @@ nsAccUtils::SetLiveContainerAttributes(nsIPersistentProperties *aAttributes,
|
|||
|
||||
// container-live, and container-live-role attributes
|
||||
if (live.IsEmpty()) {
|
||||
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(ancestor));
|
||||
nsRoleMapEntry *role = GetRoleMapEntry(node);
|
||||
nsRoleMapEntry *role = GetRoleMapEntry(ancestor);
|
||||
if (nsAccUtils::HasDefinedARIAToken(ancestor,
|
||||
nsAccessibilityAtoms::aria_live)) {
|
||||
ancestor->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_live,
|
||||
|
@ -343,46 +342,34 @@ nsAccUtils::HasDefinedARIAToken(nsIContent *aContent, nsIAtom *aAtom)
|
|||
}
|
||||
|
||||
PRBool
|
||||
nsAccUtils::HasAccessibleChildren(nsIDOMNode *aNode)
|
||||
nsAccUtils::HasAccessibleChildren(nsINode *aNode)
|
||||
{
|
||||
if (!aNode)
|
||||
return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
|
||||
if (!content)
|
||||
return PR_FALSE;
|
||||
|
||||
nsIPresShell *presShell = nsCoreUtils::GetPresShellFor(aNode);
|
||||
if (!presShell)
|
||||
return PR_FALSE;
|
||||
|
||||
nsIFrame *frame = content->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return PR_FALSE;
|
||||
|
||||
nsIContent *content = nsCoreUtils::GetRoleContent(aNode);
|
||||
nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(presShell));
|
||||
nsAccTreeWalker walker(weakShell, content, PR_FALSE);
|
||||
nsRefPtr<nsAccessible> accessible = walker.GetNextChild();
|
||||
return accessible ? PR_TRUE : PR_FALSE;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIAccessible>
|
||||
nsAccUtils::GetAncestorWithRole(nsIAccessible *aDescendant, PRUint32 aRole)
|
||||
nsAccessible *
|
||||
nsAccUtils::GetAncestorWithRole(nsAccessible *aDescendant, PRUint32 aRole)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> parentAccessible = aDescendant, testRoleAccessible;
|
||||
while (NS_SUCCEEDED(parentAccessible->GetParent(getter_AddRefs(testRoleAccessible))) &&
|
||||
testRoleAccessible) {
|
||||
PRUint32 testRole = nsAccUtils::Role(testRoleAccessible);
|
||||
if (testRole == aRole) {
|
||||
nsIAccessible *returnAccessible = testRoleAccessible;
|
||||
NS_ADDREF(returnAccessible);
|
||||
return returnAccessible;
|
||||
}
|
||||
nsCOMPtr<nsIAccessibleDocument> docAccessible = do_QueryInterface(testRoleAccessible);
|
||||
if (docAccessible) {
|
||||
nsAccessible *document = aDescendant->GetDocAccessible();
|
||||
nsAccessible *parent = aDescendant;
|
||||
while ((parent = parent->GetParent())) {
|
||||
PRUint32 testRole = nsAccUtils::Role(parent);
|
||||
if (testRole == aRole)
|
||||
return parent;
|
||||
|
||||
if (parent == document)
|
||||
break;
|
||||
}
|
||||
parentAccessible.swap(testRoleAccessible);
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
@ -487,8 +474,8 @@ nsAccUtils::GetARIATreeItemParent(nsIAccessible *aStartTreeItem,
|
|||
}
|
||||
}
|
||||
|
||||
already_AddRefed<nsIAccessible>
|
||||
nsAccUtils::GetSelectableContainer(nsIAccessible *aAccessible, PRUint32 aState)
|
||||
nsAccessible *
|
||||
nsAccUtils::GetSelectableContainer(nsAccessible *aAccessible, PRUint32 aState)
|
||||
{
|
||||
if (!aAccessible)
|
||||
return nsnull;
|
||||
|
@ -497,32 +484,27 @@ nsAccUtils::GetSelectableContainer(nsIAccessible *aAccessible, PRUint32 aState)
|
|||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessibleSelectable> container;
|
||||
nsCOMPtr<nsIAccessible> parent, accessible(aAccessible);
|
||||
nsAccessible *parent = aAccessible;
|
||||
while (!container) {
|
||||
accessible->GetParent(getter_AddRefs(parent));
|
||||
|
||||
parent = parent->GetParent();
|
||||
if (!parent || Role(parent) == nsIAccessibleRole::ROLE_PANE)
|
||||
return nsnull;
|
||||
|
||||
container = do_QueryInterface(parent);
|
||||
parent.swap(accessible);
|
||||
container = do_QueryObject(parent);
|
||||
}
|
||||
|
||||
return accessible.forget();
|
||||
return parent;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIAccessible>
|
||||
nsAccUtils::GetMultiSelectableContainer(nsIDOMNode *aNode)
|
||||
nsAccessible *
|
||||
nsAccUtils::GetMultiSelectableContainer(nsINode *aNode)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
GetAccService()->GetAccessibleFor(aNode, getter_AddRefs(accessible));
|
||||
|
||||
nsCOMPtr<nsIAccessible> container =
|
||||
GetSelectableContainer(accessible, State(accessible));
|
||||
nsAccessible *accessible = GetAccService()->GetAccessible(aNode);
|
||||
nsAccessible *container = GetSelectableContainer(accessible,
|
||||
State(accessible));
|
||||
|
||||
if (State(container) & nsIAccessibleStates::STATE_MULTISELECTABLE)
|
||||
return container.forget();
|
||||
|
||||
return container;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
|
@ -547,7 +529,7 @@ nsAccUtils::IsARIASelected(nsIAccessible *aAccessible)
|
|||
|
||||
already_AddRefed<nsIAccessibleText>
|
||||
nsAccUtils::GetTextAccessibleFromSelection(nsISelection *aSelection,
|
||||
nsIDOMNode **aNode)
|
||||
nsINode **aNode)
|
||||
{
|
||||
// Get accessible from selection's focus DOM point (the DOM point where
|
||||
// selection is ended).
|
||||
|
@ -568,30 +550,22 @@ nsAccUtils::GetTextAccessibleFromSelection(nsISelection *aSelection,
|
|||
while (resultNode) {
|
||||
// Make sure to get the correct starting node for selection events inside
|
||||
// XBL content trees.
|
||||
nsCOMPtr<nsIDOMNode> resultDOMNode(do_QueryInterface(resultNode));
|
||||
nsCOMPtr<nsIDOMNode> relevantDOMNode;
|
||||
GetAccService()->GetRelevantContentNodeFor(resultDOMNode,
|
||||
getter_AddRefs(relevantDOMNode));
|
||||
if (relevantDOMNode) {
|
||||
resultNode = do_QueryInterface(relevantDOMNode);
|
||||
resultDOMNode.swap(relevantDOMNode);
|
||||
}
|
||||
|
||||
if (!resultNode || !resultNode->IsNodeOfType(nsINode::eTEXT)) {
|
||||
nsAccessible *accessible = GetAccService()->GetAccessible(resultDOMNode);
|
||||
resultNode = GetAccService()->GetRelevantContentNodeFor(resultNode);
|
||||
if (!resultNode->IsNodeOfType(nsINode::eTEXT)) {
|
||||
nsAccessible *accessible = GetAccService()->GetAccessible(resultNode);
|
||||
if (accessible) {
|
||||
nsIAccessibleText *textAcc = nsnull;
|
||||
CallQueryInterface(accessible, &textAcc);
|
||||
if (textAcc) {
|
||||
if (aNode)
|
||||
resultDOMNode.forget(aNode);
|
||||
NS_ADDREF(*aNode = resultNode);
|
||||
|
||||
return textAcc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resultNode = resultNode->GetParent();
|
||||
resultNode = resultNode->GetNodeParent();
|
||||
}
|
||||
|
||||
NS_NOTREACHED("No nsIAccessibleText for selection change event!");
|
||||
|
@ -602,7 +576,7 @@ nsAccUtils::GetTextAccessibleFromSelection(nsISelection *aSelection,
|
|||
nsresult
|
||||
nsAccUtils::ConvertToScreenCoords(PRInt32 aX, PRInt32 aY,
|
||||
PRUint32 aCoordinateType,
|
||||
nsIAccessNode *aAccessNode,
|
||||
nsAccessNode *aAccessNode,
|
||||
nsIntPoint *aCoords)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCoords);
|
||||
|
@ -637,7 +611,7 @@ nsAccUtils::ConvertToScreenCoords(PRInt32 aX, PRInt32 aY,
|
|||
nsresult
|
||||
nsAccUtils::ConvertScreenCoordsTo(PRInt32 *aX, PRInt32 *aY,
|
||||
PRUint32 aCoordinateType,
|
||||
nsIAccessNode *aAccessNode)
|
||||
nsAccessNode *aAccessNode)
|
||||
{
|
||||
switch (aCoordinateType) {
|
||||
case nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE:
|
||||
|
@ -669,25 +643,18 @@ nsAccUtils::ConvertScreenCoordsTo(PRInt32 *aX, PRInt32 *aY,
|
|||
}
|
||||
|
||||
nsIntPoint
|
||||
nsAccUtils::GetScreenCoordsForWindow(nsIAccessNode *aAccessNode)
|
||||
nsAccUtils::GetScreenCoordsForWindow(nsAccessNode *aAccessNode)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> DOMNode;
|
||||
aAccessNode->GetDOMNode(getter_AddRefs(DOMNode));
|
||||
if (DOMNode)
|
||||
return nsCoreUtils::GetScreenCoordsForWindow(DOMNode);
|
||||
|
||||
return nsIntPoint(0, 0);
|
||||
return nsCoreUtils::GetScreenCoordsForWindow(aAccessNode->GetNode());
|
||||
}
|
||||
|
||||
nsIntPoint
|
||||
nsAccUtils::GetScreenCoordsForParent(nsIAccessNode *aAccessNode)
|
||||
nsAccUtils::GetScreenCoordsForParent(nsAccessNode *aAccessNode)
|
||||
{
|
||||
nsRefPtr<nsAccessNode> parent;
|
||||
nsCOMPtr<nsIAccessible> accessible(do_QueryInterface(aAccessNode));
|
||||
nsRefPtr<nsAccessible> accessible(do_QueryObject(aAccessNode));
|
||||
if (accessible) {
|
||||
nsCOMPtr<nsIAccessible> parentAccessible;
|
||||
accessible->GetParent(getter_AddRefs(parentAccessible));
|
||||
parent = do_QueryObject(parentAccessible);
|
||||
parent = do_QueryObject(accessible->GetParent());
|
||||
} else {
|
||||
nsCOMPtr<nsIAccessNode> parentAccessNode;
|
||||
aAccessNode->GetParentNode(getter_AddRefs(parentAccessNode));
|
||||
|
@ -706,7 +673,7 @@ nsAccUtils::GetScreenCoordsForParent(nsIAccessNode *aAccessNode)
|
|||
}
|
||||
|
||||
nsRoleMapEntry*
|
||||
nsAccUtils::GetRoleMapEntry(nsIDOMNode *aNode)
|
||||
nsAccUtils::GetRoleMapEntry(nsINode *aNode)
|
||||
{
|
||||
nsIContent *content = nsCoreUtils::GetRoleContent(aNode);
|
||||
nsAutoString roleString;
|
||||
|
@ -875,11 +842,9 @@ nsAccUtils::MustPrune(nsIAccessible *aAccessible)
|
|||
}
|
||||
|
||||
PRBool
|
||||
nsAccUtils::IsNodeRelevant(nsIDOMNode *aNode)
|
||||
nsAccUtils::IsNodeRelevant(nsINode *aNode)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> relevantNode;
|
||||
GetAccService()->GetRelevantContentNodeFor(aNode, getter_AddRefs(relevantNode));
|
||||
return aNode == relevantNode;
|
||||
return aNode == GetAccService()->GetRelevantContentNodeFor(aNode);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -112,7 +112,7 @@ public:
|
|||
* Compute position in group (posinset) and group size (setsize) for
|
||||
* nsIDOMXULSelectControlItemElement node.
|
||||
*/
|
||||
static void GetPositionAndSizeForXULSelectControlItem(nsIDOMNode *aNode,
|
||||
static void GetPositionAndSizeForXULSelectControlItem(nsIContent *aContent,
|
||||
PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
|
||||
|
@ -120,14 +120,14 @@ public:
|
|||
* Compute group position and group size (posinset and setsize) for
|
||||
* nsIDOMXULContainerItemElement node.
|
||||
*/
|
||||
static void GetPositionAndSizeForXULContainerItem(nsIDOMNode *aNode,
|
||||
static void GetPositionAndSizeForXULContainerItem(nsIContent *aContent,
|
||||
PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
|
||||
/**
|
||||
* Compute group level for nsIDOMXULContainerItemElement node.
|
||||
*/
|
||||
static PRInt32 GetLevelForXULContainerItem(nsIDOMNode *aNode);
|
||||
static PRInt32 GetLevelForXULContainerItem(nsIContent *aContent);
|
||||
|
||||
/**
|
||||
* Set container-foo live region attributes for the given node.
|
||||
|
@ -162,7 +162,7 @@ public:
|
|||
/**
|
||||
* Return document accessible for the given DOM node.
|
||||
*/
|
||||
static nsDocAccessible *GetDocAccessibleFor(nsIDOMNode *aNode)
|
||||
static nsDocAccessible *GetDocAccessibleFor(nsINode *aNode)
|
||||
{
|
||||
nsIPresShell *presShell = nsCoreUtils::GetPresShellFor(aNode);
|
||||
return presShell ?
|
||||
|
@ -184,16 +184,18 @@ public:
|
|||
/**
|
||||
* Return true if the given DOM node contains accessible children.
|
||||
*/
|
||||
static PRBool HasAccessibleChildren(nsIDOMNode *aNode);
|
||||
static PRBool HasAccessibleChildren(nsINode *aNode);
|
||||
|
||||
/**
|
||||
* If an ancestor in this document exists with the given role, return it
|
||||
* @param aDescendant Descendant to start search with
|
||||
* @param aRole Role to find matching ancestor for
|
||||
* @return The ancestor accessible with the given role, or nsnull if no match is found
|
||||
* Return ancestor in this document with the given role if it exists.
|
||||
*
|
||||
* @param aDescendant [in] descendant to start search with
|
||||
* @param aRole [in] role to find matching ancestor for
|
||||
* @return the ancestor accessible with the given role, or
|
||||
* nsnull if no match is found
|
||||
*/
|
||||
static already_AddRefed<nsIAccessible>
|
||||
GetAncestorWithRole(nsIAccessible *aDescendant, PRUint32 aRole);
|
||||
static nsAccessible * GetAncestorWithRole(nsAccessible *aDescendant,
|
||||
PRUint32 aRole);
|
||||
|
||||
/**
|
||||
* For an ARIA tree item , get the accessible that represents its conceptual parent.
|
||||
|
@ -214,14 +216,13 @@ public:
|
|||
* @param aAccessible [in] the item accessible
|
||||
* @param aState [in] the state of the item accessible
|
||||
*/
|
||||
static already_AddRefed<nsIAccessible>
|
||||
GetSelectableContainer(nsIAccessible *aAccessible, PRUint32 aState);
|
||||
static nsAccessible *GetSelectableContainer(nsAccessible *aAccessible,
|
||||
PRUint32 aState);
|
||||
|
||||
/**
|
||||
* Return multi selectable container for the given item.
|
||||
*/
|
||||
static already_AddRefed<nsIAccessible>
|
||||
GetMultiSelectableContainer(nsIDOMNode *aNode);
|
||||
static nsAccessible *GetMultiSelectableContainer(nsINode *aNode);
|
||||
|
||||
/**
|
||||
* Return true if the DOM node of given accessible has aria-selected="true"
|
||||
|
@ -239,7 +240,7 @@ public:
|
|||
*/
|
||||
static already_AddRefed<nsIAccessibleText>
|
||||
GetTextAccessibleFromSelection(nsISelection *aSelection,
|
||||
nsIDOMNode **aNode = nsnull);
|
||||
nsINode **aNode = nsnull);
|
||||
|
||||
/**
|
||||
* Converts the given coordinates to coordinates relative screen.
|
||||
|
@ -254,7 +255,7 @@ public:
|
|||
*/
|
||||
static nsresult ConvertToScreenCoords(PRInt32 aX, PRInt32 aY,
|
||||
PRUint32 aCoordinateType,
|
||||
nsIAccessNode *aAccessNode,
|
||||
nsAccessNode *aAccessNode,
|
||||
nsIntPoint *aCoords);
|
||||
|
||||
/**
|
||||
|
@ -270,29 +271,31 @@ public:
|
|||
*/
|
||||
static nsresult ConvertScreenCoordsTo(PRInt32 *aX, PRInt32 *aY,
|
||||
PRUint32 aCoordinateType,
|
||||
nsIAccessNode *aAccessNode);
|
||||
nsAccessNode *aAccessNode);
|
||||
|
||||
/**
|
||||
* Returns coordinates relative screen for the top level window.
|
||||
*
|
||||
* @param aAccessNode the accessible hosted in the window
|
||||
*/
|
||||
static nsIntPoint GetScreenCoordsForWindow(nsIAccessNode *aAccessNode);
|
||||
static nsIntPoint GetScreenCoordsForWindow(nsAccessNode *aAccessNode);
|
||||
|
||||
/**
|
||||
* Returns coordinates relative screen for the parent of the given accessible.
|
||||
*
|
||||
* @param aAccessNode the accessible
|
||||
*/
|
||||
static nsIntPoint GetScreenCoordsForParent(nsIAccessNode *aAccessNode);
|
||||
static nsIntPoint GetScreenCoordsForParent(nsAccessNode *aAccessNode);
|
||||
|
||||
/**
|
||||
* Get the role map entry for a given DOM node. This will use the first
|
||||
* ARIA role if the role attribute provides a space delimited list of roles.
|
||||
* @param aNode The DOM node to get the role map entry for
|
||||
* @return A pointer to the role map entry for the ARIA role, or nsnull if none
|
||||
*
|
||||
* @param aNode [in] the DOM node to get the role map entry for
|
||||
* @return a pointer to the role map entry for the ARIA role, or nsnull
|
||||
* if none
|
||||
*/
|
||||
static nsRoleMapEntry* GetRoleMapEntry(nsIDOMNode *aNode);
|
||||
static nsRoleMapEntry *GetRoleMapEntry(nsINode *aNode);
|
||||
|
||||
/**
|
||||
* Return the role of the given accessible.
|
||||
|
@ -410,7 +413,7 @@ public:
|
|||
* Return true if the given node can be accessible and attached to
|
||||
* the document's accessible tree.
|
||||
*/
|
||||
static PRBool IsNodeRelevant(nsIDOMNode *aNode);
|
||||
static PRBool IsNodeRelevant(nsINode *aNode);
|
||||
|
||||
/**
|
||||
* Search hint enum constants. Used by GetHeaderCellsFor() method.
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
|
||||
nsIStringBundle *nsAccessNode::gStringBundle = 0;
|
||||
nsIStringBundle *nsAccessNode::gKeyStringBundle = 0;
|
||||
nsIDOMNode *nsAccessNode::gLastFocusedNode = 0;
|
||||
nsINode *nsAccessNode::gLastFocusedNode = nsnull;
|
||||
|
||||
PRBool nsAccessNode::gIsCacheDisabled = PR_FALSE;
|
||||
PRBool nsAccessNode::gIsFormFillEnabled = PR_FALSE;
|
||||
|
@ -109,8 +109,9 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE_FULL(nsAccessNode, nsIAccessNode,
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessNode construction/desctruction
|
||||
|
||||
nsAccessNode::nsAccessNode(nsIDOMNode *aNode, nsIWeakReference* aShell):
|
||||
mDOMNode(aNode), mWeakShell(aShell)
|
||||
nsAccessNode::
|
||||
nsAccessNode(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
mContent(aContent), mWeakShell(aShell)
|
||||
{
|
||||
#ifdef DEBUG_A11Y
|
||||
mIsInitialized = PR_FALSE;
|
||||
|
@ -168,10 +169,9 @@ nsAccessNode::Init()
|
|||
// Make sure an ancestor in real content is cached
|
||||
// so that nsDocAccessible::RefreshNodes() can find the anonymous subtree to release when
|
||||
// the root node goes away
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
|
||||
if (content && content->IsInAnonymousSubtree()) {
|
||||
if (mContent && mContent->IsInAnonymousSubtree()) {
|
||||
// Specific examples of where this is used: <input type="file"> and <xul:findbar>
|
||||
nsAccessible *parent = GetAccService()->GetContainerAccessible(mDOMNode,
|
||||
nsAccessible *parent = GetAccService()->GetContainerAccessible(mContent,
|
||||
PR_TRUE);
|
||||
if (parent)
|
||||
parent->EnsureChildren();
|
||||
|
@ -188,7 +188,7 @@ nsAccessNode::Init()
|
|||
nsresult
|
||||
nsAccessNode::Shutdown()
|
||||
{
|
||||
mDOMNode = nsnull;
|
||||
mContent = nsnull;
|
||||
mWeakShell = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
|
@ -197,7 +197,7 @@ nsAccessNode::Shutdown()
|
|||
// nsIAccessNode
|
||||
NS_IMETHODIMP nsAccessNode::GetUniqueID(void **aUniqueID)
|
||||
{
|
||||
*aUniqueID = static_cast<void*>(mDOMNode);
|
||||
*aUniqueID = static_cast<void*>(GetNode());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -300,7 +300,7 @@ void nsAccessNode::ShutdownXPAccessibility()
|
|||
PRBool
|
||||
nsAccessNode::IsDefunct()
|
||||
{
|
||||
if (!mDOMNode)
|
||||
if (!mContent)
|
||||
return PR_TRUE;
|
||||
|
||||
// Call GetPresShell() since the accessible may be shut down in it.
|
||||
|
@ -338,8 +338,8 @@ nsPresContext* nsAccessNode::GetPresContext()
|
|||
already_AddRefed<nsRootAccessible> nsAccessNode::GetRootAccessible()
|
||||
{
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
|
||||
nsCoreUtils::GetDocShellTreeItemFor(mDOMNode);
|
||||
NS_ASSERTION(docShellTreeItem, "No docshell tree item for mDOMNode");
|
||||
nsCoreUtils::GetDocShellTreeItemFor(mContent);
|
||||
NS_ASSERTION(docShellTreeItem, "No docshell tree item for mContent");
|
||||
if (!docShellTreeItem) {
|
||||
return nsnull;
|
||||
}
|
||||
|
@ -358,8 +358,7 @@ already_AddRefed<nsRootAccessible> nsAccessNode::GetRootAccessible()
|
|||
nsIFrame*
|
||||
nsAccessNode::GetFrame()
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
return content ? content->GetPrimaryFrame() : nsnull;
|
||||
return mContent ? mContent->GetPrimaryFrame() : nsnull;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -381,25 +380,28 @@ nsAccessNode::IsInCache()
|
|||
// nsIAccessNode
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessNode::GetDOMNode(nsIDOMNode **aNode)
|
||||
nsAccessNode::GetDOMNode(nsIDOMNode **aDOMNode)
|
||||
{
|
||||
NS_IF_ADDREF(*aNode = mDOMNode);
|
||||
NS_ENSURE_ARG_POINTER(aDOMNode);
|
||||
*aDOMNode = nsnull;
|
||||
|
||||
nsINode *node = GetNode();
|
||||
if (node)
|
||||
CallQueryInterface(node, aDOMNode);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessNode::GetNumChildren(PRInt32 *aNumChildren)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
NS_ENSURE_ARG_POINTER(aNumChildren);
|
||||
*aNumChildren = 0;
|
||||
|
||||
if (!content) {
|
||||
*aNumChildren = 0;
|
||||
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aNumChildren = content->GetChildCount();
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aNumChildren = GetNode()->GetChildCount();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -427,7 +429,7 @@ nsAccessNode::GetInnerHTML(nsAString& aInnerHTML)
|
|||
{
|
||||
aInnerHTML.Truncate();
|
||||
|
||||
nsCOMPtr<nsIDOMNSHTMLElement> domNSElement(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMNSHTMLElement> domNSElement(do_QueryInterface(mContent));
|
||||
NS_ENSURE_TRUE(domNSElement, NS_ERROR_NULL_POINTER);
|
||||
|
||||
return domNSElement->GetInnerHTML(aInnerHTML);
|
||||
|
@ -473,31 +475,34 @@ nsAccessNode::ScrollToPoint(PRUint32 aCoordinateType, PRInt32 aX, PRInt32 aY)
|
|||
}
|
||||
|
||||
// nsAccessNode protected
|
||||
nsresult
|
||||
nsAccessNode::MakeAccessNode(nsIDOMNode *aNode, nsIAccessNode **aAccessNode)
|
||||
nsAccessNode *
|
||||
nsAccessNode::MakeAccessNode(nsINode *aNode)
|
||||
{
|
||||
*aAccessNode = nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessNode> accessNode =
|
||||
GetAccService()->GetCachedAccessNode(aNode, mWeakShell);
|
||||
nsAccessNode *accessNode = GetAccService()->GetCachedAccessNode(aNode,
|
||||
mWeakShell);
|
||||
|
||||
if (!accessNode)
|
||||
accessNode = GetAccService()->GetAccessibleInWeakShell(aNode, mWeakShell);
|
||||
|
||||
if (accessNode) {
|
||||
NS_ADDREF(*aAccessNode = accessNode);
|
||||
return NS_OK;
|
||||
if (accessNode)
|
||||
return accessNode;
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
|
||||
if (!content)
|
||||
return nsnull;
|
||||
|
||||
nsAccessNode *newAccessNode = new nsAccessNode(content, mWeakShell);
|
||||
if (!newAccessNode)
|
||||
return nsnull;
|
||||
|
||||
// Initialize and cache it.
|
||||
if (NS_FAILED(newAccessNode->Init())) {
|
||||
newAccessNode->Shutdown();
|
||||
delete newAccessNode;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsAccessNode *newAccessNode = new nsAccessNode(aNode, mWeakShell);
|
||||
if (!newAccessNode) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_ADDREF(*aAccessNode = newAccessNode);
|
||||
newAccessNode->Init();
|
||||
|
||||
return NS_OK;
|
||||
return newAccessNode;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -505,12 +510,15 @@ nsAccessNode::GetFirstChildNode(nsIAccessNode **aAccessNode)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aAccessNode);
|
||||
*aAccessNode = nsnull;
|
||||
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
mDOMNode->GetFirstChild(getter_AddRefs(domNode));
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return domNode ? MakeAccessNode(domNode, aAccessNode) : NS_OK;
|
||||
nsIContent* childNode = GetNode()->GetChildAt(0);
|
||||
if (childNode)
|
||||
NS_IF_ADDREF(*aAccessNode = MakeAccessNode(childNode));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -518,12 +526,16 @@ nsAccessNode::GetLastChildNode(nsIAccessNode **aAccessNode)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aAccessNode);
|
||||
*aAccessNode = nsnull;
|
||||
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
mDOMNode->GetLastChild(getter_AddRefs(domNode));
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return domNode ? MakeAccessNode(domNode, aAccessNode) : NS_OK;
|
||||
PRUint32 childCount = GetNode()->GetChildCount();
|
||||
nsIContent* childNode = GetNode()->GetChildAt(childCount - 1);
|
||||
if (childNode)
|
||||
NS_IF_ADDREF(*aAccessNode = MakeAccessNode(childNode));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -531,12 +543,15 @@ nsAccessNode::GetParentNode(nsIAccessNode **aAccessNode)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aAccessNode);
|
||||
*aAccessNode = nsnull;
|
||||
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
mDOMNode->GetParentNode(getter_AddRefs(domNode));
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return domNode ? MakeAccessNode(domNode, aAccessNode) : NS_OK;
|
||||
nsINode* parentNode = GetNode()->GetNodeParent();
|
||||
if (parentNode)
|
||||
NS_IF_ADDREF(*aAccessNode = MakeAccessNode(parentNode));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -544,12 +559,20 @@ nsAccessNode::GetPreviousSiblingNode(nsIAccessNode **aAccessNode)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aAccessNode);
|
||||
*aAccessNode = nsnull;
|
||||
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
mDOMNode->GetPreviousSibling(getter_AddRefs(domNode));
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return domNode ? MakeAccessNode(domNode, aAccessNode) : NS_OK;
|
||||
nsINode* parentNode = GetNode()->GetNodeParent();
|
||||
PRInt32 indexOf = parentNode->IndexOf(GetNode());
|
||||
if (indexOf == -1)
|
||||
return NS_OK;
|
||||
|
||||
nsIContent *siblingNode = parentNode->GetChildAt(indexOf - 1);
|
||||
if (siblingNode)
|
||||
NS_IF_ADDREF(*aAccessNode = MakeAccessNode(siblingNode));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -557,12 +580,20 @@ nsAccessNode::GetNextSiblingNode(nsIAccessNode **aAccessNode)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aAccessNode);
|
||||
*aAccessNode = nsnull;
|
||||
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
mDOMNode->GetNextSibling(getter_AddRefs(domNode));
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return domNode ? MakeAccessNode(domNode, aAccessNode) : NS_OK;
|
||||
nsINode* parentNode = GetNode()->GetNodeParent();
|
||||
PRInt32 indexOf = parentNode->IndexOf(GetNode());
|
||||
if (indexOf == -1)
|
||||
return NS_OK;
|
||||
|
||||
nsIContent *siblingNode = parentNode->GetChildAt(indexOf + 1);
|
||||
if (siblingNode)
|
||||
NS_IF_ADDREF(*aAccessNode = MakeAccessNode(siblingNode));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -571,13 +602,14 @@ nsAccessNode::GetChildNodeAt(PRInt32 aChildNum, nsIAccessNode **aAccessNode)
|
|||
NS_ENSURE_ARG_POINTER(aAccessNode);
|
||||
*aAccessNode = nsnull;
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
NS_ENSURE_TRUE(content, NS_ERROR_NULL_POINTER);
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> domNode =
|
||||
do_QueryInterface(content->GetChildAt(aChildNum));
|
||||
nsIContent* childNode = GetNode()->GetChildAt(aChildNum);
|
||||
if (childNode)
|
||||
NS_IF_ADDREF(*aAccessNode = MakeAccessNode(childNode));
|
||||
|
||||
return domNode ? MakeAccessNode(domNode, aAccessNode) : NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -588,9 +620,8 @@ nsAccessNode::GetComputedStyleValue(const nsAString& aPseudoElt,
|
|||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> styleDecl;
|
||||
nsCoreUtils::GetComputedStyleDeclaration(aPseudoElt, mDOMNode,
|
||||
getter_AddRefs(styleDecl));
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> styleDecl =
|
||||
nsCoreUtils::GetComputedStyleDeclaration(aPseudoElt, mContent);
|
||||
NS_ENSURE_TRUE(styleDecl, NS_ERROR_FAILURE);
|
||||
|
||||
return styleDecl->GetPropertyValue(aPropertyName, aValue);
|
||||
|
@ -607,9 +638,8 @@ nsAccessNode::GetComputedStyleCSSValue(const nsAString& aPseudoElt,
|
|||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> styleDecl;
|
||||
nsCoreUtils::GetComputedStyleDeclaration(aPseudoElt, mDOMNode,
|
||||
getter_AddRefs(styleDecl));
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> styleDecl =
|
||||
nsCoreUtils::GetComputedStyleDeclaration(aPseudoElt, mContent);
|
||||
NS_ENSURE_STATE(styleDecl);
|
||||
|
||||
nsCOMPtr<nsIDOMCSSValue> cssValue;
|
||||
|
@ -620,11 +650,14 @@ nsAccessNode::GetComputedStyleCSSValue(const nsAString& aPseudoElt,
|
|||
}
|
||||
|
||||
// nsAccessNode public
|
||||
already_AddRefed<nsIDOMNode> nsAccessNode::GetCurrentFocus()
|
||||
already_AddRefed<nsINode>
|
||||
nsAccessNode::GetCurrentFocus()
|
||||
{
|
||||
nsIPresShell *shell = nsCoreUtils::GetPresShellFor(mDOMNode);
|
||||
// XXX: consider to use nsFocusManager directly, it allows us to avoid
|
||||
// unnecessary query interface calls.
|
||||
nsCOMPtr<nsIPresShell> shell = GetPresShell();
|
||||
NS_ENSURE_TRUE(shell, nsnull);
|
||||
nsCOMPtr<nsIDocument> doc = shell->GetDocument();
|
||||
nsIDocument *doc = shell->GetDocument();
|
||||
NS_ENSURE_TRUE(doc, nsnull);
|
||||
|
||||
nsIDOMWindow* win = doc->GetWindow();
|
||||
|
@ -636,7 +669,7 @@ already_AddRefed<nsIDOMNode> nsAccessNode::GetCurrentFocus()
|
|||
fm->GetFocusedElementForWindow(win, PR_TRUE, getter_AddRefs(focusedWindow),
|
||||
getter_AddRefs(focusedElement));
|
||||
|
||||
nsIDOMNode *focusedNode = nsnull;
|
||||
nsINode *focusedNode = nsnull;
|
||||
if (focusedElement) {
|
||||
CallQueryInterface(focusedElement, &focusedNode);
|
||||
}
|
||||
|
@ -654,34 +687,14 @@ NS_IMETHODIMP
|
|||
nsAccessNode::GetLanguage(nsAString& aLanguage)
|
||||
{
|
||||
aLanguage.Truncate();
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
if (!content) {
|
||||
// For documents make sure we look for lang attribute on
|
||||
// document element
|
||||
nsCOMPtr<nsIDOMDocument> domDoc(do_QueryInterface(mDOMNode));
|
||||
if (domDoc) {
|
||||
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc(do_QueryInterface(mDOMNode));
|
||||
if (htmlDoc) {
|
||||
// Make sure we look for lang attribute on HTML <body>
|
||||
nsCOMPtr<nsIDOMHTMLElement> bodyElement;
|
||||
htmlDoc->GetBody(getter_AddRefs(bodyElement));
|
||||
content = do_QueryInterface(bodyElement);
|
||||
}
|
||||
if (!content) {
|
||||
nsCOMPtr<nsIDOMElement> docElement;
|
||||
domDoc->GetDocumentElement(getter_AddRefs(docElement));
|
||||
content = do_QueryInterface(docElement);
|
||||
}
|
||||
}
|
||||
if (!content) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
nsCoreUtils::GetLanguageFor(content, nsnull, aLanguage);
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCoreUtils::GetLanguageFor(mContent, nsnull, aLanguage);
|
||||
|
||||
if (aLanguage.IsEmpty()) { // Nothing found, so use document's language
|
||||
nsIDocument *doc = content->GetOwnerDoc();
|
||||
nsIDocument *doc = mContent->GetOwnerDoc();
|
||||
if (doc) {
|
||||
doc->GetHeaderData(nsAccessibilityAtoms::headerContentLanguage, aLanguage);
|
||||
}
|
||||
|
|
|
@ -82,9 +82,10 @@ typedef nsRefPtrHashtable<nsVoidPtrHashKey, nsAccessNode>
|
|||
|
||||
class nsAccessNode: public nsIAccessNode
|
||||
{
|
||||
public: // construction, destruction
|
||||
nsAccessNode(nsIDOMNode *, nsIWeakReference* aShell);
|
||||
virtual ~nsAccessNode();
|
||||
public:
|
||||
|
||||
nsAccessNode(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
virtual ~nsAccessNode();
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsAccessNode, nsIAccessNode)
|
||||
|
@ -110,9 +111,18 @@ class nsAccessNode: public nsIAccessNode
|
|||
*/
|
||||
already_AddRefed<nsRootAccessible> GetRootAccessible();
|
||||
|
||||
static nsIDOMNode *gLastFocusedNode;
|
||||
/**
|
||||
* Reference to a node of focused accessible.
|
||||
*/
|
||||
static nsINode *gLastFocusedNode;
|
||||
|
||||
already_AddRefed<nsIDOMNode> GetCurrentFocus();
|
||||
/**
|
||||
* Return focused node within accessible window.
|
||||
*
|
||||
* XXX: it shouldn't break us if we return focused node not depending on
|
||||
* window so that we can turn this method into util method.
|
||||
*/
|
||||
already_AddRefed<nsINode> GetCurrentFocus();
|
||||
|
||||
/**
|
||||
* Returns true when the accessible is defunct.
|
||||
|
@ -137,7 +147,31 @@ class nsAccessNode: public nsIAccessNode
|
|||
/**
|
||||
* Return DOM node associated with this accessible.
|
||||
*/
|
||||
nsIDOMNode *GetDOMNode() const { return mDOMNode; }
|
||||
already_AddRefed<nsIDOMNode> GetDOMNode() const
|
||||
{
|
||||
nsIDOMNode *DOMNode = nsnull;
|
||||
if (GetNode())
|
||||
CallQueryInterface(GetNode(), &DOMNode);
|
||||
return DOMNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return DOM node associated with the accessible.
|
||||
*/
|
||||
virtual nsINode* GetNode() const { return mContent; }
|
||||
nsIContent* GetContent() const { return mContent; }
|
||||
|
||||
/**
|
||||
* Return node type information of DOM node associated with the accessible.
|
||||
*/
|
||||
PRBool IsContent() const
|
||||
{
|
||||
return GetNode() && GetNode()->IsNodeOfType(nsINode::eCONTENT);
|
||||
}
|
||||
PRBool IsDocument() const
|
||||
{
|
||||
return GetNode() && GetNode()->IsNodeOfType(nsINode::eDOCUMENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the corresponding press shell for this accessible.
|
||||
|
@ -158,14 +192,17 @@ class nsAccessNode: public nsIAccessNode
|
|||
#endif
|
||||
|
||||
protected:
|
||||
nsresult MakeAccessNode(nsIDOMNode *aNode, nsIAccessNode **aAccessNode);
|
||||
/**
|
||||
* Return the access node for the given DOM node.
|
||||
*/
|
||||
nsAccessNode *MakeAccessNode(nsINode *aNode);
|
||||
|
||||
nsPresContext* GetPresContext();
|
||||
|
||||
void LastRelease();
|
||||
|
||||
nsCOMPtr<nsIDOMNode> mDOMNode;
|
||||
nsCOMPtr<nsIWeakReference> mWeakShell;
|
||||
nsCOMPtr<nsIContent> mContent;
|
||||
nsCOMPtr<nsIWeakReference> mWeakShell;
|
||||
|
||||
#ifdef DEBUG_A11Y
|
||||
PRBool mIsInitialized;
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
|
||||
// Alphabetical list of generic atoms
|
||||
ACCESSIBILITY_ATOM(button, "button")
|
||||
ACCESSIBILITY_ATOM(checkbox, "checkbox")
|
||||
ACCESSIBILITY_ATOM(col, "col")
|
||||
ACCESSIBILITY_ATOM(_empty, "")
|
||||
ACCESSIBILITY_ATOM(_false, "false")
|
||||
|
@ -64,7 +65,10 @@ ACCESSIBILITY_ATOM(image, "image")
|
|||
ACCESSIBILITY_ATOM(menu, "menu")
|
||||
ACCESSIBILITY_ATOM(menuButton, "menu-button")
|
||||
ACCESSIBILITY_ATOM(menugenerated, "menugenerated")
|
||||
ACCESSIBILITY_ATOM(multiple, "multiple")
|
||||
ACCESSIBILITY_ATOM(open, "open")
|
||||
ACCESSIBILITY_ATOM(password, "password")
|
||||
ACCESSIBILITY_ATOM(radio, "radio")
|
||||
ACCESSIBILITY_ATOM(reset, "reset")
|
||||
ACCESSIBILITY_ATOM(row, "row")
|
||||
ACCESSIBILITY_ATOM(submit, "submit")
|
||||
|
@ -122,6 +126,7 @@ ACCESSIBILITY_ATOM(label, "label")
|
|||
ACCESSIBILITY_ATOM(legend, "legend")
|
||||
ACCESSIBILITY_ATOM(li, "li")
|
||||
ACCESSIBILITY_ATOM(link, "link")
|
||||
ACCESSIBILITY_ATOM(listcell, "listcell") // XUL
|
||||
ACCESSIBILITY_ATOM(listcols, "listcols") // XUL
|
||||
ACCESSIBILITY_ATOM(listcol, "listcol") // XUL
|
||||
ACCESSIBILITY_ATOM(listhead, "listhead") // XUL
|
||||
|
@ -161,6 +166,7 @@ ACCESSIBILITY_ATOM(acceltext, "acceltext")
|
|||
ACCESSIBILITY_ATOM(accesskey, "accesskey")
|
||||
ACCESSIBILITY_ATOM(alt, "alt")
|
||||
ACCESSIBILITY_ATOM(anonid, "anonid") // Used for ID's in XBL
|
||||
ACCESSIBILITY_ATOM(checked, "checked")
|
||||
ACCESSIBILITY_ATOM(contenteditable, "contenteditable")
|
||||
ACCESSIBILITY_ATOM(control, "control")
|
||||
ACCESSIBILITY_ATOM(disabled, "disabled")
|
||||
|
@ -175,6 +181,7 @@ ACCESSIBILITY_ATOM(editable, "editable")
|
|||
ACCESSIBILITY_ATOM(_for, "for")
|
||||
ACCESSIBILITY_ATOM(headers, "headers") // HTML table
|
||||
ACCESSIBILITY_ATOM(hidden, "hidden") // XUL tree columns
|
||||
ACCESSIBILITY_ATOM(hover, "hover") // XUL color picker
|
||||
ACCESSIBILITY_ATOM(href, "href") // XUL, XLink
|
||||
ACCESSIBILITY_ATOM(increment, "increment") // XUL
|
||||
ACCESSIBILITY_ATOM(lang, "lang")
|
||||
|
@ -183,12 +190,14 @@ ACCESSIBILITY_ATOM(longDesc, "longdesc")
|
|||
ACCESSIBILITY_ATOM(max, "max") // XUL
|
||||
ACCESSIBILITY_ATOM(maxpos, "maxpos") // XUL
|
||||
ACCESSIBILITY_ATOM(minpos, "minpos") // XUL
|
||||
ACCESSIBILITY_ATOM(_moz_menuactive, "_moz-menuactive") // XUL
|
||||
ACCESSIBILITY_ATOM(multiline, "multiline") // XUL
|
||||
ACCESSIBILITY_ATOM(name, "name")
|
||||
ACCESSIBILITY_ATOM(onclick, "onclick")
|
||||
ACCESSIBILITY_ATOM(popup, "popup")
|
||||
ACCESSIBILITY_ATOM(readonly, "readonly")
|
||||
ACCESSIBILITY_ATOM(scope, "scope") // HTML table
|
||||
ACCESSIBILITY_ATOM(seltype, "seltype") // XUL listbox
|
||||
ACCESSIBILITY_ATOM(simple, "simple") // XLink
|
||||
ACCESSIBILITY_ATOM(src, "src")
|
||||
ACCESSIBILITY_ATOM(selected, "selected")
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -44,20 +44,8 @@
|
|||
#include "a11yGeneric.h"
|
||||
#include "nsAccDocManager.h"
|
||||
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsIObserver.h"
|
||||
|
||||
class nsAccessNode;
|
||||
class nsAccessible;
|
||||
class nsIFrame;
|
||||
class nsIWeakReference;
|
||||
class nsIDOMNode;
|
||||
class nsObjectFrame;
|
||||
class nsIDocShell;
|
||||
class nsIPresShell;
|
||||
class nsIContent;
|
||||
struct nsRoleMapEntry;
|
||||
|
||||
class nsAccessibilityService : public nsAccDocManager,
|
||||
public nsIAccessibilityService,
|
||||
public nsIObserver
|
||||
|
@ -140,14 +128,6 @@ public:
|
|||
|
||||
// nsAccessibiltiyService
|
||||
|
||||
/**
|
||||
* Return presentation shell for the given node.
|
||||
*
|
||||
* @param aNode - the given DOM node.
|
||||
*/
|
||||
static nsresult GetShellFromNode(nsIDOMNode *aNode,
|
||||
nsIWeakReference **weakShell);
|
||||
|
||||
/**
|
||||
* Return true if accessibility service has been shutdown.
|
||||
*/
|
||||
|
@ -163,13 +143,13 @@ public:
|
|||
* hidden
|
||||
*/
|
||||
already_AddRefed<nsAccessible>
|
||||
GetAccessible(nsIDOMNode *aNode, nsIPresShell *aPresShell,
|
||||
GetAccessible(nsINode *aNode, nsIPresShell *aPresShell,
|
||||
nsIWeakReference *aWeakShell, PRBool *aIsHidden = nsnull);
|
||||
|
||||
/**
|
||||
* Return an accessible for the given DOM node.
|
||||
*/
|
||||
nsAccessible *GetAccessible(nsIDOMNode *aNode);
|
||||
nsAccessible *GetAccessible(nsINode *aNode);
|
||||
|
||||
/**
|
||||
* Return an accessible for a DOM node in the given pres shell.
|
||||
|
@ -177,7 +157,7 @@ public:
|
|||
* @param aNode [in] the given node.
|
||||
* @param aPresShell [in] the presentation shell of the given node.
|
||||
*/
|
||||
nsAccessible *GetAccessibleInWeakShell(nsIDOMNode *aNode,
|
||||
nsAccessible *GetAccessibleInWeakShell(nsINode *aNode,
|
||||
nsIWeakReference *aPresShell);
|
||||
|
||||
/**
|
||||
|
@ -187,7 +167,33 @@ public:
|
|||
* @param aCanCreate [in] specifies if accessible can be created if it didn't
|
||||
* exist
|
||||
*/
|
||||
nsAccessible *GetContainerAccessible(nsIDOMNode *aNode, PRBool aCanCreate);
|
||||
nsAccessible *GetContainerAccessible(nsINode *aNode, PRBool aCanCreate);
|
||||
|
||||
/**
|
||||
* The same as getAccessibleFor method except it returns accessible only if
|
||||
* it is attached, i.e. accessible is certified to be a descendant of the root
|
||||
* accessible.
|
||||
*
|
||||
* XXX: this method must go away once we'll implement correct accessible tree.
|
||||
*
|
||||
* @param aNode [in] the DOM node to get an accessible for
|
||||
* @return the accessible for the given DOM node
|
||||
*/
|
||||
nsAccessible *GetAttachedAccessibleFor(nsINode *aNode);
|
||||
|
||||
/**
|
||||
* Return an DOM node that is relevant to attached accessible check. This
|
||||
* node is either from bindings chain if given node is anonymous and owner
|
||||
* binding denies accessible in anonymous content or given node (it's not
|
||||
* important whether it is accessible or not). This method doesn't create
|
||||
* accessible object for returned node.
|
||||
*
|
||||
* XXX: this method must go away once we'll implement correct accessible tree.
|
||||
*
|
||||
* @param aNode [in] the DOM node to get relevant content node
|
||||
* @return the DOM node for parent attached accessible
|
||||
*/
|
||||
nsINode *GetRelevantContentNodeFor(nsINode *aNode);
|
||||
|
||||
/**
|
||||
* Return an access node for the DOM node in the given presentation shell if
|
||||
|
@ -197,7 +203,7 @@ public:
|
|||
* @param aPresShell [in] the presentation shell which contains layout info
|
||||
* for the DOM node
|
||||
*/
|
||||
nsAccessNode* GetCachedAccessNode(nsIDOMNode *aNode,
|
||||
nsAccessNode* GetCachedAccessNode(nsINode *aNode,
|
||||
nsIWeakReference *aShell);
|
||||
|
||||
/**
|
||||
|
@ -234,20 +240,19 @@ private:
|
|||
/**
|
||||
* Return presentation shell, DOM node for the given frame.
|
||||
*
|
||||
* @param aFrame - the given frame
|
||||
* @param aShell [out] - presentation shell for DOM node associated with the
|
||||
* given frame
|
||||
* @param aContent [out] - DOM node associated with the given frame
|
||||
* @param aFrame [in] the given frame
|
||||
* @param aShell [out] presentation shell for DOM node associated with the
|
||||
* given frame
|
||||
* @param aContent [out] DOM node associated with the given frame
|
||||
*/
|
||||
nsresult GetInfo(nsIFrame *aFrame,
|
||||
nsIWeakReference **aShell,
|
||||
nsIDOMNode **aContent);
|
||||
nsresult GetInfo(nsIFrame *aFrame, nsIWeakReference **aShell,
|
||||
nsIContent **aContent);
|
||||
|
||||
/**
|
||||
* Return accessible for HTML area element associated with an image map.
|
||||
*/
|
||||
already_AddRefed<nsAccessible>
|
||||
GetAreaAccessible(nsIFrame *aImageFrame, nsIDOMNode *aAreaNode,
|
||||
GetAreaAccessible(nsIFrame *aImageFrame, nsINode *aAreaNode,
|
||||
nsIWeakReference *aWeakShell);
|
||||
|
||||
/**
|
||||
|
@ -255,20 +260,20 @@ private:
|
|||
* interface.
|
||||
*/
|
||||
already_AddRefed<nsAccessible>
|
||||
CreateAccessibleByType(nsIDOMNode *aNode, nsIWeakReference *aWeakShell);
|
||||
CreateAccessibleByType(nsIContent *aContent, nsIWeakReference *aWeakShell);
|
||||
|
||||
/**
|
||||
* Create accessible for HTML node by tag name.
|
||||
*/
|
||||
already_AddRefed<nsAccessible>
|
||||
CreateHTMLAccessibleByMarkup(nsIFrame *aFrame, nsIWeakReference *aWeakShell,
|
||||
nsIDOMNode *aNode);
|
||||
nsINode *aNode);
|
||||
|
||||
/**
|
||||
* Create accessible if parent is a deck frame.
|
||||
*/
|
||||
already_AddRefed<nsAccessible>
|
||||
CreateAccessibleForDeckChild(nsIFrame *aFrame, nsIDOMNode *aNode,
|
||||
CreateAccessibleForDeckChild(nsIFrame *aFrame, nsIContent *aContent,
|
||||
nsIWeakReference *aWeakShell);
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
|
@ -276,7 +281,8 @@ private:
|
|||
* Create accessible for XUL tree element.
|
||||
*/
|
||||
already_AddRefed<nsAccessible>
|
||||
CreateAccessibleForXULTree(nsIDOMNode *aNode, nsIWeakReference *aWeakShell);
|
||||
CreateAccessibleForXULTree(nsIContent *aContent,
|
||||
nsIWeakReference *aWeakShell);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -92,7 +92,7 @@ class nsAccessible : public nsAccessNodeWrap,
|
|||
public nsIAccessibleValue
|
||||
{
|
||||
public:
|
||||
nsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
nsAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
virtual ~nsAccessible();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
@ -349,7 +349,7 @@ protected:
|
|||
* @param aStartNode [in] the DOM node to start from
|
||||
* @return the resulting accessible
|
||||
*/
|
||||
nsAccessible *GetFirstAvailableAccessible(nsIDOMNode *aStartNode) const;
|
||||
nsAccessible *GetFirstAvailableAccessible(nsINode *aStartNode) const;
|
||||
|
||||
// Hyperlink helpers
|
||||
virtual nsresult GetLinkOffset(PRInt32* aStartOffset, PRInt32* aEndOffset);
|
||||
|
|
|
@ -64,19 +64,31 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsApplicationAccessible, nsAccessible,
|
|||
nsIAccessibleApplication)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIAccessNode
|
||||
// nsIAccessible
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetRootDocument(nsIAccessibleDocument **aRootDocument)
|
||||
nsApplicationAccessible::GetParent(nsIAccessible **aAccessible)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRootDocument);
|
||||
*aRootDocument = nsnull;
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aAccessible);
|
||||
*aAccessible = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIAccessible
|
||||
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::GetName(nsAString& aName)
|
||||
|
@ -107,17 +119,30 @@ nsApplicationAccessible::GetName(nsAString& aName)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetDescription(nsAString& aValue)
|
||||
nsApplicationAccessible::GetValue(nsAString &aValue)
|
||||
{
|
||||
aValue.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetDescription(nsAString &aDescription)
|
||||
{
|
||||
aDescription.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetKeyboardShortcut(nsAString &aKeyboardShortcut)
|
||||
{
|
||||
aKeyboardShortcut.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetRole(PRUint32 *aRole)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRole);
|
||||
|
||||
return GetRoleInternal(aRole);
|
||||
}
|
||||
|
||||
|
@ -125,21 +150,144 @@ NS_IMETHODIMP
|
|||
nsApplicationAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aState);
|
||||
*aState = 0;
|
||||
|
||||
if (aExtraState)
|
||||
*aExtraState = 0;
|
||||
|
||||
GetStateInternal(aState, aExtraState);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetParent(nsIAccessible **aAccessible)
|
||||
nsApplicationAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAccessible);
|
||||
*aAccessible = nsnull;
|
||||
NS_ENSURE_ARG_POINTER(aAttributes);
|
||||
*aAttributes = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return IsDefunct() ? NS_ERROR_FAILURE : NS_OK;
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GroupPosition(PRInt32 *aGroupLevel,
|
||||
PRInt32 *aSimilarItemsInGroup,
|
||||
PRInt32 *aPositionInGroup)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aGroupLevel);
|
||||
*aGroupLevel = 0;
|
||||
NS_ENSURE_ARG_POINTER(aSimilarItemsInGroup);
|
||||
*aSimilarItemsInGroup = 0;
|
||||
NS_ENSURE_ARG_POINTER(aPositionInGroup);
|
||||
*aPositionInGroup = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
nsIAccessible **aChild)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aChild);
|
||||
*aChild = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetDeepestChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
nsIAccessible **aChild)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aChild);
|
||||
*aChild = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRelation);
|
||||
*aRelation = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetRelationsCount(PRUint32 *aCount)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCount);
|
||||
*aCount = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetRelation(PRUint32 aIndex,
|
||||
nsIAccessibleRelation **aRelation)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRelation);
|
||||
*aRelation = nsnull;
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetRelations(nsIArray **aRelations)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRelations);
|
||||
*aRelations = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetBounds(PRInt32 *aX, PRInt32 *aY,
|
||||
PRInt32 *aWidth, PRInt32 *aHeight)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aX);
|
||||
*aX = 0;
|
||||
NS_ENSURE_ARG_POINTER(aY);
|
||||
*aY = 0;
|
||||
NS_ENSURE_ARG_POINTER(aWidth);
|
||||
*aWidth = 0;
|
||||
NS_ENSURE_ARG_POINTER(aHeight);
|
||||
*aHeight = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::SetSelected(PRBool aIsSelected)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::TakeSelection()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::TakeFocus()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetNumActions(PRUint8 *aNumActions)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aNumActions);
|
||||
*aNumActions = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetActionName(PRUint8 aIndex, nsAString &aName)
|
||||
{
|
||||
aName.Truncate();
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetActionDescription(PRUint8 aIndex,
|
||||
nsAString &aDescription)
|
||||
{
|
||||
aDescription.Truncate();
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::DoAction(PRUint8 aIndex)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -226,6 +374,12 @@ nsApplicationAccessible::Shutdown()
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessible public methods
|
||||
|
||||
nsresult
|
||||
nsApplicationAccessible::GetARIAState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsApplicationAccessible::GetRoleInternal(PRUint32 *aRole)
|
||||
{
|
||||
|
@ -238,6 +392,14 @@ nsApplicationAccessible::GetStateInternal(PRUint32 *aState,
|
|||
PRUint32 *aExtraState)
|
||||
{
|
||||
*aState = 0;
|
||||
|
||||
if (IsDefunct()) {
|
||||
if (aExtraState)
|
||||
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
|
||||
|
||||
return NS_OK_DEFUNCT_OBJECT;
|
||||
}
|
||||
|
||||
if (aExtraState)
|
||||
*aExtraState = 0;
|
||||
|
||||
|
@ -345,3 +507,148 @@ nsApplicationAccessible::RemoveRootAccessible(nsIAccessible *aRootAccessible)
|
|||
// properly.
|
||||
return mChildren.RemoveElement(aRootAccessible) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIAccessNode
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetDOMNode(nsIDOMNode **aDOMNode)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDOMNode);
|
||||
*aDOMNode = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetNumChildren(PRInt32 *aNumChildren)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aNumChildren);
|
||||
*aNumChildren = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetChildNodeAt(PRInt32 aChildNum,
|
||||
nsIAccessNode **aChildNode)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aChildNode);
|
||||
*aChildNode = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetParentNode(nsIAccessNode **aParentNode)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aParentNode);
|
||||
*aParentNode = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetFirstChildNode(nsIAccessNode **aFirstChildNode)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aFirstChildNode);
|
||||
*aFirstChildNode = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetLastChildNode(nsIAccessNode **aLastChildNode)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aLastChildNode);
|
||||
*aLastChildNode = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetPreviousSiblingNode(nsIAccessNode **aPreviousSiblingNode)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPreviousSiblingNode);
|
||||
*aPreviousSiblingNode = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetNextSiblingNode(nsIAccessNode **aNextSiblingNode)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aNextSiblingNode);
|
||||
*aNextSiblingNode = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetDocument(nsIAccessibleDocument **aDocument)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDocument);
|
||||
*aDocument = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetRootDocument(nsIAccessibleDocument **aRootDocument)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRootDocument);
|
||||
*aRootDocument = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetInnerHTML(nsAString &aInnerHTML)
|
||||
{
|
||||
aInnerHTML.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::ScrollTo(PRUint32 aScrollType)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::ScrollToPoint(PRUint32 aCoordinateType,
|
||||
PRInt32 aX, PRInt32 aY)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetOwnerWindow(void **aOwnerWindow)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aOwnerWindow);
|
||||
*aOwnerWindow = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetUniqueID(void **aUniqueID)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aUniqueID);
|
||||
*aUniqueID = static_cast<void *>(this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetComputedStyleValue(const nsAString &aPseudoElt,
|
||||
const nsAString &aPropertyName,
|
||||
nsAString &aValue)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetComputedStyleCSSValue(const nsAString &aPseudoElt,
|
||||
const nsAString &aPropertyName,
|
||||
nsIDOMCSSPrimitiveValue **aCSSPrimitiveValue)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCSSPrimitiveValue);
|
||||
*aCSSPrimitiveValue = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetLanguage(nsAString &aLanguage)
|
||||
{
|
||||
aLanguage.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -69,15 +69,37 @@ public:
|
|||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIAccessNode
|
||||
NS_IMETHOD GetRootDocument(nsIAccessibleDocument **aRootDocument);
|
||||
NS_DECL_NSIACCESSNODE
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetName(nsAString& aName);
|
||||
NS_IMETHOD GetDescription(nsAString& aValue);
|
||||
NS_IMETHOD GetParent(nsIAccessible **aParent);
|
||||
NS_IMETHOD GetNextSibling(nsIAccessible **aNextSibling);
|
||||
NS_IMETHOD GetPreviousSibling(nsIAccessible **aPreviousSibling);
|
||||
NS_IMETHOD GetName(nsAString &aName);
|
||||
NS_IMETHOD GetValue(nsAString &aValue);
|
||||
NS_IMETHOD GetDescription(nsAString &aDescription);
|
||||
NS_IMETHOD GetKeyboardShortcut(nsAString &aKeyboardShortcut);
|
||||
NS_IMETHOD GetRole(PRUint32 *aRole);
|
||||
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
|
||||
NS_IMETHOD GetParent(nsIAccessible **aAccessible);
|
||||
NS_IMETHOD GetState(PRUint32 *aState , PRUint32 *aExtraState );
|
||||
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
|
||||
NS_IMETHOD GroupPosition(PRInt32 *aGroupLevel, PRInt32 *aSimilarItemsInGroup,
|
||||
PRInt32 *aPositionInGroup);
|
||||
NS_IMETHOD GetChildAtPoint(PRInt32 aX, PRInt32 aY, nsIAccessible **aChild);
|
||||
NS_IMETHOD GetDeepestChildAtPoint(PRInt32 aX, PRInt32 aY, nsIAccessible **aChild);
|
||||
NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation);
|
||||
NS_IMETHOD GetRelationsCount(PRUint32 *aRelationsCount);
|
||||
NS_IMETHOD GetRelation(PRUint32 aIndex, nsIAccessibleRelation **aRelation);
|
||||
NS_IMETHOD GetRelations(nsIArray **aRelations);
|
||||
NS_IMETHOD GetBounds(PRInt32 *aX, PRInt32 *aY,
|
||||
PRInt32 *aWidth, PRInt32 *aHeight);
|
||||
NS_IMETHOD SetSelected(PRBool aIsSelected);
|
||||
NS_IMETHOD TakeSelection();
|
||||
NS_IMETHOD TakeFocus();
|
||||
NS_IMETHOD GetNumActions(PRUint8 *aNumActions);
|
||||
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString &aName);
|
||||
NS_IMETHOD GetActionDescription(PRUint8 aIndex, nsAString &aDescription);
|
||||
NS_IMETHOD DoAction(PRUint8 aIndex);
|
||||
|
||||
// nsIAccessibleApplication
|
||||
NS_DECL_NSIACCESSIBLEAPPLICATION
|
||||
|
@ -88,6 +110,7 @@ public:
|
|||
virtual nsresult Shutdown();
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetARIAState(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual nsAccessible* GetParent();
|
||||
|
|
|
@ -56,8 +56,9 @@
|
|||
// nsLeafAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsLeafAccessible::nsLeafAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsAccessibleWrap(aNode, aShell)
|
||||
nsLeafAccessible::
|
||||
nsLeafAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsAccessibleWrap(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -91,8 +92,8 @@ nsLeafAccessible::CacheChildren()
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsLinkableAccessible::
|
||||
nsLinkableAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell) :
|
||||
nsAccessibleWrap(aNode, aShell),
|
||||
nsLinkableAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsAccessibleWrap(aContent, aShell),
|
||||
mActionContent(nsnull),
|
||||
mIsLink(PR_FALSE),
|
||||
mIsOnclick(PR_FALSE)
|
||||
|
@ -247,7 +248,7 @@ nsLinkableAccessible::Shutdown()
|
|||
void
|
||||
nsLinkableAccessible::CacheActionContent()
|
||||
{
|
||||
nsCOMPtr<nsIContent> walkUpContent(do_QueryInterface(mDOMNode));
|
||||
nsIContent* walkUpContent = mContent;
|
||||
PRBool isOnclick = nsCoreUtils::HasClickListener(walkUpContent);
|
||||
|
||||
if (isOnclick) {
|
||||
|
@ -258,11 +259,8 @@ nsLinkableAccessible::CacheActionContent()
|
|||
|
||||
while ((walkUpContent = walkUpContent->GetParent())) {
|
||||
isOnclick = nsCoreUtils::HasClickListener(walkUpContent);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> walkUpNode(do_QueryInterface(walkUpContent));
|
||||
|
||||
nsAccessible *walkUpAcc =
|
||||
GetAccService()->GetAccessibleInWeakShell(walkUpNode, mWeakShell);
|
||||
GetAccService()->GetAccessibleInWeakShell(walkUpContent, mWeakShell);
|
||||
|
||||
if (nsAccUtils::Role(walkUpAcc) == nsIAccessibleRole::ROLE_LINK &&
|
||||
nsAccUtils::State(walkUpAcc) & nsIAccessibleStates::STATE_LINKED) {
|
||||
|
@ -286,20 +284,20 @@ nsLinkableAccessible::GetActionAccessible() const
|
|||
// this accessible. If the action accessible is not null then it is used to
|
||||
// redirect methods calls otherwise we use method implementation from the
|
||||
// base class.
|
||||
nsCOMPtr<nsIDOMNode> actionNode(do_QueryInterface(mActionContent));
|
||||
if (!actionNode || mDOMNode == actionNode)
|
||||
if (!mActionContent || mContent == mActionContent)
|
||||
return nsnull;
|
||||
|
||||
return GetAccService()->GetAccessibleInWeakShell(actionNode, mWeakShell);
|
||||
return GetAccService()->GetAccessibleInWeakShell(mActionContent, mWeakShell);
|
||||
}
|
||||
|
||||
//---------------------
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsEnumRoleAccessible
|
||||
//---------------------
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsEnumRoleAccessible::nsEnumRoleAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell, PRUint32 aRole) :
|
||||
nsAccessibleWrap(aNode, aShell),
|
||||
mRole(aRole)
|
||||
nsEnumRoleAccessible::
|
||||
nsEnumRoleAccessible(nsIContent *aNode, nsIWeakReference *aShell,
|
||||
PRUint32 aRole) :
|
||||
nsAccessibleWrap(aNode, aShell), mRole(aRole)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -43,8 +43,6 @@
|
|||
#include "nsHyperTextAccessibleWrap.h"
|
||||
#include "nsIContent.h"
|
||||
|
||||
class nsIDOMNode;
|
||||
|
||||
/**
|
||||
* This file contains a number of classes that are used as base
|
||||
* classes for the different accessibility implementations of
|
||||
|
@ -57,7 +55,7 @@ class nsIDOMNode;
|
|||
class nsLeafAccessible : public nsAccessibleWrap
|
||||
{
|
||||
public:
|
||||
nsLeafAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
nsLeafAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
@ -84,7 +82,7 @@ class nsLinkableAccessible : public nsAccessibleWrap
|
|||
public:
|
||||
enum { eAction_Jump = 0 };
|
||||
|
||||
nsLinkableAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
nsLinkableAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
|
@ -128,7 +126,8 @@ protected:
|
|||
class nsEnumRoleAccessible : public nsAccessibleWrap
|
||||
{
|
||||
public:
|
||||
nsEnumRoleAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell, PRUint32 aRole);
|
||||
nsEnumRoleAccessible(nsIContent *aContent, nsIWeakReference *aShell,
|
||||
PRUint32 aRole);
|
||||
virtual ~nsEnumRoleAccessible() { }
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
|
|
@ -110,7 +110,8 @@ nsresult nsCaretAccessible::ClearControlSelectionListener()
|
|||
return selPrivate->RemoveSelectionListener(this);
|
||||
}
|
||||
|
||||
nsresult nsCaretAccessible::SetControlSelectionListener(nsIDOMNode *aCurrentNode)
|
||||
nsresult
|
||||
nsCaretAccessible::SetControlSelectionListener(nsIContent *aCurrentNode)
|
||||
{
|
||||
NS_ENSURE_TRUE(mRootAccessible, NS_ERROR_FAILURE);
|
||||
|
||||
|
@ -126,10 +127,7 @@ nsresult nsCaretAccessible::SetControlSelectionListener(nsIDOMNode *aCurrentNode
|
|||
nsCOMPtr<nsISelectionController> controller =
|
||||
GetSelectionControllerForNode(mCurrentControl);
|
||||
#ifdef DEBUG
|
||||
PRUint16 nodeType;
|
||||
nsresult result = aCurrentNode->GetNodeType(&nodeType);
|
||||
NS_ASSERTION(NS_SUCCEEDED(result) &&
|
||||
(controller || nodeType == nsIDOMNode::DOCUMENT_NODE),
|
||||
NS_ASSERTION(controller || aCurrentNode->IsNodeOfType(nsINode::eDOCUMENT),
|
||||
"No selection controller for non document node!");
|
||||
#endif
|
||||
if (!controller)
|
||||
|
@ -247,7 +245,7 @@ nsCaretAccessible::NormalSelectionChanged(nsIDOMDocument *aDoc,
|
|||
return NS_OK; // No selection
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> textNode;
|
||||
nsCOMPtr<nsINode> textNode;
|
||||
nsCOMPtr<nsIAccessibleText> textAcc =
|
||||
nsAccUtils::GetTextAccessibleFromSelection(aSel, getter_AddRefs(textNode));
|
||||
NS_ENSURE_STATE(textAcc);
|
||||
|
@ -309,15 +307,13 @@ nsCaretAccessible::GetCaretRect(nsIWidget **aOutWidget)
|
|||
return caretRect; // Return empty rect
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAccessNode> lastAccessNode(do_QueryInterface(mLastTextAccessible));
|
||||
NS_ENSURE_TRUE(lastAccessNode, caretRect);
|
||||
nsRefPtr<nsAccessible> lastTextAccessible =
|
||||
do_QueryObject(mLastTextAccessible);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> lastNodeWithCaret;
|
||||
lastAccessNode->GetDOMNode(getter_AddRefs(lastNodeWithCaret));
|
||||
nsINode *lastNodeWithCaret = lastTextAccessible->GetNode();
|
||||
NS_ENSURE_TRUE(lastNodeWithCaret, caretRect);
|
||||
|
||||
nsIPresShell *presShell =
|
||||
nsCoreUtils::GetPresShellFor(lastNodeWithCaret);
|
||||
nsIPresShell *presShell = nsCoreUtils::GetPresShellFor(lastNodeWithCaret);
|
||||
NS_ENSURE_TRUE(presShell, caretRect);
|
||||
|
||||
nsRefPtr<nsCaret> caret = presShell->GetCaret();
|
||||
|
@ -361,25 +357,20 @@ nsCaretAccessible::GetCaretRect(nsIWidget **aOutWidget)
|
|||
}
|
||||
|
||||
already_AddRefed<nsISelectionController>
|
||||
nsCaretAccessible::GetSelectionControllerForNode(nsIDOMNode *aNode)
|
||||
nsCaretAccessible::GetSelectionControllerForNode(nsIContent *aContent)
|
||||
{
|
||||
if (!aNode)
|
||||
if (!aContent)
|
||||
return nsnull;
|
||||
|
||||
nsIPresShell *presShell = nsCoreUtils::GetPresShellFor(aNode);
|
||||
nsIDocument *document = aContent->GetOwnerDoc();
|
||||
if (!document)
|
||||
return nsnull;
|
||||
|
||||
nsIPresShell *presShell = document->GetPrimaryShell();
|
||||
if (!presShell)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = presShell->GetDocument();
|
||||
if (!doc)
|
||||
return nsnull;
|
||||
|
||||
// Get selection controller only for form controls, not for the document.
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
|
||||
if (!content)
|
||||
return nsnull;
|
||||
|
||||
nsIFrame *frame = content->GetPrimaryFrame();
|
||||
nsIFrame *frame = aContent->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return nsnull;
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
#include "nsIWeakReference.h"
|
||||
#include "nsIAccessibleText.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsISelectionListener.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsRect.h"
|
||||
|
@ -92,7 +92,7 @@ public:
|
|||
* to via AddDocSelectionListener().
|
||||
* @param aFocusedNode The node for the focused control
|
||||
*/
|
||||
nsresult SetControlSelectionListener(nsIDOMNode *aCurrentNode);
|
||||
nsresult SetControlSelectionListener(nsIContent *aCurrentNode);
|
||||
|
||||
/**
|
||||
* Stop listening to selection events for any control.
|
||||
|
@ -125,15 +125,20 @@ protected:
|
|||
nsresult NormalSelectionChanged(nsIDOMDocument *aDoc, nsISelection *aSel);
|
||||
nsresult SpellcheckSelectionChanged(nsIDOMDocument *aDoc, nsISelection *aSel);
|
||||
|
||||
/**
|
||||
* Return selection controller for the given node.
|
||||
*/
|
||||
already_AddRefed<nsISelectionController>
|
||||
GetSelectionControllerForNode(nsIDOMNode *aNode);
|
||||
GetSelectionControllerForNode(nsIContent *aNode);
|
||||
|
||||
private:
|
||||
// The currently focused control -- never a document.
|
||||
// We listen to selection for one control at a time (the focused one)
|
||||
// Document selection is handled separately via additional listeners on all active documents
|
||||
// The current control is set via SetControlSelectionListener()
|
||||
nsCOMPtr<nsIDOMNode> mCurrentControl; // Selection controller for the currently focused control
|
||||
|
||||
// Currently focused control.
|
||||
nsCOMPtr<nsIContent> mCurrentControl;
|
||||
|
||||
// Info for the the last selection event.
|
||||
// If it was on a control, then its control's selection. Otherwise, it's for
|
||||
|
|
|
@ -236,38 +236,16 @@ nsCoreUtils::GetAccessKeyFor(nsIContent *aContent)
|
|||
return key;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMElement>
|
||||
nsCoreUtils::GetDOMElementFor(nsIDOMNode *aNode)
|
||||
nsIContent *
|
||||
nsCoreUtils::GetDOMElementFor(nsIContent *aContent)
|
||||
{
|
||||
nsCOMPtr<nsINode> node(do_QueryInterface(aNode));
|
||||
nsIDOMElement *element = nsnull;
|
||||
if (aContent->IsElement())
|
||||
return aContent;
|
||||
|
||||
if (node->IsElement())
|
||||
CallQueryInterface(node, &element);
|
||||
if (aContent->IsNodeOfType(nsINode::eTEXT))
|
||||
return aContent->GetParent();
|
||||
|
||||
else if (node->IsNodeOfType(nsINode::eTEXT)) {
|
||||
nsCOMPtr<nsINode> nodeParent = node->GetNodeParent();
|
||||
NS_ASSERTION(nodeParent, "Text node has no parent!");
|
||||
if (nodeParent)
|
||||
CallQueryInterface(nodeParent, &element);
|
||||
}
|
||||
|
||||
else if (node->IsNodeOfType(nsINode::eDOCUMENT)) {
|
||||
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc(do_QueryInterface(node));
|
||||
if (htmlDoc) {
|
||||
nsCOMPtr<nsIDOMHTMLElement> bodyElement;
|
||||
htmlDoc->GetBody(getter_AddRefs(bodyElement));
|
||||
if (bodyElement) {
|
||||
CallQueryInterface(bodyElement, &element);
|
||||
return element;
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc(do_QueryInterface(node));
|
||||
domDoc->GetDocumentElement(&element);
|
||||
}
|
||||
|
||||
return element;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsINode *
|
||||
|
@ -289,13 +267,13 @@ nsCoreUtils::GetDOMNodeFromDOMPoint(nsINode *aNode, PRUint32 aOffset)
|
|||
}
|
||||
|
||||
nsIContent*
|
||||
nsCoreUtils::GetRoleContent(nsIDOMNode *aDOMNode)
|
||||
nsCoreUtils::GetRoleContent(nsINode *aNode)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aDOMNode));
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
|
||||
if (!content) {
|
||||
nsCOMPtr<nsIDOMDocument> domDoc(do_QueryInterface(aDOMNode));
|
||||
nsCOMPtr<nsIDOMDocument> domDoc(do_QueryInterface(aNode));
|
||||
if (domDoc) {
|
||||
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc(do_QueryInterface(aDOMNode));
|
||||
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc(do_QueryInterface(aNode));
|
||||
if (htmlDoc) {
|
||||
nsCOMPtr<nsIDOMHTMLElement> bodyElement;
|
||||
htmlDoc->GetBody(getter_AddRefs(bodyElement));
|
||||
|
@ -444,7 +422,7 @@ nsCoreUtils::ConvertScrollTypeToPercents(PRUint32 aScrollType,
|
|||
}
|
||||
|
||||
nsIntPoint
|
||||
nsCoreUtils::GetScreenCoordsForWindow(nsIDOMNode *aNode)
|
||||
nsCoreUtils::GetScreenCoordsForWindow(nsINode *aNode)
|
||||
{
|
||||
nsIntPoint coords(0, 0);
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem(GetDocShellTreeItemFor(aNode));
|
||||
|
@ -470,17 +448,12 @@ nsCoreUtils::GetScreenCoordsForWindow(nsIDOMNode *aNode)
|
|||
}
|
||||
|
||||
already_AddRefed<nsIDocShellTreeItem>
|
||||
nsCoreUtils::GetDocShellTreeItemFor(nsIDOMNode *aNode)
|
||||
nsCoreUtils::GetDocShellTreeItemFor(nsINode *aNode)
|
||||
{
|
||||
if (!aNode)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
aNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
|
||||
if (!doc)
|
||||
doc = do_QueryInterface(aNode);
|
||||
|
||||
nsIDocument *doc = aNode->GetOwnerDoc();
|
||||
NS_ASSERTION(doc, "No document for node passed in");
|
||||
NS_ENSURE_TRUE(doc, nsnull);
|
||||
|
||||
|
@ -552,16 +525,6 @@ nsCoreUtils::IsErrorPage(nsIDocument *aDocument)
|
|||
return FindInReadable(neterror, start, end);
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
nsCoreUtils::GetFrameFor(nsIDOMElement *aElm)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aElm));
|
||||
if (!content)
|
||||
return nsnull;
|
||||
|
||||
return content->GetPrimaryFrame();
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsCoreUtils::IsCorrectFrameType(nsIFrame *aFrame, nsIAtom *aAtom)
|
||||
{
|
||||
|
@ -957,28 +920,27 @@ nsCoreUtils::GetElementsHavingIDRefsAttrImpl(nsIContent *aRootContent,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
already_AddRefed<nsIDOMCSSStyleDeclaration>
|
||||
nsCoreUtils::GetComputedStyleDeclaration(const nsAString& aPseudoElt,
|
||||
nsIDOMNode *aNode,
|
||||
nsIDOMCSSStyleDeclaration **aCssDecl)
|
||||
nsIContent *aContent)
|
||||
{
|
||||
*aCssDecl = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> domElement = GetDOMElementFor(aNode);
|
||||
if (!domElement)
|
||||
return;
|
||||
nsIContent* content = GetDOMElementFor(aContent);
|
||||
if (!content)
|
||||
return nsnull;
|
||||
|
||||
// Returns number of items in style declaration
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(domElement);
|
||||
nsCOMPtr<nsIDocument> doc = content->GetDocument();
|
||||
if (!doc)
|
||||
return;
|
||||
nsIDocument* document = content->GetOwnerDoc();
|
||||
if (!document)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMViewCSS> viewCSS(do_QueryInterface(doc->GetWindow()));
|
||||
nsCOMPtr<nsIDOMViewCSS> viewCSS(do_QueryInterface(document->GetWindow()));
|
||||
if (!viewCSS)
|
||||
return;
|
||||
return nsnull;
|
||||
|
||||
viewCSS->GetComputedStyle(domElement, aPseudoElt, aCssDecl);
|
||||
nsIDOMCSSStyleDeclaration* cssDecl = nsnull;
|
||||
nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(content));
|
||||
viewCSS->GetComputedStyle(domElement, aPseudoElt, &cssDecl);
|
||||
return cssDecl;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIBoxObject>
|
||||
|
@ -995,36 +957,28 @@ nsCoreUtils::GetTreeBodyBoxObject(nsITreeBoxObject *aTreeBoxObj)
|
|||
return boxObj;
|
||||
}
|
||||
|
||||
void
|
||||
nsCoreUtils::GetTreeBoxObject(nsIDOMNode *aDOMNode,
|
||||
nsITreeBoxObject **aBoxObject)
|
||||
already_AddRefed<nsITreeBoxObject>
|
||||
nsCoreUtils::GetTreeBoxObject(nsIContent *aContent)
|
||||
{
|
||||
nsAutoString name;
|
||||
nsCOMPtr<nsIDOMNode> parentNode, currentNode;
|
||||
|
||||
// Find DOMNode's parents recursively until reach the <tree> tag
|
||||
currentNode = aDOMNode;
|
||||
while (currentNode) {
|
||||
currentNode->GetLocalName(name);
|
||||
if (name.EqualsLiteral("tree")) {
|
||||
nsIContent* currentContent = aContent;
|
||||
while (currentContent) {
|
||||
if (currentContent->NodeInfo()->Equals(nsAccessibilityAtoms::tree,
|
||||
kNameSpaceID_XUL)) {
|
||||
// We will get the nsITreeBoxObject from the tree node
|
||||
nsCOMPtr<nsIDOMXULElement> xulElement(do_QueryInterface(currentNode));
|
||||
nsCOMPtr<nsIDOMXULElement> xulElement(do_QueryInterface(currentContent));
|
||||
if (xulElement) {
|
||||
nsCOMPtr<nsIBoxObject> box;
|
||||
xulElement->GetBoxObject(getter_AddRefs(box));
|
||||
nsCOMPtr<nsITreeBoxObject> treeBox(do_QueryInterface(box));
|
||||
if (treeBox) {
|
||||
*aBoxObject = treeBox;
|
||||
NS_ADDREF(*aBoxObject);
|
||||
return;
|
||||
}
|
||||
if (treeBox)
|
||||
return treeBox.forget();
|
||||
}
|
||||
}
|
||||
currentNode->GetParentNode(getter_AddRefs(parentNode));
|
||||
currentNode = parentNode;
|
||||
currentContent = currentContent->GetParent();
|
||||
}
|
||||
|
||||
*aBoxObject = nsnull;
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
already_AddRefed<nsITreeColumn>
|
||||
|
@ -1142,20 +1096,19 @@ nsCoreUtils::IsColumnHidden(nsITreeColumn *aColumn)
|
|||
}
|
||||
|
||||
void
|
||||
nsCoreUtils::GeneratePopupTree(nsIDOMNode *aNode, PRBool aIsAnon)
|
||||
nsCoreUtils::GeneratePopupTree(nsIContent *aContent, PRBool aIsAnon)
|
||||
{
|
||||
// Set menugenerated="true" on the menupopup node to generate the sub-menu
|
||||
// items if they have not been generated.
|
||||
|
||||
nsCOMPtr<nsIDOMNodeList> list;
|
||||
if (aIsAnon) {
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
|
||||
nsIDocument* document = content->GetCurrentDoc();
|
||||
if (aIsAnon) {
|
||||
nsIDocument* document = aContent->GetCurrentDoc();
|
||||
if (document)
|
||||
document->GetXBLChildNodesFor(content, getter_AddRefs(list));
|
||||
document->GetXBLChildNodesFor(aContent, getter_AddRefs(list));
|
||||
|
||||
} else {
|
||||
aNode->GetChildNodes(getter_AddRefs(list));
|
||||
list = aContent->GetChildNodesList();
|
||||
}
|
||||
|
||||
PRUint32 length = 0;
|
||||
|
|
|
@ -119,12 +119,11 @@ public:
|
|||
* Return DOM element related with the given node, i.e.
|
||||
* a) itself if it is DOM element
|
||||
* b) parent element if it is text node
|
||||
* c) body element if it is HTML document node
|
||||
* d) document element if it is document node.
|
||||
* c) otherwise nsnull
|
||||
*
|
||||
* @param aNode [in] the given DOM node
|
||||
*/
|
||||
static already_AddRefed<nsIDOMElement> GetDOMElementFor(nsIDOMNode *aNode);
|
||||
static nsIContent* GetDOMElementFor(nsIContent *aContent);
|
||||
|
||||
/**
|
||||
* Return DOM node for the given DOM point.
|
||||
|
@ -135,12 +134,12 @@ public:
|
|||
* Return the nsIContent* to check for ARIA attributes on -- this may not
|
||||
* always be the DOM node for the accessible. Specifically, for doc
|
||||
* accessibles, it is not the document node, but either the root element or
|
||||
* <body> in HTML. Similar with GetDOMElementFor() method.
|
||||
* <body> in HTML.
|
||||
*
|
||||
* @param aDOMNode DOM node for the accessible that may be affected by ARIA
|
||||
* @return the nsIContent which may have ARIA markup
|
||||
* @param aNode [in] DOM node for the accessible that may be affected by ARIA
|
||||
* @return the nsIContent which may have ARIA markup
|
||||
*/
|
||||
static nsIContent *GetRoleContent(nsIDOMNode *aDOMNode);
|
||||
static nsIContent* GetRoleContent(nsINode *aNode);
|
||||
|
||||
/**
|
||||
* Is the first passed in node an ancestor of the second?
|
||||
|
@ -215,13 +214,13 @@ public:
|
|||
*
|
||||
* @param aNode the DOM node hosted in the window.
|
||||
*/
|
||||
static nsIntPoint GetScreenCoordsForWindow(nsIDOMNode *aNode);
|
||||
static nsIntPoint GetScreenCoordsForWindow(nsINode *aNode);
|
||||
|
||||
/**
|
||||
* Return document shell tree item for the given DOM node.
|
||||
*/
|
||||
static already_AddRefed<nsIDocShellTreeItem>
|
||||
GetDocShellTreeItemFor(nsIDOMNode *aNode);
|
||||
GetDocShellTreeItemFor(nsINode *aNode);
|
||||
|
||||
/**
|
||||
* Return true if document is loading.
|
||||
|
@ -243,11 +242,6 @@ public:
|
|||
*/
|
||||
static PRBool IsErrorPage(nsIDocument *aDocument);
|
||||
|
||||
/**
|
||||
* Retrun frame for the given DOM element.
|
||||
*/
|
||||
static nsIFrame* GetFrameFor(nsIDOMElement *aElm);
|
||||
|
||||
/**
|
||||
* Retrun true if the type of given frame equals to the given frame type.
|
||||
*
|
||||
|
@ -259,12 +253,17 @@ public:
|
|||
/**
|
||||
* Return presShell for the document containing the given DOM node.
|
||||
*/
|
||||
static nsIPresShell *GetPresShellFor(nsIDOMNode *aNode)
|
||||
static nsIPresShell *GetPresShellFor(nsINode *aNode)
|
||||
{
|
||||
nsCOMPtr<nsINode> node(do_QueryInterface(aNode));
|
||||
nsIDocument *document = node->GetOwnerDoc();
|
||||
nsIDocument *document = aNode->GetOwnerDoc();
|
||||
return document ? document->GetPrimaryShell() : nsnull;
|
||||
}
|
||||
static already_AddRefed<nsIWeakReference> GetWeakShellFor(nsINode *aNode)
|
||||
{
|
||||
nsCOMPtr<nsIWeakReference> weakShell =
|
||||
do_GetWeakReference(GetPresShellFor(aNode));
|
||||
return weakShell.forget();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return document node for the given document shell tree item.
|
||||
|
@ -340,9 +339,9 @@ public:
|
|||
/**
|
||||
* Return computed styles declaration for the given node.
|
||||
*/
|
||||
static void GetComputedStyleDeclaration(const nsAString& aPseudoElt,
|
||||
nsIDOMNode *aNode,
|
||||
nsIDOMCSSStyleDeclaration **aCssDecl);
|
||||
static already_AddRefed<nsIDOMCSSStyleDeclaration>
|
||||
GetComputedStyleDeclaration(const nsAString& aPseudoElt,
|
||||
nsIContent *aContent);
|
||||
|
||||
/**
|
||||
* Search element in neighborhood of the given element by tag name and
|
||||
|
@ -432,8 +431,8 @@ public:
|
|||
/**
|
||||
* Return tree box object from any levels DOMNode under the XUL tree.
|
||||
*/
|
||||
static void
|
||||
GetTreeBoxObject(nsIDOMNode* aDOMNode, nsITreeBoxObject** aBoxObject);
|
||||
static already_AddRefed<nsITreeBoxObject>
|
||||
GetTreeBoxObject(nsIContent* aContent);
|
||||
|
||||
/**
|
||||
* Return first sensible column for the given tree box object.
|
||||
|
@ -487,11 +486,12 @@ public:
|
|||
/**
|
||||
* Generates frames for popup subtree.
|
||||
*
|
||||
* @param aNode [in] DOM node containing the menupopup element as a child
|
||||
* @param aContent [in] DOM node containing the menupopup element as a child
|
||||
* @param aIsAnon [in] specifies whether popup should be searched inside of
|
||||
* anonymous or explicit content
|
||||
*/
|
||||
static void GeneratePopupTree(nsIDOMNode *aNode, PRBool aIsAnon = PR_FALSE);
|
||||
static void GeneratePopupTree(nsIContent *aContent,
|
||||
PRBool aIsAnon = PR_FALSE);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#include "nsIDOMDocumentType.h"
|
||||
#include "nsIDOMNSDocument.h"
|
||||
#include "nsIDOMNSHTMLDocument.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDOMMutationEvent.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMXULPopupElement.h"
|
||||
|
@ -85,24 +86,21 @@ nsIAtom *nsDocAccessible::gLastFocusedFrameType = nsnull;
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor/desctructor
|
||||
|
||||
nsDocAccessible::nsDocAccessible(nsIDOMNode *aDOMNode,
|
||||
nsIWeakReference *aShell) :
|
||||
nsHyperTextAccessibleWrap(aDOMNode, aShell), mWnd(nsnull),
|
||||
mIsLoaded(PR_FALSE), mScrollPositionChangedTicks(0)
|
||||
nsDocAccessible::
|
||||
nsDocAccessible(nsIDocument *aDocument, nsIContent *aRootContent,
|
||||
nsIWeakReference *aShell) :
|
||||
nsHyperTextAccessibleWrap(aRootContent, aShell), mWnd(nsnull),
|
||||
mDocument(aDocument), mIsLoaded(PR_FALSE), mScrollPositionChangedTicks(0)
|
||||
{
|
||||
// XXX aaronl should we use an algorithm for the initial cache size?
|
||||
mAccessNodeCache.Init(kDefaultCacheSize);
|
||||
|
||||
// For GTK+ native window, we do nothing here.
|
||||
if (!mDOMNode)
|
||||
if (!mDocument)
|
||||
return;
|
||||
|
||||
// Initialize mWnd
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mWeakShell));
|
||||
|
||||
// Initalize mDocument
|
||||
mDocument = shell->GetDocument();
|
||||
|
||||
// Initalize mWnd
|
||||
nsIViewManager* vm = shell->GetViewManager();
|
||||
if (vm) {
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
|
@ -147,7 +145,29 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDocAccessible)
|
|||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIObserver)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAccessibleDocument)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsHyperTextAccessible)
|
||||
foundInterface = 0;
|
||||
|
||||
nsresult status;
|
||||
if (!foundInterface) {
|
||||
// HTML document accessible must inherit from nsHyperTextAccessible to get
|
||||
// support text interfaces. XUL document accessible doesn't need this.
|
||||
// However at some point we may push <body> to implement the interfaces and
|
||||
// return nsDocAccessible to inherit from nsAccessibleWrap.
|
||||
|
||||
nsCOMPtr<nsIDOMXULDocument> xulDoc(do_QueryInterface(mDocument));
|
||||
if (xulDoc)
|
||||
status = nsAccessible::QueryInterface(aIID, (void**)&foundInterface);
|
||||
else
|
||||
status = nsHyperTextAccessible::QueryInterface(aIID,
|
||||
(void**)&foundInterface);
|
||||
} else {
|
||||
NS_ADDREF(foundInterface);
|
||||
status = NS_OK;
|
||||
}
|
||||
|
||||
*aInstancePtr = foundInterface;
|
||||
return status;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDocAccessible, nsHyperTextAccessible)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDocAccessible, nsHyperTextAccessible)
|
||||
|
@ -185,7 +205,7 @@ nsDocAccessible::GetRoleInternal(PRUint32 *aRole)
|
|||
*aRole = nsIAccessibleRole::ROLE_PANE; // Fall back
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
|
||||
nsCoreUtils::GetDocShellTreeItemFor(mDOMNode);
|
||||
nsCoreUtils::GetDocShellTreeItemFor(mDocument);
|
||||
if (docShellTreeItem) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> sameTypeRoot;
|
||||
docShellTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(sameTypeRoot));
|
||||
|
@ -233,9 +253,8 @@ nsDocAccessible::SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry)
|
|||
|
||||
// Allow use of ARIA role from outer to override
|
||||
nsIContent *ownerContent = parentDoc->FindContentForSubDocument(mDocument);
|
||||
nsCOMPtr<nsIDOMNode> ownerNode(do_QueryInterface(ownerContent));
|
||||
if (ownerNode) {
|
||||
nsRoleMapEntry *roleMapEntry = nsAccUtils::GetRoleMapEntry(ownerNode);
|
||||
if (ownerContent) {
|
||||
nsRoleMapEntry *roleMapEntry = nsAccUtils::GetRoleMapEntry(ownerContent);
|
||||
if (roleMapEntry)
|
||||
mRoleMapEntry = roleMapEntry; // Override
|
||||
}
|
||||
|
@ -262,8 +281,17 @@ nsDocAccessible::GetDescription(nsAString& aDescription)
|
|||
nsresult
|
||||
nsDocAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
{
|
||||
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
*aState = 0;
|
||||
|
||||
if (IsDefunct()) {
|
||||
if (aExtraState)
|
||||
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
|
||||
|
||||
return NS_OK_DEFUNCT_OBJECT;
|
||||
}
|
||||
|
||||
if (aExtraState)
|
||||
*aExtraState = 0;
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocument));
|
||||
|
@ -274,9 +302,8 @@ nsDocAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
|||
// which it should be if it is scrollable. A XUL document could be focusable.
|
||||
// See bug 376803.
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
if (gLastFocusedNode == mDOMNode) {
|
||||
if (gLastFocusedNode == mDocument)
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSED;
|
||||
}
|
||||
}
|
||||
|
||||
if (nsCoreUtils::IsDocumentBusy(mDocument)) {
|
||||
|
@ -344,33 +371,29 @@ NS_IMETHODIMP nsDocAccessible::GetFocusedChild(nsIAccessible **aFocusedChild)
|
|||
|
||||
// Return an accessible for the current global focus, which does not have to
|
||||
// be contained within the current document.
|
||||
nsCOMPtr<nsIAccessibilityService> accService =
|
||||
do_GetService("@mozilla.org/accessibilityService;1");
|
||||
return accService->GetAccessibleFor(gLastFocusedNode, aFocusedChild);
|
||||
NS_IF_ADDREF(*aFocusedChild = GetAccService()->GetAccessible(gLastFocusedNode));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessible::TakeFocus()
|
||||
{
|
||||
NS_ENSURE_TRUE(mDocument, NS_ERROR_FAILURE);
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRUint32 state;
|
||||
GetStateInternal(&state, nsnull);
|
||||
if (0 == (state & nsIAccessibleStates::STATE_FOCUSABLE)) {
|
||||
return NS_ERROR_FAILURE; // Not focusable
|
||||
}
|
||||
|
||||
// Focus the document.
|
||||
nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
|
||||
if (fm) {
|
||||
nsCOMPtr<nsIDOMDocument> domDocument(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDocument> document(do_QueryInterface(domDocument));
|
||||
if (document) {
|
||||
// focus the document
|
||||
nsCOMPtr<nsIDOMElement> newFocus;
|
||||
return fm->MoveFocus(document->GetWindow(), nsnull,
|
||||
nsIFocusManager::MOVEFOCUS_ROOT, 0,
|
||||
getter_AddRefs(newFocus));
|
||||
}
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ENSURE_STATE(fm);
|
||||
|
||||
nsCOMPtr<nsIDOMElement> newFocus;
|
||||
return fm->MoveFocus(mDocument->GetWindow(), nsnull,
|
||||
nsIFocusManager::MOVEFOCUS_ROOT, 0,
|
||||
getter_AddRefs(newFocus));
|
||||
}
|
||||
|
||||
|
||||
|
@ -379,9 +402,9 @@ NS_IMETHODIMP nsDocAccessible::TakeFocus()
|
|||
|
||||
NS_IMETHODIMP nsDocAccessible::GetURL(nsAString& aURL)
|
||||
{
|
||||
if (!mDocument) {
|
||||
return NS_ERROR_FAILURE; // Document has been shut down
|
||||
}
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsISupports> container = mDocument->GetContainer();
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_GetInterface(container));
|
||||
nsCAutoString theURL;
|
||||
|
@ -483,20 +506,14 @@ NS_IMETHODIMP nsDocAccessible::GetAssociatedEditor(nsIEditor **aEditor)
|
|||
NS_ENSURE_ARG_POINTER(aEditor);
|
||||
*aEditor = nsnull;
|
||||
|
||||
if (!mDocument)
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Check if document is editable (designMode="on" case). Otherwise check if
|
||||
// the html:body (for HTML document case) or document element is editable.
|
||||
if (!mDocument->HasFlag(NODE_IS_EDITABLE)) {
|
||||
nsCOMPtr<nsIDOMNode> DOMDocument(do_QueryInterface(mDocument));
|
||||
nsCOMPtr<nsIDOMElement> DOMElement =
|
||||
nsCoreUtils::GetDOMElementFor(DOMDocument);
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(DOMElement));
|
||||
|
||||
if (!content || !content->HasFlag(NODE_IS_EDITABLE))
|
||||
return NS_OK;
|
||||
}
|
||||
if (!mDocument->HasFlag(NODE_IS_EDITABLE) &&
|
||||
!mContent->HasFlag(NODE_IS_EDITABLE))
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsISupports> container = mDocument->GetContainer();
|
||||
nsCOMPtr<nsIEditingSession> editingSession(do_GetInterface(container));
|
||||
|
@ -588,7 +605,7 @@ nsDocAccessible::Init()
|
|||
// Fire reorder event to notify new accessible document has been created and
|
||||
// attached to the tree.
|
||||
nsRefPtr<nsAccEvent> reorderEvent =
|
||||
new nsAccReorderEvent(mParent, PR_FALSE, PR_TRUE, mDOMNode);
|
||||
new nsAccReorderEvent(mParent, PR_FALSE, PR_TRUE, mDocument);
|
||||
if (!reorderEvent)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
@ -643,10 +660,7 @@ nsDocAccessible::GetFrame()
|
|||
PRBool
|
||||
nsDocAccessible::IsDefunct()
|
||||
{
|
||||
if (nsHyperTextAccessibleWrap::IsDefunct())
|
||||
return PR_TRUE;
|
||||
|
||||
return !mDocument;
|
||||
return nsHyperTextAccessibleWrap::IsDefunct() || !mDocument;
|
||||
}
|
||||
|
||||
// nsDocAccessible protected member
|
||||
|
@ -898,13 +912,10 @@ nsDocAccessible::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent,
|
|||
AttributeChangedImpl(aContent, aNameSpaceID, aAttribute);
|
||||
|
||||
// If it was the focused node, cache the new state
|
||||
nsCOMPtr<nsIDOMNode> targetNode = do_QueryInterface(aContent);
|
||||
if (targetNode == gLastFocusedNode) {
|
||||
nsCOMPtr<nsIAccessible> focusedAccessible;
|
||||
GetAccService()->GetAccessibleFor(targetNode, getter_AddRefs(focusedAccessible));
|
||||
if (focusedAccessible) {
|
||||
if (aContent == gLastFocusedNode) {
|
||||
nsAccessible *focusedAccessible = GetAccService()->GetAccessible(aContent);
|
||||
if (focusedAccessible)
|
||||
gLastFocusedAccessiblesState = nsAccUtils::State(focusedAccessible);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -942,9 +953,8 @@ nsDocAccessible::AttributeChangedImpl(nsIContent* aContent, PRInt32 aNameSpaceID
|
|||
return; // Document has been shut down
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> targetNode(do_QueryInterface(aContent));
|
||||
NS_ASSERTION(targetNode, "No node for attr modified");
|
||||
if (!targetNode || !nsAccUtils::IsNodeRelevant(targetNode))
|
||||
NS_ASSERTION(aContent, "No node for attr modified");
|
||||
if (!aContent || !nsAccUtils::IsNodeRelevant(aContent))
|
||||
return;
|
||||
|
||||
// Universal boolean properties that don't require a role. Fire the state
|
||||
|
@ -960,14 +970,14 @@ nsDocAccessible::AttributeChangedImpl(nsIContent* aContent, PRInt32 aNameSpaceID
|
|||
// ARIA's aria-disabled does not affect the disabled state bit.
|
||||
|
||||
nsRefPtr<nsAccEvent> enabledChangeEvent =
|
||||
new nsAccStateChangeEvent(targetNode,
|
||||
new nsAccStateChangeEvent(aContent,
|
||||
nsIAccessibleStates::EXT_STATE_ENABLED,
|
||||
PR_TRUE);
|
||||
|
||||
FireDelayedAccessibleEvent(enabledChangeEvent);
|
||||
|
||||
nsRefPtr<nsAccEvent> sensitiveChangeEvent =
|
||||
new nsAccStateChangeEvent(targetNode,
|
||||
new nsAccStateChangeEvent(aContent,
|
||||
nsIAccessibleStates::EXT_STATE_SENSITIVE,
|
||||
PR_TRUE);
|
||||
|
||||
|
@ -1000,15 +1010,16 @@ nsDocAccessible::AttributeChangedImpl(nsIContent* aContent, PRInt32 aNameSpaceID
|
|||
aAttribute == nsAccessibilityAtoms::aria_label ||
|
||||
aAttribute == nsAccessibilityAtoms::aria_labelledby) {
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE,
|
||||
targetNode);
|
||||
aContent);
|
||||
return;
|
||||
}
|
||||
|
||||
if (aAttribute == nsAccessibilityAtoms::selected ||
|
||||
aAttribute == nsAccessibilityAtoms::aria_selected) {
|
||||
// ARIA or XUL selection
|
||||
nsCOMPtr<nsIAccessible> multiSelect =
|
||||
nsAccUtils::GetMultiSelectableContainer(targetNode);
|
||||
|
||||
nsAccessible *multiSelect =
|
||||
nsAccUtils::GetMultiSelectableContainer(aContent);
|
||||
// Multi selects use selection_add and selection_remove
|
||||
// Single select widgets just mirror event_selection for
|
||||
// whatever gets event_focus, which is done in
|
||||
|
@ -1017,13 +1028,8 @@ nsDocAccessible::AttributeChangedImpl(nsIContent* aContent, PRInt32 aNameSpaceID
|
|||
if (multiSelect) {
|
||||
// Need to find the right event to use here, SELECTION_WITHIN would
|
||||
// seem right but we had started using it for something else
|
||||
nsCOMPtr<nsIAccessNode> multiSelectAccessNode =
|
||||
do_QueryInterface(multiSelect);
|
||||
nsCOMPtr<nsIDOMNode> multiSelectDOMNode;
|
||||
multiSelectAccessNode->GetDOMNode(getter_AddRefs(multiSelectDOMNode));
|
||||
NS_ASSERTION(multiSelectDOMNode, "A new accessible without a DOM node!");
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN,
|
||||
multiSelectDOMNode,
|
||||
multiSelect->GetNode(),
|
||||
nsAccEvent::eAllowDupes);
|
||||
|
||||
static nsIContent::AttrValuesArray strings[] =
|
||||
|
@ -1031,18 +1037,18 @@ nsDocAccessible::AttributeChangedImpl(nsIContent* aContent, PRInt32 aNameSpaceID
|
|||
if (aContent->FindAttrValueIn(kNameSpaceID_None, aAttribute,
|
||||
strings, eCaseMatters) >= 0) {
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_SELECTION_REMOVE,
|
||||
targetNode);
|
||||
aContent);
|
||||
return;
|
||||
}
|
||||
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_SELECTION_ADD,
|
||||
targetNode);
|
||||
aContent);
|
||||
}
|
||||
}
|
||||
|
||||
if (aAttribute == nsAccessibilityAtoms::contenteditable) {
|
||||
nsRefPtr<nsAccEvent> editableChangeEvent =
|
||||
new nsAccStateChangeEvent(targetNode,
|
||||
new nsAccStateChangeEvent(aContent,
|
||||
nsIAccessibleStates::EXT_STATE_EDITABLE,
|
||||
PR_TRUE);
|
||||
FireDelayedAccessibleEvent(editableChangeEvent);
|
||||
|
@ -1054,16 +1060,12 @@ nsDocAccessible::AttributeChangedImpl(nsIContent* aContent, PRInt32 aNameSpaceID
|
|||
void
|
||||
nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> targetNode(do_QueryInterface(aContent));
|
||||
if (!targetNode)
|
||||
return;
|
||||
|
||||
// Note: For universal/global ARIA states and properties we don't care if
|
||||
// there is an ARIA role present or not.
|
||||
|
||||
if (aAttribute == nsAccessibilityAtoms::aria_required) {
|
||||
nsRefPtr<nsAccEvent> event =
|
||||
new nsAccStateChangeEvent(targetNode,
|
||||
new nsAccStateChangeEvent(aContent,
|
||||
nsIAccessibleStates::STATE_REQUIRED,
|
||||
PR_FALSE);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
|
@ -1072,7 +1074,7 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
|||
|
||||
if (aAttribute == nsAccessibilityAtoms::aria_invalid) {
|
||||
nsRefPtr<nsAccEvent> event =
|
||||
new nsAccStateChangeEvent(targetNode,
|
||||
new nsAccStateChangeEvent(aContent,
|
||||
nsIAccessibleStates::STATE_INVALID,
|
||||
PR_FALSE);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
|
@ -1082,11 +1084,11 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
|||
if (aAttribute == nsAccessibilityAtoms::aria_activedescendant) {
|
||||
// The activedescendant universal property redirects accessible focus events
|
||||
// to the element with the id that activedescendant points to
|
||||
nsCOMPtr<nsIDOMNode> currentFocus = GetCurrentFocus();
|
||||
if (SameCOMIdentity(nsCoreUtils::GetRoleContent(currentFocus), targetNode)) {
|
||||
nsCOMPtr<nsINode> focusedNode = GetCurrentFocus();
|
||||
if (nsCoreUtils::GetRoleContent(focusedNode) == aContent) {
|
||||
nsRefPtr<nsRootAccessible> rootAcc = GetRootAccessible();
|
||||
if (rootAcc)
|
||||
rootAcc->FireAccessibleFocusEvent(nsnull, currentFocus, nsnull, PR_TRUE);
|
||||
rootAcc->FireAccessibleFocusEvent(nsnull, focusedNode, nsnull, PR_TRUE);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1096,13 +1098,13 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
|||
if (aAttribute == nsAccessibilityAtoms::aria_grabbed ||
|
||||
aAttribute == nsAccessibilityAtoms::aria_dropeffect) {
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_OBJECT_ATTRIBUTE_CHANGED,
|
||||
targetNode);
|
||||
aContent);
|
||||
}
|
||||
|
||||
// We treat aria-expanded as a global ARIA state for historical reasons
|
||||
if (aAttribute == nsAccessibilityAtoms::aria_expanded) {
|
||||
nsRefPtr<nsAccEvent> event =
|
||||
new nsAccStateChangeEvent(targetNode,
|
||||
new nsAccStateChangeEvent(aContent,
|
||||
nsIAccessibleStates::STATE_EXPANDED,
|
||||
PR_FALSE);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
|
@ -1124,9 +1126,9 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
|||
nsIAccessibleStates::STATE_CHECKED :
|
||||
nsIAccessibleStates::STATE_PRESSED;
|
||||
nsRefPtr<nsAccEvent> event =
|
||||
new nsAccStateChangeEvent(targetNode, kState, PR_FALSE);
|
||||
new nsAccStateChangeEvent(aContent, kState, PR_FALSE);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
if (targetNode == gLastFocusedNode) {
|
||||
if (aContent == gLastFocusedNode) {
|
||||
// State changes for MIXED state currently only supported for focused item, because
|
||||
// otherwise we would need access to the old attribute value in this listener.
|
||||
// This is because we don't know if the previous value of aria-checked or aria-pressed was "mixed"
|
||||
|
@ -1139,7 +1141,7 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
|||
(nsAccUtils::State(accessible) & nsIAccessibleStates::STATE_MIXED) != 0;
|
||||
if (wasMixed != isMixed) {
|
||||
nsRefPtr<nsAccEvent> event =
|
||||
new nsAccStateChangeEvent(targetNode,
|
||||
new nsAccStateChangeEvent(aContent,
|
||||
nsIAccessibleStates::STATE_MIXED,
|
||||
PR_FALSE, isMixed);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
|
@ -1151,7 +1153,7 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
|||
|
||||
if (aAttribute == nsAccessibilityAtoms::aria_readonly) {
|
||||
nsRefPtr<nsAccEvent> event =
|
||||
new nsAccStateChangeEvent(targetNode,
|
||||
new nsAccStateChangeEvent(aContent,
|
||||
nsIAccessibleStates::STATE_READONLY,
|
||||
PR_FALSE);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
|
@ -1168,7 +1170,7 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
|||
nsAccessibilityAtoms::aria_valuetext, nsAccessibilityAtoms::_empty,
|
||||
eCaseMatters)))) {
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
|
||||
targetNode);
|
||||
aContent);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1322,8 +1324,7 @@ nsDocAccessible::FireTextChangeEventForText(nsIContent *aContent,
|
|||
if (contentLength == 0)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(aContent));
|
||||
nsAccessible *accessible = GetAccService()->GetAccessible(node);
|
||||
nsAccessible *accessible = GetAccService()->GetAccessible(aContent);
|
||||
if (!accessible)
|
||||
return;
|
||||
|
||||
|
@ -1334,7 +1335,7 @@ nsDocAccessible::FireTextChangeEventForText(nsIContent *aContent,
|
|||
|
||||
// Get offset within hypertext accessible.
|
||||
PRInt32 offset = 0;
|
||||
textAccessible->DOMPointToHypertextOffset(node, contentOffset, &offset);
|
||||
textAccessible->DOMPointToHypertextOffset(aContent, contentOffset, &offset);
|
||||
|
||||
nsIFrame* frame = aContent->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
|
@ -1370,7 +1371,7 @@ nsDocAccessible::FireTextChangeEventForText(nsIContent *aContent,
|
|||
|
||||
already_AddRefed<nsAccEvent>
|
||||
nsDocAccessible::CreateTextChangeEventForNode(nsAccessible *aContainerAccessible,
|
||||
nsIDOMNode *aChangeNode,
|
||||
nsIContent *aChangeNode,
|
||||
nsAccessible *aAccessibleForChangeNode,
|
||||
PRBool aIsInserting,
|
||||
PRBool aIsAsynch,
|
||||
|
@ -1396,18 +1397,16 @@ nsDocAccessible::CreateTextChangeEventForNode(nsAccessible *aContainerAccessible
|
|||
if (!changeAcc)
|
||||
return nsnull; // No descendant content that represents any text in the hypertext parent
|
||||
|
||||
nsCOMPtr<nsINode> changeNode(do_QueryInterface(aChangeNode));
|
||||
|
||||
nsAccessible *parent = changeAcc->GetParent();
|
||||
nsCOMPtr<nsINode> parentNode = do_QueryInterface(parent->GetDOMNode());
|
||||
nsINode *parentNode = parent->GetNode();
|
||||
PRInt32 childCount = parent->GetChildCount();
|
||||
PRInt32 changeAccIdx = parent->GetIndexOf(changeAcc);
|
||||
|
||||
for (PRInt32 idx = changeAccIdx; idx < childCount; idx++) {
|
||||
nsAccessible *child = parent->GetChildAt(idx);
|
||||
nsCOMPtr<nsINode> childNode(do_QueryInterface(child->GetDOMNode()));
|
||||
nsINode *childNode = child->GetNode();
|
||||
|
||||
if (!nsCoreUtils::IsAncestorOf(changeNode, childNode, parentNode)) {
|
||||
if (!nsCoreUtils::IsAncestorOf(aChangeNode, childNode, parentNode)) {
|
||||
// We only want accessibles with DOM nodes as children of this node
|
||||
break;
|
||||
}
|
||||
|
@ -1449,14 +1448,13 @@ nsDocAccessible::CreateTextChangeEventForNode(nsAccessible *aContainerAccessible
|
|||
|
||||
// nsDocAccessible public member
|
||||
nsresult
|
||||
nsDocAccessible::FireDelayedAccessibleEvent(PRUint32 aEventType,
|
||||
nsIDOMNode *aDOMNode,
|
||||
nsDocAccessible::FireDelayedAccessibleEvent(PRUint32 aEventType, nsINode *aNode,
|
||||
nsAccEvent::EEventRule aAllowDupes,
|
||||
PRBool aIsAsynch,
|
||||
EIsFromUserInput aIsFromUserInput)
|
||||
{
|
||||
nsRefPtr<nsAccEvent> event =
|
||||
new nsAccEvent(aEventType, aDOMNode, aIsAsynch, aIsFromUserInput, aAllowDupes);
|
||||
new nsAccEvent(aEventType, aNode, aIsAsynch, aIsFromUserInput, aAllowDupes);
|
||||
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
return FireDelayedAccessibleEvent(event);
|
||||
|
@ -1482,8 +1480,7 @@ nsDocAccessible::ProcessPendingEvent(nsAccEvent *aEvent)
|
|||
aEvent->GetAccessible(getter_AddRefs(acc));
|
||||
nsRefPtr<nsAccessible> accessible(do_QueryObject(acc));
|
||||
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
aEvent->GetDOMNode(getter_AddRefs(domNode));
|
||||
nsINode *node = aEvent->GetNode();
|
||||
|
||||
PRUint32 eventType = aEvent->GetEventType();
|
||||
EIsFromUserInput isFromUserInput =
|
||||
|
@ -1491,14 +1488,14 @@ nsDocAccessible::ProcessPendingEvent(nsAccEvent *aEvent)
|
|||
|
||||
PRBool isAsync = aEvent->IsAsync();
|
||||
|
||||
if (domNode == gLastFocusedNode && isAsync &&
|
||||
if (node == gLastFocusedNode && isAsync &&
|
||||
(eventType == nsIAccessibleEvent::EVENT_SHOW ||
|
||||
eventType == nsIAccessibleEvent::EVENT_HIDE)) {
|
||||
// If frame type didn't change for this event, then we don't actually need to invalidate
|
||||
// However, we only keep track of the old frame type for the focus, where it's very
|
||||
// important not to destroy and recreate the accessible for minor style changes,
|
||||
// such as a:focus { overflow: scroll; }
|
||||
nsCOMPtr<nsIContent> focusContent(do_QueryInterface(domNode));
|
||||
nsCOMPtr<nsIContent> focusContent(do_QueryInterface(node));
|
||||
if (focusContent) {
|
||||
nsIFrame *focusFrame = focusContent->GetPrimaryFrame();
|
||||
nsIAtom *newFrameType =
|
||||
|
@ -1508,7 +1505,7 @@ nsDocAccessible::ProcessPendingEvent(nsAccEvent *aEvent)
|
|||
if (newFrameType == gLastFocusedFrameType) {
|
||||
// Don't need to invalidate this current accessible, but can
|
||||
// just invalidate the children instead
|
||||
FireShowHideEvents(domNode, PR_TRUE, eventType, eNormalEvent,
|
||||
FireShowHideEvents(node, PR_TRUE, eventType, eNormalEvent,
|
||||
isAsync, isFromUserInput);
|
||||
return;
|
||||
}
|
||||
|
@ -1523,7 +1520,7 @@ nsDocAccessible::ProcessPendingEvent(nsAccEvent *aEvent)
|
|||
containerAccessible = accessible->GetParent();
|
||||
|
||||
if (!containerAccessible) {
|
||||
containerAccessible = GetAccService()->GetContainerAccessible(domNode,
|
||||
containerAccessible = GetAccService()->GetContainerAccessible(node,
|
||||
PR_TRUE);
|
||||
if (!containerAccessible)
|
||||
containerAccessible = this;
|
||||
|
@ -1536,7 +1533,7 @@ nsDocAccessible::ProcessPendingEvent(nsAccEvent *aEvent)
|
|||
// Some show events in the subtree may have been removed to
|
||||
// avoid firing redundant events. But, we still need to make sure any
|
||||
// accessibles parenting those shown nodes lose their child references.
|
||||
InvalidateChildrenInSubtree(domNode);
|
||||
InvalidateChildrenInSubtree(node);
|
||||
}
|
||||
|
||||
// Also fire text changes if the node being created could affect the text in an nsIAccessibleText parent.
|
||||
|
@ -1544,9 +1541,10 @@ nsDocAccessible::ProcessPendingEvent(nsAccEvent *aEvent)
|
|||
// At this point we now have the frame and accessible for this node if there is one. That is why we
|
||||
// wait to fire this here, instead of in InvalidateCacheSubtree(), where we wouldn't be able to calculate
|
||||
// the offset, length and text for the text change.
|
||||
if (domNode && domNode != mDOMNode) {
|
||||
if (node && node != mDocument) {
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
|
||||
nsRefPtr<nsAccEvent> textChangeEvent =
|
||||
CreateTextChangeEventForNode(containerAccessible, domNode, accessible,
|
||||
CreateTextChangeEventForNode(containerAccessible, content, accessible,
|
||||
PR_TRUE, PR_TRUE, isFromUserInput);
|
||||
if (textChangeEvent) {
|
||||
// XXX Queue them up and merge the text change events
|
||||
|
@ -1557,7 +1555,7 @@ nsDocAccessible::ProcessPendingEvent(nsAccEvent *aEvent)
|
|||
}
|
||||
|
||||
// Fire show/create events for this node or first accessible descendants of it
|
||||
FireShowHideEvents(domNode, PR_FALSE, eventType, eNormalEvent, isAsync,
|
||||
FireShowHideEvents(node, PR_FALSE, eventType, eNormalEvent, isAsync,
|
||||
isFromUserInput);
|
||||
return;
|
||||
}
|
||||
|
@ -1575,9 +1573,9 @@ nsDocAccessible::ProcessPendingEvent(nsAccEvent *aEvent)
|
|||
#ifdef DEBUG_CARET
|
||||
// Test caret line # -- fire an EVENT_ALERT on the focused node so we can watch the
|
||||
// line-number object attribute on it
|
||||
nsCOMPtr<nsIAccessible> accForFocus;
|
||||
GetAccService()->GetAccessibleFor(gLastFocusedNode, getter_AddRefs(accForFocus));
|
||||
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_ALERT, accForFocus);
|
||||
nsAccessible *focusedAcc =
|
||||
GetAccService()->GetAccessible(gLastFocusedNode);
|
||||
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_ALERT, focusedAcc);
|
||||
#endif
|
||||
nsRefPtr<nsAccEvent> caretMoveEvent =
|
||||
new nsAccCaretMoveEvent(accessible, caretOffset);
|
||||
|
@ -1608,36 +1606,33 @@ nsDocAccessible::ProcessPendingEvent(nsAccEvent *aEvent)
|
|||
nsEventShell::FireEvent(aEvent);
|
||||
|
||||
// Post event processing
|
||||
if (eventType == nsIAccessibleEvent::EVENT_HIDE) {
|
||||
if (eventType == nsIAccessibleEvent::EVENT_HIDE && node) {
|
||||
// Shutdown nsIAccessNode's or nsIAccessibles for any DOM nodes in
|
||||
// this subtree.
|
||||
nsCOMPtr<nsIDOMNode> hidingNode;
|
||||
aEvent->GetDOMNode(getter_AddRefs(hidingNode));
|
||||
if (hidingNode) {
|
||||
RefreshNodes(hidingNode); // Will this bite us with asynch events
|
||||
}
|
||||
// XXX: Will this bite us with asynch events.
|
||||
RefreshNodes(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nsDocAccessible::InvalidateChildrenInSubtree(nsIDOMNode *aStartNode)
|
||||
void
|
||||
nsDocAccessible::InvalidateChildrenInSubtree(nsINode *aStartNode)
|
||||
{
|
||||
nsRefPtr<nsAccessible> acc = do_QueryObject(GetCachedAccessNode(aStartNode));
|
||||
if (acc)
|
||||
acc->InvalidateChildren();
|
||||
|
||||
// Invalidate accessible children in the DOM subtree
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aStartNode);
|
||||
PRInt32 index, numChildren = node->GetChildCount();
|
||||
PRInt32 index, numChildren = aStartNode->GetChildCount();
|
||||
for (index = 0; index < numChildren; index ++) {
|
||||
nsCOMPtr<nsIDOMNode> childNode = do_QueryInterface(node->GetChildAt(index));
|
||||
if (childNode)
|
||||
InvalidateChildrenInSubtree(childNode);
|
||||
nsINode *childNode = aStartNode->GetChildAt(index);
|
||||
InvalidateChildrenInSubtree(childNode);
|
||||
}
|
||||
}
|
||||
|
||||
void nsDocAccessible::RefreshNodes(nsIDOMNode *aStartNode)
|
||||
void
|
||||
nsDocAccessible::RefreshNodes(nsINode *aStartNode)
|
||||
{
|
||||
if (mAccessNodeCache.Count() <= 1) {
|
||||
return; // All we have is a doc accessible. There is nothing to invalidate, quit early
|
||||
|
@ -1652,9 +1647,7 @@ void nsDocAccessible::RefreshNodes(nsIDOMNode *aStartNode)
|
|||
// Fire menupopup end if a menu goes away
|
||||
PRUint32 role = nsAccUtils::Role(accessible);
|
||||
if (role == nsIAccessibleRole::ROLE_MENUPOPUP) {
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
accessNode->GetDOMNode(getter_AddRefs(domNode));
|
||||
nsCOMPtr<nsIDOMXULPopupElement> popup(do_QueryInterface(domNode));
|
||||
nsCOMPtr<nsIDOMXULPopupElement> popup(do_QueryInterface(aStartNode));
|
||||
if (!popup) {
|
||||
// Popup elements already fire these via DOMMenuInactive
|
||||
// handling in nsRootAccessible::HandleEvent
|
||||
|
@ -1673,12 +1666,12 @@ void nsDocAccessible::RefreshNodes(nsIDOMNode *aStartNode)
|
|||
PRUint32 childCount =0;
|
||||
if (children)
|
||||
children->GetLength(&childCount);
|
||||
nsCOMPtr<nsIDOMNode> possibleAnonNode;
|
||||
nsINode *possibleAnonNode = nsnull;
|
||||
for (PRUint32 index = 0; index < childCount; index++) {
|
||||
nsCOMPtr<nsIAccessNode> childAccessNode;
|
||||
children->QueryElementAt(index, NS_GET_IID(nsIAccessNode),
|
||||
nsRefPtr<nsAccessNode> childAccessNode;
|
||||
children->QueryElementAt(index, NS_GET_IID(nsAccessNode),
|
||||
getter_AddRefs(childAccessNode));
|
||||
childAccessNode->GetDOMNode(getter_AddRefs(possibleAnonNode));
|
||||
possibleAnonNode = childAccessNode->GetNode();
|
||||
nsCOMPtr<nsIContent> iterContent = do_QueryInterface(possibleAnonNode);
|
||||
if (iterContent && iterContent->IsInAnonymousSubtree()) {
|
||||
// IsInAnonymousSubtree() check is a perf win -- make sure we don't
|
||||
|
@ -1692,12 +1685,10 @@ void nsDocAccessible::RefreshNodes(nsIDOMNode *aStartNode)
|
|||
|
||||
// Shutdown ordinary content subtree as well -- there may be
|
||||
// access node children which are not full accessible objects
|
||||
nsCOMPtr<nsIDOMNode> nextNode, iterNode;
|
||||
aStartNode->GetFirstChild(getter_AddRefs(nextNode));
|
||||
while (nextNode) {
|
||||
nextNode.swap(iterNode);
|
||||
RefreshNodes(iterNode);
|
||||
iterNode->GetNextSibling(getter_AddRefs(nextNode));
|
||||
PRUint32 childCount = aStartNode->GetChildCount();
|
||||
for (PRUint32 childIdx = 0; childIdx < childCount; childIdx++) {
|
||||
nsIContent *childContent = aStartNode->GetChildAt(childIdx);
|
||||
RefreshNodes(childContent);
|
||||
}
|
||||
|
||||
if (!accessNode)
|
||||
|
@ -1751,9 +1742,11 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
|||
// instead of just the accessible tree, although that would be faster
|
||||
// Otherwise we might miss the nsAccessNode's that are not nsAccessible's.
|
||||
|
||||
NS_ENSURE_TRUE(mDOMNode,);
|
||||
NS_ENSURE_TRUE(mDocument,);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> childNode = aChild ? do_QueryInterface(aChild) : mDOMNode;
|
||||
nsINode *childNode = aChild;
|
||||
if (!childNode)
|
||||
childNode = mDocument;
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
||||
NS_ENSURE_TRUE(presShell,);
|
||||
|
@ -1799,7 +1792,8 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
|||
|
||||
#ifdef DEBUG_A11Y
|
||||
nsAutoString localName;
|
||||
childNode->GetLocalName(localName);
|
||||
if (aChild)
|
||||
aChild->NodeInfo()->GetName(localName);
|
||||
const char *hasAccessible = childAccessible ? " (acc)" : "";
|
||||
if (aChangeType == nsIAccessibilityService::FRAME_HIDE)
|
||||
printf("[Hide %s %s]\n", NS_ConvertUTF16toUTF8(localName).get(), hasAccessible);
|
||||
|
@ -1824,9 +1818,8 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
|||
if (!isShowing) {
|
||||
// Fire EVENT_HIDE.
|
||||
if (isHiding) {
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(childNode));
|
||||
if (content) {
|
||||
nsIFrame *frame = content->GetPrimaryFrame();
|
||||
if (aChild) {
|
||||
nsIFrame *frame = aChild->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
nsIFrame *frameParent = frame->GetParent();
|
||||
if (!frameParent || !frameParent->GetStyleVisibility()->IsVisible()) {
|
||||
|
@ -1850,7 +1843,8 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
|||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
if (childNode != mDOMNode) { // Fire text change unless the node being removed is for this doc
|
||||
if (aChild) {
|
||||
// Fire text change unless the node being removed is for this doc.
|
||||
// When a node is hidden or removed, the text in an ancestor hyper text will lose characters
|
||||
// At this point we still have the frame and accessible for this node if there was one
|
||||
// XXX Collate events when a range is deleted
|
||||
|
@ -1860,7 +1854,7 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
|||
// accessible object. See the nsAccTextChangeEvent constructor for details
|
||||
// about this exceptional case.
|
||||
nsRefPtr<nsAccEvent> textChangeEvent =
|
||||
CreateTextChangeEventForNode(containerAccessible, childNode, childAccessible,
|
||||
CreateTextChangeEventForNode(containerAccessible, aChild, childAccessible,
|
||||
PR_FALSE, isAsynch);
|
||||
if (textChangeEvent) {
|
||||
FireDelayedAccessibleEvent(textChangeEvent);
|
||||
|
@ -1906,17 +1900,15 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
|||
nsIContent *ancestor = aChild;
|
||||
while (PR_TRUE) {
|
||||
if (roleMapEntry && roleMapEntry->role == nsIAccessibleRole::ROLE_ALERT) {
|
||||
nsCOMPtr<nsIDOMNode> alertNode(do_QueryInterface(ancestor));
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_ALERT, alertNode,
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_ALERT, ancestor,
|
||||
nsAccEvent::eRemoveDupes, isAsynch);
|
||||
break;
|
||||
}
|
||||
ancestor = ancestor->GetParent();
|
||||
nsCOMPtr<nsIDOMNode> ancestorNode = do_QueryInterface(ancestor);
|
||||
if (!ancestorNode) {
|
||||
if (!ancestor)
|
||||
break;
|
||||
}
|
||||
roleMapEntry = nsAccUtils::GetRoleMapEntry(ancestorNode);
|
||||
|
||||
roleMapEntry = nsAccUtils::GetRoleMapEntry(ancestor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1940,31 +1932,30 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
|||
nsRefPtr<nsAccEvent> reorderEvent =
|
||||
new nsAccReorderEvent(containerAccessible, isAsynch,
|
||||
isUnconditionalEvent,
|
||||
aChild ? childNode.get() : nsnull);
|
||||
aChild ? aChild : nsnull);
|
||||
NS_ENSURE_TRUE(reorderEvent,);
|
||||
|
||||
FireDelayedAccessibleEvent(reorderEvent);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDocAccessible::FireShowHideEvents(nsIDOMNode *aDOMNode,
|
||||
nsDocAccessible::FireShowHideEvents(nsINode *aNode,
|
||||
PRBool aAvoidOnThisNode,
|
||||
PRUint32 aEventType,
|
||||
EEventFiringType aDelayedOrNormal,
|
||||
PRBool aIsAsyncChange,
|
||||
EIsFromUserInput aIsFromUserInput)
|
||||
{
|
||||
NS_ENSURE_ARG(aDOMNode);
|
||||
NS_ENSURE_ARG(aNode);
|
||||
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
nsRefPtr<nsAccessible> accessible;
|
||||
if (!aAvoidOnThisNode) {
|
||||
if (aEventType == nsIAccessibleEvent::EVENT_HIDE) {
|
||||
// Don't allow creation for accessibles when nodes going away
|
||||
accessible = do_QueryInterface(GetCachedAccessNode(aDOMNode));
|
||||
accessible = do_QueryObject(GetCachedAccessNode(aNode));
|
||||
} else {
|
||||
// Allow creation of new accessibles for show events
|
||||
GetAccService()->GetAttachedAccessibleFor(aDOMNode,
|
||||
getter_AddRefs(accessible));
|
||||
accessible = GetAccService()->GetAttachedAccessibleFor(aNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1985,10 +1976,9 @@ nsDocAccessible::FireShowHideEvents(nsIDOMNode *aDOMNode,
|
|||
|
||||
// Could not find accessible to show hide yet, so fire on any
|
||||
// accessible descendants in this subtree
|
||||
nsCOMPtr<nsINode> node(do_QueryInterface(aDOMNode));
|
||||
PRUint32 count = node->GetChildCount();
|
||||
PRUint32 count = aNode->GetChildCount();
|
||||
for (PRUint32 index = 0; index < count; index++) {
|
||||
nsCOMPtr<nsIDOMNode> childNode = do_QueryInterface(node->GetChildAt(index));
|
||||
nsINode *childNode = aNode->GetChildAt(index);
|
||||
nsresult rv = FireShowHideEvents(childNode, PR_FALSE, aEventType,
|
||||
aDelayedOrNormal, aIsAsyncChange,
|
||||
aIsFromUserInput);
|
||||
|
|
|
@ -82,7 +82,8 @@ class nsDocAccessible : public nsHyperTextAccessibleWrap,
|
|||
NS_DECL_NSIOBSERVER
|
||||
|
||||
public:
|
||||
nsDocAccessible(nsIDOMNode *aNode, nsIWeakReference* aShell);
|
||||
nsDocAccessible(nsIDocument *aDocument, nsIContent *aRootContent,
|
||||
nsIWeakReference* aShell);
|
||||
virtual ~nsDocAccessible();
|
||||
|
||||
// nsIAccessible
|
||||
|
@ -104,6 +105,7 @@ public:
|
|||
virtual nsresult Shutdown();
|
||||
virtual nsIFrame* GetFrame();
|
||||
virtual PRBool IsDefunct();
|
||||
virtual nsINode* GetNode() const { return mDocument; }
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
|
@ -149,7 +151,7 @@ public:
|
|||
* @param aIsAsynch [in] set to PR_TRUE if this is not being called from
|
||||
* code synchronous with a DOM event
|
||||
*/
|
||||
nsresult FireDelayedAccessibleEvent(PRUint32 aEventType, nsIDOMNode *aDOMNode,
|
||||
nsresult FireDelayedAccessibleEvent(PRUint32 aEventType, nsINode *aNode,
|
||||
nsAccEvent::EEventRule aAllowDupes = nsAccEvent::eRemoveDupes,
|
||||
PRBool aIsAsynch = PR_FALSE,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect);
|
||||
|
@ -223,9 +225,13 @@ protected:
|
|||
* @param aStartNode [in] the root of the subrtee to invalidate accessible
|
||||
* child/parent refs in
|
||||
*/
|
||||
void InvalidateChildrenInSubtree(nsIDOMNode *aStartNode);
|
||||
void InvalidateChildrenInSubtree(nsINode *aStartNode);
|
||||
|
||||
/**
|
||||
* Traverse through DOM tree and shutdown accessible objects.
|
||||
*/
|
||||
void RefreshNodes(nsINode *aStartNode);
|
||||
|
||||
void RefreshNodes(nsIDOMNode *aStartNode);
|
||||
static void ScrollTimerCallback(nsITimer *aTimer, void *aClosure);
|
||||
|
||||
/**
|
||||
|
@ -262,7 +268,7 @@ protected:
|
|||
* Create a text change event for a changed node.
|
||||
*
|
||||
* @param aContainerAccessible [in] the parent accessible for the node
|
||||
* @param aNode [in] the node that is being inserted or
|
||||
* @param aChangeNode [in] the node that is being inserted or
|
||||
* removed, or shown/hidden
|
||||
* @param aAccessible [in] the accessible for that node, or nsnull
|
||||
* if none exists
|
||||
|
@ -273,7 +279,7 @@ protected:
|
|||
*/
|
||||
already_AddRefed<nsAccEvent>
|
||||
CreateTextChangeEventForNode(nsAccessible *aContainerAccessible,
|
||||
nsIDOMNode *aNode,
|
||||
nsIContent *aChangeNode,
|
||||
nsAccessible *aAccessible,
|
||||
PRBool aIsInserting,
|
||||
PRBool aIsAsynch,
|
||||
|
@ -299,7 +305,7 @@ protected:
|
|||
* @param aIsAsyncChange [in] whether casual change is async
|
||||
* @param aIsFromUserInput [in] the event is known to be from user input
|
||||
*/
|
||||
nsresult FireShowHideEvents(nsIDOMNode *aDOMNode, PRBool aAvoidOnThisNode,
|
||||
nsresult FireShowHideEvents(nsINode *aDOMNode, PRBool aAvoidOnThisNode,
|
||||
PRUint32 aEventType,
|
||||
EEventFiringType aDelayedOrNormal,
|
||||
PRBool aIsAsyncChange,
|
||||
|
|
|
@ -55,8 +55,7 @@ nsEventShell::FireEvent(nsAccEvent *aEvent)
|
|||
nsRefPtr<nsAccessible> acc = do_QueryObject(aEvent->GetAccessible());
|
||||
NS_ENSURE_TRUE(acc,);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
aEvent->GetDOMNode(getter_AddRefs(node));
|
||||
nsINode* node = aEvent->GetNode();
|
||||
if (node) {
|
||||
sEventTargetNode = node;
|
||||
sEventFromUserInput = aEvent->IsFromUserInput();
|
||||
|
@ -80,7 +79,7 @@ nsEventShell::FireEvent(PRUint32 aEventType, nsIAccessible *aAccessible,
|
|||
}
|
||||
|
||||
void
|
||||
nsEventShell::GetEventAttributes(nsIDOMNode *aNode,
|
||||
nsEventShell::GetEventAttributes(nsINode *aNode,
|
||||
nsIPersistentProperties *aAttributes)
|
||||
{
|
||||
if (aNode != sEventTargetNode)
|
||||
|
@ -95,7 +94,7 @@ nsEventShell::GetEventAttributes(nsIDOMNode *aNode,
|
|||
// nsEventShell: private
|
||||
|
||||
PRBool nsEventShell::sEventFromUserInput = PR_FALSE;
|
||||
nsCOMPtr<nsIDOMNode> nsEventShell::sEventTargetNode;
|
||||
nsCOMPtr<nsINode> nsEventShell::sEventTargetNode;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -78,11 +78,11 @@ public:
|
|||
* @param aNode [in] the DOM node
|
||||
* @param aAttributes [in, out] the attributes
|
||||
*/
|
||||
static void GetEventAttributes(nsIDOMNode *aNode,
|
||||
static void GetEventAttributes(nsINode *aNode,
|
||||
nsIPersistentProperties *aAttributes);
|
||||
|
||||
private:
|
||||
static nsCOMPtr<nsIDOMNode> sEventTargetNode;
|
||||
static nsCOMPtr<nsINode> sEventTargetNode;
|
||||
static PRBool sEventFromUserInput;
|
||||
};
|
||||
|
||||
|
|
|
@ -44,27 +44,25 @@
|
|||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIDOMXULControlElement.h"
|
||||
|
||||
// ------------
|
||||
// Radio button
|
||||
// ------------
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsRadioButtonAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsRadioButtonAccessible::nsRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsFormControlAccessible(aNode, aShell)
|
||||
{
|
||||
nsRadioButtonAccessible::
|
||||
nsRadioButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsFormControlAccessible(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP nsRadioButtonAccessible::GetNumActions(PRUint8 *_retval)
|
||||
NS_IMETHODIMP
|
||||
nsRadioButtonAccessible::GetNumActions(PRUint8 *aNumActions)
|
||||
{
|
||||
*_retval = 1;
|
||||
NS_ENSURE_ARG_POINTER(aNumActions);
|
||||
*aNumActions = 1;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP nsRadioButtonAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
|
||||
{
|
||||
if (aIndex == eAction_Click) {
|
||||
|
|
|
@ -44,13 +44,13 @@
|
|||
typedef nsLeafAccessible nsFormControlAccessible;
|
||||
|
||||
/**
|
||||
* nsRadioButtonAccessible
|
||||
* Generic class used for radio buttons.
|
||||
*/
|
||||
class nsRadioButtonAccessible : public nsFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
nsRadioButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetNumActions(PRUint8 *_retval);
|
||||
|
|
|
@ -45,9 +45,9 @@
|
|||
// nsOuterDocAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsOuterDocAccessible::nsOuterDocAccessible(nsIDOMNode* aNode,
|
||||
nsIWeakReference* aShell):
|
||||
nsAccessibleWrap(aNode, aShell)
|
||||
nsOuterDocAccessible::
|
||||
nsOuterDocAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsAccessibleWrap(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -228,14 +228,12 @@ nsOuterDocAccessible::CacheChildren()
|
|||
{
|
||||
// Request document accessible for the content document to make sure it's
|
||||
// created because once it's created it appends itself as a child.
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsIDocument *outerDoc = content->GetCurrentDoc();
|
||||
nsIDocument *outerDoc = mContent->GetCurrentDoc();
|
||||
if (!outerDoc)
|
||||
return;
|
||||
|
||||
nsIDocument *innerDoc = outerDoc->GetSubDocumentFor(content);
|
||||
nsCOMPtr<nsIDOMNode> innerNode(do_QueryInterface(innerDoc));
|
||||
if (!innerNode)
|
||||
nsIDocument *innerDoc = outerDoc->GetSubDocumentFor(mContent);
|
||||
if (!innerDoc)
|
||||
return;
|
||||
|
||||
nsDocAccessible *docAcc = GetAccService()->GetDocAccessible(innerDoc);
|
||||
|
|
|
@ -53,8 +53,7 @@
|
|||
class nsOuterDocAccessible : public nsAccessibleWrap
|
||||
{
|
||||
public:
|
||||
nsOuterDocAccessible(nsIDOMNode* aNode,
|
||||
nsIWeakReference* aShell);
|
||||
nsOuterDocAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "nsCoreUtils.h"
|
||||
#include "nsRelUtils.h"
|
||||
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsHTMLSelectAccessible.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
|
@ -105,8 +106,10 @@ NS_IMPL_RELEASE_INHERITED(nsRootAccessible, nsDocAccessible)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor/desctructor
|
||||
|
||||
nsRootAccessible::nsRootAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell):
|
||||
nsDocAccessibleWrap(aDOMNode, aShell)
|
||||
nsRootAccessible::
|
||||
nsRootAccessible(nsIDocument *aDocument, nsIContent *aRootContent,
|
||||
nsIWeakReference *aShell) :
|
||||
nsDocAccessibleWrap(aDocument, aRootContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -171,7 +174,7 @@ PRUint32 nsRootAccessible::GetChromeFlags()
|
|||
// by nsIWebBrowserChrome::CHROME_WINDOW_[FLAGNAME]
|
||||
// Not simple: nsIXULWindow is not just a QI from nsIDOMWindow
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem =
|
||||
nsCoreUtils::GetDocShellTreeItemFor(mDOMNode);
|
||||
nsCoreUtils::GetDocShellTreeItemFor(mDocument);
|
||||
NS_ENSURE_TRUE(treeItem, 0);
|
||||
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
|
||||
treeItem->GetTreeOwner(getter_AddRefs(treeOwner));
|
||||
|
@ -317,8 +320,8 @@ nsRootAccessible::GetCaretAccessible()
|
|||
}
|
||||
|
||||
PRBool
|
||||
nsRootAccessible::FireAccessibleFocusEvent(nsIAccessible *aAccessible,
|
||||
nsIDOMNode *aNode,
|
||||
nsRootAccessible::FireAccessibleFocusEvent(nsAccessible *aAccessible,
|
||||
nsINode *aNode,
|
||||
nsIDOMEvent *aFocusEvent,
|
||||
PRBool aForceEvent,
|
||||
PRBool aIsAsynch,
|
||||
|
@ -337,12 +340,12 @@ nsRootAccessible::FireAccessibleFocusEvent(nsIAccessible *aAccessible,
|
|||
// stays outside on that binding parent.
|
||||
nsCOMPtr<nsIDOMEventTarget> domEventTarget;
|
||||
nsevent->GetOriginalTarget(getter_AddRefs(domEventTarget));
|
||||
nsCOMPtr<nsIDOMNode> realFocusedNode(do_QueryInterface(domEventTarget));
|
||||
nsCOMPtr<nsIContent> realFocusedNode(do_QueryInterface(domEventTarget));
|
||||
if (!realFocusedNode) {
|
||||
// When FireCurrentFocusEvent() synthesizes a focus event,
|
||||
// the orignal target does not exist, so use the passed-in node
|
||||
// which is the relevant focused node
|
||||
realFocusedNode = aNode;
|
||||
realFocusedNode = do_QueryInterface(aNode);
|
||||
}
|
||||
if (realFocusedNode) {
|
||||
mCaretAccessible->SetControlSelectionListener(realFocusedNode);
|
||||
|
@ -351,25 +354,15 @@ nsRootAccessible::FireAccessibleFocusEvent(nsIAccessible *aAccessible,
|
|||
}
|
||||
|
||||
// Check for aria-activedescendant, which changes which element has focus
|
||||
nsCOMPtr<nsIDOMNode> finalFocusNode = aNode;
|
||||
nsCOMPtr<nsIAccessible> finalFocusAccessible = aAccessible;
|
||||
nsCOMPtr<nsIContent> finalFocusContent =
|
||||
nsCoreUtils::GetRoleContent(finalFocusNode);
|
||||
nsINode *finalFocusNode = aNode;
|
||||
nsAccessible *finalFocusAccessible = aAccessible;
|
||||
|
||||
nsIContent *finalFocusContent = nsCoreUtils::GetRoleContent(finalFocusNode);
|
||||
if (finalFocusContent) {
|
||||
nsAutoString id;
|
||||
if (finalFocusContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_activedescendant, id)) {
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
aNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
||||
if (!domDoc) { // Maybe the passed-in node actually is a doc
|
||||
domDoc = do_QueryInterface(aNode);
|
||||
}
|
||||
if (!domDoc) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
nsCOMPtr<nsIDOMElement> relatedEl;
|
||||
domDoc->GetElementById(id, getter_AddRefs(relatedEl));
|
||||
finalFocusNode = do_QueryInterface(relatedEl);
|
||||
nsIDocument *doc = aNode->GetOwnerDoc();
|
||||
finalFocusNode = doc->GetElementById(id);
|
||||
if (!finalFocusNode) {
|
||||
// If aria-activedescendant is set to nonextistant ID, then treat as focus
|
||||
// on the activedescendant container (which has real DOM focus)
|
||||
|
@ -385,7 +378,7 @@ nsRootAccessible::FireAccessibleFocusEvent(nsIAccessible *aAccessible,
|
|||
}
|
||||
|
||||
if (!finalFocusAccessible) {
|
||||
GetAccService()->GetAccessibleFor(finalFocusNode, getter_AddRefs(finalFocusAccessible));
|
||||
finalFocusAccessible = GetAccService()->GetAccessible(finalFocusNode);
|
||||
// For activedescendant, the ARIA spec does not require that the user agent
|
||||
// checks whether finalFocusNode is actually a descendant of the element with
|
||||
// the activedescendant attribute.
|
||||
|
@ -401,12 +394,11 @@ nsRootAccessible::FireAccessibleFocusEvent(nsIAccessible *aAccessible,
|
|||
// The natural role is the role that this type of element normally has
|
||||
PRUint32 naturalRole = nsAccUtils::RoleInternal(finalFocusAccessible);
|
||||
if (role != naturalRole) { // Must be a DHTML menuitem
|
||||
nsCOMPtr<nsIAccessible> menuBarAccessible =
|
||||
nsAccessible *menuBarAccessible =
|
||||
nsAccUtils::GetAncestorWithRole(finalFocusAccessible,
|
||||
nsIAccessibleRole::ROLE_MENUBAR);
|
||||
nsCOMPtr<nsIAccessNode> menuBarAccessNode = do_QueryInterface(menuBarAccessible);
|
||||
if (menuBarAccessNode) {
|
||||
menuBarAccessNode->GetDOMNode(getter_AddRefs(mCurrentARIAMenubar));
|
||||
if (menuBarAccessible) {
|
||||
mCurrentARIAMenubar = menuBarAccessible->GetNode();
|
||||
if (mCurrentARIAMenubar) {
|
||||
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENU_START,
|
||||
menuBarAccessible, PR_FALSE,
|
||||
|
@ -459,7 +451,7 @@ nsRootAccessible::FireCurrentFocusEvent()
|
|||
if (IsDefunct())
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> focusedNode = GetCurrentFocus();
|
||||
nsCOMPtr<nsINode> focusedNode = GetCurrentFocus();
|
||||
if (!focusedNode) {
|
||||
return; // No current focus
|
||||
}
|
||||
|
@ -472,28 +464,20 @@ nsRootAccessible::FireCurrentFocusEvent()
|
|||
getter_AddRefs(event))) &&
|
||||
NS_SUCCEEDED(event->InitEvent(NS_LITERAL_STRING("focus"), PR_TRUE, PR_TRUE))) {
|
||||
// Get the target node we really want for the event.
|
||||
nsIAccessibilityService* accService = GetAccService();
|
||||
if (accService) {
|
||||
nsCOMPtr<nsIDOMNode> targetNode;
|
||||
accService->GetRelevantContentNodeFor(focusedNode,
|
||||
getter_AddRefs(targetNode));
|
||||
|
||||
if (targetNode) {
|
||||
// If the focused element is document element or HTML body element
|
||||
// then simulate the focus event for the document.
|
||||
nsCOMPtr<nsIContent> targetContent(do_QueryInterface(targetNode));
|
||||
if (targetContent) {
|
||||
nsCOMPtr<nsIDOMNode> document =
|
||||
do_QueryInterface(targetContent->GetOwnerDoc());
|
||||
if (targetContent == nsCoreUtils::GetRoleContent(document)) {
|
||||
HandleEventWithTarget(event, document);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise simulate the focus event for currently focused node.
|
||||
HandleEventWithTarget(event, targetNode);
|
||||
nsINode *targetNode =
|
||||
GetAccService()->GetRelevantContentNodeFor(focusedNode);
|
||||
if (targetNode) {
|
||||
// If the focused element is document element or HTML body element
|
||||
// then simulate the focus event for the document.
|
||||
nsINode *document = targetNode->GetOwnerDoc();
|
||||
if (targetNode == nsCoreUtils::GetRoleContent(document)) {
|
||||
HandleEventWithTarget(event, document);
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise simulate the focus event for currently focused node.
|
||||
HandleEventWithTarget(event, targetNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -510,19 +494,22 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
|||
GetTargetNode(aEvent, getter_AddRefs(targetNode));
|
||||
if (!targetNode)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return HandleEventWithTarget(aEvent, targetNode);
|
||||
|
||||
nsCOMPtr<nsINode> node(do_QueryInterface(targetNode));
|
||||
return HandleEventWithTarget(aEvent, node);
|
||||
}
|
||||
|
||||
|
||||
// nsRootAccessible protected member
|
||||
nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
|
||||
nsIDOMNode* aTargetNode)
|
||||
nsINode* aTargetNode)
|
||||
{
|
||||
nsAutoString eventType;
|
||||
aEvent->GetType(eventType);
|
||||
nsAutoString localName;
|
||||
aTargetNode->GetLocalName(localName);
|
||||
nsCOMPtr<nsIContent> targetContent(do_QueryInterface(aTargetNode));
|
||||
if (targetContent)
|
||||
targetContent->NodeInfo()->GetName(localName);
|
||||
#ifdef MOZ_XUL
|
||||
PRBool isTree = localName.EqualsLiteral("tree");
|
||||
#endif
|
||||
|
@ -536,16 +523,16 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
|
|||
}
|
||||
#endif
|
||||
|
||||
nsIAccessibilityService *accService = GetAccService();
|
||||
nsAccessibilityService *accService = GetAccService();
|
||||
NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
|
||||
|
||||
nsIPresShell *eventShell = nsCoreUtils::GetPresShellFor(aTargetNode);
|
||||
if (!eventShell) {
|
||||
nsCOMPtr<nsIWeakReference> weakShell =
|
||||
nsCoreUtils::GetWeakShellFor(aTargetNode);
|
||||
if (!weakShell)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsAccessible *accessible =
|
||||
accService->GetAccessibleInShell(aTargetNode, eventShell);
|
||||
accService->GetAccessibleInWeakShell(aTargetNode, weakShell);
|
||||
|
||||
if (eventType.EqualsLiteral("popuphiding"))
|
||||
return HandlePopupHidingEvent(aTargetNode, accessible);
|
||||
|
@ -667,7 +654,7 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
|
|||
else
|
||||
#endif
|
||||
if (eventType.EqualsLiteral("focus")) {
|
||||
if (aTargetNode == mDOMNode && mDOMNode != gLastFocusedNode) {
|
||||
if (aTargetNode == mDocument && mDocument != gLastFocusedNode) {
|
||||
// Got focus event for the window, we will make sure that an accessible
|
||||
// focus event for initial focus is fired. We do this on a short timer
|
||||
// because the initial focus may not have been set yet.
|
||||
|
@ -677,7 +664,7 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
|
|||
// Keep a reference to the target node. We might want to change
|
||||
// it to the individual radio button or selected item, and send
|
||||
// the focus event to that.
|
||||
nsCOMPtr<nsIDOMNode> focusedItem(aTargetNode);
|
||||
nsCOMPtr<nsINode> focusedItem(aTargetNode);
|
||||
|
||||
if (!treeItemAccessible) {
|
||||
nsCOMPtr<nsIDOMXULSelectControlElement> selectControl =
|
||||
|
@ -696,7 +683,8 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
|
|||
if (!focusedItem)
|
||||
return NS_OK;
|
||||
|
||||
accessible = accService->GetAccessibleInShell(focusedItem, eventShell);
|
||||
accessible = accService->GetAccessibleInWeakShell(focusedItem,
|
||||
weakShell);
|
||||
if (!accessible)
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -757,7 +745,7 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
|
|||
}
|
||||
}
|
||||
if (!fireFocus) {
|
||||
nsCOMPtr<nsIDOMNode> realFocusedNode = GetCurrentFocus();
|
||||
nsCOMPtr<nsINode> realFocusedNode = GetCurrentFocus();
|
||||
nsCOMPtr<nsIContent> realFocusedContent = do_QueryInterface(realFocusedNode);
|
||||
nsCOMPtr<nsIContent> targetContent = do_QueryInterface(aTargetNode);
|
||||
nsIContent *containerContent = targetContent;
|
||||
|
@ -919,12 +907,12 @@ nsRootAccessible::GetRelationByType(PRUint32 aRelationType,
|
|||
NS_ENSURE_ARG_POINTER(aRelation);
|
||||
*aRelation = nsnull;
|
||||
|
||||
if (!mDOMNode || aRelationType != nsIAccessibleRelation::RELATION_EMBEDS) {
|
||||
if (!mDocument || aRelationType != nsIAccessibleRelation::RELATION_EMBEDS) {
|
||||
return nsDocAccessibleWrap::GetRelationByType(aRelationType, aRelation);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem =
|
||||
nsCoreUtils::GetDocShellTreeItemFor(mDOMNode);
|
||||
nsCoreUtils::GetDocShellTreeItemFor(mDocument);
|
||||
nsCOMPtr<nsIDocShellTreeItem> contentTreeItem = GetContentDocShell(treeItem);
|
||||
// there may be no content area, so we need a null check
|
||||
if (contentTreeItem) {
|
||||
|
@ -950,7 +938,7 @@ nsRootAccessible::GetParent()
|
|||
// Protected members
|
||||
|
||||
nsresult
|
||||
nsRootAccessible::HandlePopupShownEvent(nsIAccessible *aAccessible)
|
||||
nsRootAccessible::HandlePopupShownEvent(nsAccessible *aAccessible)
|
||||
{
|
||||
PRUint32 role = nsAccUtils::Role(aAccessible);
|
||||
|
||||
|
@ -972,10 +960,7 @@ nsRootAccessible::HandlePopupShownEvent(nsIAccessible *aAccessible)
|
|||
|
||||
if (role == nsIAccessibleRole::ROLE_COMBOBOX_LIST) {
|
||||
// Fire expanded state change event for comboboxes and autocompeletes.
|
||||
nsCOMPtr<nsIAccessible> comboboxAcc;
|
||||
nsresult rv = aAccessible->GetParent(getter_AddRefs(comboboxAcc));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAccessible *comboboxAcc = aAccessible->GetParent();
|
||||
PRUint32 comboboxRole = nsAccUtils::Role(comboboxAcc);
|
||||
if (comboboxRole == nsIAccessibleRole::ROLE_COMBOBOX ||
|
||||
comboboxRole == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
|
||||
|
@ -985,7 +970,6 @@ nsRootAccessible::HandlePopupShownEvent(nsIAccessible *aAccessible)
|
|||
PR_FALSE, PR_TRUE);
|
||||
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsRefPtr<nsAccessible> acc(do_QueryObject(comboboxAcc));
|
||||
nsEventShell::FireEvent(event);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -995,19 +979,17 @@ nsRootAccessible::HandlePopupShownEvent(nsIAccessible *aAccessible)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsRootAccessible::HandlePopupHidingEvent(nsIDOMNode *aNode,
|
||||
nsIAccessible *aAccessible)
|
||||
nsRootAccessible::HandlePopupHidingEvent(nsINode *aNode,
|
||||
nsAccessible *aAccessible)
|
||||
{
|
||||
// If accessible focus was on or inside popup that closes, then restore it
|
||||
// to true current focus. This is the case when we've been getting
|
||||
// DOMMenuItemActive events inside of a combo box that closes. The real focus
|
||||
// is on the combo box. It's also the case when a popup gets focus in ATK --
|
||||
// when it closes we need to fire an event to restore focus to where it was.
|
||||
nsCOMPtr<nsINode> node(do_QueryInterface(aNode));
|
||||
nsCOMPtr<nsINode> lastFocusedNode(do_QueryInterface(gLastFocusedNode));
|
||||
|
||||
if (gLastFocusedNode &&
|
||||
nsCoreUtils::IsAncestorOf(node, lastFocusedNode)) {
|
||||
nsCoreUtils::IsAncestorOf(aNode, gLastFocusedNode)) {
|
||||
// Focus was on or inside of a popup that's being hidden
|
||||
FireCurrentFocusEvent();
|
||||
}
|
||||
|
@ -1020,10 +1002,7 @@ nsRootAccessible::HandlePopupHidingEvent(nsIDOMNode *aNode,
|
|||
if (role != nsIAccessibleRole::ROLE_COMBOBOX_LIST)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIAccessible> comboboxAcc;
|
||||
nsresult rv = aAccessible->GetParent(getter_AddRefs(comboboxAcc));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAccessible *comboboxAcc = aAccessible->GetParent();
|
||||
PRUint32 comboboxRole = nsAccUtils::Role(comboboxAcc);
|
||||
if (comboboxRole == nsIAccessibleRole::ROLE_COMBOBOX ||
|
||||
comboboxRole == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
|
||||
|
|
|
@ -68,7 +68,8 @@ class nsRootAccessible : public nsDocAccessibleWrap,
|
|||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
public:
|
||||
nsRootAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell);
|
||||
nsRootAccessible(nsIDocument *aDocument, nsIContent *aRootContent,
|
||||
nsIWeakReference *aShell);
|
||||
virtual ~nsRootAccessible();
|
||||
|
||||
// nsIAccessible
|
||||
|
@ -103,8 +104,8 @@ public:
|
|||
* item was the same
|
||||
* @return boolean -- was a focus event actually fired
|
||||
*/
|
||||
PRBool FireAccessibleFocusEvent(nsIAccessible *aFocusAccessible,
|
||||
nsIDOMNode *aFocusNode,
|
||||
PRBool FireAccessibleFocusEvent(nsAccessible *aFocusAccessible,
|
||||
nsINode *aFocusNode,
|
||||
nsIDOMEvent *aFocusEvent,
|
||||
PRBool aForceEvent = PR_FALSE,
|
||||
PRBool aIsAsynch = PR_FALSE,
|
||||
|
@ -123,16 +124,23 @@ protected:
|
|||
|
||||
nsresult AddEventListeners();
|
||||
nsresult RemoveEventListeners();
|
||||
nsresult HandleEventWithTarget(nsIDOMEvent* aEvent,
|
||||
nsIDOMNode* aTargetNode);
|
||||
|
||||
/**
|
||||
* Process DOM events.
|
||||
*/
|
||||
nsresult HandleEventWithTarget(nsIDOMEvent* aEvent, nsINode* aTargetNode);
|
||||
|
||||
static void GetTargetNode(nsIDOMEvent *aEvent, nsIDOMNode **aTargetNode);
|
||||
|
||||
/**
|
||||
* Used in HandleEventWithTarget().
|
||||
*/
|
||||
nsresult HandlePopupShownEvent(nsIAccessible *aAccessible);
|
||||
nsresult HandlePopupHidingEvent(nsIDOMNode *aNode,
|
||||
nsIAccessible *aAccessible);
|
||||
/**
|
||||
* Process "popupshown" event. Used by HandleEventWithTarget().
|
||||
*/
|
||||
|
||||
nsresult HandlePopupShownEvent(nsAccessible *aAccessible);
|
||||
/*
|
||||
* Process "popuphiding" event. Used by HandleEventWithTarget().
|
||||
*/
|
||||
nsresult HandlePopupHidingEvent(nsINode *aNode, nsAccessible *aAccessible);
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
nsresult HandleTreeRowCountChangedEvent(nsIDOMEvent *aEvent,
|
||||
|
@ -145,7 +153,7 @@ protected:
|
|||
already_AddRefed<nsIDocShellTreeItem>
|
||||
GetContentDocShell(nsIDocShellTreeItem *aStart);
|
||||
nsRefPtr<nsCaretAccessible> mCaretAccessible;
|
||||
nsCOMPtr<nsIDOMNode> mCurrentARIAMenubar;
|
||||
nsCOMPtr<nsINode> mCurrentARIAMenubar;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsRootAccessible, NS_ROOTACCESSIBLE_IMPL_CID)
|
||||
|
|
|
@ -45,8 +45,8 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsTextAccessible::
|
||||
nsTextAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell) :
|
||||
nsLinkableAccessible(aDOMNode, aShell)
|
||||
nsTextAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsLinkableAccessible(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
class nsTextAccessible : public nsLinkableAccessible
|
||||
{
|
||||
public:
|
||||
nsTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
nsTextAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
|
|
|
@ -131,24 +131,26 @@ nsTextAttrsMgr::GetAttributes(nsIPersistentProperties *aAttributes,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIDOMNode *hyperTextNode = mHyperTextAcc->GetDOMNode();
|
||||
nsCOMPtr<nsIDOMElement> hyperTextElm =
|
||||
nsCoreUtils::GetDOMElementFor(mHyperTextAcc->GetDOMNode());
|
||||
nsIFrame *rootFrame = nsCoreUtils::GetFrameFor(hyperTextElm);
|
||||
// Get the content and frame of the accessible. In the case of document
|
||||
// accessible it's role content and root frame.
|
||||
nsIContent *hyperTextElm = mHyperTextAcc->GetContent();
|
||||
nsIFrame *rootFrame = mHyperTextAcc->GetFrame();
|
||||
NS_ASSERTION(rootFrame, "No frame for accessible!");
|
||||
if (!rootFrame)
|
||||
return NS_OK;
|
||||
|
||||
nsIDOMNode *offsetNode = nsnull;
|
||||
nsCOMPtr<nsIDOMElement> offsetElm;
|
||||
nsIContent *offsetNode = nsnull, *offsetElm = nsnull;
|
||||
nsIFrame *frame = nsnull;
|
||||
if (mOffsetAcc) {
|
||||
offsetNode = mOffsetAcc->GetDOMNode();
|
||||
offsetNode = mOffsetAcc->GetContent();
|
||||
offsetElm = nsCoreUtils::GetDOMElementFor(offsetNode);
|
||||
frame = nsCoreUtils::GetFrameFor(offsetElm);
|
||||
frame = offsetElm->GetPrimaryFrame();
|
||||
}
|
||||
|
||||
nsTPtrArray<nsITextAttr> textAttrArray(10);
|
||||
|
||||
// "language" text attribute
|
||||
nsLangTextAttr langTextAttr(mHyperTextAcc, hyperTextNode, offsetNode);
|
||||
nsLangTextAttr langTextAttr(mHyperTextAcc, hyperTextElm, offsetNode);
|
||||
textAttrArray.AppendElement(static_cast<nsITextAttr*>(&langTextAttr));
|
||||
|
||||
// "color" text attribute
|
||||
|
@ -224,8 +226,7 @@ nsTextAttrsMgr::GetRange(const nsTPtrArray<nsITextAttr>& aTextAttrArray,
|
|||
if (nsAccUtils::IsEmbeddedObject(currAcc))
|
||||
break;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> currElm =
|
||||
nsCoreUtils::GetDOMElementFor(currAcc->GetDOMNode());
|
||||
nsIContent *currElm = nsCoreUtils::GetDOMElementFor(currAcc->GetContent());
|
||||
NS_ENSURE_STATE(currElm);
|
||||
|
||||
PRBool offsetFound = PR_FALSE;
|
||||
|
@ -250,8 +251,7 @@ nsTextAttrsMgr::GetRange(const nsTPtrArray<nsITextAttr>& aTextAttrArray,
|
|||
if (nsAccUtils::IsEmbeddedObject(currAcc))
|
||||
break;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> currElm =
|
||||
nsCoreUtils::GetDOMElementFor(currAcc->GetDOMNode());
|
||||
nsIContent *currElm = nsCoreUtils::GetDOMElementFor(currAcc->GetContent());
|
||||
NS_ENSURE_STATE(currElm);
|
||||
|
||||
PRBool offsetFound = PR_FALSE;
|
||||
|
@ -279,25 +279,20 @@ nsTextAttrsMgr::GetRange(const nsTPtrArray<nsITextAttr>& aTextAttrArray,
|
|||
// nsLangTextAttr
|
||||
|
||||
nsLangTextAttr::nsLangTextAttr(nsHyperTextAccessible *aRootAcc,
|
||||
nsIDOMNode *aRootNode, nsIDOMNode *aNode) :
|
||||
nsTextAttr<nsAutoString>(aNode == nsnull)
|
||||
nsIContent *aRootContent, nsIContent *aContent) :
|
||||
nsTextAttr<nsAutoString>(aContent == nsnull), mRootContent(aRootContent)
|
||||
{
|
||||
mRootContent = do_QueryInterface(aRootNode);
|
||||
|
||||
nsresult rv = aRootAcc->GetLanguage(mRootNativeValue);
|
||||
mIsRootDefined = NS_SUCCEEDED(rv) && !mRootNativeValue.IsEmpty();
|
||||
|
||||
if (aNode) {
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
|
||||
mIsDefined = GetLang(content, mNativeValue);
|
||||
}
|
||||
if (aContent)
|
||||
mIsDefined = GetLang(aContent, mNativeValue);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsLangTextAttr::GetValueFor(nsIDOMElement *aElm, nsAutoString *aValue)
|
||||
nsLangTextAttr::GetValueFor(nsIContent *aElm, nsAutoString *aValue)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aElm);
|
||||
return GetLang(content, *aValue);
|
||||
return GetLang(aElm, *aValue);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -313,17 +308,19 @@ nsLangTextAttr::GetLang(nsIContent *aContent, nsAString& aLang)
|
|||
return !aLang.IsEmpty();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsCSSTextAttr
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsCSSTextAttr::nsCSSTextAttr(PRUint32 aIndex, nsIDOMElement *aRootElm,
|
||||
nsIDOMElement *aElm) :
|
||||
nsTextAttr<nsAutoString>(aElm == nsnull), mIndex(aIndex)
|
||||
nsCSSTextAttr::nsCSSTextAttr(PRUint32 aIndex, nsIContent *aRootContent,
|
||||
nsIContent *aContent) :
|
||||
nsTextAttr<nsAutoString>(aContent == nsnull), mIndex(aIndex)
|
||||
{
|
||||
mIsRootDefined = GetValueFor(aRootElm, &mRootNativeValue);
|
||||
mIsRootDefined = GetValueFor(aRootContent, &mRootNativeValue);
|
||||
|
||||
if (aElm)
|
||||
mIsDefined = GetValueFor(aElm, &mNativeValue);
|
||||
if (aContent)
|
||||
mIsDefined = GetValueFor(aContent, &mNativeValue);
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
|
@ -333,11 +330,10 @@ nsCSSTextAttr::GetName()
|
|||
}
|
||||
|
||||
PRBool
|
||||
nsCSSTextAttr::GetValueFor(nsIDOMElement *aElm, nsAutoString *aValue)
|
||||
nsCSSTextAttr::GetValueFor(nsIContent *aContent, nsAutoString *aValue)
|
||||
{
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> currStyleDecl;
|
||||
nsCoreUtils::GetComputedStyleDeclaration(EmptyString(), aElm,
|
||||
getter_AddRefs(currStyleDecl));
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> currStyleDecl =
|
||||
nsCoreUtils::GetComputedStyleDeclaration(EmptyString(), aContent);
|
||||
if (!currStyleDecl)
|
||||
return PR_FALSE;
|
||||
|
||||
|
@ -364,8 +360,10 @@ nsCSSTextAttr::Format(const nsAutoString& aValue, nsAString& aFormattedValue)
|
|||
aFormattedValue = aValue;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsBackgroundTextAttr
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsBGColorTextAttr::nsBGColorTextAttr(nsIFrame *aRootFrame, nsIFrame *aFrame) :
|
||||
nsTextAttr<nscolor>(aFrame == nsnull), mRootFrame(aRootFrame)
|
||||
|
@ -376,9 +374,9 @@ nsBGColorTextAttr::nsBGColorTextAttr(nsIFrame *aRootFrame, nsIFrame *aFrame) :
|
|||
}
|
||||
|
||||
PRBool
|
||||
nsBGColorTextAttr::GetValueFor(nsIDOMElement *aElm, nscolor *aValue)
|
||||
nsBGColorTextAttr::GetValueFor(nsIContent *aContent, nscolor *aValue)
|
||||
{
|
||||
nsIFrame *frame = nsCoreUtils::GetFrameFor(aElm);
|
||||
nsIFrame *frame = aContent->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return PR_FALSE;
|
||||
|
||||
|
@ -426,8 +424,10 @@ nsBGColorTextAttr::GetColor(nsIFrame *aFrame, nscolor *aColor)
|
|||
return GetColor(parentFrame, aColor);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsFontSizeTextAttr
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsFontSizeTextAttr::nsFontSizeTextAttr(nsIFrame *aRootFrame, nsIFrame *aFrame) :
|
||||
nsTextAttr<nscoord>(aFrame == nsnull)
|
||||
|
@ -444,9 +444,9 @@ nsFontSizeTextAttr::nsFontSizeTextAttr(nsIFrame *aRootFrame, nsIFrame *aFrame) :
|
|||
}
|
||||
|
||||
PRBool
|
||||
nsFontSizeTextAttr::GetValueFor(nsIDOMElement *aElm, nscoord *aValue)
|
||||
nsFontSizeTextAttr::GetValueFor(nsIContent *aContent, nscoord *aValue)
|
||||
{
|
||||
nsIFrame *frame = nsCoreUtils::GetFrameFor(aElm);
|
||||
nsIFrame *frame = aContent->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return PR_FALSE;
|
||||
|
||||
|
@ -487,6 +487,7 @@ nsFontSizeTextAttr::GetFontSize(nsIFrame *aFrame)
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsFontWeightTextAttr
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsFontWeightTextAttr::nsFontWeightTextAttr(nsIFrame *aRootFrame,
|
||||
nsIFrame *aFrame) :
|
||||
|
@ -502,9 +503,9 @@ nsFontWeightTextAttr::nsFontWeightTextAttr(nsIFrame *aRootFrame,
|
|||
}
|
||||
|
||||
PRBool
|
||||
nsFontWeightTextAttr::GetValueFor(nsIDOMElement *aElm, PRInt32 *aValue)
|
||||
nsFontWeightTextAttr::GetValueFor(nsIContent *aContent, PRInt32 *aValue)
|
||||
{
|
||||
nsIFrame *frame = nsCoreUtils::GetFrameFor(aElm);
|
||||
nsIFrame *frame = aContent->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return PR_FALSE;
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ public:
|
|||
* Return true if the text attribute value on the given element equals with
|
||||
* predefined attribute value.
|
||||
*/
|
||||
virtual PRBool Equal(nsIDOMElement *aElm) = 0;
|
||||
virtual PRBool Equal(nsIContent *aContent) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -196,10 +196,10 @@ public:
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
virtual PRBool Equal(nsIDOMElement *aElm)
|
||||
virtual PRBool Equal(nsIContent *aContent)
|
||||
{
|
||||
T nativeValue;
|
||||
PRBool isDefined = GetValueFor(aElm, &nativeValue);
|
||||
PRBool isDefined = GetValueFor(aContent, &nativeValue);
|
||||
|
||||
if (!mIsDefined && !isDefined)
|
||||
return PR_TRUE;
|
||||
|
@ -216,7 +216,7 @@ public:
|
|||
protected:
|
||||
|
||||
// Return native value for the given DOM element.
|
||||
virtual PRBool GetValueFor(nsIDOMElement *aElm, T *aValue) = 0;
|
||||
virtual PRBool GetValueFor(nsIContent *aContent, T *aValue) = 0;
|
||||
|
||||
// Format native value to text attribute value.
|
||||
virtual void Format(const T& aValue, nsAString& aFormattedValue) = 0;
|
||||
|
@ -244,8 +244,8 @@ protected:
|
|||
class nsLangTextAttr : public nsTextAttr<nsAutoString>
|
||||
{
|
||||
public:
|
||||
nsLangTextAttr(nsHyperTextAccessible *aRootAcc, nsIDOMNode *aRootNode,
|
||||
nsIDOMNode *aNode);
|
||||
nsLangTextAttr(nsHyperTextAccessible *aRootAcc, nsIContent *aRootContent,
|
||||
nsIContent *aContent);
|
||||
|
||||
// nsITextAttr
|
||||
virtual nsIAtom *GetName() { return nsAccessibilityAtoms::language; }
|
||||
|
@ -253,7 +253,7 @@ public:
|
|||
protected:
|
||||
|
||||
// nsTextAttr
|
||||
virtual PRBool GetValueFor(nsIDOMElement *aElm, nsAutoString *aValue);
|
||||
virtual PRBool GetValueFor(nsIContent *aElm, nsAutoString *aValue);
|
||||
virtual void Format(const nsAutoString& aValue, nsAString& aFormattedValue);
|
||||
|
||||
private:
|
||||
|
@ -269,7 +269,8 @@ private:
|
|||
class nsCSSTextAttr : public nsTextAttr<nsAutoString>
|
||||
{
|
||||
public:
|
||||
nsCSSTextAttr(PRUint32 aIndex, nsIDOMElement *aRootElm, nsIDOMElement *aElm);
|
||||
nsCSSTextAttr(PRUint32 aIndex, nsIContent *aRootContent,
|
||||
nsIContent *aContent);
|
||||
|
||||
// nsITextAttr
|
||||
virtual nsIAtom *GetName();
|
||||
|
@ -277,7 +278,7 @@ public:
|
|||
protected:
|
||||
|
||||
// nsTextAttr
|
||||
virtual PRBool GetValueFor(nsIDOMElement *aElm, nsAutoString *aValue);
|
||||
virtual PRBool GetValueFor(nsIContent *aContent, nsAutoString *aValue);
|
||||
virtual void Format(const nsAutoString& aValue, nsAString& aFormattedValue);
|
||||
|
||||
private:
|
||||
|
@ -299,7 +300,7 @@ public:
|
|||
|
||||
protected:
|
||||
// nsTextAttr
|
||||
virtual PRBool GetValueFor(nsIDOMElement *aElm, nscolor *aValue);
|
||||
virtual PRBool GetValueFor(nsIContent *aContent, nscolor *aValue);
|
||||
virtual void Format(const nscolor& aValue, nsAString& aFormattedValue);
|
||||
|
||||
private:
|
||||
|
@ -323,7 +324,7 @@ public:
|
|||
protected:
|
||||
|
||||
// nsTextAttr
|
||||
virtual PRBool GetValueFor(nsIDOMElement *aElm, nscoord *aValue);
|
||||
virtual PRBool GetValueFor(nsIContent *aContent, nscoord *aValue);
|
||||
virtual void Format(const nscoord& aValue, nsAString& aFormattedValue);
|
||||
|
||||
private:
|
||||
|
@ -355,7 +356,7 @@ public:
|
|||
protected:
|
||||
|
||||
// nsTextAttr
|
||||
virtual PRBool GetValueFor(nsIDOMElement *aElm, PRInt32 *aValue);
|
||||
virtual PRBool GetValueFor(nsIContent *aElm, PRInt32 *aValue);
|
||||
virtual void Format(const PRInt32& aValue, nsAString& aFormattedValue);
|
||||
|
||||
private:
|
||||
|
|
|
@ -54,7 +54,7 @@ NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_GENERAL, 0x24)
|
|||
// nsTextEquivUtils. Public.
|
||||
|
||||
nsresult
|
||||
nsTextEquivUtils::GetNameFromSubtree(nsIAccessible *aAccessible,
|
||||
nsTextEquivUtils::GetNameFromSubtree(nsAccessible *aAccessible,
|
||||
nsAString& aName)
|
||||
{
|
||||
aName.Truncate();
|
||||
|
@ -68,12 +68,8 @@ nsTextEquivUtils::GetNameFromSubtree(nsIAccessible *aAccessible,
|
|||
PRUint32 nameRule = gRoleToNameRulesMap[role];
|
||||
|
||||
if (nameRule == eFromSubtree) {
|
||||
nsCOMPtr<nsIAccessNode> accessNode(do_QueryInterface(aAccessible));
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode;
|
||||
accessNode->GetDOMNode(getter_AddRefs(DOMNode));
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(DOMNode));
|
||||
if (content) {
|
||||
//XXX: is it necessary to care the accessible is not a document?
|
||||
if (aAccessible->IsContent()) {
|
||||
nsAutoString name;
|
||||
AppendFromAccessibleChildren(aAccessible, &name);
|
||||
name.CompressWhitespace();
|
||||
|
@ -88,18 +84,13 @@ nsTextEquivUtils::GetNameFromSubtree(nsIAccessible *aAccessible,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsTextEquivUtils::GetTextEquivFromIDRefs(nsIAccessible *aAccessible,
|
||||
nsTextEquivUtils::GetTextEquivFromIDRefs(nsAccessible *aAccessible,
|
||||
nsIAtom *aIDRefsAttr,
|
||||
nsAString& aTextEquiv)
|
||||
{
|
||||
aTextEquiv.Truncate();
|
||||
|
||||
nsCOMPtr<nsIAccessNode> accessNode(do_QueryInterface(aAccessible));
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode;
|
||||
accessNode->GetDOMNode(getter_AddRefs(DOMNode));
|
||||
|
||||
nsCOMPtr<nsIContent> content = nsCoreUtils::GetRoleContent(DOMNode);
|
||||
nsIContent* content = aAccessible->GetContent();
|
||||
if (!content)
|
||||
return NS_OK;
|
||||
|
||||
|
@ -130,7 +121,7 @@ nsTextEquivUtils::GetTextEquivFromIDRefs(nsIAccessible *aAccessible,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsTextEquivUtils::AppendTextEquivFromContent(nsIAccessible *aInitiatorAcc,
|
||||
nsTextEquivUtils::AppendTextEquivFromContent(nsAccessible *aInitiatorAcc,
|
||||
nsIContent *aContent,
|
||||
nsAString *aString)
|
||||
{
|
||||
|
@ -140,8 +131,7 @@ nsTextEquivUtils::AppendTextEquivFromContent(nsIAccessible *aInitiatorAcc,
|
|||
|
||||
gInitiatorAcc = aInitiatorAcc;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(aContent));
|
||||
nsIPresShell *shell = nsCoreUtils::GetPresShellFor(DOMNode);
|
||||
nsCOMPtr<nsIWeakReference> shell = nsCoreUtils::GetWeakShellFor(aContent);
|
||||
if (!shell) {
|
||||
NS_ASSERTION(PR_TRUE, "There is no presshell!");
|
||||
gInitiatorAcc = nsnull;
|
||||
|
@ -159,7 +149,7 @@ nsTextEquivUtils::AppendTextEquivFromContent(nsIAccessible *aInitiatorAcc,
|
|||
|
||||
if (isVisible) {
|
||||
nsAccessible *accessible =
|
||||
GetAccService()->GetAccessibleInShell(DOMNode, shell);
|
||||
GetAccService()->GetAccessibleInWeakShell(aContent, shell);
|
||||
if (accessible) {
|
||||
rv = AppendFromAccessible(accessible, aString);
|
||||
goThroughDOMSubtree = PR_FALSE;
|
||||
|
@ -178,11 +168,8 @@ nsTextEquivUtils::AppendTextEquivFromTextContent(nsIContent *aContent,
|
|||
nsAString *aString)
|
||||
{
|
||||
if (aContent->IsNodeOfType(nsINode::eTEXT)) {
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(aContent));
|
||||
|
||||
PRBool isHTMLBlock = PR_FALSE;
|
||||
|
||||
|
||||
nsIContent *parentContent = aContent->GetParent();
|
||||
if (parentContent) {
|
||||
nsIFrame *frame = parentContent->GetPrimaryFrame();
|
||||
|
@ -230,18 +217,17 @@ nsTextEquivUtils::AppendTextEquivFromTextContent(nsIContent *aContent,
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsTextEquivUtils. Private.
|
||||
|
||||
nsCOMPtr<nsIAccessible> nsTextEquivUtils::gInitiatorAcc;
|
||||
nsRefPtr<nsAccessible> nsTextEquivUtils::gInitiatorAcc;
|
||||
|
||||
nsresult
|
||||
nsTextEquivUtils::AppendFromAccessibleChildren(nsIAccessible *aAccessible,
|
||||
nsTextEquivUtils::AppendFromAccessibleChildren(nsAccessible *aAccessible,
|
||||
nsAString *aString)
|
||||
{
|
||||
nsresult rv = NS_OK_NO_NAME_CLAUSE_HANDLED;
|
||||
|
||||
nsRefPtr<nsAccessible> accessible(do_QueryObject(aAccessible));
|
||||
PRInt32 childCount = accessible->GetChildCount();
|
||||
PRInt32 childCount = aAccessible->GetChildCount();
|
||||
for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
|
||||
nsAccessible *child = accessible->GetChildAt(childIdx);
|
||||
nsAccessible *child = aAccessible->GetChildAt(childIdx);
|
||||
rv = AppendFromAccessible(child, aString);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
@ -250,18 +236,13 @@ nsTextEquivUtils::AppendFromAccessibleChildren(nsIAccessible *aAccessible,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsTextEquivUtils::AppendFromAccessible(nsIAccessible *aAccessible,
|
||||
nsTextEquivUtils::AppendFromAccessible(nsAccessible *aAccessible,
|
||||
nsAString *aString)
|
||||
{
|
||||
nsCOMPtr<nsIAccessNode> accessNode(do_QueryInterface(aAccessible));
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode;
|
||||
accessNode->GetDOMNode(getter_AddRefs(DOMNode));
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(DOMNode));
|
||||
NS_ASSERTION(content, "There is no content!");
|
||||
|
||||
if (content) {
|
||||
nsresult rv = AppendTextEquivFromTextContent(content, aString);
|
||||
//XXX: is it necessary to care the accessible is not a document?
|
||||
if (aAccessible->IsContent()) {
|
||||
nsresult rv = AppendTextEquivFromTextContent(aAccessible->GetContent(),
|
||||
aString);
|
||||
if (rv != NS_OK_NO_NAME_CLAUSE_HANDLED)
|
||||
return rv;
|
||||
}
|
||||
|
@ -310,7 +291,7 @@ nsTextEquivUtils::AppendFromAccessible(nsIAccessible *aAccessible,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsTextEquivUtils::AppendFromValue(nsIAccessible *aAccessible,
|
||||
nsTextEquivUtils::AppendFromValue(nsAccessible *aAccessible,
|
||||
nsAString *aString)
|
||||
{
|
||||
PRUint32 role = nsAccUtils::Role(aAccessible);
|
||||
|
@ -333,13 +314,11 @@ nsTextEquivUtils::AppendFromValue(nsIAccessible *aAccessible,
|
|||
NS_OK : NS_OK_NO_NAME_CLAUSE_HANDLED;
|
||||
}
|
||||
|
||||
nsRefPtr<nsAccessible> acc = do_QueryObject(aAccessible);
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
acc->GetDOMNode(getter_AddRefs(node));
|
||||
NS_ENSURE_STATE(node);
|
||||
//XXX: is it necessary to care the accessible is not a document?
|
||||
if (aAccessible->IsDocument())
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
|
||||
NS_ENSURE_STATE(content);
|
||||
nsIContent *content = aAccessible->GetContent();
|
||||
|
||||
nsCOMPtr<nsIContent> parent = content->GetParent();
|
||||
PRInt32 indexOf = parent->IndexOf(content);
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#ifndef _nsTextEquivUtils_H_
|
||||
#define _nsTextEquivUtils_H_
|
||||
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsAccessible.h"
|
||||
|
||||
#include "nsIContent.h"
|
||||
#include "nsIStringBundle.h"
|
||||
|
@ -80,7 +80,7 @@ public:
|
|||
* @param aAccessible [in] the given accessible
|
||||
* @param aName [out] accessible name
|
||||
*/
|
||||
static nsresult GetNameFromSubtree(nsIAccessible *aAccessible,
|
||||
static nsresult GetNameFromSubtree(nsAccessible *aAccessible,
|
||||
nsAString& aName);
|
||||
|
||||
/**
|
||||
|
@ -91,7 +91,7 @@ public:
|
|||
* @param aIDRefsAttr [in] IDRefs attribute on DOM node of the accessible
|
||||
* @param aTextEquiv [out] result text equivalent
|
||||
*/
|
||||
static nsresult GetTextEquivFromIDRefs(nsIAccessible *aAccessible,
|
||||
static nsresult GetTextEquivFromIDRefs(nsAccessible *aAccessible,
|
||||
nsIAtom *aIDRefsAttr,
|
||||
nsAString& aTextEquiv);
|
||||
|
||||
|
@ -106,7 +106,7 @@ public:
|
|||
* computed from
|
||||
* @param aString [in, out] the string
|
||||
*/
|
||||
static nsresult AppendTextEquivFromContent(nsIAccessible *aInitiatorAcc,
|
||||
static nsresult AppendTextEquivFromContent(nsAccessible *aInitiatorAcc,
|
||||
nsIContent *aContent,
|
||||
nsAString *aString);
|
||||
|
||||
|
@ -125,20 +125,20 @@ private:
|
|||
* Iterates accessible children and calculates text equivalent from each
|
||||
* child.
|
||||
*/
|
||||
static nsresult AppendFromAccessibleChildren(nsIAccessible *aAccessible,
|
||||
static nsresult AppendFromAccessibleChildren(nsAccessible *aAccessible,
|
||||
nsAString *aString);
|
||||
|
||||
/**
|
||||
* Calculates text equivalent from the given accessible and its subtree if
|
||||
* allowed.
|
||||
*/
|
||||
static nsresult AppendFromAccessible(nsIAccessible *aAccessible,
|
||||
static nsresult AppendFromAccessible(nsAccessible *aAccessible,
|
||||
nsAString *aString);
|
||||
|
||||
/**
|
||||
* Calculates text equivalent from the value of given accessible.
|
||||
*/
|
||||
static nsresult AppendFromValue(nsIAccessible *aAccessible,
|
||||
static nsresult AppendFromValue(nsAccessible *aAccessible,
|
||||
nsAString *aString);
|
||||
/**
|
||||
* Iterates DOM children and calculates text equivalent from each child node.
|
||||
|
@ -181,7 +181,7 @@ private:
|
|||
* for bailing out during recursive text computation, or for special cases
|
||||
* like step f. of the ARIA implementation guide.
|
||||
*/
|
||||
static nsCOMPtr<nsIAccessible> gInitiatorAcc;
|
||||
static nsRefPtr<nsAccessible> gInitiatorAcc;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -61,11 +61,14 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsITextControlFrame.h"
|
||||
|
||||
// --- checkbox -----
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLCheckboxAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHTMLCheckboxAccessible::nsHTMLCheckboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsFormControlAccessible(aNode, aShell)
|
||||
{
|
||||
nsHTMLCheckboxAccessible::
|
||||
nsHTMLCheckboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsFormControlAccessible(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -123,8 +126,8 @@ nsHTMLCheckboxAccessible::GetStateInternal(PRUint32 *aState,
|
|||
PRBool checked = PR_FALSE; // Radio buttons and check boxes can be checked
|
||||
PRBool mixed = PR_FALSE; // or mixed.
|
||||
|
||||
nsCOMPtr<nsIDOMNSHTMLInputElement>
|
||||
html5CheckboxElement(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMNSHTMLInputElement> html5CheckboxElement =
|
||||
do_QueryInterface(mContent);
|
||||
|
||||
if (html5CheckboxElement) {
|
||||
html5CheckboxElement->GetIndeterminate(&mixed);
|
||||
|
@ -135,7 +138,8 @@ nsHTMLCheckboxAccessible::GetStateInternal(PRUint32 *aState,
|
|||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> htmlCheckboxElement(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> htmlCheckboxElement =
|
||||
do_QueryInterface(mContent);
|
||||
if (htmlCheckboxElement) {
|
||||
htmlCheckboxElement->GetChecked(&checked);
|
||||
|
||||
|
@ -150,9 +154,10 @@ nsHTMLCheckboxAccessible::GetStateInternal(PRUint32 *aState,
|
|||
// nsHTMLRadioButtonAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHTMLRadioButtonAccessible::nsHTMLRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsRadioButtonAccessible(aNode, aShell)
|
||||
{
|
||||
nsHTMLRadioButtonAccessible::
|
||||
nsHTMLRadioButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsRadioButtonAccessible(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -166,7 +171,8 @@ nsHTMLRadioButtonAccessible::GetStateInternal(PRUint32 *aState,
|
|||
|
||||
PRBool checked = PR_FALSE; // Radio buttons and check boxes can be checked
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> htmlRadioElement(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> htmlRadioElement =
|
||||
do_QueryInterface(mContent);
|
||||
if (htmlRadioElement)
|
||||
htmlRadioElement->GetChecked(&checked);
|
||||
|
||||
|
@ -181,27 +187,25 @@ nsHTMLRadioButtonAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
|||
PRInt32 *aSetSize)
|
||||
{
|
||||
nsAutoString nsURI;
|
||||
mDOMNode->GetNamespaceURI(nsURI);
|
||||
mContent->NodeInfo()->GetNamespaceURI(nsURI);
|
||||
nsAutoString tagName;
|
||||
mDOMNode->GetLocalName(tagName);
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
mContent->NodeInfo()->GetName(tagName);
|
||||
|
||||
nsAutoString type;
|
||||
content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::type, type);
|
||||
mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::type, type);
|
||||
nsAutoString name;
|
||||
content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::name, name);
|
||||
mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::name, name);
|
||||
|
||||
nsCOMPtr<nsIDOMNodeList> inputs;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> radio(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> radio(do_QueryInterface(mContent));
|
||||
nsCOMPtr<nsIDOMHTMLFormElement> form;
|
||||
radio->GetForm(getter_AddRefs(form));
|
||||
if (form) {
|
||||
form->GetElementsByTagNameNS(nsURI, tagName, getter_AddRefs(inputs));
|
||||
} else {
|
||||
nsCOMPtr<nsIDOMDocument> document;
|
||||
mDOMNode->GetOwnerDocument(getter_AddRefs(document));
|
||||
nsIDocument* doc = mContent->GetOwnerDoc();
|
||||
nsCOMPtr<nsIDOMDocument> document(do_QueryInterface(doc));
|
||||
if (document)
|
||||
document->GetElementsByTagNameNS(nsURI, tagName, getter_AddRefs(inputs));
|
||||
}
|
||||
|
@ -228,7 +232,7 @@ nsHTMLRadioButtonAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
|||
|
||||
count++;
|
||||
|
||||
if (itemNode == mDOMNode)
|
||||
if (item == mContent)
|
||||
indexOf = count;
|
||||
}
|
||||
}
|
||||
|
@ -241,9 +245,10 @@ nsHTMLRadioButtonAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
|||
// nsHTMLButtonAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHTMLButtonAccessible::nsHTMLButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHyperTextAccessibleWrap(aNode, aShell)
|
||||
{
|
||||
nsHTMLButtonAccessible::
|
||||
nsHTMLButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsHyperTextAccessibleWrap(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetNumActions(PRUint8 *_retval)
|
||||
|
@ -279,12 +284,8 @@ nsHTMLButtonAccessible::GetStateInternal(PRUint32 *aState,
|
|||
aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
NS_ENSURE_TRUE(element, NS_ERROR_FAILURE);
|
||||
|
||||
nsAutoString buttonType;
|
||||
element->GetAttribute(NS_LITERAL_STRING("type"), buttonType);
|
||||
if (buttonType.LowerCaseEqualsLiteral("submit"))
|
||||
if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
|
||||
nsAccessibilityAtoms::submit, eIgnoreCase))
|
||||
*aState |= nsIAccessibleStates::STATE_DEFAULT;
|
||||
|
||||
return NS_OK;
|
||||
|
@ -304,14 +305,12 @@ nsHTMLButtonAccessible::GetNameInternal(nsAString& aName)
|
|||
if (!aName.IsEmpty())
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
|
||||
// No name from HTML or ARIA
|
||||
nsAutoString name;
|
||||
if (!content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::value,
|
||||
name) &&
|
||||
!content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::alt,
|
||||
name)) {
|
||||
if (!mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::value,
|
||||
name) &&
|
||||
!mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::alt,
|
||||
name)) {
|
||||
// Use the button's (default) label if nothing else works
|
||||
nsIFrame* frame = GetFrame();
|
||||
if (frame) {
|
||||
|
@ -322,9 +321,9 @@ nsHTMLButtonAccessible::GetNameInternal(nsAString& aName)
|
|||
}
|
||||
|
||||
if (name.IsEmpty() &&
|
||||
!content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::src,
|
||||
name)) {
|
||||
content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::data, name);
|
||||
!mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::src,
|
||||
name)) {
|
||||
mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::data, name);
|
||||
}
|
||||
|
||||
name.CompressWhitespace();
|
||||
|
@ -334,11 +333,14 @@ nsHTMLButtonAccessible::GetNameInternal(nsAString& aName)
|
|||
}
|
||||
|
||||
|
||||
// ----- HTML 4 Button: can contain arbitrary HTML content -----
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTML4ButtonAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHTML4ButtonAccessible::nsHTML4ButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHyperTextAccessibleWrap(aNode, aShell)
|
||||
{
|
||||
nsHTML4ButtonAccessible::
|
||||
nsHTML4ButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsHyperTextAccessibleWrap(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetNumActions(PRUint8 *_retval)
|
||||
|
@ -381,23 +383,23 @@ nsHTML4ButtonAccessible::GetStateInternal(PRUint32 *aState,
|
|||
aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
NS_ASSERTION(element, "No element for button's dom node!");
|
||||
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
|
||||
nsAutoString buttonType;
|
||||
element->GetAttribute(NS_LITERAL_STRING("type"), buttonType);
|
||||
if (buttonType.LowerCaseEqualsLiteral("submit"))
|
||||
if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
|
||||
nsAccessibilityAtoms::submit, eIgnoreCase))
|
||||
*aState |= nsIAccessibleStates::STATE_DEFAULT;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// --- textfield -----
|
||||
|
||||
nsHTMLTextFieldAccessible::nsHTMLTextFieldAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHyperTextAccessibleWrap(aNode, aShell)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLTextFieldAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHTMLTextFieldAccessible::
|
||||
nsHTMLTextFieldAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsHyperTextAccessibleWrap(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -407,10 +409,9 @@ nsresult
|
|||
nsHTMLTextFieldAccessible::GetRoleInternal(PRUint32 *aRole)
|
||||
{
|
||||
*aRole = nsIAccessibleRole::ROLE_ENTRY;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
if (content &&
|
||||
content->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
|
||||
nsAccessibilityAtoms::password, eIgnoreCase)) {
|
||||
|
||||
if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
|
||||
nsAccessibilityAtoms::password, eIgnoreCase)) {
|
||||
*aRole = nsIAccessibleRole::ROLE_PASSWORD_TEXT;
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -425,8 +426,7 @@ nsHTMLTextFieldAccessible::GetNameInternal(nsAString& aName)
|
|||
if (!aName.IsEmpty())
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
|
||||
if (!content->GetBindingParent())
|
||||
if (!mContent->GetBindingParent())
|
||||
return NS_OK;
|
||||
|
||||
// XXX: bug 459640
|
||||
|
@ -434,9 +434,8 @@ nsHTMLTextFieldAccessible::GetNameInternal(nsAString& aName)
|
|||
// This means we're part of another control, so use parent accessible for name.
|
||||
// This ensures that a textbox inside of a XUL widget gets
|
||||
// an accessible name.
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
rv = GetParent(getter_AddRefs(parent));
|
||||
return parent ? parent->GetName(aName) : rv;
|
||||
nsAccessible* parent = GetParent();
|
||||
return parent ? parent->GetName(aName) : NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetValue(nsAString& _retval)
|
||||
|
@ -448,12 +447,12 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible::GetValue(nsAString& _retval)
|
|||
if (state & nsIAccessibleStates::STATE_PROTECTED) // Don't return password text!
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea(do_QueryInterface(mContent));
|
||||
if (textArea) {
|
||||
return textArea->GetValue(_retval);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(mContent));
|
||||
if (inputElement) {
|
||||
return inputElement->GetValue(_retval);
|
||||
}
|
||||
|
@ -470,28 +469,23 @@ nsHTMLTextFieldAccessible::GetStateInternal(PRUint32 *aState,
|
|||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
|
||||
// can be focusable, focused, protected. readonly, unavailable, selected
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
NS_ASSERTION(content, "Should not have gotten here if upcalled GetExtState() succeeded");
|
||||
|
||||
if (content->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
|
||||
nsAccessibilityAtoms::password, eIgnoreCase)) {
|
||||
if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
|
||||
nsAccessibilityAtoms::password, eIgnoreCase)) {
|
||||
*aState |= nsIAccessibleStates::STATE_PROTECTED;
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
GetParent(getter_AddRefs(parent));
|
||||
if (nsAccUtils::Role(parent) == nsIAccessibleRole::ROLE_AUTOCOMPLETE)
|
||||
if (nsAccUtils::Role(GetParent()) == nsIAccessibleRole::ROLE_AUTOCOMPLETE)
|
||||
*aState |= nsIAccessibleStates::STATE_HASPOPUP;
|
||||
}
|
||||
|
||||
if (content->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::readonly)) {
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::readonly)) {
|
||||
*aState |= nsIAccessibleStates::STATE_READONLY;
|
||||
}
|
||||
|
||||
if (!aExtraState)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> htmlInput(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> htmlInput(do_QueryInterface(mContent));
|
||||
// Is it an <input> or a <textarea> ?
|
||||
if (htmlInput) {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_SINGLE_LINE;
|
||||
|
@ -503,7 +497,7 @@ nsHTMLTextFieldAccessible::GetStateInternal(PRUint32 *aState,
|
|||
if (!(*aExtraState & nsIAccessibleStates::EXT_STATE_EDITABLE))
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIContent> bindingContent = content->GetBindingParent();
|
||||
nsCOMPtr<nsIContent> bindingContent = mContent->GetBindingParent();
|
||||
if (bindingContent &&
|
||||
bindingContent->NodeInfo()->Equals(nsAccessibilityAtoms::textbox,
|
||||
kNameSpaceID_XUL) &&
|
||||
|
@ -521,8 +515,8 @@ nsHTMLTextFieldAccessible::GetStateInternal(PRUint32 *aState,
|
|||
// we're talking here is based on what the user types, where a popup of
|
||||
// possible choices comes up.
|
||||
nsAutoString autocomplete;
|
||||
content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::autocomplete,
|
||||
autocomplete);
|
||||
mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::autocomplete,
|
||||
autocomplete);
|
||||
|
||||
if (!autocomplete.LowerCaseEqualsLiteral("off")) {
|
||||
nsCOMPtr<nsIDOMHTMLFormElement> form;
|
||||
|
@ -559,7 +553,7 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible::GetActionName(PRUint8 aIndex, nsAString
|
|||
NS_IMETHODIMP nsHTMLTextFieldAccessible::DoAction(PRUint8 index)
|
||||
{
|
||||
if (index == 0) {
|
||||
nsCOMPtr<nsIDOMNSHTMLElement> element(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMNSHTMLElement> element(do_QueryInterface(mContent));
|
||||
if ( element ) {
|
||||
return element->Focus();
|
||||
}
|
||||
|
@ -571,7 +565,7 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible::DoAction(PRUint8 index)
|
|||
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAssociatedEditor(nsIEditor **aEditor)
|
||||
{
|
||||
*aEditor = nsnull;
|
||||
nsCOMPtr<nsIDOMNSEditableElement> editableElt(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMNSEditableElement> editableElt(do_QueryInterface(mContent));
|
||||
NS_ENSURE_TRUE(editableElt, NS_ERROR_FAILURE);
|
||||
|
||||
// nsGenericHTMLElement::GetEditor has a security check.
|
||||
|
@ -593,15 +587,14 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAssociatedEditor(nsIEditor **aEditor
|
|||
return rv;
|
||||
}
|
||||
|
||||
// --- groupbox -----
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLGroupboxAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
* The HTML for this is <fieldset> <legend>box-title</legend> form elements </fieldset>
|
||||
*/
|
||||
|
||||
nsHTMLGroupboxAccessible::nsHTMLGroupboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHyperTextAccessibleWrap(aNode, aShell)
|
||||
{
|
||||
nsHTMLGroupboxAccessible::
|
||||
nsHTMLGroupboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsHyperTextAccessibleWrap(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -613,16 +606,13 @@ nsHTMLGroupboxAccessible::GetRoleInternal(PRUint32 *aRole)
|
|||
|
||||
nsIContent* nsHTMLGroupboxAccessible::GetLegend()
|
||||
{
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
|
||||
NS_ENSURE_TRUE(content, nsnull);
|
||||
|
||||
nsresult count = 0;
|
||||
nsIContent *testLegendContent;
|
||||
while ((testLegendContent = content->GetChildAt(count ++ )) != nsnull) {
|
||||
if (testLegendContent->NodeInfo()->Equals(nsAccessibilityAtoms::legend,
|
||||
content->GetNameSpaceID())) {
|
||||
nsIContent *legendContent = nsnull;
|
||||
while ((legendContent = mContent->GetChildAt(count++)) != nsnull) {
|
||||
if (legendContent->NodeInfo()->Equals(nsAccessibilityAtoms::legend,
|
||||
mContent->GetNameSpaceID())) {
|
||||
// Either XHTML namespace or no namespace
|
||||
return testLegendContent;
|
||||
return legendContent;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -664,12 +654,15 @@ nsHTMLGroupboxAccessible::GetRelationByType(PRUint32 aRelationType,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLLegendAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHTMLLegendAccessible::nsHTMLLegendAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHyperTextAccessibleWrap(aNode, aShell)
|
||||
{
|
||||
nsHTMLLegendAccessible::
|
||||
nsHTMLLegendAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsHyperTextAccessibleWrap(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -42,13 +42,16 @@
|
|||
#include "nsFormControlAccessible.h"
|
||||
#include "nsHyperTextAccessibleWrap.h"
|
||||
|
||||
/**
|
||||
* Accessible for HTML input@type="checkbox".
|
||||
*/
|
||||
class nsHTMLCheckboxAccessible : public nsFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
enum { eAction_Click = 0 };
|
||||
|
||||
nsHTMLCheckboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
nsHTMLCheckboxAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetNumActions(PRUint8 *_retval);
|
||||
|
@ -60,11 +63,15 @@ public:
|
|||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Accessible for HTML input@type="radio" element.
|
||||
*/
|
||||
class nsHTMLRadioButtonAccessible : public nsRadioButtonAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
nsHTMLRadioButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
|
@ -72,13 +79,18 @@ public:
|
|||
PRInt32 *aSetSize);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Accessible for HTML input@type="button", @type="submit", @type="image"
|
||||
* elements.
|
||||
*/
|
||||
class nsHTMLButtonAccessible : public nsHyperTextAccessibleWrap
|
||||
{
|
||||
|
||||
public:
|
||||
enum { eAction_Click = 0 };
|
||||
|
||||
nsHTMLButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
nsHTMLButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetNumActions(PRUint8 *_retval);
|
||||
|
@ -91,13 +103,17 @@ public:
|
|||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Accessible for HTML button element.
|
||||
*/
|
||||
class nsHTML4ButtonAccessible : public nsHyperTextAccessibleWrap
|
||||
{
|
||||
|
||||
public:
|
||||
enum { eAction_Click = 0 };
|
||||
|
||||
nsHTML4ButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
nsHTML4ButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetNumActions(PRUint8 *_retval);
|
||||
|
@ -109,13 +125,17 @@ public:
|
|||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Accessible for HTML input@type="text" element.
|
||||
*/
|
||||
class nsHTMLTextFieldAccessible : public nsHyperTextAccessibleWrap
|
||||
{
|
||||
|
||||
public:
|
||||
enum { eAction_Click = 0 };
|
||||
|
||||
nsHTMLTextFieldAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
nsHTMLTextFieldAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
|
@ -134,10 +154,14 @@ public:
|
|||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Accessible for HTML fieldset element.
|
||||
*/
|
||||
class nsHTMLGroupboxAccessible : public nsHyperTextAccessibleWrap
|
||||
{
|
||||
public:
|
||||
nsHTMLGroupboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
nsHTMLGroupboxAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
|
||||
|
@ -151,10 +175,14 @@ protected:
|
|||
nsIContent* GetLegend();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Accessible for HTML legend element.
|
||||
*/
|
||||
class nsHTMLLegendAccessible : public nsHyperTextAccessibleWrap
|
||||
{
|
||||
public:
|
||||
nsHTMLLegendAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
nsHTMLLegendAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
|
||||
|
|
|
@ -57,8 +57,8 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHTMLImageAccessible::
|
||||
nsHTMLImageAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell) :
|
||||
nsLinkableAccessible(aDOMNode, aShell)
|
||||
nsHTMLImageAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsLinkableAccessible(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ nsHTMLImageAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
|||
nsresult rv = nsLinkableAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIImageLoadingContent> content(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIImageLoadingContent> content(do_QueryInterface(mContent));
|
||||
nsCOMPtr<imgIRequest> imageRequest;
|
||||
|
||||
if (content)
|
||||
|
@ -101,9 +101,8 @@ nsHTMLImageAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
|||
nsresult
|
||||
nsHTMLImageAccessible::GetNameInternal(nsAString& aName)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
PRBool hasAltAttrib =
|
||||
content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::alt, aName);
|
||||
mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::alt, aName);
|
||||
if (!aName.IsEmpty())
|
||||
return NS_OK;
|
||||
|
||||
|
@ -172,15 +171,14 @@ nsHTMLImageAccessible::DoAction(PRUint8 aIndex)
|
|||
|
||||
if (IsValidLongDescIndex(aIndex)) {
|
||||
//get the long description uri and open in a new window
|
||||
nsCOMPtr<nsIDOMHTMLImageElement> element(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMHTMLImageElement> element(do_QueryInterface(mContent));
|
||||
NS_ENSURE_TRUE(element, NS_ERROR_FAILURE);
|
||||
|
||||
nsAutoString longDesc;
|
||||
nsresult rv = element->GetLongDesc(longDesc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIDOMDocument> domDocument;
|
||||
rv = mDOMNode->GetOwnerDocument(getter_AddRefs(domDocument));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIDocument> document(do_QueryInterface(domDocument));
|
||||
|
||||
nsIDocument* document = mContent->GetOwnerDoc();
|
||||
nsCOMPtr<nsPIDOMWindow> piWindow = document->GetWindow();
|
||||
nsCOMPtr<nsIDOMWindowInternal> win(do_QueryInterface(piWindow));
|
||||
NS_ENSURE_TRUE(win, NS_ERROR_FAILURE);
|
||||
|
@ -223,10 +221,8 @@ nsHTMLImageAccessible::GetAttributesInternal(nsIPersistentProperties *aAttribute
|
|||
nsresult rv = nsLinkableAccessible::GetAttributesInternal(aAttributes);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
|
||||
nsAutoString src;
|
||||
content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::src, src);
|
||||
mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::src, src);
|
||||
if (!src.IsEmpty())
|
||||
nsAccUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::src, src);
|
||||
|
||||
|
@ -242,8 +238,7 @@ nsHTMLImageAccessible::HasLongDesc()
|
|||
if (IsDefunct())
|
||||
return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
return (content->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::longDesc));
|
||||
return mContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::longDesc);
|
||||
}
|
||||
|
||||
PRBool
|
||||
|
|
|
@ -51,7 +51,7 @@ class nsHTMLImageAccessible : public nsLinkableAccessible,
|
|||
public nsIAccessibleImage
|
||||
{
|
||||
public:
|
||||
nsHTMLImageAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
nsHTMLImageAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
|
|
@ -54,9 +54,9 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHTMLImageMapAccessible::
|
||||
nsHTMLImageMapAccessible(nsIDOMNode *aDOMNode, nsIWeakReference *aShell,
|
||||
nsHTMLImageMapAccessible(nsIContent *aContent, nsIWeakReference *aShell,
|
||||
nsIDOMHTMLMapElement *aMapElm) :
|
||||
nsHTMLImageAccessibleWrap(aDOMNode, aShell), mMapElement(aMapElm)
|
||||
nsHTMLImageAccessibleWrap(aContent, aShell), mMapElement(aMapElm)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -143,8 +143,9 @@ nsHTMLImageMapAccessible::CacheChildren()
|
|||
if (!areaNode)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIContent> areaContent(do_QueryInterface(areaNode));
|
||||
nsRefPtr<nsAccessible> areaAcc =
|
||||
new nsHTMLAreaAccessible(areaNode, mWeakShell);
|
||||
new nsHTMLAreaAccessible(areaContent, mWeakShell);
|
||||
if (!areaAcc)
|
||||
return;
|
||||
|
||||
|
@ -155,7 +156,7 @@ nsHTMLImageMapAccessible::CacheChildren()
|
|||
}
|
||||
|
||||
// We must respect ARIA on area elements (for the canvas map technique)
|
||||
areaAcc->SetRoleMapEntry(nsAccUtils::GetRoleMapEntry(areaNode));
|
||||
areaAcc->SetRoleMapEntry(nsAccUtils::GetRoleMapEntry(areaContent));
|
||||
|
||||
mChildren.AppendElement(areaAcc);
|
||||
areaAcc->SetParent(this);
|
||||
|
@ -168,8 +169,8 @@ nsHTMLImageMapAccessible::CacheChildren()
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHTMLAreaAccessible::
|
||||
nsHTMLAreaAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell) :
|
||||
nsHTMLLinkAccessible(aNode, aShell)
|
||||
nsHTMLAreaAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsHTMLLinkAccessible(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -185,9 +186,8 @@ nsHTMLAreaAccessible::GetNameInternal(nsAString & aName)
|
|||
if (!aName.IsEmpty())
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
if (!content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::alt,
|
||||
aName)) {
|
||||
if (!mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::alt,
|
||||
aName)) {
|
||||
return GetValue(aName);
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ nsHTMLAreaAccessible::GetDescription(nsAString& aDescription)
|
|||
aDescription.Truncate();
|
||||
|
||||
// Still to do - follow IE's standard here
|
||||
nsCOMPtr<nsIDOMHTMLAreaElement> area(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMHTMLAreaElement> area(do_QueryInterface(mContent));
|
||||
if (area)
|
||||
area->GetShape(aDescription);
|
||||
|
||||
|
@ -208,21 +208,25 @@ nsHTMLAreaAccessible::GetDescription(nsAString& aDescription)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAreaAccessible::GetBounds(PRInt32 *x, PRInt32 *y,
|
||||
PRInt32 *width, PRInt32 *height)
|
||||
nsHTMLAreaAccessible::GetBounds(PRInt32 *aX, PRInt32 *aY,
|
||||
PRInt32 *aWidth, PRInt32 *aHeight)
|
||||
{
|
||||
nsresult rv;
|
||||
NS_ENSURE_ARG_POINTER(aX);
|
||||
*aX = 0;
|
||||
NS_ENSURE_ARG_POINTER(aY);
|
||||
*aY = 0;
|
||||
NS_ENSURE_ARG_POINTER(aWidth);
|
||||
*aWidth = 0;
|
||||
NS_ENSURE_ARG_POINTER(aHeight);
|
||||
*aHeight = 0;
|
||||
|
||||
// Essentially this uses GetRect on mAreas of nsImageMap from nsImageFrame
|
||||
|
||||
*x = *y = *width = *height = 0;
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Essentially this uses GetRect on mAreas of nsImageMap from nsImageFrame.
|
||||
nsPresContext *presContext = GetPresContext();
|
||||
NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIContent> ourContent(do_QueryInterface(mDOMNode));
|
||||
NS_ENSURE_TRUE(ourContent, NS_ERROR_FAILURE);
|
||||
|
||||
nsIFrame *frame = GetFrame();
|
||||
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
|
||||
nsIImageFrame *imageFrame = do_QueryFrame(frame);
|
||||
|
@ -233,21 +237,21 @@ nsHTMLAreaAccessible::GetBounds(PRInt32 *x, PRInt32 *y,
|
|||
|
||||
nsRect rect;
|
||||
nsIntRect orgRectPixels;
|
||||
rv = map->GetBoundsForAreaContent(ourContent, rect);
|
||||
nsresult rv = map->GetBoundsForAreaContent(mContent, rect);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
*x = presContext->AppUnitsToDevPixels(rect.x);
|
||||
*y = presContext->AppUnitsToDevPixels(rect.y);
|
||||
*aX = presContext->AppUnitsToDevPixels(rect.x);
|
||||
*aY = presContext->AppUnitsToDevPixels(rect.y);
|
||||
|
||||
// XXX Areas are screwy; they return their rects as a pair of points, one pair
|
||||
// stored into the width and height.
|
||||
*width = presContext->AppUnitsToDevPixels(rect.width - rect.x);
|
||||
*height = presContext->AppUnitsToDevPixels(rect.height - rect.y);
|
||||
*aWidth = presContext->AppUnitsToDevPixels(rect.width - rect.x);
|
||||
*aHeight = presContext->AppUnitsToDevPixels(rect.height - rect.y);
|
||||
|
||||
// Put coords in absolute screen coords
|
||||
orgRectPixels = frame->GetScreenRectExternal();
|
||||
*x += orgRectPixels.x;
|
||||
*y += orgRectPixels.y;
|
||||
*aX += orgRectPixels.x;
|
||||
*aY += orgRectPixels.y;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
class nsHTMLImageMapAccessible : public nsHTMLImageAccessibleWrap
|
||||
{
|
||||
public:
|
||||
nsHTMLImageMapAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell,
|
||||
nsHTMLImageMapAccessible(nsIContent *aContent, nsIWeakReference *aShell,
|
||||
nsIDOMHTMLMapElement *aMapElm);
|
||||
|
||||
// nsISupports and cycle collector
|
||||
|
@ -83,7 +83,7 @@ class nsHTMLAreaAccessible : public nsHTMLLinkAccessible
|
|||
{
|
||||
|
||||
public:
|
||||
nsHTMLAreaAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell);
|
||||
nsHTMLAreaAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetDescription(nsAString& aDescription);
|
||||
|
|
|
@ -45,11 +45,12 @@
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLLinkAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHTMLLinkAccessible::nsHTMLLinkAccessible(nsIDOMNode* aDomNode,
|
||||
nsIWeakReference* aShell):
|
||||
nsHyperTextAccessibleWrap(aDomNode, aShell)
|
||||
{
|
||||
nsHTMLLinkAccessible::
|
||||
nsHTMLLinkAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsHyperTextAccessibleWrap(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
// Expose nsIAccessibleHyperLink unconditionally
|
||||
|
@ -75,21 +76,19 @@ nsHTMLLinkAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
|||
|
||||
*aState &= ~nsIAccessibleStates::STATE_READONLY;
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
if (content && content->HasAttr(kNameSpaceID_None,
|
||||
nsAccessibilityAtoms::name)) {
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::name)) {
|
||||
// This is how we indicate it is a named anchor
|
||||
// In other words, this anchor can be selected as a location :)
|
||||
// There is no other better state to use to indicate this.
|
||||
*aState |= nsIAccessibleStates::STATE_SELECTABLE;
|
||||
}
|
||||
|
||||
nsLinkState linkState = content->GetLinkState();
|
||||
nsLinkState linkState = mContent->GetLinkState();
|
||||
if (linkState == eLinkState_NotLink || linkState == eLinkState_Unknown) {
|
||||
// This is a either named anchor (a link with also a name attribute) or
|
||||
// it doesn't have any attributes. Check if 'click' event handler is
|
||||
// registered, otherwise bail out.
|
||||
PRBool isOnclick = nsCoreUtils::HasClickListener(content);
|
||||
PRBool isOnclick = nsCoreUtils::HasClickListener(mContent);
|
||||
if (!isOnclick)
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -114,10 +113,8 @@ nsHTMLLinkAccessible::GetValue(nsAString& aValue)
|
|||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mWeakShell));
|
||||
if (mDOMNode && presShell)
|
||||
return presShell->GetLinkLocation(mDOMNode, aValue);
|
||||
|
||||
return NS_OK;
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
return presShell->GetLinkLocation(DOMNode, aValue);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -177,10 +174,11 @@ nsHTMLLinkAccessible::GetURI(PRInt32 aIndex, nsIURI **aURI)
|
|||
if (aIndex != 0)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
nsCOMPtr<nsIContent> link(do_QueryInterface(mDOMNode));
|
||||
NS_ENSURE_STATE(link);
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aURI = link->GetHrefURI().get();
|
||||
nsCOMPtr<nsIURI> uri = mContent->GetHrefURI();
|
||||
uri.forget(aURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -190,11 +188,9 @@ nsHTMLLinkAccessible::GetURI(PRInt32 aIndex, nsIURI **aURI)
|
|||
PRBool
|
||||
nsHTMLLinkAccessible::IsLinked()
|
||||
{
|
||||
nsCOMPtr<nsIContent> link(do_QueryInterface(mDOMNode));
|
||||
if (!link)
|
||||
if (IsDefunct())
|
||||
return PR_FALSE;
|
||||
|
||||
nsLinkState linkState = link->GetLinkState();
|
||||
|
||||
nsLinkState linkState = mContent->GetLinkState();
|
||||
return linkState != eLinkState_NotLink && linkState != eLinkState_Unknown;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
class nsHTMLLinkAccessible : public nsHyperTextAccessibleWrap
|
||||
{
|
||||
public:
|
||||
nsHTMLLinkAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
nsHTMLLinkAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
|
|
|
@ -55,34 +55,21 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsIMutableArray.h"
|
||||
|
||||
/**
|
||||
* Selects, Listboxes and Comboboxes, are made up of a number of different
|
||||
* widgets, some of which are shared between the two. This file contains
|
||||
* all of the widgets for both of the Selects, for HTML only.
|
||||
*
|
||||
* Listbox:
|
||||
* - nsHTMLSelectListAccessible
|
||||
* - nsHTMLSelectOptionAccessible
|
||||
*
|
||||
* Comboboxes:
|
||||
* - nsHTMLComboboxAccessible
|
||||
* - nsHTMLComboboxListAccessible [ inserted in accessible tree ]
|
||||
* - nsHTMLSelectOptionAccessible(s)
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLSelectableAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLSelectableAccessible::iterator
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
/** Impl. of nsHTMLSelectableAccessible */
|
||||
/** ------------------------------------------------------ */
|
||||
|
||||
// Helper class
|
||||
nsHTMLSelectableAccessible::iterator::iterator(nsHTMLSelectableAccessible *aParent, nsIWeakReference *aWeakShell):
|
||||
mWeakShell(aWeakShell), mParentSelect(aParent)
|
||||
{
|
||||
mLength = mIndex = 0;
|
||||
mSelCount = 0;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> htmlSelect(do_QueryInterface(mParentSelect->mDOMNode));
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> htmlSelect =
|
||||
do_QueryInterface(mParentSelect->mContent);
|
||||
if (htmlSelect) {
|
||||
htmlSelect->GetOptions(getter_AddRefs(mOptions));
|
||||
if (mOptions)
|
||||
|
@ -125,8 +112,8 @@ nsHTMLSelectableAccessible::iterator::AddAccessibleIfSelected(nsIMutableArray *a
|
|||
if (mOption) {
|
||||
mOption->GetSelected(&isSelected);
|
||||
if (isSelected) {
|
||||
nsCOMPtr<nsIDOMNode> optionNode(do_QueryInterface(mOption));
|
||||
optionAcc = GetAccService()->GetAccessibleInWeakShell(optionNode,
|
||||
nsCOMPtr<nsIContent> optionContent(do_QueryInterface(mOption));
|
||||
optionAcc = GetAccService()->GetAccessibleInWeakShell(optionContent,
|
||||
mWeakShell);
|
||||
}
|
||||
}
|
||||
|
@ -149,9 +136,9 @@ nsHTMLSelectableAccessible::iterator::GetAccessibleIfSelected(PRInt32 aIndex,
|
|||
mOption->GetSelected(&isSelected);
|
||||
if (isSelected) {
|
||||
if (mSelCount == aIndex) {
|
||||
nsCOMPtr<nsIDOMNode> optionNode(do_QueryInterface(mOption));
|
||||
nsCOMPtr<nsIContent> optionContent(do_QueryInterface(mOption));
|
||||
nsAccessible *accessible =
|
||||
GetAccService()->GetAccessibleInWeakShell(optionNode, mWeakShell);
|
||||
GetAccService()->GetAccessibleInWeakShell(optionContent, mWeakShell);
|
||||
NS_IF_ADDREF(*aAccessible = accessible);
|
||||
|
||||
return PR_TRUE;
|
||||
|
@ -169,9 +156,12 @@ void nsHTMLSelectableAccessible::iterator::Select(PRBool aSelect)
|
|||
mOption->SetSelected(aSelect);
|
||||
}
|
||||
|
||||
nsHTMLSelectableAccessible::nsHTMLSelectableAccessible(nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell):
|
||||
nsAccessibleWrap(aDOMNode, aShell)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLSelectableAccessible
|
||||
|
||||
nsHTMLSelectableAccessible::
|
||||
nsHTMLSelectableAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsAccessibleWrap(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -182,7 +172,7 @@ NS_IMETHODIMP nsHTMLSelectableAccessible::ChangeSelection(PRInt32 aIndex, PRUint
|
|||
{
|
||||
*aSelState = PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> htmlSelect(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> htmlSelect(do_QueryInterface(mContent));
|
||||
if (!htmlSelect)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -290,7 +280,7 @@ NS_IMETHODIMP nsHTMLSelectableAccessible::SelectAllSelection(PRBool *_retval)
|
|||
{
|
||||
*_retval = PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> htmlSelect(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> htmlSelect(do_QueryInterface(mContent));
|
||||
if (!htmlSelect)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -303,18 +293,14 @@ NS_IMETHODIMP nsHTMLSelectableAccessible::SelectAllSelection(PRBool *_retval)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
/** First, the common widgets */
|
||||
/** ------------------------------------------------------ */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLSelectListAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/** Default Constructor */
|
||||
nsHTMLSelectListAccessible::nsHTMLSelectListAccessible(nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell)
|
||||
:nsHTMLSelectableAccessible(aDOMNode, aShell)
|
||||
nsHTMLSelectListAccessible::
|
||||
nsHTMLSelectListAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsHTMLSelectableAccessible(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -333,14 +319,13 @@ nsHTMLSelectListAccessible::GetStateInternal(PRUint32 *aState,
|
|||
// nsIAccessibleStates::STATE_MULTISELECTABLE
|
||||
// nsIAccessibleStates::STATE_EXTSELECTABLE
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> select (do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> select(do_QueryInterface(mContent));
|
||||
if (select) {
|
||||
if (*aState & nsIAccessibleStates::STATE_FOCUSED) {
|
||||
// Treat first focusable option node as actual focus, in order
|
||||
// to avoid confusing JAWS, which needs focus on the option
|
||||
nsCOMPtr<nsIDOMNode> focusedOption;
|
||||
nsHTMLSelectOptionAccessible::GetFocusedOptionNode(mDOMNode,
|
||||
getter_AddRefs(focusedOption));
|
||||
nsCOMPtr<nsIContent> focusedOption =
|
||||
nsHTMLSelectOptionAccessible::GetFocusedOption(mContent);
|
||||
if (focusedOption) { // Clear focused state since it is on option
|
||||
*aState &= ~nsIAccessibleStates::STATE_FOCUSED;
|
||||
}
|
||||
|
@ -376,9 +361,7 @@ nsHTMLSelectListAccessible::CacheChildren()
|
|||
// 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<nsIContent> selectContent(do_QueryInterface(mDOMNode));
|
||||
CacheOptSiblings(selectContent);
|
||||
CacheOptSiblings(mContent);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -399,10 +382,8 @@ nsHTMLSelectListAccessible::CacheOptSiblings(nsIContent *aParentContent)
|
|||
tag == nsAccessibilityAtoms::optgroup) {
|
||||
|
||||
// Get an accessible for option or optgroup and cache it.
|
||||
nsCOMPtr<nsIDOMNode> childNode(do_QueryInterface(childContent));
|
||||
|
||||
nsAccessible *accessible =
|
||||
GetAccService()->GetAccessibleInWeakShell(childNode, mWeakShell);
|
||||
GetAccService()->GetAccessibleInWeakShell(childContent, mWeakShell);
|
||||
if (accessible) {
|
||||
mChildren.AppendElement(accessible);
|
||||
accessible->SetParent(this);
|
||||
|
@ -421,13 +402,11 @@ nsHTMLSelectListAccessible::CacheOptSiblings(nsIContent *aParentContent)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHTMLSelectOptionAccessible::
|
||||
nsHTMLSelectOptionAccessible(nsIDOMNode *aDOMNode, nsIWeakReference *aShell) :
|
||||
nsHyperTextAccessibleWrap(aDOMNode, aShell)
|
||||
nsHTMLSelectOptionAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsHyperTextAccessibleWrap(aContent, aShell)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> parentNode;
|
||||
aDOMNode->GetParentNode(getter_AddRefs(parentNode));
|
||||
|
||||
if (!parentNode)
|
||||
nsIContent *parentContent = aContent->GetParent();
|
||||
if (!parentContent)
|
||||
return;
|
||||
|
||||
// If the parent node is a Combobox, then the option's accessible parent
|
||||
|
@ -436,7 +415,7 @@ nsHTMLSelectOptionAccessible::
|
|||
// nsHTMLComboboxListAccessible is inserted into the accessible hierarchy
|
||||
// where there is no DOM node for it.
|
||||
nsAccessible *parentAcc =
|
||||
GetAccService()->GetAccessibleInWeakShell(parentNode, mWeakShell);
|
||||
GetAccService()->GetAccessibleInWeakShell(parentContent, mWeakShell);
|
||||
if (!parentAcc)
|
||||
return;
|
||||
|
||||
|
@ -467,14 +446,13 @@ nsHTMLSelectOptionAccessible::GetNameInternal(nsAString& aName)
|
|||
{
|
||||
// CASE #1 -- great majority of the cases
|
||||
// find the label attribute - this is what the W3C says we should use
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::label, aName);
|
||||
mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::label, aName);
|
||||
if (!aName.IsEmpty())
|
||||
return NS_OK;
|
||||
|
||||
|
||||
// CASE #2 -- no label parameter, get the first child,
|
||||
// use it if it is a text node
|
||||
nsCOMPtr<nsIContent> text = content->GetChildAt(0);
|
||||
nsIContent *text = mContent->GetChildAt(0);
|
||||
if (!text)
|
||||
return NS_OK;
|
||||
|
||||
|
@ -532,8 +510,7 @@ nsHTMLSelectOptionAccessible::GetStateInternal(PRUint32 *aState,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> selectNode = do_QueryInterface(selectContent);
|
||||
NS_ENSURE_TRUE(selectNode, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(selectContent, NS_ERROR_FAILURE);
|
||||
|
||||
// Is disabled?
|
||||
if (0 == (*aState & nsIAccessibleStates::STATE_UNAVAILABLE)) {
|
||||
|
@ -543,19 +520,17 @@ nsHTMLSelectOptionAccessible::GetStateInternal(PRUint32 *aState,
|
|||
// Firefox draws a focus ring around the first non-disabled option.
|
||||
// We need to indicated STATE_FOCUSED in that case, because it
|
||||
// prevents JAWS from ignoring the list
|
||||
// GetFocusedOptionNode() ensures that an option node is
|
||||
// GetFocusedOption() ensures that an option node is
|
||||
// returned in this case, as long as some focusable option exists
|
||||
// in the listbox
|
||||
nsCOMPtr<nsIDOMNode> focusedOptionNode;
|
||||
GetFocusedOptionNode(selectNode, getter_AddRefs(focusedOptionNode));
|
||||
if (focusedOptionNode == mDOMNode) {
|
||||
nsCOMPtr<nsIContent> focusedOption = GetFocusedOption(selectContent);
|
||||
if (focusedOption == mContent)
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSED;
|
||||
}
|
||||
}
|
||||
|
||||
// Are we selected?
|
||||
PRBool isSelected = PR_FALSE;
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> option (do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> option(do_QueryInterface(mContent));
|
||||
if (option) {
|
||||
option->GetSelected(&isSelected);
|
||||
if ( isSelected )
|
||||
|
@ -603,8 +578,7 @@ nsHTMLSelectOptionAccessible::GetStateInternal(PRUint32 *aState,
|
|||
PRInt32
|
||||
nsHTMLSelectOptionAccessible::GetLevelInternal()
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsIContent *parentContent = content->GetParent();
|
||||
nsIContent *parentContent = mContent->GetParent();
|
||||
|
||||
PRInt32 level =
|
||||
parentContent->NodeInfo()->Equals(nsAccessibilityAtoms::optgroup) ? 2 : 1;
|
||||
|
@ -620,9 +594,8 @@ nsHTMLSelectOptionAccessible::GetLevelInternal()
|
|||
void
|
||||
nsHTMLSelectOptionAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsIContent *parentContent = content->GetParent();
|
||||
{
|
||||
nsIContent *parentContent = mContent->GetParent();
|
||||
|
||||
PRInt32 posInSet = 0, setSize = 0;
|
||||
PRBool isContentFound = PR_FALSE;
|
||||
|
@ -630,9 +603,9 @@ nsHTMLSelectOptionAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
|||
PRUint32 childCount = parentContent->GetChildCount();
|
||||
for (PRUint32 childIdx = 0; childIdx < childCount; childIdx++) {
|
||||
nsIContent *childContent = parentContent->GetChildAt(childIdx);
|
||||
if (childContent->NodeInfo()->Equals(content->NodeInfo())) {
|
||||
if (childContent->NodeInfo()->Equals(mContent->NodeInfo())) {
|
||||
if (!isContentFound) {
|
||||
if (childContent == content)
|
||||
if (childContent == mContent)
|
||||
isContentFound = PR_TRUE;
|
||||
|
||||
posInSet++;
|
||||
|
@ -667,17 +640,17 @@ NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetNumActions(PRUint8 *_retval)
|
|||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::DoAction(PRUint8 index)
|
||||
{
|
||||
if (index == eAction_Select) { // default action
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> newHTMLOption(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> newHTMLOption(do_QueryInterface(mContent));
|
||||
if (!newHTMLOption)
|
||||
return NS_ERROR_FAILURE;
|
||||
// Clear old selection
|
||||
nsCOMPtr<nsIDOMNode> oldHTMLOptionNode, selectNode;
|
||||
nsAccessible* parent = GetParent();
|
||||
NS_ASSERTION(parent, "No parent!");
|
||||
|
||||
parent->GetDOMNode(getter_AddRefs(selectNode));
|
||||
GetFocusedOptionNode(selectNode, getter_AddRefs(oldHTMLOptionNode));
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> oldHTMLOption(do_QueryInterface(oldHTMLOptionNode));
|
||||
nsCOMPtr<nsIContent> oldHTMLOptionContent =
|
||||
GetFocusedOption(parent->GetContent());
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> oldHTMLOption =
|
||||
do_QueryInterface(oldHTMLOptionContent);
|
||||
if (oldHTMLOption)
|
||||
oldHTMLOption->SetSelected(PR_FALSE);
|
||||
// Set new selection
|
||||
|
@ -685,21 +658,20 @@ NS_IMETHODIMP nsHTMLSelectOptionAccessible::DoAction(PRUint8 index)
|
|||
|
||||
// If combo box, and open, close it
|
||||
// First, get the <select> widgets list control frame
|
||||
nsCOMPtr<nsIDOMNode> testSelectNode;
|
||||
nsCOMPtr<nsIDOMNode> thisNode(do_QueryInterface(mDOMNode));
|
||||
nsIContent *selectContent = mContent;
|
||||
do {
|
||||
thisNode->GetParentNode(getter_AddRefs(testSelectNode));
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> selectControl(do_QueryInterface(testSelectNode));
|
||||
selectContent = selectContent->GetParent();
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> selectControl =
|
||||
do_QueryInterface(selectContent);
|
||||
if (selectControl)
|
||||
break;
|
||||
thisNode = testSelectNode;
|
||||
} while (testSelectNode);
|
||||
|
||||
} while (selectContent);
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mWeakShell));
|
||||
nsCOMPtr<nsIContent> selectContent(do_QueryInterface(testSelectNode));
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> option(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> option(do_QueryInterface(mContent));
|
||||
|
||||
if (!testSelectNode || !selectContent || !presShell || !option)
|
||||
if (!selectContent || !presShell || !option)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIFrame *selectFrame = selectContent->GetPrimaryFrame();
|
||||
|
@ -730,16 +702,14 @@ NS_IMETHODIMP nsHTMLSelectOptionAccessible::DoAction(PRUint8 index)
|
|||
* need to use the frame to get the focused option because for some reason we
|
||||
* weren't getting the proper notification when the focus changed using the DOM
|
||||
*/
|
||||
nsresult nsHTMLSelectOptionAccessible::GetFocusedOptionNode(nsIDOMNode *aListNode,
|
||||
nsIDOMNode **aFocusedOptionNode)
|
||||
already_AddRefed<nsIContent>
|
||||
nsHTMLSelectOptionAccessible::GetFocusedOption(nsIContent *aListNode)
|
||||
{
|
||||
*aFocusedOptionNode = nsnull;
|
||||
NS_ASSERTION(aListNode, "Called GetFocusedOptionNode without a valid list node");
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aListNode));
|
||||
nsIFrame *frame = content->GetPrimaryFrame();
|
||||
nsIFrame *frame = aListNode->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return NS_ERROR_FAILURE;
|
||||
return nsnull;
|
||||
|
||||
PRInt32 focusedOptionIndex = 0;
|
||||
|
||||
|
@ -781,37 +751,39 @@ nsresult nsHTMLSelectOptionAccessible::GetFocusedOptionNode(nsIDOMNode *aListNod
|
|||
|
||||
// Either use options and focused index, or default return null
|
||||
if (NS_SUCCEEDED(rv) && options && focusedOptionIndex >= 0) { // Something is focused
|
||||
rv = options->Item(focusedOptionIndex, aFocusedOptionNode);
|
||||
nsCOMPtr<nsIDOMNode> focusedOptionNode;
|
||||
options->Item(focusedOptionIndex, getter_AddRefs(focusedOptionNode));
|
||||
nsIContent *focusedOption = nsnull;
|
||||
if (focusedOptionNode)
|
||||
CallQueryInterface(focusedOptionNode, &focusedOption);
|
||||
return focusedOption;
|
||||
}
|
||||
|
||||
return rv;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
void nsHTMLSelectOptionAccessible::SelectionChangedIfOption(nsIContent *aPossibleOption)
|
||||
void
|
||||
nsHTMLSelectOptionAccessible::SelectionChangedIfOption(nsIContent *aPossibleOptionNode)
|
||||
{
|
||||
if (!aPossibleOption || aPossibleOption->Tag() != nsAccessibilityAtoms::option ||
|
||||
!aPossibleOption->IsHTML()) {
|
||||
if (!aPossibleOptionNode ||
|
||||
aPossibleOptionNode->Tag() != nsAccessibilityAtoms::option ||
|
||||
!aPossibleOptionNode->IsHTML()) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> optionNode(do_QueryInterface(aPossibleOption));
|
||||
NS_ASSERTION(optionNode, "No option node for nsIContent with option tag!");
|
||||
|
||||
nsCOMPtr<nsIAccessible> multiSelect =
|
||||
nsAccUtils::GetMultiSelectableContainer(optionNode);
|
||||
nsAccessible *multiSelect =
|
||||
nsAccUtils::GetMultiSelectableContainer(aPossibleOptionNode);
|
||||
if (!multiSelect)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIAccessible> optionAccessible;
|
||||
GetAccService()->GetAccessibleFor(optionNode,
|
||||
getter_AddRefs(optionAccessible));
|
||||
if (!optionAccessible)
|
||||
nsAccessible *option = GetAccService()->GetAccessible(aPossibleOptionNode);
|
||||
if (!option)
|
||||
return;
|
||||
|
||||
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN,
|
||||
multiSelect);
|
||||
|
||||
PRUint32 state = nsAccUtils::State(optionAccessible);
|
||||
PRUint32 state = nsAccUtils::State(option);
|
||||
PRUint32 eventType;
|
||||
if (state & nsIAccessibleStates::STATE_SELECTED) {
|
||||
eventType = nsIAccessibleEvent::EVENT_SELECTION_ADD;
|
||||
|
@ -820,7 +792,7 @@ void nsHTMLSelectOptionAccessible::SelectionChangedIfOption(nsIContent *aPossibl
|
|||
eventType = nsIAccessibleEvent::EVENT_SELECTION_REMOVE;
|
||||
}
|
||||
|
||||
nsEventShell::FireEvent(eventType, optionAccessible);
|
||||
nsEventShell::FireEvent(eventType, option);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -829,7 +801,7 @@ void nsHTMLSelectOptionAccessible::SelectionChangedIfOption(nsIContent *aPossibl
|
|||
nsIContent* nsHTMLSelectOptionAccessible::GetSelectState(PRUint32* aState,
|
||||
PRUint32* aExtraState)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsIContent *content = mContent;
|
||||
while (content && content->Tag() != nsAccessibilityAtoms::select) {
|
||||
content = content->GetParent();
|
||||
}
|
||||
|
@ -846,13 +818,15 @@ nsIContent* nsHTMLSelectOptionAccessible::GetSelectState(PRUint32* aState,
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLSelectOptGroupAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/** Default Constructor */
|
||||
nsHTMLSelectOptGroupAccessible::nsHTMLSelectOptGroupAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsHTMLSelectOptionAccessible(aDOMNode, aShell)
|
||||
nsHTMLSelectOptGroupAccessible::
|
||||
nsHTMLSelectOptGroupAccessible(nsIContent *aContent,
|
||||
nsIWeakReference *aShell) :
|
||||
nsHTMLSelectOptionAccessible(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -905,20 +879,17 @@ nsHTMLSelectOptGroupAccessible::CacheChildren()
|
|||
// CreateAttributeContent() in nsCSSFrameConstructor
|
||||
}
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
/** Finally, the Combobox widgets */
|
||||
/** ------------------------------------------------------ */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLComboboxAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHTMLComboboxAccessible::nsHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsAccessibleWrap(aDOMNode, aShell)
|
||||
nsHTMLComboboxAccessible::
|
||||
nsHTMLComboboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsAccessibleWrap(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/** We are a combobox */
|
||||
nsresult
|
||||
nsHTMLComboboxAccessible::GetRoleInternal(PRUint32 *aRole)
|
||||
{
|
||||
|
@ -943,7 +914,7 @@ nsHTMLComboboxAccessible::CacheChildren()
|
|||
|
||||
if (!mListAccessible) {
|
||||
mListAccessible =
|
||||
new nsHTMLComboboxListAccessible(mParent, mDOMNode, mWeakShell);
|
||||
new nsHTMLComboboxListAccessible(mParent, mContent, mWeakShell);
|
||||
if (!mListAccessible)
|
||||
return;
|
||||
|
||||
|
@ -1018,14 +989,13 @@ nsHTMLComboboxAccessible::GetFocusedOptionAccessible()
|
|||
if (IsDefunct())
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> focusedOptionNode;
|
||||
nsHTMLSelectOptionAccessible::
|
||||
GetFocusedOptionNode(mDOMNode, getter_AddRefs(focusedOptionNode));
|
||||
if (!focusedOptionNode) {
|
||||
nsCOMPtr<nsIContent> focusedOption =
|
||||
nsHTMLSelectOptionAccessible::GetFocusedOption(mContent);
|
||||
if (!focusedOption) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
return GetAccService()->GetAccessibleInWeakShell(focusedOptionNode,
|
||||
return GetAccService()->GetAccessibleInWeakShell(focusedOption,
|
||||
mWeakShell);
|
||||
}
|
||||
|
||||
|
@ -1102,10 +1072,10 @@ NS_IMETHODIMP nsHTMLComboboxAccessible::GetActionName(PRUint8 aIndex, nsAString&
|
|||
// nsHTMLComboboxListAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHTMLComboboxListAccessible::nsHTMLComboboxListAccessible(nsIAccessible *aParent,
|
||||
nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell):
|
||||
nsHTMLSelectListAccessible(aDOMNode, aShell)
|
||||
nsHTMLComboboxListAccessible::
|
||||
nsHTMLComboboxListAccessible(nsIAccessible *aParent, nsIContent *aContent,
|
||||
nsIWeakReference *aShell) :
|
||||
nsHTMLSelectListAccessible(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1151,7 +1121,8 @@ nsHTMLComboboxListAccessible::GetStateInternal(PRUint32 *aState,
|
|||
|
||||
NS_IMETHODIMP nsHTMLComboboxListAccessible::GetUniqueID(void **aUniqueID)
|
||||
{
|
||||
// Since mDOMNode is same for all tree item, use |this| pointer as the unique Id
|
||||
// Since mContent is same for all tree item, use |this| pointer as the unique
|
||||
// Id.
|
||||
*aUniqueID = static_cast<void*>(this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1172,12 +1143,9 @@ void nsHTMLComboboxListAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aBo
|
|||
nsHTMLSelectListAccessible::GetBoundsRect(aBounds, aBoundingFrame);
|
||||
return;
|
||||
}
|
||||
// get our first option
|
||||
nsCOMPtr<nsIDOMNode> child;
|
||||
mDOMNode->GetFirstChild(getter_AddRefs(child));
|
||||
|
||||
// now get its frame
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(child));
|
||||
// Get the first option.
|
||||
nsIContent* content = mContent->GetChildAt(0);
|
||||
if (!content) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -59,8 +59,6 @@ class nsIMutableArray;
|
|||
*
|
||||
* Comboboxes:
|
||||
* - nsHTMLComboboxAccessible
|
||||
* - nsHTMLComboboxTextFieldAccessible
|
||||
* - nsHTMLComboboxButtonAccessible
|
||||
* - nsHTMLComboboxListAccessible [ inserted in accessible tree ]
|
||||
* - nsHTMLSelectOptionAccessible(s)
|
||||
*/
|
||||
|
@ -79,7 +77,7 @@ public:
|
|||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLESELECTABLE
|
||||
|
||||
nsHTMLSelectableAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
nsHTMLSelectableAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
virtual ~nsHTMLSelectableAccessible() {}
|
||||
|
||||
protected:
|
||||
|
@ -120,7 +118,7 @@ class nsHTMLSelectListAccessible : public nsHTMLSelectableAccessible
|
|||
{
|
||||
public:
|
||||
|
||||
nsHTMLSelectListAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
nsHTMLSelectListAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
virtual ~nsHTMLSelectListAccessible() {}
|
||||
|
||||
// nsAccessible
|
||||
|
@ -148,7 +146,7 @@ class nsHTMLSelectOptionAccessible : public nsHyperTextAccessibleWrap
|
|||
public:
|
||||
enum { eAction_Select = 0 };
|
||||
|
||||
nsHTMLSelectOptionAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
nsHTMLSelectOptionAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
virtual ~nsHTMLSelectOptionAccessible() {}
|
||||
|
||||
// nsIAccessible
|
||||
|
@ -166,7 +164,12 @@ public:
|
|||
PRInt32 *aSetSize);
|
||||
|
||||
nsIFrame* GetBoundsFrame();
|
||||
static nsresult GetFocusedOptionNode(nsIDOMNode *aListNode, nsIDOMNode **aFocusedOptionNode);
|
||||
|
||||
/**
|
||||
* Return focused option if any.
|
||||
*/
|
||||
static already_AddRefed<nsIContent> GetFocusedOption(nsIContent *aListNode);
|
||||
|
||||
static void SelectionChangedIfOption(nsIContent *aPossibleOption);
|
||||
|
||||
private:
|
||||
|
@ -187,7 +190,7 @@ class nsHTMLSelectOptGroupAccessible : public nsHTMLSelectOptionAccessible
|
|||
{
|
||||
public:
|
||||
|
||||
nsHTMLSelectOptGroupAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
nsHTMLSelectOptGroupAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
virtual ~nsHTMLSelectOptGroupAccessible() {}
|
||||
|
||||
// nsIAccessible
|
||||
|
@ -218,7 +221,7 @@ class nsHTMLComboboxAccessible : public nsAccessibleWrap
|
|||
public:
|
||||
enum { eAction_Click = 0 };
|
||||
|
||||
nsHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
nsHTMLComboboxAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
virtual ~nsHTMLComboboxAccessible() {}
|
||||
|
||||
// nsIAccessible
|
||||
|
@ -260,7 +263,7 @@ class nsHTMLComboboxListAccessible : public nsHTMLSelectListAccessible
|
|||
public:
|
||||
|
||||
nsHTMLComboboxListAccessible(nsIAccessible *aParent,
|
||||
nsIDOMNode* aDOMNode,
|
||||
nsIContent *aContent,
|
||||
nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLComboboxListAccessible() {}
|
||||
|
||||
|
|
|
@ -70,8 +70,8 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHTMLTableCellAccessible::
|
||||
nsHTMLTableCellAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell) :
|
||||
nsHyperTextAccessibleWrap(aDomNode, aShell)
|
||||
nsHTMLTableCellAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsHyperTextAccessibleWrap(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -99,9 +99,7 @@ nsHTMLTableCellAccessible::GetStateInternal(PRUint32 *aState,
|
|||
nsresult rv= nsHyperTextAccessibleWrap::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
|
||||
nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(mWeakShell);
|
||||
nsIFrame *frame = content->GetPrimaryFrame();
|
||||
nsIFrame *frame = mContent->GetPrimaryFrame();
|
||||
NS_ASSERTION(frame, "No frame for valid cell accessible!");
|
||||
|
||||
if (frame) {
|
||||
|
@ -291,13 +289,11 @@ nsHTMLTableCellAccessible::GetTableAccessible()
|
|||
nsITableCellLayout*
|
||||
nsHTMLTableCellAccessible::GetCellLayout()
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
|
||||
nsIFrame *frame = content->GetPrimaryFrame();
|
||||
nsIFrame *frame = mContent->GetPrimaryFrame();
|
||||
NS_ASSERTION(frame, "The frame cannot be obtaied for HTML table cell.");
|
||||
if (!frame)
|
||||
return nsnull;
|
||||
|
||||
|
||||
nsITableCellLayout *cellLayout = do_QueryFrame(frame);
|
||||
return cellLayout;
|
||||
}
|
||||
|
@ -316,11 +312,9 @@ nsresult
|
|||
nsHTMLTableCellAccessible::GetHeaderCells(PRInt32 aRowOrColumnHeaderCell,
|
||||
nsIArray **aHeaderCells)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
|
||||
// Get header cells from @header attribute.
|
||||
nsCOMPtr<nsIArray> headerCellElms;
|
||||
nsCoreUtils::GetElementsByIDRefsAttr(content, nsAccessibilityAtoms::headers,
|
||||
nsCoreUtils::GetElementsByIDRefsAttr(mContent, nsAccessibilityAtoms::headers,
|
||||
getter_AddRefs(headerCellElms));
|
||||
|
||||
if (headerCellElms) {
|
||||
|
@ -332,11 +326,11 @@ nsHTMLTableCellAccessible::GetHeaderCells(PRInt32 aRowOrColumnHeaderCell,
|
|||
PRUint32 count = 0;
|
||||
rv = headerCellElms->GetLength(&count);
|
||||
if (NS_SUCCEEDED(rv) && count > 0) {
|
||||
nsCOMPtr<nsIDOMNode> headerCellNode;
|
||||
nsCOMPtr<nsIContent> headerCellContent;
|
||||
for (PRUint32 idx = 0; idx < count; idx++) {
|
||||
headerCellNode = do_QueryElementAt(headerCellElms, idx, &rv);
|
||||
headerCellContent = do_QueryElementAt(headerCellElms, idx, &rv);
|
||||
nsAccessible *headerCell =
|
||||
GetAccService()->GetAccessibleInWeakShell(headerCellNode, mWeakShell);
|
||||
GetAccService()->GetAccessibleInWeakShell(headerCellContent, mWeakShell);
|
||||
|
||||
if (headerCell &&
|
||||
(aRowOrColumnHeaderCell == nsAccUtils::eRowHeaderCells &&
|
||||
|
@ -368,9 +362,9 @@ nsHTMLTableCellAccessible::GetHeaderCells(PRInt32 aRowOrColumnHeaderCell,
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHTMLTableHeaderCellAccessible::
|
||||
nsHTMLTableHeaderCellAccessible(nsIDOMNode* aDomNode,
|
||||
nsIWeakReference* aShell) :
|
||||
nsHTMLTableCellAccessible(aDomNode, aShell)
|
||||
nsHTMLTableHeaderCellAccessible(nsIContent *aContent,
|
||||
nsIWeakReference *aShell) :
|
||||
nsHTMLTableCellAccessible(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -380,14 +374,12 @@ nsHTMLTableHeaderCellAccessible::
|
|||
nsresult
|
||||
nsHTMLTableHeaderCellAccessible::GetRoleInternal(PRUint32 *aRole)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
|
||||
// Check value of @scope attribute.
|
||||
static nsIContent::AttrValuesArray scopeValues[] =
|
||||
{&nsAccessibilityAtoms::col, &nsAccessibilityAtoms::row, nsnull};
|
||||
PRInt32 valueIdx =
|
||||
content->FindAttrValueIn(kNameSpaceID_None, nsAccessibilityAtoms::scope,
|
||||
scopeValues, eCaseMatters);
|
||||
mContent->FindAttrValueIn(kNameSpaceID_None, nsAccessibilityAtoms::scope,
|
||||
scopeValues, eCaseMatters);
|
||||
|
||||
switch (valueIdx) {
|
||||
case 0:
|
||||
|
@ -400,10 +392,10 @@ nsHTMLTableHeaderCellAccessible::GetRoleInternal(PRUint32 *aRole)
|
|||
|
||||
// Assume it's columnheader if there are headers in siblings, oterwise
|
||||
// rowheader.
|
||||
nsIContent* parent = content->GetParent();
|
||||
nsIContent *parent = mContent->GetParent();
|
||||
NS_ENSURE_STATE(parent);
|
||||
|
||||
PRInt32 indexInParent = parent->IndexOf(content);
|
||||
PRInt32 indexInParent = parent->IndexOf(mContent);
|
||||
|
||||
for (PRInt32 idx = indexInParent - 1; idx >= 0; idx--) {
|
||||
nsIContent* sibling = parent->GetChildAt(idx);
|
||||
|
@ -442,9 +434,9 @@ nsHTMLTableHeaderCellAccessible::GetRoleInternal(PRUint32 *aRole)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHTMLTableAccessible::
|
||||
nsHTMLTableAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell) :
|
||||
nsAccessibleWrap(aDomNode, aShell)
|
||||
{
|
||||
nsHTMLTableAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsAccessibleWrap(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -504,12 +496,8 @@ nsHTMLTableAccessible::GetNameInternal(nsAString& aName)
|
|||
{
|
||||
nsAccessible::GetNameInternal(aName);
|
||||
|
||||
if (aName.IsEmpty()) {
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
if (content) {
|
||||
content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::summary, aName);
|
||||
}
|
||||
}
|
||||
if (aName.IsEmpty())
|
||||
mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::summary, aName);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -517,13 +505,9 @@ nsHTMLTableAccessible::GetNameInternal(nsAString& aName)
|
|||
nsresult
|
||||
nsHTMLTableAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
|
||||
{
|
||||
if (!mDOMNode) {
|
||||
return NS_ERROR_FAILURE; // Node already shut down
|
||||
}
|
||||
|
||||
nsresult rv = nsAccessibleWrap::GetAttributesInternal(aAttributes);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
PRBool isProbablyForLayout;
|
||||
IsProbablyForLayout(&isProbablyForLayout);
|
||||
if (isProbablyForLayout) {
|
||||
|
@ -572,7 +556,7 @@ nsHTMLTableAccessible::GetCaption(nsIAccessible **aCaption)
|
|||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::GetSummary(nsAString &aSummary)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mContent));
|
||||
NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
|
||||
|
||||
return table->GetSummary(aSummary);
|
||||
|
@ -738,8 +722,9 @@ nsHTMLTableAccessible::GetSelectedCells(nsIArray **aCells)
|
|||
|
||||
if (NS_SUCCEEDED(rv) && startRowIndex == rowIndex &&
|
||||
startColIndex == columnIndex && isSelected) {
|
||||
nsCOMPtr<nsIContent> cellContent(do_QueryInterface(cellElement));
|
||||
nsAccessible *cell =
|
||||
GetAccService()->GetAccessibleInWeakShell(cellElement, mWeakShell);
|
||||
GetAccService()->GetAccessibleInWeakShell(cellContent, mWeakShell);
|
||||
selCells->AppendElement(static_cast<nsIAccessible*>(cell), PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
@ -911,8 +896,9 @@ nsHTMLTableAccessible::GetCellAt(PRInt32 aRow, PRInt32 aColumn,
|
|||
nsresult rv = GetCellAt(aRow, aColumn, *getter_AddRefs(cellElement));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIContent> cellContent(do_QueryInterface(cellElement));
|
||||
nsAccessible *cell =
|
||||
GetAccService()->GetAccessibleInWeakShell(cellElement, mWeakShell);
|
||||
GetAccService()->GetAccessibleInWeakShell(cellContent, mWeakShell);
|
||||
if (cell)
|
||||
CallQueryInterface(cell, aTableCellAccessible);
|
||||
|
||||
|
@ -1214,8 +1200,6 @@ nsHTMLTableAccessible::RemoveRowsOrColumnsFromSelection(PRInt32 aIndex,
|
|||
PRUint32 aTarget,
|
||||
PRBool aIsOuter)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
|
||||
nsITableLayout *tableLayout = GetTableLayout();
|
||||
NS_ENSURE_STATE(tableLayout);
|
||||
|
||||
|
@ -1238,11 +1222,11 @@ nsHTMLTableAccessible::RemoveRowsOrColumnsFromSelection(PRInt32 aIndex,
|
|||
PRInt32 endColIdx = doUnselectRow ? count - 1 : aIndex;
|
||||
|
||||
if (aIsOuter)
|
||||
return tableSelection->RestrictCellsToSelection(content,
|
||||
return tableSelection->RestrictCellsToSelection(mContent,
|
||||
startRowIdx, startColIdx,
|
||||
endRowIdx, endColIdx);
|
||||
|
||||
return tableSelection->RemoveCellsFromSelection(content,
|
||||
return tableSelection->RemoveCellsFromSelection(mContent,
|
||||
startRowIdx, startColIdx,
|
||||
endRowIdx, endColIdx);
|
||||
}
|
||||
|
@ -1250,8 +1234,7 @@ nsHTMLTableAccessible::RemoveRowsOrColumnsFromSelection(PRInt32 aIndex,
|
|||
nsITableLayout*
|
||||
nsHTMLTableAccessible::GetTableLayout()
|
||||
{
|
||||
nsCOMPtr<nsIContent> tableContent(do_QueryInterface(mDOMNode));
|
||||
nsIFrame *frame = tableContent->GetPrimaryFrame();
|
||||
nsIFrame *frame = mContent->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return nsnull;
|
||||
|
||||
|
@ -1319,7 +1302,7 @@ PRBool
|
|||
nsHTMLTableAccessible::HasDescendant(const nsAString& aTagName,
|
||||
PRBool aAllowEmpty)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> tableElt(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMElement> tableElt(do_QueryInterface(mContent));
|
||||
NS_ENSURE_TRUE(tableElt, PR_FALSE);
|
||||
|
||||
nsCOMPtr<nsIDOMNodeList> nodeList;
|
||||
|
@ -1397,8 +1380,7 @@ nsHTMLTableAccessible::IsProbablyForLayout(PRBool *aIsProbablyForLayout)
|
|||
RETURN_LAYOUT_ANSWER(PR_FALSE, "Has role attribute");
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
if (content->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::role)) {
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::role)) {
|
||||
// Role attribute is present, but overridden roles have already been dealt with.
|
||||
// Only landmarks and other roles that don't override the role from native
|
||||
// markup are left to deal with here.
|
||||
|
@ -1407,7 +1389,8 @@ nsHTMLTableAccessible::IsProbablyForLayout(PRBool *aIsProbablyForLayout)
|
|||
|
||||
// Check for legitimate data table elements or attributes
|
||||
nsAutoString summary;
|
||||
if ((content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::summary, summary) && !summary.IsEmpty()) ||
|
||||
if ((mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::summary, summary) &&
|
||||
!summary.IsEmpty()) ||
|
||||
HasDescendant(NS_LITERAL_STRING("caption"), PR_FALSE) ||
|
||||
HasDescendant(NS_LITERAL_STRING("th")) ||
|
||||
HasDescendant(NS_LITERAL_STRING("thead")) ||
|
||||
|
@ -1461,7 +1444,7 @@ nsHTMLTableAccessible::IsProbablyForLayout(PRBool *aIsProbablyForLayout)
|
|||
// Check for styled background color across the row
|
||||
// Alternating background color is a common way
|
||||
nsCOMPtr<nsIDOMNodeList> nodeList;
|
||||
nsCOMPtr<nsIDOMElement> tableElt(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMElement> tableElt(do_QueryInterface(mContent));
|
||||
tableElt->GetElementsByTagName(NS_LITERAL_STRING("tr"), getter_AddRefs(nodeList));
|
||||
NS_ENSURE_TRUE(nodeList, NS_ERROR_FAILURE);
|
||||
PRUint32 length;
|
||||
|
@ -1470,10 +1453,10 @@ nsHTMLTableAccessible::IsProbablyForLayout(PRBool *aIsProbablyForLayout)
|
|||
for (PRUint32 rowCount = 0; rowCount < length; rowCount ++) {
|
||||
nsCOMPtr<nsIDOMNode> rowNode;
|
||||
nodeList->Item(rowCount, getter_AddRefs(rowNode));
|
||||
nsCOMPtr<nsIContent> rowContent(do_QueryInterface(rowNode));
|
||||
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> styleDecl;
|
||||
nsCoreUtils::GetComputedStyleDeclaration(EmptyString(), rowNode,
|
||||
getter_AddRefs(styleDecl));
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> styleDecl =
|
||||
nsCoreUtils::GetComputedStyleDeclaration(EmptyString(), rowContent);
|
||||
NS_ENSURE_TRUE(styleDecl, NS_ERROR_FAILURE);
|
||||
|
||||
lastRowColor = color;
|
||||
|
|
|
@ -52,7 +52,7 @@ class nsHTMLTableCellAccessible : public nsHyperTextAccessibleWrap,
|
|||
public nsIAccessibleTableCell
|
||||
{
|
||||
public:
|
||||
nsHTMLTableCellAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
nsHTMLTableCellAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
@ -95,8 +95,8 @@ protected:
|
|||
class nsHTMLTableHeaderCellAccessible : public nsHTMLTableCellAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLTableHeaderCellAccessible(nsIDOMNode* aDomNode,
|
||||
nsIWeakReference* aShell);
|
||||
nsHTMLTableHeaderCellAccessible(nsIContent *aContent,
|
||||
nsIWeakReference *aShell);
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
|
@ -124,7 +124,7 @@ class nsHTMLTableAccessible : public nsAccessibleWrap,
|
|||
public nsIAccessibleTable
|
||||
{
|
||||
public:
|
||||
nsHTMLTableAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
nsHTMLTableAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLETABLE
|
||||
|
@ -207,8 +207,8 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsHTMLTableAccessible,
|
|||
class nsHTMLCaptionAccessible : public nsHyperTextAccessibleWrap
|
||||
{
|
||||
public:
|
||||
nsHTMLCaptionAccessible(nsIDOMNode *aDomNode, nsIWeakReference *aShell) :
|
||||
nsHyperTextAccessibleWrap(aDomNode, aShell) { }
|
||||
nsHTMLCaptionAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsHyperTextAccessibleWrap(aContent, aShell) { }
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
|
||||
|
|
|
@ -52,9 +52,10 @@
|
|||
// nsHTMLTextAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHTMLTextAccessible::nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsTextAccessibleWrap(aDomNode, aShell)
|
||||
{
|
||||
nsHTMLTextAccessible::
|
||||
nsHTMLTextAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsTextAccessibleWrap(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTextAccessible, nsTextAccessible)
|
||||
|
@ -102,10 +103,6 @@ nsHTMLTextAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
|||
nsresult
|
||||
nsHTMLTextAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
|
||||
{
|
||||
if (!mDOMNode) {
|
||||
return NS_ERROR_FAILURE; // Node already shut down
|
||||
}
|
||||
|
||||
PRUint32 role;
|
||||
GetRoleInternal(&role);
|
||||
if (role == nsIAccessibleRole::ROLE_STATICTEXT) {
|
||||
|
@ -117,13 +114,15 @@ nsHTMLTextAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLHRAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHTMLHRAccessible::nsHTMLHRAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsLeafAccessible(aDomNode, aShell)
|
||||
{
|
||||
nsHTMLHRAccessible::
|
||||
nsHTMLHRAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsLeafAccessible(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -133,9 +132,15 @@ nsHTMLHRAccessible::GetRoleInternal(PRUint32 *aRole)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsHTMLBRAccessible::nsHTMLBRAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsLeafAccessible(aDomNode, aShell)
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLBRAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHTMLBRAccessible::
|
||||
nsHTMLBRAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsLeafAccessible(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -175,14 +180,14 @@ nsHTMLBRAccessible::GetNameInternal(nsAString& aName)
|
|||
// nsHTMLLabelAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLLabelAccessible, nsHyperTextAccessible)
|
||||
|
||||
nsHTMLLabelAccessible::
|
||||
nsHTMLLabelAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell) :
|
||||
nsHyperTextAccessibleWrap(aDomNode, aShell)
|
||||
nsHTMLLabelAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsHyperTextAccessibleWrap(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLLabelAccessible, nsHyperTextAccessible)
|
||||
|
||||
nsresult
|
||||
nsHTMLLabelAccessible::GetNameInternal(nsAString& aName)
|
||||
{
|
||||
|
@ -201,12 +206,12 @@ nsHTMLLabelAccessible::GetRoleInternal(PRUint32 *aRole)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHTMLLIAccessible::
|
||||
nsHTMLLIAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell,
|
||||
const nsAString& aBulletText):
|
||||
nsHyperTextAccessibleWrap(aDOMNode, aShell)
|
||||
nsHTMLLIAccessible(nsIContent *aContent, nsIWeakReference *aShell,
|
||||
const nsAString& aBulletText) :
|
||||
nsHyperTextAccessibleWrap(aContent, aShell)
|
||||
{
|
||||
if (!aBulletText.IsEmpty()) {
|
||||
mBulletAccessible = new nsHTMLListBulletAccessible(mDOMNode, mWeakShell,
|
||||
mBulletAccessible = new nsHTMLListBulletAccessible(mContent, mWeakShell,
|
||||
aBulletText);
|
||||
if (mBulletAccessible)
|
||||
mBulletAccessible->Init();
|
||||
|
@ -282,9 +287,9 @@ nsHTMLLIAccessible::CacheChildren()
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHTMLListBulletAccessible::
|
||||
nsHTMLListBulletAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell,
|
||||
nsHTMLListBulletAccessible(nsIContent *aContent, nsIWeakReference *aShell,
|
||||
const nsAString& aBulletText) :
|
||||
nsLeafAccessible(aDomNode, aShell), mBulletText(aBulletText)
|
||||
nsLeafAccessible(aContent, aShell), mBulletText(aBulletText)
|
||||
{
|
||||
mBulletText += ' '; // Otherwise bullets are jammed up against list text
|
||||
}
|
||||
|
@ -292,7 +297,8 @@ nsHTMLListBulletAccessible::
|
|||
NS_IMETHODIMP
|
||||
nsHTMLListBulletAccessible::GetUniqueID(void **aUniqueID)
|
||||
{
|
||||
// Since mDOMNode is same as for list item, use |this| pointer as the unique Id
|
||||
// Since mContent is same as for list item, use |this| pointer as the unique
|
||||
// id.
|
||||
*aUniqueID = static_cast<void*>(this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -352,6 +358,12 @@ nsHTMLListBulletAccessible::GetParent()
|
|||
// nsHTMLListAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHTMLListAccessible::
|
||||
nsHTMLListAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsHyperTextAccessibleWrap(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLListAccessible, nsHyperTextAccessible)
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -44,12 +44,13 @@
|
|||
#include "nsAutoPtr.h"
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
|
||||
class nsIWeakReference;
|
||||
|
||||
/**
|
||||
* Used for text nodes within HTML document.
|
||||
*/
|
||||
class nsHTMLTextAccessible : public nsTextAccessibleWrap
|
||||
{
|
||||
public:
|
||||
nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
nsHTMLTextAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
@ -63,19 +64,25 @@ public:
|
|||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
};
|
||||
|
||||
/**
|
||||
* Used for HTML hr element.
|
||||
*/
|
||||
class nsHTMLHRAccessible : public nsLeafAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLHRAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
nsHTMLHRAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
};
|
||||
|
||||
/**
|
||||
* Used for HTML br element.
|
||||
*/
|
||||
class nsHTMLBRAccessible : public nsLeafAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLBRAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
nsHTMLBRAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
|
@ -83,10 +90,13 @@ public:
|
|||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
};
|
||||
|
||||
/**
|
||||
* Used for HTML label element.
|
||||
*/
|
||||
class nsHTMLLabelAccessible : public nsHyperTextAccessibleWrap
|
||||
{
|
||||
public:
|
||||
nsHTMLLabelAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
nsHTMLLabelAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
|
@ -95,10 +105,13 @@ public:
|
|||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
};
|
||||
|
||||
/**
|
||||
* Used for bullet of HTML list item element (for example, HTML li).
|
||||
*/
|
||||
class nsHTMLListBulletAccessible : public nsLeafAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLListBulletAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell,
|
||||
nsHTMLListBulletAccessible(nsIContent *aContent, nsIWeakReference *aShell,
|
||||
const nsAString& aBulletText);
|
||||
|
||||
// nsIAccessNode
|
||||
|
@ -128,11 +141,13 @@ protected:
|
|||
nsString mBulletText;
|
||||
};
|
||||
|
||||
/**
|
||||
* Used for HTML list (like HTML ul).
|
||||
*/
|
||||
class nsHTMLListAccessible : public nsHyperTextAccessibleWrap
|
||||
{
|
||||
public:
|
||||
nsHTMLListAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell):
|
||||
nsHyperTextAccessibleWrap(aDOMNode, aShell) { }
|
||||
nsHTMLListAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
@ -142,10 +157,13 @@ public:
|
|||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
};
|
||||
|
||||
/**
|
||||
* Used for HTML list item (e.g. HTML li).
|
||||
*/
|
||||
class nsHTMLLIAccessible : public nsHyperTextAccessibleWrap
|
||||
{
|
||||
public:
|
||||
nsHTMLLIAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell,
|
||||
nsHTMLLIAccessible(nsIContent *aContent, nsIWeakReference *aShell,
|
||||
const nsAString& aBulletText);
|
||||
|
||||
// nsISupports
|
||||
|
|
|
@ -72,9 +72,15 @@
|
|||
|
||||
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
|
||||
|
||||
// ------------
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHyperTextAccessible
|
||||
// ------------
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHyperTextAccessible::
|
||||
nsHyperTextAccessible(nsIContent *aNode, nsIWeakReference *aShell) :
|
||||
nsAccessibleWrap(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHyperTextAccessible, nsAccessibleWrap)
|
||||
NS_IMPL_RELEASE_INHERITED(nsHyperTextAccessible, nsAccessibleWrap)
|
||||
|
@ -83,66 +89,50 @@ nsresult nsHyperTextAccessible::QueryInterface(REFNSIID aIID, void** aInstancePt
|
|||
{
|
||||
*aInstancePtr = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMXULDocument> xulDoc(do_QueryInterface(mDOMNode));
|
||||
if (mDOMNode && !xulDoc) {
|
||||
// We need XUL doc check for now because for now nsDocAccessible must
|
||||
// inherit from nsHyperTextAccessible in order for HTML document accessibles
|
||||
// to get support for these interfaces.
|
||||
// However at some point we may push <body> to implement the interfaces and
|
||||
// return nsDocAccessible to inherit from nsAccessibleWrap.
|
||||
if (aIID.Equals(NS_GET_IID(nsHyperTextAccessible))) {
|
||||
*aInstancePtr = static_cast<nsHyperTextAccessible*>(this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsHyperTextAccessible))) {
|
||||
*aInstancePtr = static_cast<nsHyperTextAccessible*>(this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (mRoleMapEntry &&
|
||||
(mRoleMapEntry->role == nsIAccessibleRole::ROLE_GRAPHIC ||
|
||||
mRoleMapEntry->role == nsIAccessibleRole::ROLE_IMAGE_MAP ||
|
||||
mRoleMapEntry->role == nsIAccessibleRole::ROLE_SLIDER ||
|
||||
mRoleMapEntry->role == nsIAccessibleRole::ROLE_PROGRESSBAR ||
|
||||
mRoleMapEntry->role == nsIAccessibleRole::ROLE_SEPARATOR)) {
|
||||
// ARIA roles that these interfaces are not appropriate for
|
||||
return nsAccessible::QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
if (mRoleMapEntry &&
|
||||
(mRoleMapEntry->role == nsIAccessibleRole::ROLE_GRAPHIC ||
|
||||
mRoleMapEntry->role == nsIAccessibleRole::ROLE_IMAGE_MAP ||
|
||||
mRoleMapEntry->role == nsIAccessibleRole::ROLE_SLIDER ||
|
||||
mRoleMapEntry->role == nsIAccessibleRole::ROLE_PROGRESSBAR ||
|
||||
mRoleMapEntry->role == nsIAccessibleRole::ROLE_SEPARATOR)) {
|
||||
// ARIA roles that these interfaces are not appropriate for
|
||||
return nsAccessible::QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
if (aIID.Equals(NS_GET_IID(nsIAccessibleText))) {
|
||||
*aInstancePtr = static_cast<nsIAccessibleText*>(this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsIAccessibleText))) {
|
||||
*aInstancePtr = static_cast<nsIAccessibleText*>(this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(NS_GET_IID(nsIAccessibleHyperText))) {
|
||||
*aInstancePtr = static_cast<nsIAccessibleHyperText*>(this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsIAccessibleHyperText))) {
|
||||
*aInstancePtr = static_cast<nsIAccessibleHyperText*>(this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsIAccessibleEditableText))) {
|
||||
*aInstancePtr = static_cast<nsIAccessibleEditableText*>(this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(NS_GET_IID(nsIAccessibleEditableText))) {
|
||||
*aInstancePtr = static_cast<nsIAccessibleEditableText*>(this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return nsAccessible::QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
nsHyperTextAccessible::nsHyperTextAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsAccessibleWrap(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHyperTextAccessible::GetRoleInternal(PRUint32 *aRole)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
|
||||
if (!content) {
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsIAtom *tag = content->Tag();
|
||||
nsIAtom *tag = mContent->Tag();
|
||||
|
||||
if (tag == nsAccessibilityAtoms::form) {
|
||||
*aRole = nsIAccessibleRole::ROLE_FORM;
|
||||
|
@ -475,9 +465,9 @@ nsHyperTextAccessible::GetPosAndText(PRInt32& aStartOffset, PRInt32& aEndOffset,
|
|||
|
||||
NS_IMETHODIMP nsHyperTextAccessible::GetText(PRInt32 aStartOffset, PRInt32 aEndOffset, nsAString &aText)
|
||||
{
|
||||
if (!mDOMNode) {
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return GetPosAndText(aStartOffset, aEndOffset, &aText) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -508,9 +498,9 @@ NS_IMETHODIMP nsHyperTextAccessible::GetCharacterCount(PRInt32 *aCharacterCount)
|
|||
*/
|
||||
NS_IMETHODIMP nsHyperTextAccessible::GetCharacterAtOffset(PRInt32 aOffset, PRUnichar *aCharacter)
|
||||
{
|
||||
if (!mDOMNode) {
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsAutoString text;
|
||||
nsresult rv = GetText(aOffset, aOffset + 1, text);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -525,7 +515,7 @@ NS_IMETHODIMP nsHyperTextAccessible::GetCharacterAtOffset(PRInt32 aOffset, PRUni
|
|||
}
|
||||
|
||||
nsAccessible*
|
||||
nsHyperTextAccessible::DOMPointToHypertextOffset(nsIDOMNode *aNode,
|
||||
nsHyperTextAccessible::DOMPointToHypertextOffset(nsINode *aNode,
|
||||
PRInt32 aNodeOffset,
|
||||
PRInt32 *aHyperTextOffset,
|
||||
PRBool aIsEndOffset)
|
||||
|
@ -538,14 +528,12 @@ nsHyperTextAccessible::DOMPointToHypertextOffset(nsIDOMNode *aNode,
|
|||
return nsnull;
|
||||
|
||||
PRUint32 addTextOffset = 0;
|
||||
nsCOMPtr<nsIDOMNode> findNode;
|
||||
nsINode* findNode = nsnull;
|
||||
|
||||
unsigned short nodeType;
|
||||
aNode->GetNodeType(&nodeType);
|
||||
if (aNodeOffset == -1) {
|
||||
findNode = aNode;
|
||||
}
|
||||
else if (nodeType == nsIDOMNode::TEXT_NODE) {
|
||||
|
||||
} else if (aNode->IsNodeOfType(nsINode::eTEXT)) {
|
||||
// For text nodes, aNodeOffset comes in as a character offset
|
||||
// Text offset will be added at the end, if we find the offset in this hypertext
|
||||
// We want the "skipped" offset into the text (rendered text without the extra whitespace)
|
||||
|
@ -557,26 +545,26 @@ nsHyperTextAccessible::DOMPointToHypertextOffset(nsIDOMNode *aNode,
|
|||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
// Get the child node and
|
||||
findNode = aNode;
|
||||
}
|
||||
else {
|
||||
// For non-text nodes, aNodeOffset comes in as a child node index
|
||||
nsCOMPtr<nsIContent> parentContent(do_QueryInterface(aNode));
|
||||
// Should not happen, but better to protect against crash if doc node is somehow passed in
|
||||
NS_ENSURE_TRUE(parentContent, nsnull);
|
||||
// findNode could be null if aNodeOffset == # of child nodes, which means one of two things:
|
||||
// 1) we're at the end of the children, keep findNode = null, so that we get the last possible offset
|
||||
// 2) there are no children and the passed-in node is mDOMNode, which means we're an aempty nsIAccessibleText
|
||||
// 3) there are no children, and the passed-in node is not mDOMNode -- use parentContent for the node to find
|
||||
|
||||
findNode = do_QueryInterface(parentContent->GetChildAt(aNodeOffset));
|
||||
|
||||
} else {
|
||||
// findNode could be null if aNodeOffset == # of child nodes, which means
|
||||
// one of two things:
|
||||
// 1) we're at the end of the children, keep findNode = null, so that we get
|
||||
// the last possible offset
|
||||
// 2) there are no children and the passed-in node is mContent, which means
|
||||
// we're an aempty nsIAccessibleText
|
||||
// 3) there are no children, and the passed-in node is not mContent -- use
|
||||
// parentContent for the node to find
|
||||
|
||||
findNode = aNode->GetChildAt(aNodeOffset);
|
||||
if (!findNode && !aNodeOffset) {
|
||||
if (SameCOMIdentity(parentContent, mDOMNode)) {
|
||||
if (aNode == GetNode()) {
|
||||
// There are no children, which means this is an empty nsIAccessibleText, in which
|
||||
// case we can only be at hypertext offset 0
|
||||
*aHyperTextOffset = 0;
|
||||
return nsnull;
|
||||
}
|
||||
findNode = do_QueryInterface(parentContent); // Case #2: there are no children
|
||||
findNode = aNode; // Case #2: there are no children
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -584,8 +572,8 @@ nsHyperTextAccessible::DOMPointToHypertextOffset(nsIDOMNode *aNode,
|
|||
// accessible for the next DOM node which has one (based on forward depth first search)
|
||||
nsAccessible *descendantAcc = nsnull;
|
||||
if (findNode) {
|
||||
nsCOMPtr<nsIContent> findContent = do_QueryInterface(findNode);
|
||||
if (findContent->IsHTML() &&
|
||||
nsCOMPtr<nsIContent> findContent(do_QueryInterface(findNode));
|
||||
if (findContent && findContent->IsHTML() &&
|
||||
findContent->NodeInfo()->Equals(nsAccessibilityAtoms::br) &&
|
||||
findContent->AttrValueIs(kNameSpaceID_None,
|
||||
nsAccessibilityAtoms::mozeditorbogusnode,
|
||||
|
@ -807,14 +795,14 @@ nsHyperTextAccessible::GetRelativeOffset(nsIPresShell *aPresShell,
|
|||
|
||||
// Turn the resulting node and offset into a hyperTextOffset
|
||||
PRInt32 hyperTextOffset;
|
||||
nsCOMPtr<nsIDOMNode> resultNode = do_QueryInterface(pos.mResultContent);
|
||||
NS_ENSURE_TRUE(resultNode, -1);
|
||||
if (!pos.mResultContent)
|
||||
return -1;
|
||||
|
||||
// If finalAccessible is nsnull, then DOMPointToHypertextOffset() searched
|
||||
// through the hypertext children without finding the node/offset position.
|
||||
nsAccessible *finalAccessible =
|
||||
DOMPointToHypertextOffset(resultNode, pos.mContentOffset, &hyperTextOffset,
|
||||
aDirection == eDirNext);
|
||||
DOMPointToHypertextOffset(pos.mResultContent, pos.mContentOffset,
|
||||
&hyperTextOffset, aDirection == eDirNext);
|
||||
|
||||
if (!finalAccessible && aDirection == eDirPrevious) {
|
||||
// If we reached the end during search, this means we didn't find the DOM point
|
||||
|
@ -1176,10 +1164,7 @@ nsHyperTextAccessible::GetDefaultTextAttributes(nsIPersistentProperties **aAttri
|
|||
PRInt32
|
||||
nsHyperTextAccessible::GetLevelInternal()
|
||||
{
|
||||
nsCOMPtr<nsIContent> content = nsCoreUtils::GetRoleContent(mDOMNode);
|
||||
NS_ENSURE_TRUE(content, 0);
|
||||
|
||||
nsIAtom *tag = content->Tag();
|
||||
nsIAtom *tag = mContent->Tag();
|
||||
if (tag == nsAccessibilityAtoms::h1)
|
||||
return 1;
|
||||
if (tag == nsAccessibilityAtoms::h2)
|
||||
|
@ -1213,7 +1198,7 @@ nsHyperTextAccessible::GetAttributesInternal(nsIPersistentProperties *aAttribute
|
|||
oldValueUnused);
|
||||
}
|
||||
|
||||
if (gLastFocusedNode == mDOMNode) {
|
||||
if (gLastFocusedNode == GetNode()) {
|
||||
PRInt32 lineNumber = GetCaretLineNumber();
|
||||
if (lineNumber >= 1) {
|
||||
nsAutoString strLineNumber;
|
||||
|
@ -1505,12 +1490,12 @@ NS_IMETHODIMP
|
|||
nsHyperTextAccessible::GetAssociatedEditor(nsIEditor **aEditor)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aEditor);
|
||||
|
||||
*aEditor = nsnull;
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
|
||||
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
|
||||
|
||||
if (!content->HasFlag(NODE_IS_EDITABLE)) {
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!mContent->HasFlag(NODE_IS_EDITABLE)) {
|
||||
// If we're inside an editable container, then return that container's editor
|
||||
nsCOMPtr<nsIAccessible> ancestor, current = this;
|
||||
while (NS_SUCCEEDED(current->GetParent(getter_AddRefs(ancestor))) && ancestor) {
|
||||
|
@ -1528,7 +1513,7 @@ nsHyperTextAccessible::GetAssociatedEditor(nsIEditor **aEditor)
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
|
||||
nsCoreUtils::GetDocShellTreeItemFor(mDOMNode);
|
||||
nsCoreUtils::GetDocShellTreeItemFor(mContent);
|
||||
nsCOMPtr<nsIEditingSession> editingSession(do_GetInterface(docShellTreeItem));
|
||||
if (!editingSession)
|
||||
return NS_OK; // No editing session interface
|
||||
|
@ -1600,13 +1585,13 @@ nsHyperTextAccessible::GetCaretOffset(PRInt32 *aCaretOffset)
|
|||
|
||||
// No caret if the focused node is not inside this DOM node and this DOM node
|
||||
// is not inside of focused node.
|
||||
nsCOMPtr<nsINode> thisNode(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsINode> lastFocusedNode(do_QueryInterface(gLastFocusedNode));
|
||||
PRBool isInsideOfFocusedNode =
|
||||
nsCoreUtils::IsAncestorOf(lastFocusedNode, thisNode);
|
||||
|
||||
if (!isInsideOfFocusedNode && mDOMNode != gLastFocusedNode &&
|
||||
!nsCoreUtils::IsAncestorOf(thisNode, lastFocusedNode))
|
||||
nsINode* thisNode = GetNode();
|
||||
PRBool isInsideOfFocusedNode =
|
||||
nsCoreUtils::IsAncestorOf(gLastFocusedNode, thisNode);
|
||||
|
||||
if (!isInsideOfFocusedNode && thisNode != gLastFocusedNode &&
|
||||
!nsCoreUtils::IsAncestorOf(thisNode, gLastFocusedNode))
|
||||
return NS_OK;
|
||||
|
||||
// Turn the focus node and offset of the selection into caret hypretext
|
||||
|
@ -1626,8 +1611,8 @@ nsHyperTextAccessible::GetCaretOffset(PRInt32 *aCaretOffset)
|
|||
|
||||
// No caret if this DOM node is inside of focused node but the selection's
|
||||
// focus point is not inside of this DOM node.
|
||||
nsCOMPtr<nsINode> focusNode(do_QueryInterface(focusDOMNode));
|
||||
if (isInsideOfFocusedNode) {
|
||||
nsCOMPtr<nsINode> focusNode(do_QueryInterface(focusDOMNode));
|
||||
nsINode *resultNode =
|
||||
nsCoreUtils::GetDOMNodeFromDOMPoint(focusNode, focusOffset);
|
||||
|
||||
|
@ -1636,7 +1621,7 @@ nsHyperTextAccessible::GetCaretOffset(PRInt32 *aCaretOffset)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
DOMPointToHypertextOffset(focusDOMNode, focusOffset, aCaretOffset);
|
||||
DOMPointToHypertextOffset(focusNode, focusOffset, aCaretOffset);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1656,10 +1641,8 @@ PRInt32 nsHyperTextAccessible::GetCaretLineNumber()
|
|||
nsCOMPtr<nsIDOMNode> caretNode;
|
||||
domSel->GetFocusNode(getter_AddRefs(caretNode));
|
||||
nsCOMPtr<nsIContent> caretContent = do_QueryInterface(caretNode);
|
||||
nsCOMPtr<nsINode> thisNode(do_QueryInterface(mDOMNode));
|
||||
if (!caretContent || !nsCoreUtils::IsAncestorOf(thisNode, caretContent)) {
|
||||
if (!caretContent || !nsCoreUtils::IsAncestorOf(GetNode(), caretContent))
|
||||
return -1;
|
||||
}
|
||||
|
||||
PRInt32 caretOffset, returnOffsetUnused;
|
||||
domSel->GetFocusOffset(&caretOffset);
|
||||
|
@ -1670,7 +1653,7 @@ PRInt32 nsHyperTextAccessible::GetCaretLineNumber()
|
|||
|
||||
PRInt32 lineNumber = 1;
|
||||
nsAutoLineIterator lineIterForCaret;
|
||||
nsCOMPtr<nsIContent> hyperTextContent = do_QueryInterface(mDOMNode);
|
||||
nsIContent *hyperTextContent = IsContent() ? mContent : nsnull;
|
||||
while (caretFrame) {
|
||||
if (hyperTextContent == caretFrame->GetContent()) {
|
||||
return lineNumber; // Must be in a single line hyper text, there is no line iterator
|
||||
|
@ -1714,9 +1697,9 @@ nsHyperTextAccessible::GetSelections(PRInt16 aType,
|
|||
nsISelection **aDomSel,
|
||||
nsCOMArray<nsIDOMRange>* aRanges)
|
||||
{
|
||||
if (!mDOMNode) {
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (aSelCon) {
|
||||
*aSelCon = nsnull;
|
||||
}
|
||||
|
@ -1766,7 +1749,7 @@ nsHyperTextAccessible::GetSelections(PRInt16 aType,
|
|||
nsCOMPtr<nsISelection2> selection2(do_QueryInterface(domSel));
|
||||
NS_ENSURE_TRUE(selection2, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> startNode(mDOMNode);
|
||||
nsCOMPtr<nsINode> startNode = GetNode();
|
||||
if (peditor) {
|
||||
nsCOMPtr<nsIDOMElement> editorRoot;
|
||||
editor->GetRootElement(getter_AddRefs(editorRoot));
|
||||
|
@ -1774,15 +1757,11 @@ nsHyperTextAccessible::GetSelections(PRInt16 aType,
|
|||
}
|
||||
NS_ENSURE_STATE(startNode);
|
||||
|
||||
nsCOMPtr<nsIDOMNodeList> childNodes;
|
||||
nsresult rv = startNode->GetChildNodes(getter_AddRefs(childNodes));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
PRUint32 numChildren;
|
||||
rv = childNodes->GetLength(&numChildren);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = selection2->GetRangesForIntervalCOMArray(startNode, 0,
|
||||
startNode, numChildren,
|
||||
PR_TRUE, aRanges);
|
||||
PRUint32 childCount = startNode->GetChildCount();
|
||||
nsCOMPtr<nsIDOMNode> startDOMNode(do_QueryInterface(startNode));
|
||||
nsresult rv = selection2->
|
||||
GetRangesForIntervalCOMArray(startDOMNode, 0, startDOMNode, childCount,
|
||||
PR_TRUE, aRanges);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// Remove collapsed ranges
|
||||
PRInt32 numRanges = aRanges->Count();
|
||||
|
@ -1836,14 +1815,16 @@ NS_IMETHODIMP nsHyperTextAccessible::GetSelectionBounds(PRInt32 aSelectionNum, P
|
|||
nsCOMPtr<nsIDOMRange> range = ranges[aSelectionNum];
|
||||
|
||||
// Get start point
|
||||
nsCOMPtr<nsIDOMNode> startNode;
|
||||
range->GetStartContainer(getter_AddRefs(startNode));
|
||||
nsCOMPtr<nsIDOMNode> startDOMNode;
|
||||
range->GetStartContainer(getter_AddRefs(startDOMNode));
|
||||
nsCOMPtr<nsINode> startNode(do_QueryInterface(startDOMNode));
|
||||
PRInt32 startOffset;
|
||||
range->GetStartOffset(&startOffset);
|
||||
|
||||
// Get end point
|
||||
nsCOMPtr<nsIDOMNode> endNode;
|
||||
range->GetEndContainer(getter_AddRefs(endNode));
|
||||
nsCOMPtr<nsIDOMNode> endDOMNode;
|
||||
range->GetEndContainer(getter_AddRefs(endDOMNode));
|
||||
nsCOMPtr<nsINode> endNode(do_QueryInterface(endDOMNode));
|
||||
PRInt32 endOffset;
|
||||
range->GetEndOffset(&endOffset);
|
||||
|
||||
|
@ -2191,24 +2172,25 @@ nsHyperTextAccessible::DOMRangeBoundToHypertextOffset(nsIDOMRange *aRange,
|
|||
PRBool aIsStartHTOffset,
|
||||
PRInt32 *aHTOffset)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIDOMNode> DOMNode;
|
||||
PRInt32 nodeOffset = 0;
|
||||
|
||||
nsresult rv;
|
||||
if (aIsStartBound) {
|
||||
rv = aRange->GetStartContainer(getter_AddRefs(node));
|
||||
rv = aRange->GetStartContainer(getter_AddRefs(DOMNode));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = aRange->GetStartOffset(&nodeOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else {
|
||||
rv = aRange->GetEndContainer(getter_AddRefs(node));
|
||||
rv = aRange->GetEndContainer(getter_AddRefs(DOMNode));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = aRange->GetEndOffset(&nodeOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsINode> node(do_QueryInterface(DOMNode));
|
||||
nsAccessible *startAcc =
|
||||
DOMPointToHypertextOffset(node, nodeOffset, aHTOffset);
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ class nsHyperTextAccessible : public nsAccessibleWrap,
|
|||
public nsIAccessibleEditableText
|
||||
{
|
||||
public:
|
||||
nsHyperTextAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
nsHyperTextAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLETEXT
|
||||
NS_DECL_NSIACCESSIBLEHYPERTEXT
|
||||
|
@ -120,7 +120,7 @@ public:
|
|||
* it is within the current nsHyperTextAccessible,
|
||||
* otherwise nsnull
|
||||
*/
|
||||
nsAccessible *DOMPointToHypertextOffset(nsIDOMNode *aNode,
|
||||
nsAccessible *DOMPointToHypertextOffset(nsINode *aNode,
|
||||
PRInt32 aNodeOffset,
|
||||
PRInt32 *aHypertextOffset,
|
||||
PRBool aIsEndOffset = PR_FALSE);
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
class nsAccessNodeWrap : public nsAccessNode
|
||||
{
|
||||
public: // construction, destruction
|
||||
nsAccessNodeWrap(nsIDOMNode *aNode, nsIWeakReference* aShell);
|
||||
nsAccessNodeWrap(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
virtual ~nsAccessNodeWrap();
|
||||
|
||||
static void InitAccessibility();
|
||||
|
|
|
@ -51,8 +51,9 @@
|
|||
// construction
|
||||
//-----------------------------------------------------
|
||||
|
||||
nsAccessNodeWrap::nsAccessNodeWrap(nsIDOMNode *aNode, nsIWeakReference* aShell):
|
||||
nsAccessNode(aNode, aShell)
|
||||
nsAccessNodeWrap::
|
||||
nsAccessNodeWrap(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsAccessNode(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ struct objc_class;
|
|||
class nsAccessibleWrap : public nsAccessible
|
||||
{
|
||||
public: // construction, destruction
|
||||
nsAccessibleWrap(nsIDOMNode*, nsIWeakReference *aShell);
|
||||
nsAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
virtual ~nsAccessibleWrap();
|
||||
|
||||
// creates the native accessible connected to this one.
|
||||
|
|
|
@ -46,9 +46,9 @@
|
|||
#import "mozActionElements.h"
|
||||
#import "mozTextAccessible.h"
|
||||
|
||||
nsAccessibleWrap::nsAccessibleWrap(nsIDOMNode* aNode, nsIWeakReference *aShell):
|
||||
nsAccessible(aNode, aShell),
|
||||
mNativeWrapper(nsnull)
|
||||
nsAccessibleWrap::
|
||||
nsAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsAccessible(aContent, aShell), mNativeWrapper(nsnull)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -44,8 +44,9 @@
|
|||
class nsDocAccessibleWrap: public nsDocAccessible
|
||||
{
|
||||
public:
|
||||
nsDocAccessibleWrap(nsIDOMNode *aNode, nsIWeakReference *aShell);
|
||||
virtual ~nsDocAccessibleWrap();
|
||||
nsDocAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
|
||||
nsIWeakReference *aShell);
|
||||
virtual ~nsDocAccessibleWrap();
|
||||
|
||||
// nsIAccessNode
|
||||
|
||||
|
|
|
@ -40,8 +40,9 @@
|
|||
#import "mozAccessibleWrapper.h"
|
||||
|
||||
nsDocAccessibleWrap::
|
||||
nsDocAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell) :
|
||||
nsDocAccessible(aDOMNode, aShell)
|
||||
nsDocAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
|
||||
nsIWeakReference *aShell) :
|
||||
nsDocAccessible(aDocument, aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -49,9 +49,10 @@ struct objc_class;
|
|||
|
||||
class nsRootAccessibleWrap : public nsRootAccessible
|
||||
{
|
||||
public:
|
||||
nsRootAccessibleWrap(nsIDOMNode *aNode, nsIWeakReference *aShell);
|
||||
virtual ~nsRootAccessibleWrap();
|
||||
public:
|
||||
nsRootAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
|
||||
nsIWeakReference *aShell);
|
||||
virtual ~nsRootAccessibleWrap();
|
||||
|
||||
objc_class* GetNativeType ();
|
||||
|
||||
|
|
|
@ -48,8 +48,10 @@
|
|||
#import "mozAccessibleWrapper.h"
|
||||
|
||||
|
||||
nsRootAccessibleWrap::nsRootAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell):
|
||||
nsRootAccessible(aDOMNode, aShell)
|
||||
nsRootAccessibleWrap::
|
||||
nsRootAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
|
||||
nsIWeakReference *aShell) :
|
||||
nsRootAccessible(aDocument, aRootContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -53,8 +53,8 @@ class nsARIAGridAccessibleWrap : public nsARIAGridAccessible,
|
|||
public CAccessibleTable
|
||||
{
|
||||
public:
|
||||
nsARIAGridAccessibleWrap(nsIDOMNode* aNode, nsIWeakReference* aShell) :
|
||||
nsARIAGridAccessible(aNode, aShell) {}
|
||||
nsARIAGridAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsARIAGridAccessible(aContent, aShell) {}
|
||||
|
||||
// IUnknown
|
||||
DECL_IUNKNOWN_INHERITED
|
||||
|
@ -71,8 +71,8 @@ class nsARIAGridCellAccessibleWrap : public nsARIAGridCellAccessible,
|
|||
public CAccessibleTableCell
|
||||
{
|
||||
public:
|
||||
nsARIAGridCellAccessibleWrap(nsIDOMNode* aNode, nsIWeakReference* aShell) :
|
||||
nsARIAGridCellAccessible(aNode, aShell) {}
|
||||
nsARIAGridCellAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsARIAGridCellAccessible(aContent, aShell) {}
|
||||
|
||||
// IUnknown
|
||||
DECL_IUNKNOWN_INHERITED
|
||||
|
|
|
@ -81,22 +81,16 @@ nsIAccessibleTextChangeEvent *nsAccessNodeWrap::gTextEvent = nsnull;
|
|||
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class nsAccessNodeWrap
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessNodeWrap
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//-----------------------------------------------------
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
|
||||
nsAccessNodeWrap::nsAccessNodeWrap(nsIDOMNode *aNode, nsIWeakReference* aShell):
|
||||
nsAccessNode(aNode, aShell)
|
||||
nsAccessNodeWrap::
|
||||
nsAccessNodeWrap(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsAccessNode(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// destruction
|
||||
//-----------------------------------------------------
|
||||
nsAccessNodeWrap::~nsAccessNodeWrap()
|
||||
{
|
||||
}
|
||||
|
@ -188,26 +182,28 @@ __try{
|
|||
*aNodeName = nsnull;
|
||||
*aNodeValue = nsnull;
|
||||
|
||||
if (!mDOMNode)
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(GetNode()));
|
||||
|
||||
PRUint16 nodeType = 0;
|
||||
mDOMNode->GetNodeType(&nodeType);
|
||||
DOMNode->GetNodeType(&nodeType);
|
||||
*aNodeType=static_cast<unsigned short>(nodeType);
|
||||
|
||||
if (*aNodeType != NODETYPE_TEXT) {
|
||||
nsAutoString nodeName;
|
||||
mDOMNode->GetNodeName(nodeName);
|
||||
DOMNode->GetNodeName(nodeName);
|
||||
*aNodeName = ::SysAllocString(nodeName.get());
|
||||
}
|
||||
|
||||
nsAutoString nodeValue;
|
||||
|
||||
mDOMNode->GetNodeValue(nodeValue);
|
||||
DOMNode->GetNodeValue(nodeValue);
|
||||
*aNodeValue = ::SysAllocString(nodeValue.get());
|
||||
*aNameSpaceID = content ? static_cast<short>(content->GetNameSpaceID()) : 0;
|
||||
|
||||
*aNameSpaceID = IsContent() ?
|
||||
static_cast<short>(mContent->GetNameSpaceID()) : 0;
|
||||
|
||||
// This is a unique ID for every content node. The 3rd party
|
||||
// accessibility application can compare this to the childID we
|
||||
|
@ -217,12 +213,7 @@ __try{
|
|||
GetUniqueID(&uniqueID);
|
||||
*aUniqueID = - NS_PTR_TO_INT32(uniqueID);
|
||||
|
||||
*aNumChildren = 0;
|
||||
PRUint32 numChildren = 0;
|
||||
nsCOMPtr<nsIDOMNodeList> nodeList;
|
||||
mDOMNode->GetChildNodes(getter_AddRefs(nodeList));
|
||||
if (nodeList && NS_OK == nodeList->GetLength(&numChildren))
|
||||
*aNumChildren = static_cast<unsigned int>(numChildren);
|
||||
*aNumChildren = GetNode()->GetChildCount();
|
||||
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
return S_OK;
|
||||
|
@ -240,12 +231,10 @@ STDMETHODIMP nsAccessNodeWrap::get_attributes(
|
|||
__try{
|
||||
*aNumAttribs = 0;
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
if (!content)
|
||||
if (IsDefunct() || IsDocument())
|
||||
return E_FAIL;
|
||||
|
||||
PRUint32 numAttribs = content->GetAttrCount();
|
||||
|
||||
PRUint32 numAttribs = mContent->GetAttrCount();
|
||||
if (numAttribs > aMaxAttribs)
|
||||
numAttribs = aMaxAttribs;
|
||||
*aNumAttribs = static_cast<unsigned short>(numAttribs);
|
||||
|
@ -254,10 +243,10 @@ __try{
|
|||
aNameSpaceIDs[index] = 0; aAttribValues[index] = aAttribNames[index] = nsnull;
|
||||
nsAutoString attributeValue;
|
||||
|
||||
const nsAttrName* name = content->GetAttrNameAt(index);
|
||||
const nsAttrName* name = mContent->GetAttrNameAt(index);
|
||||
aNameSpaceIDs[index] = static_cast<short>(name->NamespaceID());
|
||||
aAttribNames[index] = ::SysAllocString(name->LocalName()->GetUTF16String());
|
||||
content->GetAttr(name->NamespaceID(), name->LocalName(), attributeValue);
|
||||
mContent->GetAttr(name->NamespaceID(), name->LocalName(), attributeValue);
|
||||
aAttribValues[index] = ::SysAllocString(attributeValue.get());
|
||||
}
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
@ -273,15 +262,10 @@ STDMETHODIMP nsAccessNodeWrap::get_attributesForNames(
|
|||
/* [length_is][size_is][retval] */ BSTR __RPC_FAR *aAttribValues)
|
||||
{
|
||||
__try {
|
||||
nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
|
||||
if (!domElement || !content)
|
||||
return E_FAIL;
|
||||
|
||||
if (!content->GetDocument())
|
||||
if (IsDefunct() || IsDocument())
|
||||
return E_FAIL;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(mContent));
|
||||
nsCOMPtr<nsINameSpaceManager> nameSpaceManager =
|
||||
do_GetService(NS_NAMESPACEMANAGER_CONTRACTID);
|
||||
|
||||
|
@ -320,12 +304,11 @@ STDMETHODIMP nsAccessNodeWrap::get_computedStyle(
|
|||
__try{
|
||||
*aNumStyleProperties = 0;
|
||||
|
||||
if (IsDefunct())
|
||||
if (IsDefunct() || IsDocument())
|
||||
return E_FAIL;
|
||||
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> cssDecl;
|
||||
nsCoreUtils::GetComputedStyleDeclaration(EmptyString(), mDOMNode,
|
||||
getter_AddRefs(cssDecl));
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> cssDecl =
|
||||
nsCoreUtils::GetComputedStyleDeclaration(EmptyString(), mContent);
|
||||
NS_ENSURE_TRUE(cssDecl, E_FAIL);
|
||||
|
||||
PRUint32 length;
|
||||
|
@ -356,12 +339,11 @@ STDMETHODIMP nsAccessNodeWrap::get_computedStyleForProperties(
|
|||
/* [length_is][size_is][out] */ BSTR __RPC_FAR *aStyleValues)
|
||||
{
|
||||
__try {
|
||||
if (IsDefunct())
|
||||
if (IsDefunct() || IsDocument())
|
||||
return E_FAIL;
|
||||
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> cssDecl;
|
||||
nsCoreUtils::GetComputedStyleDeclaration(EmptyString(), mDOMNode,
|
||||
getter_AddRefs(cssDecl));
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> cssDecl =
|
||||
nsCoreUtils::GetComputedStyleDeclaration(EmptyString(), mContent);
|
||||
NS_ENSURE_TRUE(cssDecl, E_FAIL);
|
||||
|
||||
PRUint32 index;
|
||||
|
@ -391,30 +373,17 @@ __try {
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
ISimpleDOMNode* nsAccessNodeWrap::MakeAccessNode(nsIDOMNode *node)
|
||||
ISimpleDOMNode*
|
||||
nsAccessNodeWrap::MakeAccessNode(nsINode *aNode)
|
||||
{
|
||||
if (!node)
|
||||
if (!aNode)
|
||||
return NULL;
|
||||
|
||||
nsAccessNodeWrap *newNode = NULL;
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
|
||||
if (content)
|
||||
doc = content->GetDocument();
|
||||
else {
|
||||
// Get the document via QueryInterface, since there is no content node
|
||||
doc = do_QueryInterface(node);
|
||||
content = do_QueryInterface(node);
|
||||
}
|
||||
|
||||
if (!doc)
|
||||
return NULL;
|
||||
|
||||
ISimpleDOMNode *iNode = NULL;
|
||||
nsAccessible *acc =
|
||||
GetAccService()->GetAccessibleInWeakShell(node, mWeakShell);
|
||||
GetAccService()->GetAccessibleInWeakShell(aNode, mWeakShell);
|
||||
if (acc) {
|
||||
IAccessible *msaaAccessible = nsnull;
|
||||
acc->GetNativeInterface((void**)&msaaAccessible); // addrefs
|
||||
|
@ -422,7 +391,13 @@ ISimpleDOMNode* nsAccessNodeWrap::MakeAccessNode(nsIDOMNode *node)
|
|||
msaaAccessible->Release(); // Release IAccessible
|
||||
}
|
||||
else {
|
||||
newNode = new nsAccessNodeWrap(node, mWeakShell);
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
|
||||
if (!content) {
|
||||
NS_NOTREACHED("The node is a document which is not accessible!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
newNode = new nsAccessNodeWrap(content, mWeakShell);
|
||||
if (!newNode)
|
||||
return NULL;
|
||||
|
||||
|
@ -438,12 +413,11 @@ ISimpleDOMNode* nsAccessNodeWrap::MakeAccessNode(nsIDOMNode *node)
|
|||
STDMETHODIMP nsAccessNodeWrap::get_parentNode(ISimpleDOMNode __RPC_FAR *__RPC_FAR *aNode)
|
||||
{
|
||||
__try {
|
||||
if (!mDOMNode)
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
mDOMNode->GetParentNode(getter_AddRefs(node));
|
||||
*aNode = MakeAccessNode(node);
|
||||
|
||||
*aNode = MakeAccessNode(GetNode()->GetNodeParent());
|
||||
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return S_OK;
|
||||
|
@ -452,12 +426,11 @@ __try {
|
|||
STDMETHODIMP nsAccessNodeWrap::get_firstChild(ISimpleDOMNode __RPC_FAR *__RPC_FAR *aNode)
|
||||
{
|
||||
__try {
|
||||
if (!mDOMNode)
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
mDOMNode->GetFirstChild(getter_AddRefs(node));
|
||||
*aNode = MakeAccessNode(node);
|
||||
|
||||
*aNode = MakeAccessNode(GetNode()->GetFirstChild());
|
||||
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return S_OK;
|
||||
|
@ -465,13 +438,12 @@ __try {
|
|||
|
||||
STDMETHODIMP nsAccessNodeWrap::get_lastChild(ISimpleDOMNode __RPC_FAR *__RPC_FAR *aNode)
|
||||
{
|
||||
__try {
|
||||
if (!mDOMNode)
|
||||
__try {
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
mDOMNode->GetLastChild(getter_AddRefs(node));
|
||||
*aNode = MakeAccessNode(node);
|
||||
*aNode = MakeAccessNode(GetNode()->GetLastChild());
|
||||
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return S_OK;
|
||||
|
@ -480,12 +452,11 @@ STDMETHODIMP nsAccessNodeWrap::get_lastChild(ISimpleDOMNode __RPC_FAR *__RPC_FAR
|
|||
STDMETHODIMP nsAccessNodeWrap::get_previousSibling(ISimpleDOMNode __RPC_FAR *__RPC_FAR *aNode)
|
||||
{
|
||||
__try {
|
||||
if (!mDOMNode)
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
mDOMNode->GetPreviousSibling(getter_AddRefs(node));
|
||||
*aNode = MakeAccessNode(node);
|
||||
*aNode = MakeAccessNode(GetNode()->GetPreviousSibling());
|
||||
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return S_OK;
|
||||
|
@ -494,12 +465,11 @@ __try {
|
|||
STDMETHODIMP nsAccessNodeWrap::get_nextSibling(ISimpleDOMNode __RPC_FAR *__RPC_FAR *aNode)
|
||||
{
|
||||
__try {
|
||||
if (!mDOMNode)
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
mDOMNode->GetNextSibling(getter_AddRefs(node));
|
||||
*aNode = MakeAccessNode(node);
|
||||
*aNode = MakeAccessNode(GetNode()->GetNextSibling());
|
||||
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return S_OK;
|
||||
|
@ -512,17 +482,11 @@ nsAccessNodeWrap::get_childAt(unsigned aChildIndex,
|
|||
__try {
|
||||
*aNode = nsnull;
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
if (!content)
|
||||
return E_FAIL; // Node already shut down
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node =
|
||||
do_QueryInterface(content->GetChildAt(aChildIndex));
|
||||
*aNode = MakeAccessNode(GetNode()->GetChildAt(aChildIndex));
|
||||
|
||||
if (!node)
|
||||
return E_FAIL; // No such child
|
||||
|
||||
*aNode = MakeAccessNode(node);
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return S_OK;
|
||||
|
@ -534,7 +498,7 @@ nsAccessNodeWrap::get_innerHTML(BSTR __RPC_FAR *aInnerHTML)
|
|||
__try {
|
||||
*aInnerHTML = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMNSHTMLElement> domNSElement(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMNSHTMLElement> domNSElement(do_QueryInterface(GetNode()));
|
||||
if (!domNSElement)
|
||||
return E_FAIL; // Node already shut down
|
||||
|
||||
|
|
|
@ -83,9 +83,9 @@ class nsAccessNodeWrap : public nsAccessNode,
|
|||
public: // IServiceProvider
|
||||
STDMETHODIMP QueryService(REFGUID guidService, REFIID riid, void** ppv);
|
||||
|
||||
public: // construction, destruction
|
||||
nsAccessNodeWrap(nsIDOMNode *, nsIWeakReference* aShell);
|
||||
virtual ~nsAccessNodeWrap();
|
||||
public: // construction, destruction
|
||||
nsAccessNodeWrap(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
virtual ~nsAccessNodeWrap();
|
||||
|
||||
// IUnknown
|
||||
STDMETHODIMP QueryInterface(REFIID, void**);
|
||||
|
@ -162,9 +162,17 @@ class nsAccessNodeWrap : public nsAccessNode,
|
|||
static void TurnOffNewTabSwitchingForJawsAndWE();
|
||||
|
||||
static void DoATSpecificProcessing();
|
||||
protected:
|
||||
|
||||
protected:
|
||||
void GetAccessibleFor(nsIDOMNode *node, nsIAccessible **newAcc);
|
||||
ISimpleDOMNode* MakeAccessNode(nsIDOMNode *node);
|
||||
|
||||
/**
|
||||
* Return ISimpleDOMNode instance for existing accessible object or
|
||||
* creates new nsAccessNode instance if the accessible doesn't exist.
|
||||
*
|
||||
* @note ISimpleDOMNode is returned addrefed
|
||||
*/
|
||||
ISimpleDOMNode *MakeAccessNode(nsINode *aNode);
|
||||
|
||||
static PRBool gIsEnumVariantSupportDisabled;
|
||||
|
||||
|
|
|
@ -82,15 +82,16 @@ EXTERN_C GUID CDECL CLSID_Accessible =
|
|||
|
||||
static const PRInt32 kIEnumVariantDisconnected = -1;
|
||||
|
||||
/*
|
||||
* Class nsAccessibleWrap
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessibleWrap
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//-----------------------------------------------------
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
nsAccessibleWrap::nsAccessibleWrap(nsIDOMNode* aNode, nsIWeakReference *aShell):
|
||||
nsAccessible(aNode, aShell), mEnumVARIANTPosition(0), mTypeInfo(NULL)
|
||||
nsAccessibleWrap::
|
||||
nsAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsAccessible(aContent, aShell), mEnumVARIANTPosition(0), mTypeInfo(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -481,7 +482,7 @@ __try {
|
|||
// -- Try BSTR role
|
||||
// Could not map to known enumerated MSAA role like ROLE_BUTTON
|
||||
// Use BSTR role to expose role attribute or tag name + namespace
|
||||
nsIContent *content = nsCoreUtils::GetRoleContent(xpAccessible->GetDOMNode());
|
||||
nsIContent *content = xpAccessible->GetContent();
|
||||
if (!content)
|
||||
return E_FAIL;
|
||||
|
||||
|
@ -596,9 +597,8 @@ STDMETHODIMP nsAccessibleWrap::get_accFocus(
|
|||
// VT_DISPATCH: pdispVal member is the address of the IDispatch interface
|
||||
// for the child object with the keyboard focus.
|
||||
__try {
|
||||
if (!mDOMNode) {
|
||||
return E_FAIL; // This node is shut down
|
||||
}
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
|
||||
VariantInit(pvarChild);
|
||||
|
||||
|
@ -1470,7 +1470,7 @@ nsAccessibleWrap::get_windowHandle(HWND *aWindowHandle)
|
|||
__try {
|
||||
*aWindowHandle = 0;
|
||||
|
||||
if (!mDOMNode)
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
|
||||
void *handle = nsnull;
|
||||
|
|
|
@ -103,9 +103,9 @@ class nsAccessibleWrap : public nsAccessible,
|
|||
public IAccessible2,
|
||||
public IEnumVARIANT
|
||||
{
|
||||
public: // construction, destruction
|
||||
nsAccessibleWrap(nsIDOMNode*, nsIWeakReference *aShell);
|
||||
virtual ~nsAccessibleWrap();
|
||||
public: // construction, destruction
|
||||
nsAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
virtual ~nsAccessibleWrap();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
|
|
@ -57,9 +57,10 @@
|
|||
// nsDocAccessibleWrap
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsDocAccessibleWrap::nsDocAccessibleWrap(nsIDOMNode *aDOMNode,
|
||||
nsIWeakReference *aShell) :
|
||||
nsDocAccessible(aDOMNode, aShell)
|
||||
nsDocAccessibleWrap::
|
||||
nsDocAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
|
||||
nsIWeakReference *aShell) :
|
||||
nsDocAccessible(aDocument, aRootContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -53,8 +53,9 @@ class nsDocAccessibleWrap: public nsDocAccessible,
|
|||
public ISimpleDOMDocument
|
||||
{
|
||||
public:
|
||||
nsDocAccessibleWrap(nsIDOMNode *aNode, nsIWeakReference *aShell);
|
||||
virtual ~nsDocAccessibleWrap();
|
||||
nsDocAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
|
||||
nsIWeakReference *aShell);
|
||||
virtual ~nsDocAccessibleWrap();
|
||||
|
||||
// IUnknown
|
||||
STDMETHODIMP_(ULONG) AddRef();
|
||||
|
|
|
@ -48,8 +48,8 @@ class nsHTMLImageAccessibleWrap : public nsHTMLImageAccessible,
|
|||
public CAccessibleImage
|
||||
{
|
||||
public:
|
||||
nsHTMLImageAccessibleWrap(nsIDOMNode* aNode, nsIWeakReference* aShell) :
|
||||
nsHTMLImageAccessible(aNode, aShell){}
|
||||
nsHTMLImageAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsHTMLImageAccessible(aContent, aShell) {}
|
||||
|
||||
// IUnknown
|
||||
DECL_IUNKNOWN_INHERITED
|
||||
|
|
|
@ -54,8 +54,8 @@ class nsHTMLTableAccessibleWrap : public nsHTMLTableAccessible,
|
|||
public CAccessibleTable
|
||||
{
|
||||
public:
|
||||
nsHTMLTableAccessibleWrap(nsIDOMNode* aNode, nsIWeakReference* aShell) :
|
||||
nsHTMLTableAccessible(aNode, aShell){}
|
||||
nsHTMLTableAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsHTMLTableAccessible(aContent, aShell) {}
|
||||
|
||||
// IUnknown
|
||||
DECL_IUNKNOWN_INHERITED
|
||||
|
@ -73,8 +73,8 @@ class nsHTMLTableCellAccessibleWrap : public nsHTMLTableCellAccessible,
|
|||
public CAccessibleTableCell
|
||||
{
|
||||
public:
|
||||
nsHTMLTableCellAccessibleWrap(nsIDOMNode* aNode, nsIWeakReference* aShell) :
|
||||
nsHTMLTableCellAccessible(aNode, aShell) {}
|
||||
nsHTMLTableCellAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsHTMLTableCellAccessible(aContent, aShell) {}
|
||||
|
||||
// IUnknown
|
||||
DECL_IUNKNOWN_INHERITED
|
||||
|
@ -92,9 +92,9 @@ class nsHTMLTableHeaderCellAccessibleWrap : public nsHTMLTableHeaderCellAccessib
|
|||
public CAccessibleTableCell
|
||||
{
|
||||
public:
|
||||
nsHTMLTableHeaderCellAccessibleWrap(nsIDOMNode* aNode,
|
||||
nsIWeakReference* aShell) :
|
||||
nsHTMLTableHeaderCellAccessible(aNode, aShell) {}
|
||||
nsHTMLTableHeaderCellAccessibleWrap(nsIContent *aContent,
|
||||
nsIWeakReference *aShell) :
|
||||
nsHTMLTableHeaderCellAccessible(aContent, aShell) {}
|
||||
|
||||
// IUnknown
|
||||
DECL_IUNKNOWN_INHERITED
|
||||
|
|
|
@ -43,12 +43,10 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHTMLWin32ObjectOwnerAccessible::
|
||||
nsHTMLWin32ObjectOwnerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell,
|
||||
void* aHwnd) :
|
||||
nsAccessibleWrap(aNode, aShell)
|
||||
nsHTMLWin32ObjectOwnerAccessible(nsIContent *aContent,
|
||||
nsIWeakReference *aShell, void *aHwnd) :
|
||||
nsAccessibleWrap(aContent, aShell), mHwnd(aHwnd)
|
||||
{
|
||||
mHwnd = aHwnd;
|
||||
|
||||
// Our only child is a nsHTMLWin32ObjectAccessible object.
|
||||
mNativeAccessible = new nsHTMLWin32ObjectAccessible(mHwnd);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,8 @@ public:
|
|||
// because the native plugin accessible doesn't know where it exists in the
|
||||
// Mozilla tree, and returns null for previous and next sibling. This would
|
||||
// have the effect of cutting off all content after the plugin.
|
||||
nsHTMLWin32ObjectOwnerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell, void* aHwnd);
|
||||
nsHTMLWin32ObjectOwnerAccessible(nsIContent *aContent,
|
||||
nsIWeakReference *aShell, void *aHwnd);
|
||||
virtual ~nsHTMLWin32ObjectOwnerAccessible() {}
|
||||
|
||||
// nsAccessNode
|
||||
|
@ -86,7 +87,7 @@ class nsHTMLWin32ObjectAccessible : public nsLeafAccessible,
|
|||
{
|
||||
public:
|
||||
|
||||
nsHTMLWin32ObjectAccessible(void* aHwnd);
|
||||
nsHTMLWin32ObjectAccessible(void *aHwnd);
|
||||
virtual ~nsHTMLWin32ObjectAccessible() {}
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
|
|
@ -51,8 +51,8 @@ class nsHyperTextAccessibleWrap : public nsHyperTextAccessible,
|
|||
public CAccessibleEditableText
|
||||
{
|
||||
public:
|
||||
nsHyperTextAccessibleWrap(nsIDOMNode* aNode, nsIWeakReference* aShell) :
|
||||
nsHyperTextAccessible(aNode, aShell){}
|
||||
nsHyperTextAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsHyperTextAccessible(aContent, aShell) {}
|
||||
|
||||
// IUnknown
|
||||
DECL_IUNKNOWN_INHERITED
|
||||
|
|
|
@ -45,10 +45,14 @@
|
|||
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
|
||||
*/
|
||||
|
||||
//----- nsRootAccessibleWrap -----
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsRootAccessibleWrap
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsRootAccessibleWrap::nsRootAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell):
|
||||
nsRootAccessible(aDOMNode, aShell)
|
||||
nsRootAccessibleWrap::
|
||||
nsRootAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
|
||||
nsIWeakReference *aShell) :
|
||||
nsRootAccessible(aDocument, aRootContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -48,9 +48,10 @@
|
|||
|
||||
class nsRootAccessibleWrap: public nsRootAccessible
|
||||
{
|
||||
public:
|
||||
nsRootAccessibleWrap(nsIDOMNode *aNode, nsIWeakReference *aShell);
|
||||
virtual ~nsRootAccessibleWrap();
|
||||
public:
|
||||
nsRootAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
|
||||
nsIWeakReference *aShell);
|
||||
virtual ~nsRootAccessibleWrap();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -50,13 +50,14 @@
|
|||
#include "nsIRenderingContext.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
||||
// --------------------------------------------------------
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsTextAccessibleWrap Accessible
|
||||
// --------------------------------------------------------
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsTextAccessibleWrap::nsTextAccessibleWrap(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsTextAccessible(aDOMNode, aShell)
|
||||
{
|
||||
nsTextAccessibleWrap::
|
||||
nsTextAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsTextAccessible(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
STDMETHODIMP_(ULONG) nsTextAccessibleWrap::AddRef()
|
||||
|
@ -89,12 +90,13 @@ STDMETHODIMP nsTextAccessibleWrap::get_domText(
|
|||
__try {
|
||||
*aDomText = NULL;
|
||||
|
||||
if (!mDOMNode) {
|
||||
return E_FAIL; // Node already shut down
|
||||
}
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
|
||||
nsAutoString nodeValue;
|
||||
|
||||
mDOMNode->GetNodeValue(nodeValue);
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
DOMNode->GetNodeValue(nodeValue);
|
||||
if (nodeValue.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
|
@ -155,9 +157,8 @@ STDMETHODIMP nsTextAccessibleWrap::get_unclippedSubstringBounds(
|
|||
__try {
|
||||
*aX = *aY = *aWidth = *aHeight = 0;
|
||||
|
||||
if (!mDOMNode) {
|
||||
return E_FAIL; // Node already shut down
|
||||
}
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
|
||||
if (NS_FAILED(GetCharacterExtents(aStartIndex, aEndIndex,
|
||||
aX, aY, aWidth, aHeight))) {
|
||||
|
@ -174,9 +175,13 @@ STDMETHODIMP nsTextAccessibleWrap::scrollToSubstring(
|
|||
/* [in] */ unsigned int aEndIndex)
|
||||
{
|
||||
__try {
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
nsresult rv =
|
||||
nsCoreUtils::ScrollSubstringTo(GetFrame(), mDOMNode, aStartIndex,
|
||||
mDOMNode, aEndIndex,
|
||||
nsCoreUtils::ScrollSubstringTo(GetFrame(), DOMNode, aStartIndex,
|
||||
DOMNode, aEndIndex,
|
||||
nsIAccessibleScrollType::SCROLL_TYPE_ANYWHERE);
|
||||
if (NS_FAILED(rv))
|
||||
return E_FAIL;
|
||||
|
|
|
@ -49,9 +49,9 @@ class nsIRenderingContext;
|
|||
class nsTextAccessibleWrap : public nsTextAccessible,
|
||||
public ISimpleDOMText
|
||||
{
|
||||
public:
|
||||
nsTextAccessibleWrap(nsIDOMNode *, nsIWeakReference* aShell);
|
||||
virtual ~nsTextAccessibleWrap() {}
|
||||
public:
|
||||
nsTextAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
virtual ~nsTextAccessibleWrap() {}
|
||||
|
||||
// IUnknown methods - see iunknown.h for documentation
|
||||
STDMETHODIMP_(ULONG) AddRef();
|
||||
|
|
|
@ -43,8 +43,8 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsXULListboxAccessibleWrap::
|
||||
nsXULListboxAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell) :
|
||||
nsXULListboxAccessible(aDOMNode, aShell)
|
||||
nsXULListboxAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsXULListboxAccessible(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -62,8 +62,8 @@ IMPL_IUNKNOWN_QUERY_TAIL
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsXULListCellAccessibleWrap::
|
||||
nsXULListCellAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell) :
|
||||
nsXULListCellAccessible(aDOMNode, aShell)
|
||||
nsXULListCellAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsXULListCellAccessible(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ class nsXULListboxAccessibleWrap : public nsXULListboxAccessible,
|
|||
public CAccessibleTable
|
||||
{
|
||||
public:
|
||||
nsXULListboxAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell);
|
||||
nsXULListboxAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// IUnknown
|
||||
DECL_IUNKNOWN_INHERITED
|
||||
|
@ -69,7 +69,7 @@ class nsXULListCellAccessibleWrap : public nsXULListCellAccessible,
|
|||
public CAccessibleTableCell
|
||||
{
|
||||
public:
|
||||
nsXULListCellAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell);
|
||||
nsXULListCellAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// IUnknown
|
||||
DECL_IUNKNOWN_INHERITED
|
||||
|
|
|
@ -39,13 +39,13 @@
|
|||
#include "nsAccessibilityAtoms.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
// --------------------------------------------------------
|
||||
// nsXULMenuAccessibleWrap Accessible
|
||||
// --------------------------------------------------------
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULMenuAccessibleWrap
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsXULMenuitemAccessibleWrap::nsXULMenuitemAccessibleWrap(nsIDOMNode *aDOMNode,
|
||||
nsIWeakReference *aShell):
|
||||
nsXULMenuitemAccessible(aDOMNode, aShell)
|
||||
nsXULMenuitemAccessibleWrap::
|
||||
nsXULMenuitemAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsXULMenuitemAccessible(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -58,11 +58,9 @@ nsXULMenuitemAccessibleWrap::GetName(nsAString& aName)
|
|||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
NS_ASSERTION(content, "Should not have gotten past nsXULMenuitemAccessible::GetName");
|
||||
|
||||
nsAutoString accel;
|
||||
content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::acceltext, accel);
|
||||
mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::acceltext, accel);
|
||||
if (!accel.IsEmpty()) {
|
||||
aName += NS_LITERAL_STRING("\t") + accel;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
class nsXULMenuitemAccessibleWrap : public nsXULMenuitemAccessible
|
||||
{
|
||||
public:
|
||||
nsXULMenuitemAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell);
|
||||
nsXULMenuitemAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
virtual ~nsXULMenuitemAccessibleWrap() {}
|
||||
|
||||
// nsIAccessible
|
||||
|
|
|
@ -44,8 +44,8 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsXULTreeGridAccessibleWrap::
|
||||
nsXULTreeGridAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell) :
|
||||
nsXULTreeGridAccessible(aDOMNode, aShell)
|
||||
nsXULTreeGridAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsXULTreeGridAccessible(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -62,13 +62,13 @@ IMPL_IUNKNOWN_INHERITED1(nsXULTreeGridAccessibleWrap,
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsXULTreeGridCellAccessibleWrap::
|
||||
nsXULTreeGridCellAccessibleWrap(nsIDOMNode *aDOMNode,
|
||||
nsXULTreeGridCellAccessibleWrap(nsIContent *aContent,
|
||||
nsIWeakReference *aShell,
|
||||
nsXULTreeGridRowAccessible *aRowAcc,
|
||||
nsITreeBoxObject *aTree,
|
||||
nsITreeView *aTreeView,
|
||||
PRInt32 aRow, nsITreeColumn* aColumn) :
|
||||
nsXULTreeGridCellAccessible(aDOMNode, aShell, aRowAcc, aTree, aTreeView,
|
||||
nsXULTreeGridCellAccessible(aContent, aShell, aRowAcc, aTree, aTreeView,
|
||||
aRow, aColumn)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ class nsXULTreeGridAccessibleWrap : public nsXULTreeGridAccessible,
|
|||
public CAccessibleTable
|
||||
{
|
||||
public:
|
||||
nsXULTreeGridAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell);
|
||||
nsXULTreeGridAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// IUnknown
|
||||
DECL_IUNKNOWN_INHERITED
|
||||
|
@ -70,7 +70,7 @@ class nsXULTreeGridCellAccessibleWrap : public nsXULTreeGridCellAccessible,
|
|||
public CAccessibleTableCell
|
||||
{
|
||||
public:
|
||||
nsXULTreeGridCellAccessibleWrap(nsIDOMNode *aDOMNode,
|
||||
nsXULTreeGridCellAccessibleWrap(nsIContent *aContent,
|
||||
nsIWeakReference *aShell,
|
||||
nsXULTreeGridRowAccessible *aRowAcc,
|
||||
nsITreeBoxObject *aTree,
|
||||
|
|
|
@ -43,16 +43,17 @@
|
|||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Class nsAccessNodeWrap
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class nsAccessNodeWrap
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//-----------------------------------------------------
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
|
||||
nsAccessNodeWrap::nsAccessNodeWrap(nsIDOMNode *aNode, nsIWeakReference* aShell):
|
||||
nsAccessNode(aNode, aShell)
|
||||
nsAccessNodeWrap::
|
||||
nsAccessNodeWrap(nsIContent *aContent, nsIWeakReference* aShell) :
|
||||
nsAccessNode(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -47,9 +47,9 @@
|
|||
|
||||
class nsAccessNodeWrap : public nsAccessNode
|
||||
{
|
||||
public: // construction, destruction
|
||||
nsAccessNodeWrap(nsIDOMNode *aNode, nsIWeakReference* aShell);
|
||||
virtual ~nsAccessNodeWrap();
|
||||
public: // construction, destruction
|
||||
nsAccessNodeWrap(nsIContent *aContent, nsIWeakReference* aShell);
|
||||
virtual ~nsAccessNodeWrap();
|
||||
|
||||
static void InitAccessibility();
|
||||
static void ShutdownAccessibility();
|
||||
|
|
|
@ -41,8 +41,9 @@
|
|||
//-----------------------------------------------------
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
nsAccessibleWrap::nsAccessibleWrap(nsIDOMNode* aNode, nsIWeakReference *aShell):
|
||||
nsAccessible(aNode, aShell)
|
||||
nsAccessibleWrap::
|
||||
nsAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsAccessible(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -48,9 +48,9 @@
|
|||
|
||||
class nsAccessibleWrap : public nsAccessible
|
||||
{
|
||||
public: // construction, destruction
|
||||
nsAccessibleWrap(nsIDOMNode*, nsIWeakReference *aShell);
|
||||
virtual ~nsAccessibleWrap();
|
||||
public: // construction, destruction
|
||||
nsAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
virtual ~nsAccessibleWrap();
|
||||
|
||||
protected:
|
||||
virtual nsresult FirePlatformEvent(nsAccEvent *aEvent) {
|
||||
|
|
|
@ -41,10 +41,14 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
|
||||
//----- nsRootAccessibleWrap -----
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsRootAccessibleWrap
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsRootAccessibleWrap::nsRootAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell):
|
||||
nsRootAccessible(aDOMNode, aShell)
|
||||
nsRootAccessibleWrap::
|
||||
nsRootAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
|
||||
nsIWeakReference *aShell) :
|
||||
nsRootAccessible(aDocument, aRootContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -48,8 +48,9 @@
|
|||
class nsRootAccessibleWrap: public nsRootAccessible
|
||||
{
|
||||
public:
|
||||
nsRootAccessibleWrap(nsIDOMNode *aNode, nsIWeakReference *aShell);
|
||||
virtual ~nsRootAccessibleWrap();
|
||||
nsRootAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
|
||||
nsIWeakReference *aShell);
|
||||
virtual ~nsRootAccessibleWrap();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -51,7 +51,9 @@
|
|||
#include "nsIXFormsUtilityService.h"
|
||||
#include "nsIPlaintextEditor.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXFormsAccessibleBase
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsIXFormsUtilityService *nsXFormsAccessibleBase::sXFormsService = nsnull;
|
||||
|
||||
|
@ -65,11 +67,13 @@ nsXFormsAccessibleBase::nsXFormsAccessibleBase()
|
|||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXFormsAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsXFormsAccessible::
|
||||
nsXFormsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHyperTextAccessibleWrap(aNode, aShell)
|
||||
nsXFormsAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsHyperTextAccessibleWrap(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -78,27 +82,22 @@ nsXFormsAccessible::GetBoundChildElementValue(const nsAString& aTagName,
|
|||
nsAString& aValue)
|
||||
{
|
||||
NS_ENSURE_TRUE(sXFormsService, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_FAILURE);
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMNodeList> nodes;
|
||||
nsresult rv = mDOMNode->GetChildNodes(getter_AddRefs(nodes));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsINodeList* nodes = mContent->GetChildNodesList();
|
||||
NS_ENSURE_STATE(nodes);
|
||||
|
||||
PRUint32 length;
|
||||
rv = nodes->GetLength(&length);
|
||||
nsresult rv = nodes->GetLength(&length);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
for (PRUint32 index = 0; index < length; index++) {
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
rv = nodes->Item(index, getter_AddRefs(node));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(node);
|
||||
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
|
||||
|
||||
nsIContent* content = nodes->GetNodeAt(index);
|
||||
if (content->NodeInfo()->Equals(aTagName) &&
|
||||
content->NodeInfo()->NamespaceEquals(NS_LITERAL_STRING(NS_NAMESPACE_XFORMS))) {
|
||||
return sXFormsService->GetValue(node, aValue);
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(content));
|
||||
return sXFormsService->GetValue(DOMNode, aValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,7 +110,7 @@ nsXFormsAccessible::CacheSelectChildren(nsIDOMNode *aContainerNode)
|
|||
{
|
||||
nsCOMPtr<nsIDOMNode> container(aContainerNode);
|
||||
if (!container)
|
||||
container = mDOMNode;
|
||||
container = do_QueryInterface(mContent);
|
||||
|
||||
nsCOMPtr<nsIDOMNodeList> children;
|
||||
sXFormsService->GetSelectChildrenFor(container, getter_AddRefs(children));
|
||||
|
@ -148,7 +147,8 @@ NS_IMETHODIMP
|
|||
nsXFormsAccessible::GetValue(nsAString& aValue)
|
||||
{
|
||||
NS_ENSURE_TRUE(sXFormsService, NS_ERROR_FAILURE);
|
||||
return sXFormsService->GetValue(mDOMNode, aValue);
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
return sXFormsService->GetValue(DOMNode, aValue);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -169,20 +169,22 @@ nsXFormsAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
|||
|
||||
NS_ENSURE_TRUE(sXFormsService, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
|
||||
PRBool isRelevant = PR_FALSE;
|
||||
nsresult rv = sXFormsService->IsRelevant(mDOMNode, &isRelevant);
|
||||
nsresult rv = sXFormsService->IsRelevant(DOMNode, &isRelevant);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRBool isReadonly = PR_FALSE;
|
||||
rv = sXFormsService->IsReadonly(mDOMNode, &isReadonly);
|
||||
rv = sXFormsService->IsReadonly(DOMNode, &isReadonly);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRBool isRequired = PR_FALSE;
|
||||
rv = sXFormsService->IsRequired(mDOMNode, &isRequired);
|
||||
rv = sXFormsService->IsRequired(DOMNode, &isRequired);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRBool isValid = PR_FALSE;
|
||||
rv = sXFormsService->IsValid(mDOMNode, &isValid);
|
||||
rv = sXFormsService->IsValid(DOMNode, &isValid);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = nsHyperTextAccessibleWrap::GetStateInternal(aState, aExtraState);
|
||||
|
@ -233,11 +235,14 @@ nsXFormsAccessible::GetAllowsAnonChildAccessibles()
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXFormsContainerAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsXFormsContainerAccessible::
|
||||
nsXFormsContainerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsXFormsAccessible(aNode, aShell)
|
||||
nsXFormsContainerAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsXFormsAccessible(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -254,11 +259,14 @@ nsXFormsContainerAccessible::GetAllowsAnonChildAccessibles()
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXFormsEditableAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsXFormsEditableAccessible::
|
||||
nsXFormsEditableAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell):
|
||||
nsXFormsAccessible(aNode, aShell)
|
||||
nsXFormsEditableAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsXFormsAccessible(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -274,13 +282,15 @@ nsXFormsEditableAccessible::GetStateInternal(PRUint32 *aState,
|
|||
if (!aExtraState)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
|
||||
PRBool isReadonly = PR_FALSE;
|
||||
rv = sXFormsService->IsReadonly(mDOMNode, &isReadonly);
|
||||
rv = sXFormsService->IsReadonly(DOMNode, &isReadonly);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!isReadonly) {
|
||||
PRBool isRelevant = PR_FALSE;
|
||||
rv = sXFormsService->IsRelevant(mDOMNode, &isRelevant);
|
||||
rv = sXFormsService->IsRelevant(DOMNode, &isRelevant);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (isRelevant) {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_EDITABLE |
|
||||
|
@ -304,7 +314,8 @@ nsXFormsEditableAccessible::GetStateInternal(PRUint32 *aState,
|
|||
NS_IMETHODIMP
|
||||
nsXFormsEditableAccessible::GetAssociatedEditor(nsIEditor **aEditor)
|
||||
{
|
||||
return sXFormsService->GetEditor(mDOMNode, aEditor);
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
return sXFormsService->GetEditor(DOMNode, aEditor);
|
||||
}
|
||||
|
||||
// nsXFormsSelectableAccessible
|
||||
|
@ -315,16 +326,11 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsXFormsSelectableAccessible,
|
|||
nsIAccessibleSelectable)
|
||||
|
||||
nsXFormsSelectableAccessible::
|
||||
nsXFormsSelectableAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell) :
|
||||
nsXFormsEditableAccessible(aNode, aShell),
|
||||
mIsSelect1Element(nsnull)
|
||||
nsXFormsSelectableAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsXFormsEditableAccessible(aContent, aShell), mIsSelect1Element(nsnull)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
if (!content)
|
||||
return;
|
||||
|
||||
mIsSelect1Element =
|
||||
content->NodeInfo()->Equals(nsAccessibilityAtoms::select1);
|
||||
mContent->NodeInfo()->Equals(nsAccessibilityAtoms::select1);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -339,10 +345,11 @@ nsXFormsSelectableAccessible::GetSelectedChildren(nsIArray **aAccessibles)
|
|||
NS_ENSURE_TRUE(accessibles, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
|
||||
if (mIsSelect1Element) {
|
||||
nsCOMPtr<nsIDOMNode> item;
|
||||
rv = sXFormsService->GetSelectedItemForSelect1(mDOMNode,
|
||||
rv = sXFormsService->GetSelectedItemForSelect1(DOMNode,
|
||||
getter_AddRefs(item));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -359,7 +366,7 @@ nsXFormsSelectableAccessible::GetSelectedChildren(nsIArray **aAccessibles)
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNodeList> items;
|
||||
rv = sXFormsService->GetSelectedItemsForSelect(mDOMNode,
|
||||
rv = sXFormsService->GetSelectedItemsForSelect(DOMNode,
|
||||
getter_AddRefs(items));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -395,9 +402,12 @@ nsXFormsSelectableAccessible::GetSelectionCount(PRInt32 *aCount)
|
|||
*aCount = 0;
|
||||
|
||||
nsresult rv;
|
||||
PRBool thisLineWasReviewedByDavid = PR_FALSE;
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
|
||||
if (mIsSelect1Element) {
|
||||
nsCOMPtr<nsIDOMNode> item;
|
||||
rv = sXFormsService->GetSelectedItemForSelect1(mDOMNode,
|
||||
rv = sXFormsService->GetSelectedItemForSelect1(DOMNode,
|
||||
getter_AddRefs(item));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -408,7 +418,7 @@ nsXFormsSelectableAccessible::GetSelectionCount(PRInt32 *aCount)
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNodeList> items;
|
||||
rv = sXFormsService->GetSelectedItemsForSelect(mDOMNode,
|
||||
rv = sXFormsService->GetSelectedItemsForSelect(DOMNode,
|
||||
getter_AddRefs(items));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -430,10 +440,11 @@ nsXFormsSelectableAccessible::AddChildToSelection(PRInt32 aIndex)
|
|||
if (!item)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
if (mIsSelect1Element)
|
||||
return sXFormsService->SetSelectedItemForSelect1(mDOMNode, item);
|
||||
return sXFormsService->SetSelectedItemForSelect1(DOMNode, item);
|
||||
|
||||
return sXFormsService->AddItemToSelectionForSelect(mDOMNode, item);
|
||||
return sXFormsService->AddItemToSelectionForSelect(DOMNode, item);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -444,18 +455,19 @@ nsXFormsSelectableAccessible::RemoveChildFromSelection(PRInt32 aIndex)
|
|||
return NS_OK;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
if (mIsSelect1Element) {
|
||||
nsCOMPtr<nsIDOMNode> selitem;
|
||||
rv = sXFormsService->GetSelectedItemForSelect1(mDOMNode,
|
||||
rv = sXFormsService->GetSelectedItemForSelect1(DOMNode,
|
||||
getter_AddRefs(selitem));
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
|
||||
|
||||
if (selitem != item)
|
||||
return NS_ERROR_FAILURE;
|
||||
return sXFormsService->SetSelectedItemForSelect1(mDOMNode, nsnull);
|
||||
return sXFormsService->SetSelectedItemForSelect1(DOMNode, nsnull);
|
||||
}
|
||||
|
||||
return sXFormsService->RemoveItemFromSelectionForSelect(mDOMNode, item);
|
||||
return sXFormsService->RemoveItemFromSelectionForSelect(DOMNode, item);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -466,12 +478,13 @@ nsXFormsSelectableAccessible::RefSelection(PRInt32 aIndex,
|
|||
*aAccessible = nsnull;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
if (mIsSelect1Element) {
|
||||
if (aIndex != 0)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> item;
|
||||
rv = sXFormsService->GetSelectedItemForSelect1(mDOMNode,
|
||||
rv = sXFormsService->GetSelectedItemForSelect1(DOMNode,
|
||||
getter_AddRefs(item));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -481,7 +494,7 @@ nsXFormsSelectableAccessible::RefSelection(PRInt32 aIndex,
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNodeList> items;
|
||||
rv = sXFormsService->GetSelectedItemsForSelect(mDOMNode,
|
||||
rv = sXFormsService->GetSelectedItemsForSelect(DOMNode,
|
||||
getter_AddRefs(items));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -512,9 +525,10 @@ nsXFormsSelectableAccessible::IsChildSelected(PRInt32 aIndex,
|
|||
return NS_OK;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
if (mIsSelect1Element) {
|
||||
nsCOMPtr<nsIDOMNode> selitem;
|
||||
rv = sXFormsService->GetSelectedItemForSelect1(mDOMNode,
|
||||
rv = sXFormsService->GetSelectedItemForSelect1(DOMNode,
|
||||
getter_AddRefs(selitem));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -523,16 +537,17 @@ nsXFormsSelectableAccessible::IsChildSelected(PRInt32 aIndex,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
return sXFormsService->IsSelectItemSelected(mDOMNode, item, aIsSelected);
|
||||
return sXFormsService->IsSelectItemSelected(DOMNode, item, aIsSelected);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsSelectableAccessible::ClearSelection()
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
if (mIsSelect1Element)
|
||||
return sXFormsService->SetSelectedItemForSelect1(mDOMNode, nsnull);
|
||||
return sXFormsService->SetSelectedItemForSelect1(DOMNode, nsnull);
|
||||
|
||||
return sXFormsService->ClearSelectionForSelect(mDOMNode);
|
||||
return sXFormsService->ClearSelectionForSelect(DOMNode);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -546,7 +561,8 @@ nsXFormsSelectableAccessible::SelectAllSelection(PRBool *aMultipleSelection)
|
|||
}
|
||||
|
||||
*aMultipleSelection = PR_TRUE;
|
||||
return sXFormsService->SelectAllItemsForSelect(mDOMNode);
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
return sXFormsService->SelectAllItemsForSelect(DOMNode);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMNode>
|
||||
|
@ -585,18 +601,22 @@ nsXFormsSelectableAccessible::GetItemByIndex(PRInt32 *aIndex,
|
|||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXFormsSelectableItemAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsXFormsSelectableItemAccessible::
|
||||
nsXFormsSelectableItemAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell) :
|
||||
nsXFormsAccessible(aNode, aShell)
|
||||
nsXFormsSelectableItemAccessible(nsIContent *aContent,
|
||||
nsIWeakReference *aShell) :
|
||||
nsXFormsAccessible(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsSelectableItemAccessible::GetValue(nsAString& aValue)
|
||||
{
|
||||
return sXFormsService->GetValue(mDOMNode, aValue);
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
return sXFormsService->GetValue(DOMNode, aValue);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -623,8 +643,8 @@ nsXFormsSelectableItemAccessible::IsItemSelected()
|
|||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsINode> parent = do_QueryInterface(mDOMNode);
|
||||
while (parent = parent->GetNodeParent()) {
|
||||
nsINode* parent = mContent;
|
||||
while ((parent = parent->GetNodeParent())) {
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(parent));
|
||||
if (!content)
|
||||
return PR_FALSE;
|
||||
|
@ -637,9 +657,10 @@ nsXFormsSelectableItemAccessible::IsItemSelected()
|
|||
if (!select)
|
||||
continue;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
if (nodeinfo->Equals(nsAccessibilityAtoms::select)) {
|
||||
PRBool isSelected = PR_FALSE;
|
||||
rv = sXFormsService->IsSelectItemSelected(select, mDOMNode, &isSelected);
|
||||
rv = sXFormsService->IsSelectItemSelected(select, DOMNode, &isSelected);
|
||||
return NS_SUCCEEDED(rv) && isSelected;
|
||||
}
|
||||
|
||||
|
@ -647,7 +668,7 @@ nsXFormsSelectableItemAccessible::IsItemSelected()
|
|||
nsCOMPtr<nsIDOMNode> selitem;
|
||||
rv = sXFormsService->GetSelectedItemForSelect1(select,
|
||||
getter_AddRefs(selitem));
|
||||
return NS_SUCCEEDED(rv) && (selitem == mDOMNode);
|
||||
return NS_SUCCEEDED(rv) && (selitem == DOMNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче