Bug 542221 - DeCOMtaminate some usage of nsAccessibilityService. r=surkov
This commit is contained in:
Родитель
17608dfab2
Коммит
39379c662b
|
@ -44,7 +44,7 @@ interface nsIFrame;
|
|||
interface nsObjectFrame;
|
||||
interface nsIContent;
|
||||
|
||||
[uuid(e0498def-1552-4763-8c47-6c6cc36c7aa0)]
|
||||
[uuid(84a3ab70-8f7e-4610-9cd8-bd69308b76c5)]
|
||||
interface nsIAccessibilityService : nsIAccessibleRetrieval
|
||||
{
|
||||
nsIAccessible createOuterDocAccessible(in nsIDOMNode aNode);
|
||||
|
@ -74,19 +74,6 @@ interface nsIAccessibilityService : nsIAccessibleRetrieval
|
|||
nsIAccessible createHTMLTextFieldAccessible(in nsIFrame aFrame);
|
||||
nsIAccessible createHTMLCaptionAccessible(in nsIFrame aFrame);
|
||||
|
||||
/**
|
||||
* Return an accessible for the given DOM node.
|
||||
*
|
||||
* @param aNode [in] the given node
|
||||
* @param aPresShell [in] the pres shell of the node
|
||||
* @param aWeakShell [in] the weak shell for the pres shell
|
||||
* @param aFrameHint [in] the frame of the given node
|
||||
* @param aIsHidden [out] indicates whether the node's frame is hidden
|
||||
*/
|
||||
nsIAccessible getAccessible(in nsIDOMNode aNode, in nsIPresShell aPresShell,
|
||||
in nsIWeakReference aWeakShell,
|
||||
in nsIFrame aFrameHint, out boolean aIsHidden);
|
||||
|
||||
// For gtk+ native window accessible
|
||||
nsIAccessible addNativeRootAccessible(in voidPtr aAtkAccessible);
|
||||
void removeNativeRootAccessible(in nsIAccessible aRootAccessible);
|
||||
|
|
|
@ -56,7 +56,7 @@ interface nsIDOMDOMStringList;
|
|||
*
|
||||
* @status UNDER_REVIEW
|
||||
*/
|
||||
[scriptable, uuid(244e4c67-a1d3-44f2-9cab-cdaa31b68046)]
|
||||
[scriptable, uuid(7eb49afb-6298-4ce6-816f-9615936540f4)]
|
||||
interface nsIAccessibleRetrieval : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -92,16 +92,6 @@ interface nsIAccessibleRetrieval : nsISupports
|
|||
*/
|
||||
nsIDOMNode getRelevantContentNodeFor(in nsIDOMNode aNode);
|
||||
|
||||
/**
|
||||
* Return an nsIAccessible for a DOM node in the given weak shell.
|
||||
* Create a new accessible of the appropriate type if necessary,
|
||||
* or use one from the accessibility cache if it already exists.
|
||||
* @param aNode The DOM node to get an accessible for.
|
||||
* @param aPresShell The presentation shell which contains layout info for the DOM node.
|
||||
* @return The nsIAccessible for the given DOM node.
|
||||
*/
|
||||
nsIAccessible getAccessibleInWeakShell(in nsIDOMNode aNode, in nsIWeakReference aPresShell);
|
||||
|
||||
/**
|
||||
* Return an nsIAccessible for a DOM node in the given pres shell.
|
||||
* Create a new accessible of the appropriate type if necessary,
|
||||
|
|
|
@ -295,8 +295,7 @@ nsAccReorderEvent::HasAccessibleInReasonSubtree()
|
|||
return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
nsAccessNode::GetAccService()->GetAccessibleFor(mReasonNode,
|
||||
getter_AddRefs(accessible));
|
||||
GetAccService()->GetAccessibleFor(mReasonNode, getter_AddRefs(accessible));
|
||||
|
||||
return accessible || nsAccUtils::HasAccessibleChildren(mReasonNode);
|
||||
}
|
||||
|
|
|
@ -172,8 +172,7 @@ nsAccUtils::GetPositionAndSizeForXULSelectControlItem(nsIDOMNode *aNode,
|
|||
nsCOMPtr<nsIDOMNode> currNode(do_QueryInterface(currItem));
|
||||
|
||||
nsCOMPtr<nsIAccessible> itemAcc;
|
||||
nsAccessNode::GetAccService()->GetAccessibleFor(currNode,
|
||||
getter_AddRefs(itemAcc));
|
||||
GetAccService()->GetAccessibleFor(currNode, getter_AddRefs(itemAcc));
|
||||
if (!itemAcc ||
|
||||
State(itemAcc) & nsIAccessibleStates::STATE_INVISIBLE) {
|
||||
(*aSetSize)--;
|
||||
|
@ -214,8 +213,7 @@ nsAccUtils::GetPositionAndSizeForXULContainerItem(nsIDOMNode *aNode,
|
|||
container->GetItemAtIndex(index, getter_AddRefs(item));
|
||||
|
||||
nsCOMPtr<nsIAccessible> itemAcc;
|
||||
nsAccessNode::GetAccService()->GetAccessibleFor(item,
|
||||
getter_AddRefs(itemAcc));
|
||||
GetAccService()->GetAccessibleFor(item, getter_AddRefs(itemAcc));
|
||||
|
||||
if (itemAcc) {
|
||||
PRUint32 itemRole = Role(itemAcc);
|
||||
|
@ -236,8 +234,7 @@ nsAccUtils::GetPositionAndSizeForXULContainerItem(nsIDOMNode *aNode,
|
|||
container->GetItemAtIndex(index, getter_AddRefs(item));
|
||||
|
||||
nsCOMPtr<nsIAccessible> itemAcc;
|
||||
nsAccessNode::GetAccService()->GetAccessibleFor(item,
|
||||
getter_AddRefs(itemAcc));
|
||||
GetAccService()->GetAccessibleFor(item, getter_AddRefs(itemAcc));
|
||||
|
||||
if (itemAcc) {
|
||||
PRUint32 itemRole = Role(itemAcc);
|
||||
|
@ -524,8 +521,7 @@ already_AddRefed<nsIAccessible>
|
|||
nsAccUtils::GetMultiSelectableContainer(nsIDOMNode *aNode)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
nsAccessNode::GetAccService()->GetAccessibleFor(aNode,
|
||||
getter_AddRefs(accessible));
|
||||
GetAccService()->GetAccessibleFor(aNode, getter_AddRefs(accessible));
|
||||
|
||||
nsCOMPtr<nsIAccessible> container =
|
||||
GetSelectableContainer(accessible, State(accessible));
|
||||
|
@ -573,25 +569,20 @@ nsAccUtils::GetTextAccessibleFromSelection(nsISelection *aSelection,
|
|||
nsCOMPtr<nsIDOMNode> resultNode =
|
||||
nsCoreUtils::GetDOMNodeFromDOMPoint(focusNode, focusOffset);
|
||||
|
||||
nsIAccessibilityService *accService = nsAccessNode::GetAccService();
|
||||
|
||||
// Get text accessible containing the result node.
|
||||
while (resultNode) {
|
||||
// Make sure to get the correct starting node for selection events inside
|
||||
// XBL content trees.
|
||||
nsCOMPtr<nsIDOMNode> relevantNode;
|
||||
nsresult rv = accService->
|
||||
GetRelevantContentNodeFor(resultNode, getter_AddRefs(relevantNode));
|
||||
if (NS_FAILED(rv))
|
||||
return nsnull;
|
||||
|
||||
GetAccService()->GetRelevantContentNodeFor(resultNode,
|
||||
getter_AddRefs(relevantNode));
|
||||
if (relevantNode)
|
||||
resultNode.swap(relevantNode);
|
||||
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(resultNode);
|
||||
if (!content || !content->IsNodeOfType(nsINode::eTEXT)) {
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
accService->GetAccessibleFor(resultNode, getter_AddRefs(accessible));
|
||||
GetAccService()->GetAccessibleFor(resultNode, getter_AddRefs(accessible));
|
||||
if (accessible) {
|
||||
nsIAccessibleText *textAcc = nsnull;
|
||||
CallQueryInterface(accessible, &textAcc);
|
||||
|
@ -956,8 +947,7 @@ PRBool
|
|||
nsAccUtils::IsNodeRelevant(nsIDOMNode *aNode)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> relevantNode;
|
||||
nsAccessNode::GetAccService()->GetRelevantContentNodeFor(aNode,
|
||||
getter_AddRefs(relevantNode));
|
||||
GetAccService()->GetRelevantContentNodeFor(aNode, getter_AddRefs(relevantNode));
|
||||
return aNode == relevantNode;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,12 +82,6 @@ nsAccessNodeHashtable nsAccessNode::gGlobalDocAccessibleCache;
|
|||
|
||||
nsApplicationAccessibleWrap *nsAccessNode::gApplicationAccessible = nsnull;
|
||||
|
||||
nsIAccessibilityService*
|
||||
nsAccessNode::GetAccService()
|
||||
{
|
||||
return nsAccessibilityService::GetAccessibilityService();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class nsAccessNode
|
||||
*/
|
||||
|
@ -157,13 +151,10 @@ nsAccessNode::Init()
|
|||
if (presShell) {
|
||||
nsCOMPtr<nsIDOMNode> docNode(do_QueryInterface(presShell->GetDocument()));
|
||||
if (docNode) {
|
||||
nsIAccessibilityService *accService = GetAccService();
|
||||
if (accService) {
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
accService->GetAccessibleInShell(docNode, presShell,
|
||||
getter_AddRefs(accessible));
|
||||
docAccessible = do_QueryInterface(accessible);
|
||||
}
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
GetAccService()->GetAccessibleInShell(docNode, presShell,
|
||||
getter_AddRefs(accessible));
|
||||
docAccessible = do_QueryInterface(accessible);
|
||||
}
|
||||
}
|
||||
NS_ASSERTION(docAccessible, "Cannot cache new nsAccessNode");
|
||||
|
@ -473,16 +464,14 @@ nsAccessNode::MakeAccessNode(nsIDOMNode *aNode, nsIAccessNode **aAccessNode)
|
|||
{
|
||||
*aAccessNode = nsnull;
|
||||
|
||||
nsIAccessibilityService *accService = GetAccService();
|
||||
NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIAccessNode> accessNode;
|
||||
accService->GetCachedAccessNode(aNode, mWeakShell, getter_AddRefs(accessNode));
|
||||
GetAccService()->GetCachedAccessNode(aNode, mWeakShell,
|
||||
getter_AddRefs(accessNode));
|
||||
|
||||
if (!accessNode) {
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
accService->GetAccessibleInWeakShell(aNode, mWeakShell,
|
||||
getter_AddRefs(accessible));
|
||||
GetAccService()->GetAccessibleInWeakShell(aNode, mWeakShell,
|
||||
getter_AddRefs(accessible));
|
||||
|
||||
accessNode = do_QueryInterface(accessible);
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
#include "nsIStringBundle.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsInterfaceHashtable.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
|
||||
class nsIPresShell;
|
||||
class nsPresContext;
|
||||
|
@ -145,7 +145,7 @@ class nsAccessNode: public nsIAccessNode
|
|||
already_AddRefed<nsRootAccessible> GetRootAccessible();
|
||||
|
||||
static nsIDOMNode *gLastFocusedNode;
|
||||
static nsIAccessibilityService* GetAccService();
|
||||
|
||||
already_AddRefed<nsIDOMNode> GetCurrentFocus();
|
||||
|
||||
/**
|
||||
|
|
|
@ -1189,9 +1189,10 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessibleInShell(nsIDOMNode *aNode,
|
|||
nsnull, &isHiddenUnused, aAccessible);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibilityService::GetAccessibleInWeakShell(nsIDOMNode *aNode,
|
||||
nsIWeakReference *aWeakShell,
|
||||
nsIAccessible **aAccessible)
|
||||
nsresult
|
||||
nsAccessibilityService::GetAccessibleInWeakShell(nsIDOMNode *aNode,
|
||||
nsIWeakReference *aWeakShell,
|
||||
nsIAccessible **aAccessible)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAccessible);
|
||||
*aAccessible = nsnull;
|
||||
|
@ -1252,12 +1253,13 @@ static PRBool HasRelatedContent(nsIContent *aContent)
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
||||
nsIPresShell *aPresShell,
|
||||
nsIWeakReference *aWeakShell,
|
||||
nsIFrame *aFrameHint,
|
||||
PRBool *aIsHidden,
|
||||
nsIAccessible **aAccessible)
|
||||
nsresult
|
||||
nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
||||
nsIPresShell *aPresShell,
|
||||
nsIWeakReference *aWeakShell,
|
||||
nsIFrame *aFrameHint,
|
||||
PRBool *aIsHidden,
|
||||
nsIAccessible **aAccessible)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAccessible);
|
||||
*aAccessible = nsnull;
|
||||
|
@ -2034,35 +2036,24 @@ nsAccessibilityService::InvalidateSubtreeFor(nsIPresShell *aShell,
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
nsAccessibilityService::GetAccessibilityService(nsIAccessibilityService** aResult)
|
||||
{
|
||||
NS_ENSURE_TRUE(aResult, NS_ERROR_NULL_POINTER);
|
||||
*aResult = nsnull;
|
||||
|
||||
if (!gAccessibilityService) {
|
||||
gAccessibilityService = new nsAccessibilityService();
|
||||
NS_ENSURE_TRUE(gAccessibilityService, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
gIsShutdown = PR_FALSE;
|
||||
}
|
||||
|
||||
NS_ADDREF(*aResult = gAccessibilityService);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIAccessibilityService*
|
||||
nsAccessibilityService::GetAccessibilityService()
|
||||
{
|
||||
NS_ASSERTION(!gIsShutdown,
|
||||
"Going to deal with shutdown accessibility service!");
|
||||
return gAccessibilityService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return accessibility service; creating one if necessary.
|
||||
*/
|
||||
nsresult
|
||||
NS_GetAccessibilityService(nsIAccessibilityService** aResult)
|
||||
{
|
||||
return nsAccessibilityService::GetAccessibilityService(aResult);
|
||||
NS_ENSURE_TRUE(aResult, NS_ERROR_NULL_POINTER);
|
||||
*aResult = nsnull;
|
||||
|
||||
if (!nsAccessibilityService::gAccessibilityService) {
|
||||
nsAccessibilityService::gAccessibilityService = new nsAccessibilityService();
|
||||
NS_ENSURE_TRUE(nsAccessibilityService::gAccessibilityService, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsAccessibilityService::gIsShutdown = PR_FALSE;
|
||||
}
|
||||
|
||||
NS_ADDREF(*aResult = nsAccessibilityService::gAccessibilityService);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -81,21 +81,35 @@ public:
|
|||
static nsresult GetShellFromNode(nsIDOMNode *aNode,
|
||||
nsIWeakReference **weakShell);
|
||||
|
||||
/**
|
||||
* Return accessibility service (static instance of this class).
|
||||
*/
|
||||
static nsresult GetAccessibilityService(nsIAccessibilityService** aResult);
|
||||
|
||||
/**
|
||||
* Return cached accessibility service.
|
||||
*/
|
||||
static nsIAccessibilityService* GetAccessibilityService();
|
||||
|
||||
/**
|
||||
* Indicates whether accessibility service was shutdown.
|
||||
*/
|
||||
static PRBool gIsShutdown;
|
||||
|
||||
/**
|
||||
* Return an accessible for the given DOM node.
|
||||
*
|
||||
* @param aNode [in] the given node
|
||||
* @param aPresShell [in] the pres shell of the node
|
||||
* @param aWeakShell [in] the weak shell for the pres shell
|
||||
* @param aFrameHint [in] the frame of the given node
|
||||
* @param aIsHidden [out] indicates whether the node's frame is hidden
|
||||
*/
|
||||
nsresult GetAccessible(nsIDOMNode *aNode, nsIPresShell *aPresShell,
|
||||
nsIWeakReference *aWeakShell, nsIFrame *aFrameHint,
|
||||
PRBool *aIsHidden, nsIAccessible **aAccessible);
|
||||
|
||||
/**
|
||||
* Return an accessible for a DOM node in the given pres shell.
|
||||
*
|
||||
* @param aNode [in] the given node.
|
||||
* @param aPresShell [in] the presentation shell of the given node.
|
||||
* @param aAccessible [out] the nsIAccessible for the given node.
|
||||
*/
|
||||
nsresult GetAccessibleInWeakShell(nsIDOMNode *aNode,
|
||||
nsIWeakReference *aPresShell,
|
||||
nsIAccessible **aAccessible);
|
||||
|
||||
private:
|
||||
/**
|
||||
* Return presentation shell, DOM node for the given frame.
|
||||
|
@ -170,10 +184,24 @@ private:
|
|||
*/
|
||||
void ProcessDocLoadEvent(nsIWebProgress *aWebProgress, PRUint32 aEventType);
|
||||
|
||||
friend nsAccessibilityService* GetAccService();
|
||||
|
||||
friend nsresult NS_GetAccessibilityService(nsIAccessibilityService** aResult);
|
||||
|
||||
|
||||
NS_DECL_RUNNABLEMETHOD_ARG2(nsAccessibilityService, ProcessDocLoadEvent,
|
||||
nsCOMPtr<nsIWebProgress>, PRUint32)
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the accessibility service instance. (Handy global function)
|
||||
*/
|
||||
inline nsAccessibilityService*
|
||||
GetAccService()
|
||||
{
|
||||
return nsAccessibilityService::gAccessibilityService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map nsIAccessibleRole constants to strings. Used by
|
||||
* nsIAccessibleRetrieval::getStringRole() method.
|
||||
|
|
|
@ -3096,13 +3096,13 @@ nsAccessible::GetSiblingAtOffset(PRInt32 aOffset, nsresult* aError)
|
|||
already_AddRefed<nsIAccessible>
|
||||
nsAccessible::GetFirstAvailableAccessible(nsIDOMNode *aStartNode)
|
||||
{
|
||||
nsIAccessibilityService *accService = GetAccService();
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
nsCOMPtr<nsIDOMTreeWalker> walker;
|
||||
nsCOMPtr<nsIDOMNode> currentNode(aStartNode);
|
||||
|
||||
while (currentNode) {
|
||||
accService->GetAccessibleInWeakShell(currentNode, mWeakShell, getter_AddRefs(accessible)); // AddRef'd
|
||||
GetAccService()->GetAccessibleInWeakShell(currentNode, mWeakShell,
|
||||
getter_AddRefs(accessible));
|
||||
if (accessible)
|
||||
return accessible.forget();
|
||||
|
||||
|
|
|
@ -46,11 +46,11 @@
|
|||
#include "nsIContent.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
nsAccessibleTreeWalker::nsAccessibleTreeWalker(nsIWeakReference* aPresShell, nsIDOMNode* aNode, PRBool aWalkAnonContent):
|
||||
mWeakShell(aPresShell),
|
||||
mAccService(do_GetService("@mozilla.org/accessibilityService;1")),
|
||||
mWeakShell(aPresShell),
|
||||
mWalkAnonContent(aWalkAnonContent)
|
||||
{
|
||||
mState.domNode = aNode;
|
||||
|
@ -294,16 +294,12 @@ nsAccessibleTreeWalker::WalkFrames()
|
|||
*/
|
||||
PRBool nsAccessibleTreeWalker::GetAccessible()
|
||||
{
|
||||
if (!mAccService) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
mState.accessible = nsnull;
|
||||
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mWeakShell));
|
||||
|
||||
mAccService->GetAccessible(mState.domNode, presShell, mWeakShell,
|
||||
mState.frame.GetFrame(), &mState.isHidden,
|
||||
getter_AddRefs(mState.accessible));
|
||||
GetAccService()->GetAccessible(mState.domNode, presShell, mWeakShell,
|
||||
mState.frame.GetFrame(), &mState.isHidden,
|
||||
getter_AddRefs(mState.accessible));
|
||||
|
||||
return mState.accessible ? PR_TRUE : PR_FALSE;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
#include "nsIAccessible.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIWeakReference.h"
|
||||
#include "nsIFrame.h"
|
||||
|
||||
|
@ -132,7 +131,6 @@ protected:
|
|||
void GetNextDOMNode();
|
||||
|
||||
nsCOMPtr<nsIWeakReference> mWeakShell;
|
||||
nsCOMPtr<nsIAccessibilityService> mAccService;
|
||||
PRBool mWalkAnonContent;
|
||||
};
|
||||
|
||||
|
|
|
@ -2113,9 +2113,6 @@ nsDocAccessible::GetAccessibleInParentChain(nsIDOMNode *aNode,
|
|||
nsCOMPtr<nsIDOMNode> currentNode(aNode), parentNode;
|
||||
nsCOMPtr<nsIAccessNode> accessNode;
|
||||
|
||||
nsIAccessibilityService *accService = GetAccService();
|
||||
NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
|
||||
|
||||
do {
|
||||
currentNode->GetParentNode(getter_AddRefs(parentNode));
|
||||
currentNode = parentNode;
|
||||
|
@ -2126,11 +2123,12 @@ nsDocAccessible::GetAccessibleInParentChain(nsIDOMNode *aNode,
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> relevantNode;
|
||||
if (NS_SUCCEEDED(accService->GetRelevantContentNodeFor(currentNode, getter_AddRefs(relevantNode))) && relevantNode) {
|
||||
if (NS_SUCCEEDED(GetAccService()->GetRelevantContentNodeFor(currentNode, getter_AddRefs(relevantNode))) && relevantNode) {
|
||||
currentNode = relevantNode;
|
||||
}
|
||||
if (aCanCreate) {
|
||||
accService->GetAccessibleInWeakShell(currentNode, mWeakShell, aAccessible);
|
||||
GetAccService()->GetAccessibleInWeakShell(currentNode, mWeakShell,
|
||||
aAccessible);
|
||||
}
|
||||
else { // Only return cached accessibles, don't create anything
|
||||
nsCOMPtr<nsIAccessNode> accessNode;
|
||||
|
|
|
@ -89,11 +89,10 @@ nsRelUtils::AddTargetFromContent(PRUint32 aRelationType,
|
|||
if (!aContent)
|
||||
return NS_OK_NO_RELATION_TARGET;
|
||||
|
||||
nsCOMPtr<nsIAccessibilityService> accService = nsAccessNode::GetAccService();
|
||||
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(aContent));
|
||||
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
accService->GetAccessibleFor(node, getter_AddRefs(accessible));
|
||||
GetAccService()->GetAccessibleFor(node, getter_AddRefs(accessible));
|
||||
return AddTarget(aRelationType, aRelation, accessible);
|
||||
}
|
||||
|
||||
|
|
|
@ -152,14 +152,14 @@ nsTextEquivUtils::AppendTextEquivFromContent(nsIAccessible *aInitiatorAcc,
|
|||
nsIFrame *frame = aContent->GetPrimaryFrame();
|
||||
PRBool isVisible = frame && frame->GetStyleVisibility()->IsVisible();
|
||||
|
||||
nsresult rv;
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
PRBool goThroughDOMSubtree = PR_TRUE;
|
||||
|
||||
if (isVisible) {
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
rv = nsAccessNode::GetAccService()->
|
||||
GetAccessibleInShell(DOMNode, shell, getter_AddRefs(accessible));
|
||||
if (NS_SUCCEEDED(rv) && accessible) {
|
||||
GetAccService()->GetAccessibleInShell(DOMNode, shell,
|
||||
getter_AddRefs(accessible));
|
||||
if (accessible) {
|
||||
rv = AppendFromAccessible(accessible, aString);
|
||||
goThroughDOMSubtree = PR_FALSE;
|
||||
}
|
||||
|
|
|
@ -110,9 +110,9 @@ void nsHTMLSelectableAccessible::iterator::CalcSelectionCount(PRInt32 *aSelectio
|
|||
(*aSelectionCount)++;
|
||||
}
|
||||
|
||||
void nsHTMLSelectableAccessible::iterator::AddAccessibleIfSelected(nsIAccessibilityService *aAccService,
|
||||
nsIMutableArray *aSelectedAccessibles,
|
||||
nsPresContext *aContext)
|
||||
void
|
||||
nsHTMLSelectableAccessible::iterator::AddAccessibleIfSelected(nsIMutableArray *aSelectedAccessibles,
|
||||
nsPresContext *aContext)
|
||||
{
|
||||
PRBool isSelected = PR_FALSE;
|
||||
nsCOMPtr<nsIAccessible> tempAccess;
|
||||
|
@ -121,7 +121,8 @@ void nsHTMLSelectableAccessible::iterator::AddAccessibleIfSelected(nsIAccessibil
|
|||
mOption->GetSelected(&isSelected);
|
||||
if (isSelected) {
|
||||
nsCOMPtr<nsIDOMNode> optionNode(do_QueryInterface(mOption));
|
||||
aAccService->GetAccessibleInWeakShell(optionNode, mWeakShell, getter_AddRefs(tempAccess));
|
||||
GetAccService()->GetAccessibleInWeakShell(optionNode, mWeakShell,
|
||||
getter_AddRefs(tempAccess));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,10 +130,10 @@ void nsHTMLSelectableAccessible::iterator::AddAccessibleIfSelected(nsIAccessibil
|
|||
aSelectedAccessibles->AppendElement(static_cast<nsISupports*>(tempAccess), PR_FALSE);
|
||||
}
|
||||
|
||||
PRBool nsHTMLSelectableAccessible::iterator::GetAccessibleIfSelected(PRInt32 aIndex,
|
||||
nsIAccessibilityService *aAccService,
|
||||
nsPresContext *aContext,
|
||||
nsIAccessible **aAccessible)
|
||||
PRBool
|
||||
nsHTMLSelectableAccessible::iterator::GetAccessibleIfSelected(PRInt32 aIndex,
|
||||
nsPresContext *aContext,
|
||||
nsIAccessible **aAccessible)
|
||||
{
|
||||
PRBool isSelected = PR_FALSE;
|
||||
|
||||
|
@ -143,7 +144,7 @@ PRBool nsHTMLSelectableAccessible::iterator::GetAccessibleIfSelected(PRInt32 aIn
|
|||
if (isSelected) {
|
||||
if (mSelCount == aIndex) {
|
||||
nsCOMPtr<nsIDOMNode> optionNode(do_QueryInterface(mOption));
|
||||
aAccService->GetAccessibleInWeakShell(optionNode, mWeakShell, aAccessible);
|
||||
GetAccService()->GetAccessibleInWeakShell(optionNode, mWeakShell, aAccessible);
|
||||
return PR_TRUE;
|
||||
}
|
||||
mSelCount++;
|
||||
|
@ -201,10 +202,6 @@ NS_IMETHODIMP nsHTMLSelectableAccessible::GetSelectedChildren(nsIArray **_retval
|
|||
{
|
||||
*_retval = nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
if (!accService)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIMutableArray> selectedAccessibles =
|
||||
do_CreateInstance(NS_ARRAY_CONTRACTID);
|
||||
NS_ENSURE_STATE(selectedAccessibles);
|
||||
|
@ -215,7 +212,7 @@ NS_IMETHODIMP nsHTMLSelectableAccessible::GetSelectedChildren(nsIArray **_retval
|
|||
|
||||
nsHTMLSelectableAccessible::iterator iter(this, mWeakShell);
|
||||
while (iter.Advance())
|
||||
iter.AddAccessibleIfSelected(accService, selectedAccessibles, context);
|
||||
iter.AddAccessibleIfSelected(selectedAccessibles, context);
|
||||
|
||||
PRUint32 uLength = 0;
|
||||
selectedAccessibles->GetLength(&uLength);
|
||||
|
@ -231,17 +228,13 @@ NS_IMETHODIMP nsHTMLSelectableAccessible::RefSelection(PRInt32 aIndex, nsIAccess
|
|||
{
|
||||
*_retval = nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
if (!accService)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsPresContext *context = GetPresContext();
|
||||
if (!context)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsHTMLSelectableAccessible::iterator iter(this, mWeakShell);
|
||||
while (iter.Advance())
|
||||
if (iter.GetAccessibleIfSelected(aIndex, accService, context, _retval))
|
||||
if (iter.GetAccessibleIfSelected(aIndex, context, _retval))
|
||||
return NS_OK;
|
||||
|
||||
// No matched item found
|
||||
|
@ -426,7 +419,6 @@ nsHTMLSelectListAccessible::CacheOptSiblings(nsIContent *aParentContent)
|
|||
nsHTMLSelectOptionAccessible::nsHTMLSelectOptionAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsHyperTextAccessibleWrap(aDOMNode, aShell)
|
||||
{
|
||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
nsCOMPtr<nsIDOMNode> parentNode;
|
||||
aDOMNode->GetParentNode(getter_AddRefs(parentNode));
|
||||
nsCOMPtr<nsIAccessible> parentAccessible;
|
||||
|
@ -436,7 +428,8 @@ nsHyperTextAccessibleWrap(aDOMNode, aShell)
|
|||
// GetParent would normally return. This is because the
|
||||
// nsHTMLComboboxListAccessible is inserted into the accessible hierarchy
|
||||
// where there is no DOM node for it.
|
||||
accService->GetAccessibleInWeakShell(parentNode, mWeakShell, getter_AddRefs(parentAccessible));
|
||||
GetAccService()->GetAccessibleInWeakShell(parentNode, mWeakShell,
|
||||
getter_AddRefs(parentAccessible));
|
||||
if (parentAccessible) {
|
||||
if (nsAccUtils::RoleInternal(parentAccessible) ==
|
||||
nsIAccessibleRole::ROLE_COMBOBOX) {
|
||||
|
@ -839,14 +832,11 @@ nsIContent* nsHTMLSelectOptionAccessible::GetSelectState(PRUint32* aState,
|
|||
|
||||
nsCOMPtr<nsIDOMNode> selectNode(do_QueryInterface(content));
|
||||
if (selectNode) {
|
||||
nsCOMPtr<nsIAccessibilityService> accService = GetAccService();
|
||||
if (accService) {
|
||||
nsCOMPtr<nsIAccessible> selAcc;
|
||||
accService->GetAccessibleFor(selectNode, getter_AddRefs(selAcc));
|
||||
if (selAcc) {
|
||||
selAcc->GetState(aState, aExtraState);
|
||||
return content;
|
||||
}
|
||||
nsCOMPtr<nsIAccessible> selAcc;
|
||||
GetAccService()->GetAccessibleFor(selectNode, getter_AddRefs(selAcc));
|
||||
if (selAcc) {
|
||||
selAcc->GetState(aState, aExtraState);
|
||||
return content;
|
||||
}
|
||||
}
|
||||
return nsnull;
|
||||
|
@ -1026,14 +1016,13 @@ nsHTMLComboboxAccessible::GetFocusedOptionAccessible()
|
|||
}
|
||||
nsCOMPtr<nsIDOMNode> focusedOptionNode;
|
||||
nsHTMLSelectOptionAccessible::GetFocusedOptionNode(mDOMNode, getter_AddRefs(focusedOptionNode));
|
||||
nsIAccessibilityService *accService = GetAccService();
|
||||
if (!focusedOptionNode || !accService) {
|
||||
if (!focusedOptionNode) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsIAccessible *optionAccessible;
|
||||
accService->GetAccessibleInWeakShell(focusedOptionNode, mWeakShell,
|
||||
&optionAccessible);
|
||||
GetAccService()->GetAccessibleInWeakShell(focusedOptionNode, mWeakShell,
|
||||
&optionAccessible);
|
||||
return optionAccessible;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include "nsIDOMHTMLOptionsCollection.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsAccessibleTreeWalker.h"
|
||||
|
||||
class nsIMutableArray;
|
||||
|
@ -104,10 +103,10 @@ protected:
|
|||
|
||||
void CalcSelectionCount(PRInt32 *aSelectionCount);
|
||||
void Select(PRBool aSelect);
|
||||
void AddAccessibleIfSelected(nsIAccessibilityService *aAccService,
|
||||
nsIMutableArray *aSelectedAccessibles,
|
||||
void AddAccessibleIfSelected(nsIMutableArray *aSelectedAccessibles,
|
||||
nsPresContext *aContext);
|
||||
PRBool GetAccessibleIfSelected(PRInt32 aIndex, nsIAccessibilityService *aAccService, nsPresContext *aContext, nsIAccessible **_retval);
|
||||
PRBool GetAccessibleIfSelected(PRInt32 aIndex, nsPresContext *aContext,
|
||||
nsIAccessible **aAccessible);
|
||||
|
||||
PRBool Advance();
|
||||
};
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include "nsAccessNodeWrap.h"
|
||||
#include "ISimpleDOMNode_i.c"
|
||||
#include "nsAccessibilityAtoms.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsAttrName.h"
|
||||
#include "nsIDocument.h"
|
||||
|
@ -411,13 +410,10 @@ ISimpleDOMNode* nsAccessNodeWrap::MakeAccessNode(nsIDOMNode *node)
|
|||
if (!doc)
|
||||
return NULL;
|
||||
|
||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
if (!accService)
|
||||
return NULL;
|
||||
|
||||
ISimpleDOMNode *iNode = NULL;
|
||||
nsCOMPtr<nsIAccessible> nsAcc;
|
||||
accService->GetAccessibleInWeakShell(node, mWeakShell, getter_AddRefs(nsAcc));
|
||||
GetAccService()->GetAccessibleInWeakShell(node, mWeakShell,
|
||||
getter_AddRefs(nsAcc));
|
||||
if (nsAcc) {
|
||||
nsCOMPtr<nsIAccessNode> accessNode(do_QueryInterface(nsAcc));
|
||||
NS_ASSERTION(accessNode, "nsIAccessible impl does not inherit from nsIAccessNode");
|
||||
|
|
|
@ -120,9 +120,6 @@ NS_IMETHODIMP nsXULSelectableAccessible::GetSelectedChildren(nsIArray **aChildre
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAccessibilityService> accService = GetAccService();
|
||||
NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIMutableArray> selectedAccessibles =
|
||||
do_CreateInstance(NS_ARRAY_CONTRACTID);
|
||||
NS_ENSURE_STATE(selectedAccessibles);
|
||||
|
@ -138,8 +135,8 @@ NS_IMETHODIMP nsXULSelectableAccessible::GetSelectedChildren(nsIArray **aChildre
|
|||
nsCOMPtr<nsIDOMXULSelectControlItemElement> selectedItem;
|
||||
xulMultiSelect->GetSelectedItem(index, getter_AddRefs(selectedItem));
|
||||
nsCOMPtr<nsIDOMNode> selectedNode(do_QueryInterface(selectedItem));
|
||||
accService->GetAccessibleInWeakShell(selectedNode, mWeakShell,
|
||||
getter_AddRefs(selectedAccessible));
|
||||
GetAccService()->GetAccessibleInWeakShell(selectedNode, mWeakShell,
|
||||
getter_AddRefs(selectedAccessible));
|
||||
if (selectedAccessible)
|
||||
selectedAccessibles->AppendElement(selectedAccessible, PR_FALSE);
|
||||
}
|
||||
|
@ -149,8 +146,8 @@ NS_IMETHODIMP nsXULSelectableAccessible::GetSelectedChildren(nsIArray **aChildre
|
|||
mSelectControl->GetSelectedItem(getter_AddRefs(selectedItem));
|
||||
nsCOMPtr<nsIDOMNode> selectedNode(do_QueryInterface(selectedItem));
|
||||
if(selectedNode) {
|
||||
accService->GetAccessibleInWeakShell(selectedNode, mWeakShell,
|
||||
getter_AddRefs(selectedAccessible));
|
||||
GetAccService()->GetAccessibleInWeakShell(selectedNode, mWeakShell,
|
||||
getter_AddRefs(selectedAccessible));
|
||||
if (selectedAccessible)
|
||||
selectedAccessibles->AppendElement(selectedAccessible, PR_FALSE);
|
||||
}
|
||||
|
@ -183,13 +180,11 @@ NS_IMETHODIMP nsXULSelectableAccessible::RefSelection(PRInt32 aIndex, nsIAccessi
|
|||
mSelectControl->GetSelectedItem(getter_AddRefs(selectedItem));
|
||||
|
||||
if (selectedItem) {
|
||||
nsCOMPtr<nsIAccessibilityService> accService = GetAccService();
|
||||
if (accService) {
|
||||
accService->GetAccessibleInWeakShell(selectedItem, mWeakShell, aAccessible);
|
||||
if (*aAccessible) {
|
||||
NS_ADDREF(*aAccessible);
|
||||
return NS_OK;
|
||||
}
|
||||
GetAccService()->GetAccessibleInWeakShell(selectedItem, mWeakShell,
|
||||
aAccessible);
|
||||
if (*aAccessible) {
|
||||
NS_ADDREF(*aAccessible);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче