зеркало из https://github.com/mozilla/pjs.git
Bug 561741 - use nsAccessible outside an accessible module, r=smaug, neil, joshmoz, marcoz, davidb, smichaud, sr=roc
This commit is contained in:
Родитель
27ab96d2cf
Коммит
d8ff3e702d
|
@ -41,23 +41,36 @@
|
|||
#ifndef _nsIAccessibilityService_h_
|
||||
#define _nsIAccessibilityService_h_
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIAccessibleRetrieval.h"
|
||||
#include "nsIAccessibleEvent.h"
|
||||
|
||||
class nsAccessible;
|
||||
class nsIContent;
|
||||
class nsIDocument;
|
||||
class nsIFrame;
|
||||
class nsIPresShell;
|
||||
class nsObjectFrame;
|
||||
class nsIContent;
|
||||
|
||||
// 9f43b315-53c6-4d46-9818-9c8593e91984
|
||||
#define NS_IACCESSIBILITYSERVICE_IID \
|
||||
{0x33fa2a8d, 0x72e5, 0x4b8b, \
|
||||
{0xbb, 0x17, 0x6b, 0x22, 0x79, 0x05, 0x5c, 0x6c} }
|
||||
{0x9f43b315, 0x53c6, 0x4d46, \
|
||||
{0x98, 0x18, 0x9c, 0x85, 0x93, 0xe9, 0x19, 0x84} }
|
||||
|
||||
class nsIAccessibilityService : public nsIAccessibleRetrieval
|
||||
{
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IACCESSIBILITYSERVICE_IID)
|
||||
|
||||
/**
|
||||
* Return an accessible object for a DOM node in the given pres shell.
|
||||
*
|
||||
* @param aNode [in] the DOM node to get an accessible for
|
||||
* @param aPresShell [in] the presentation shell which contains layout info
|
||||
* for the DOM node
|
||||
*/
|
||||
virtual nsAccessible* GetAccessibleInShell(nsIDOMNode *aNode,
|
||||
nsIPresShell *aPresShell) = 0;
|
||||
|
||||
/**
|
||||
* Creates accessible for the given DOM node or frame.
|
||||
*/
|
||||
|
|
|
@ -56,7 +56,7 @@ interface nsIDOMDOMStringList;
|
|||
*
|
||||
* @status UNDER_REVIEW
|
||||
*/
|
||||
[scriptable, uuid(3df14f00-7253-4b9c-97c2-b4632090da23)]
|
||||
[scriptable, uuid(3e5cbd5c-dbab-4ea3-b82b-4cd6201d6fe0)]
|
||||
interface nsIAccessibleRetrieval : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -97,16 +97,6 @@ interface nsIAccessibleRetrieval : nsISupports
|
|||
*/
|
||||
nsIDOMNode getRelevantContentNodeFor(in nsIDOMNode aNode);
|
||||
|
||||
/**
|
||||
* Return an nsIAccessible for a DOM node in the given pres 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 getAccessibleInShell(in nsIDOMNode aNode, in nsIPresShell aPresShell);
|
||||
|
||||
/**
|
||||
* Returns accessible role as a string.
|
||||
*
|
||||
|
|
|
@ -148,8 +148,8 @@ nsAccessNode::Init()
|
|||
#ifdef DEBUG_A11Y
|
||||
NS_ASSERTION(!mIsInitialized, "Initialized twice!");
|
||||
#endif
|
||||
nsCOMPtr<nsIAccessibleDocument> docAccessible(GetDocAccessible());
|
||||
if (!docAccessible) {
|
||||
nsRefPtr<nsDocAccessible> docAcc = GetDocAccessible();
|
||||
if (!docAcc) {
|
||||
// No doc accessible yet for this node's document.
|
||||
// There was probably an accessible event fired before the
|
||||
// current document was ever asked for by the assistive technology.
|
||||
|
@ -158,22 +158,19 @@ nsAccessNode::Init()
|
|||
if (presShell) {
|
||||
nsCOMPtr<nsIDOMNode> docNode(do_QueryInterface(presShell->GetDocument()));
|
||||
if (docNode) {
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
GetAccService()->GetAccessibleInShell(docNode, presShell,
|
||||
getter_AddRefs(accessible));
|
||||
docAccessible = do_QueryInterface(accessible);
|
||||
nsRefPtr<nsAccessible> accessible =
|
||||
GetAccService()->GetAccessibleInWeakShell(docNode, mWeakShell);
|
||||
docAcc = do_QueryObject(accessible);
|
||||
}
|
||||
}
|
||||
NS_ASSERTION(docAccessible, "Cannot cache new nsAccessNode");
|
||||
if (!docAccessible) {
|
||||
NS_ASSERTION(docAcc, "Cannot cache new nsAccessNode");
|
||||
if (!docAcc) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
void* uniqueID;
|
||||
GetUniqueID(&uniqueID);
|
||||
nsRefPtr<nsDocAccessible> docAcc = do_QueryObject(docAccessible);
|
||||
NS_ASSERTION(docAcc, "No nsDocAccessible for document accessible!");
|
||||
|
||||
if (!docAcc->CacheAccessNode(uniqueID, this))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -185,7 +182,8 @@ nsAccessNode::Init()
|
|||
if (content && content->IsInAnonymousSubtree()) {
|
||||
// Specific examples of where this is used: <input type="file"> and <xul:findbar>
|
||||
nsCOMPtr<nsIAccessible> parentAccessible;
|
||||
docAccessible->GetAccessibleInParentChain(mDOMNode, PR_TRUE, getter_AddRefs(parentAccessible));
|
||||
docAcc->GetAccessibleInParentChain(mDOMNode, PR_TRUE,
|
||||
getter_AddRefs(parentAccessible));
|
||||
if (parentAccessible) {
|
||||
PRInt32 childCountUnused;
|
||||
parentAccessible->GetChildCount(&childCountUnused);
|
||||
|
|
|
@ -1220,25 +1220,17 @@ nsAccessibilityService::GetAttachedAccessibleFor(nsIDOMNode *aNode,
|
|||
return GetAccessibleFor(aNode, aAccessible);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessible*
|
||||
nsAccessibilityService::GetAccessibleInShell(nsIDOMNode *aNode,
|
||||
nsIPresShell *aPresShell,
|
||||
nsIAccessible **aAccessible)
|
||||
nsIPresShell *aPresShell)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAccessible);
|
||||
*aAccessible = nsnull;
|
||||
|
||||
NS_ENSURE_ARG(aNode);
|
||||
NS_ENSURE_ARG(aPresShell);
|
||||
if (!aNode || !aPresShell)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(aPresShell));
|
||||
nsRefPtr<nsAccessible> accessible =
|
||||
GetAccessible(aNode, aPresShell, weakShell);
|
||||
|
||||
if (accessible)
|
||||
CallQueryInterface(accessible.get(), aAccessible);
|
||||
|
||||
return NS_OK;
|
||||
return accessible;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -76,6 +76,9 @@ public:
|
|||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
|
||||
// nsIAccessibilityService
|
||||
virtual nsAccessible* GetAccessibleInShell(nsIDOMNode *aNode,
|
||||
nsIPresShell *aPresShell);
|
||||
|
||||
virtual nsresult CreateOuterDocAccessible(nsIDOMNode *aNode,
|
||||
nsIAccessible **aAccessible);
|
||||
virtual nsresult CreateHTML4ButtonAccessible(nsIFrame *aFrame,
|
||||
|
|
|
@ -648,15 +648,13 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
accService->GetAccessibleInShell(aTargetNode, eventShell,
|
||||
getter_AddRefs(accessible));
|
||||
nsAccessible *accessible =
|
||||
accService->GetAccessibleInShell(aTargetNode, eventShell);
|
||||
|
||||
if (eventType.EqualsLiteral("popuphiding"))
|
||||
return HandlePopupHidingEvent(aTargetNode, accessible);
|
||||
|
||||
nsRefPtr<nsAccessible> acc(do_QueryObject(accessible));
|
||||
if (!acc)
|
||||
if (!accessible)
|
||||
return NS_OK;
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
|
@ -715,7 +713,7 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAccessible> treeItemAccessible;
|
||||
nsAccessible *treeItemAccessible = nsnull;
|
||||
#ifdef MOZ_XUL
|
||||
// If it's a tree element, need the currently selected item
|
||||
if (isTree) {
|
||||
|
@ -802,8 +800,7 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
|
|||
if (!focusedItem)
|
||||
return NS_OK;
|
||||
|
||||
accService->GetAccessibleInShell(focusedItem, eventShell,
|
||||
getter_AddRefs(accessible));
|
||||
accessible = accService->GetAccessibleInShell(focusedItem, eventShell);
|
||||
if (!accessible)
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -836,9 +833,7 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
|
|||
return NS_OK; // Tree with nothing selected
|
||||
}
|
||||
#endif
|
||||
nsRefPtr<nsAccessNode> menuAccessNode = do_QueryObject(accessible);
|
||||
|
||||
nsIFrame* menuFrame = menuAccessNode->GetFrame();
|
||||
nsIFrame* menuFrame = accessible->GetFrame();
|
||||
NS_ENSURE_TRUE(menuFrame, NS_ERROR_FAILURE);
|
||||
|
||||
nsIMenuFrame* imenuFrame = do_QueryFrame(menuFrame);
|
||||
|
@ -851,15 +846,13 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
|
|||
// is active.
|
||||
return NS_OK;
|
||||
} else {
|
||||
nsCOMPtr<nsIAccessible> containerAccessible;
|
||||
accessible->GetParent(getter_AddRefs(containerAccessible));
|
||||
nsAccessible *containerAccessible = accessible->GetParent();
|
||||
NS_ENSURE_TRUE(containerAccessible, NS_ERROR_FAILURE);
|
||||
// It is not top level menuitem
|
||||
// Only fire focus event if it is not inside collapsed popup
|
||||
// and not a listitem of a combo box
|
||||
if (nsAccUtils::State(containerAccessible) & nsIAccessibleStates::STATE_COLLAPSED) {
|
||||
nsCOMPtr<nsIAccessible> containerParent;
|
||||
containerAccessible->GetParent(getter_AddRefs(containerParent));
|
||||
nsAccessible *containerParent = containerAccessible->GetParent();
|
||||
NS_ENSURE_TRUE(containerParent, NS_ERROR_FAILURE);
|
||||
if (nsAccUtils::Role(containerParent) != nsIAccessibleRole::ROLE_COMBOBOX) {
|
||||
return NS_OK;
|
||||
|
|
|
@ -158,9 +158,8 @@ nsTextEquivUtils::AppendTextEquivFromContent(nsIAccessible *aInitiatorAcc,
|
|||
PRBool goThroughDOMSubtree = PR_TRUE;
|
||||
|
||||
if (isVisible) {
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
GetAccService()->GetAccessibleInShell(DOMNode, shell,
|
||||
getter_AddRefs(accessible));
|
||||
nsAccessible *accessible =
|
||||
GetAccService()->GetAccessibleInShell(DOMNode, shell);
|
||||
if (accessible) {
|
||||
rv = AppendFromAccessible(accessible, aString);
|
||||
goThroughDOMSubtree = PR_FALSE;
|
||||
|
|
|
@ -947,12 +947,14 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
|
|||
newEvent = mutationEvent;
|
||||
break;
|
||||
}
|
||||
#ifdef ACCESSIBILITY
|
||||
case NS_ACCESSIBLE_EVENT:
|
||||
{
|
||||
newEvent = new nsAccessibleEvent(PR_FALSE, msg, nsnull);
|
||||
isInputEvent = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case NS_FORM_EVENT:
|
||||
{
|
||||
newEvent = new nsFormEvent(PR_FALSE, msg);
|
||||
|
|
|
@ -180,8 +180,7 @@
|
|||
#include "nsITimer.h"
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsIAccessibleEvent.h"
|
||||
#include "nsAccessible.h"
|
||||
#endif
|
||||
|
||||
// For style data reconstruction
|
||||
|
@ -6332,8 +6331,10 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsIView *aView,
|
|||
#ifdef ACCESSIBILITY
|
||||
if (aEvent->eventStructType == NS_ACCESSIBLE_EVENT)
|
||||
{
|
||||
static_cast<nsAccessibleEvent*>(aEvent)->accessible = nsnull;
|
||||
nsCOMPtr<nsIAccessibilityService> accService =
|
||||
nsAccessibleEvent *accEvent = static_cast<nsAccessibleEvent*>(aEvent);
|
||||
accEvent->mAccessible = nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessibilityService> accService =
|
||||
do_GetService("@mozilla.org/accessibilityService;1");
|
||||
if (accService) {
|
||||
nsCOMPtr<nsISupports> container = mPresContext->GetContainer();
|
||||
|
@ -6342,14 +6343,12 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsIView *aView,
|
|||
// preshell is being held onto for fastback.
|
||||
return NS_OK;
|
||||
}
|
||||
nsIAccessible* acc;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> domNode(do_QueryInterface(mDocument));
|
||||
NS_ASSERTION(domNode, "No dom node for doc");
|
||||
accService->GetAccessibleInShell(domNode, this, &acc);
|
||||
// Addref this - it's not a COM Ptr
|
||||
// We'll make sure the right number of Addref's occur before
|
||||
// handing this back to the accessibility client
|
||||
static_cast<nsAccessibleEvent*>(aEvent)->accessible = acc;
|
||||
|
||||
accEvent->mAccessible = accService->GetAccessibleInShell(domNode, this);
|
||||
|
||||
// Ensure this is set in case a11y was activated before any
|
||||
// nsPresShells existed to observe "a11y-init-or-shutdown" topic
|
||||
gIsAccessibilityActive = PR_TRUE;
|
||||
|
|
|
@ -79,7 +79,9 @@ class nsScrollPortEvent;
|
|||
class nsInputEvent;
|
||||
class nsMouseEvent;
|
||||
class nsDragEvent;
|
||||
#ifdef ACCESSIBILITY
|
||||
class nsAccessibleEvent;
|
||||
#endif
|
||||
class nsKeyEvent;
|
||||
class nsTextEvent;
|
||||
class nsCompositionEvent;
|
||||
|
|
|
@ -60,9 +60,11 @@
|
|||
#include "nsITransferable.h"
|
||||
#include "nsIVariant.h"
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
class nsAccessible;
|
||||
#endif
|
||||
class nsIRenderingContext;
|
||||
class nsIMenuItem;
|
||||
class nsIAccessible;
|
||||
class nsIContent;
|
||||
class nsIURI;
|
||||
class nsHashKey;
|
||||
|
@ -838,6 +840,7 @@ public:
|
|||
PRPackedBool userCancelled;
|
||||
};
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
/**
|
||||
* Accessible event
|
||||
*/
|
||||
|
@ -847,12 +850,13 @@ class nsAccessibleEvent : public nsInputEvent
|
|||
public:
|
||||
nsAccessibleEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
|
||||
: nsInputEvent(isTrusted, msg, w, NS_ACCESSIBLE_EVENT),
|
||||
accessible(nsnull)
|
||||
mAccessible(nsnull)
|
||||
{
|
||||
}
|
||||
|
||||
nsIAccessible* accessible;
|
||||
nsAccessible *mAccessible;
|
||||
};
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Keyboard event
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
// formal protocols
|
||||
#include "mozView.h"
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "mozAccessibleProtocol.h"
|
||||
#endif
|
||||
|
||||
|
@ -366,7 +366,7 @@ public:
|
|||
virtual PRBool DispatchWindowEvent(nsGUIEvent& event);
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
void GetDocumentAccessible(nsIAccessible** aAccessible);
|
||||
already_AddRefed<nsAccessible> GetDocumentAccessible();
|
||||
#endif
|
||||
|
||||
virtual gfxASurface* GetThebesSurface();
|
||||
|
|
|
@ -2115,28 +2115,26 @@ nsChildView::EndSecureKeyboardInput()
|
|||
}
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
void
|
||||
nsChildView::GetDocumentAccessible(nsIAccessible** aAccessible)
|
||||
already_AddRefed<nsAccessible>
|
||||
nsChildView::GetDocumentAccessible()
|
||||
{
|
||||
*aAccessible = nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessible> accessible = do_QueryReferent(mAccessible);
|
||||
if (!mAccessible) {
|
||||
// need to fetch the accessible anew, because it has gone away.
|
||||
nsEventStatus status;
|
||||
nsAccessibleEvent event(PR_TRUE, NS_GETACCESSIBLE, this);
|
||||
DispatchEvent(&event, status);
|
||||
|
||||
// cache the accessible in our weak ptr
|
||||
mAccessible = do_GetWeakReference(event.accessible);
|
||||
|
||||
// now try again
|
||||
accessible = do_QueryReferent(mAccessible);
|
||||
nsAccessible *docAccessible = nsnull;
|
||||
if (mAccessible) {
|
||||
CallQueryReferent(mAccessible.get(), &docAccessible);
|
||||
return docAccessible;
|
||||
}
|
||||
|
||||
NS_IF_ADDREF(*aAccessible = accessible.get());
|
||||
|
||||
return;
|
||||
// need to fetch the accessible anew, because it has gone away.
|
||||
nsEventStatus status;
|
||||
nsAccessibleEvent event(PR_TRUE, NS_GETACCESSIBLE, this);
|
||||
DispatchEvent(&event, status);
|
||||
|
||||
// cache the accessible in our weak ptr
|
||||
mAccessible =
|
||||
do_GetWeakReference(static_cast<nsIAccessible*>(event.mAccessible));
|
||||
|
||||
NS_IF_ADDREF(event.mAccessible);
|
||||
return event.mAccessible;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -6075,8 +6073,7 @@ static const char* ToEscapedString(NSString* aString, nsCAutoString& aBuf)
|
|||
|
||||
nsAutoRetainCocoaObject kungFuDeathGrip(self);
|
||||
nsCOMPtr<nsIWidget> kungFuDeathGrip2(mGeckoChild);
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
mGeckoChild->GetDocumentAccessible(getter_AddRefs(accessible));
|
||||
nsRefPtr<nsAccessible> accessible = mGeckoChild->GetDocumentAccessible();
|
||||
if (!mGeckoChild)
|
||||
return nil;
|
||||
|
||||
|
|
|
@ -95,8 +95,6 @@
|
|||
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIAccessibleRole.h"
|
||||
#include "nsIAccessibleEvent.h"
|
||||
#include "prenv.h"
|
||||
#include "stdlib.h"
|
||||
static PRBool sAccessibilityChecked = PR_FALSE;
|
||||
|
@ -6510,14 +6508,13 @@ gdk_keyboard_get_modmap_masks(Display* aDisplay,
|
|||
* void
|
||||
* nsWindow::CreateRootAccessible
|
||||
*
|
||||
* request to create the nsIAccessible Object for the toplevel window
|
||||
* request to create the accessible object for the toplevel window
|
||||
**/
|
||||
void
|
||||
nsWindow::CreateRootAccessible()
|
||||
{
|
||||
if (mIsTopLevel && !mRootAccessible) {
|
||||
nsCOMPtr<nsIAccessible> acc;
|
||||
DispatchAccessibleEvent(getter_AddRefs(acc));
|
||||
nsAccessible *acc = DispatchAccessibleEvent();
|
||||
|
||||
if (acc) {
|
||||
mRootAccessible = acc;
|
||||
|
@ -6525,71 +6522,40 @@ nsWindow::CreateRootAccessible()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsWindow::GetRootAccessible(nsIAccessible** aAccessible)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> accessible, parentAccessible;
|
||||
DispatchAccessibleEvent(getter_AddRefs(accessible));
|
||||
PRUint32 role;
|
||||
|
||||
if (!accessible) {
|
||||
return;
|
||||
}
|
||||
while (PR_TRUE) {
|
||||
accessible->GetParent(getter_AddRefs(parentAccessible));
|
||||
if (!parentAccessible) {
|
||||
break;
|
||||
}
|
||||
parentAccessible->GetRole(&role);
|
||||
if (role == nsIAccessibleRole::ROLE_APP_ROOT) {
|
||||
NS_ADDREF(*aAccessible = accessible);
|
||||
break;
|
||||
}
|
||||
accessible = parentAccessible;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* void
|
||||
* nsWindow::DispatchAccessibleEvent
|
||||
* @aAccessible: the out var, hold the new accessible object
|
||||
*
|
||||
* generate the NS_GETACCESSIBLE event, the event handler is
|
||||
* reponsible to create an nsIAccessible instant.
|
||||
* reponsible to create an nsAccessible instant.
|
||||
**/
|
||||
PRBool
|
||||
nsWindow::DispatchAccessibleEvent(nsIAccessible** aAccessible)
|
||||
nsAccessible*
|
||||
nsWindow::DispatchAccessibleEvent()
|
||||
{
|
||||
PRBool result = PR_FALSE;
|
||||
nsAccessibleEvent event(PR_TRUE, NS_GETACCESSIBLE, this);
|
||||
|
||||
*aAccessible = nsnull;
|
||||
|
||||
nsEventStatus status;
|
||||
DispatchEvent(&event, status);
|
||||
result = (nsEventStatus_eConsumeNoDefault == status) ? PR_TRUE : PR_FALSE;
|
||||
(nsEventStatus_eConsumeNoDefault == status) ? PR_TRUE : PR_FALSE;
|
||||
|
||||
// if the event returned an accesssible get it.
|
||||
if (event.accessible)
|
||||
*aAccessible = event.accessible;
|
||||
|
||||
return result;
|
||||
return event.mAccessible;
|
||||
}
|
||||
|
||||
void
|
||||
nsWindow::DispatchActivateEventAccessible(void)
|
||||
{
|
||||
if (sAccessibilityEnabled) {
|
||||
nsCOMPtr<nsIAccessible> rootAcc;
|
||||
GetRootAccessible(getter_AddRefs(rootAcc));
|
||||
|
||||
nsCOMPtr<nsIAccessibilityService> accService =
|
||||
do_GetService("@mozilla.org/accessibilityService;1");
|
||||
|
||||
if (accService) {
|
||||
nsCOMPtr<nsIAccessible> appRootAcc;
|
||||
accService->GetApplicationAccessible(getter_AddRefs(appRootAcc));
|
||||
accService->FireAccessibleEvent(
|
||||
nsIAccessibleEvent::EVENT_WINDOW_ACTIVATE,
|
||||
rootAcc);
|
||||
appRootAcc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6598,16 +6564,15 @@ void
|
|||
nsWindow::DispatchDeactivateEventAccessible(void)
|
||||
{
|
||||
if (sAccessibilityEnabled) {
|
||||
nsCOMPtr<nsIAccessible> rootAcc;
|
||||
GetRootAccessible(getter_AddRefs(rootAcc));
|
||||
|
||||
nsCOMPtr<nsIAccessibilityService> accService =
|
||||
do_GetService("@mozilla.org/accessibilityService;1");
|
||||
|
||||
if (accService) {
|
||||
nsCOMPtr<nsIAccessible> appRootAcc;
|
||||
accService->GetApplicationAccessible(getter_AddRefs(appRootAcc));
|
||||
accService->FireAccessibleEvent(
|
||||
nsIAccessibleEvent::EVENT_WINDOW_DEACTIVATE,
|
||||
rootAcc);
|
||||
appRootAcc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,8 +65,7 @@
|
|||
#endif /* MOZ_X11 */
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsIAccessNode.h"
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsAccessible.h"
|
||||
#endif
|
||||
|
||||
#include "nsGtkIMModule.h"
|
||||
|
@ -408,12 +407,11 @@ private:
|
|||
#endif
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
nsCOMPtr<nsIAccessible> mRootAccessible;
|
||||
nsRefPtr<nsAccessible> mRootAccessible;
|
||||
void CreateRootAccessible();
|
||||
void GetRootAccessible(nsIAccessible** aAccessible);
|
||||
void DispatchActivateEventAccessible();
|
||||
void DispatchDeactivateEventAccessible();
|
||||
NS_IMETHOD_(PRBool) DispatchAccessibleEvent(nsIAccessible** aAccessible);
|
||||
nsAccessible* DispatchAccessibleEvent();
|
||||
#endif
|
||||
|
||||
// The cursor cache
|
||||
|
|
|
@ -184,9 +184,6 @@
|
|||
#if !defined(WINABLEAPI)
|
||||
#include <winable.h>
|
||||
#endif // !defined(WINABLEAPI)
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsIAccessibleDocument.h"
|
||||
#include "nsIAccessNode.h"
|
||||
#endif // defined(ACCESSIBILITY)
|
||||
|
||||
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_WIN7
|
||||
|
@ -3617,32 +3614,24 @@ PRBool nsWindow::DispatchMouseEvent(PRUint32 aEventType, WPARAM wParam,
|
|||
|
||||
// Deal with accessibile event
|
||||
#ifdef ACCESSIBILITY
|
||||
PRBool nsWindow::DispatchAccessibleEvent(PRUint32 aEventType, nsIAccessible** aAcc, nsIntPoint* aPoint)
|
||||
nsAccessible*
|
||||
nsWindow::DispatchAccessibleEvent(PRUint32 aEventType)
|
||||
{
|
||||
PRBool result = PR_FALSE;
|
||||
|
||||
if (nsnull == mEventCallback) {
|
||||
return result;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
*aAcc = nsnull;
|
||||
|
||||
nsAccessibleEvent event(PR_TRUE, aEventType, this);
|
||||
InitEvent(event, aPoint);
|
||||
InitEvent(event, nsnull);
|
||||
|
||||
event.isShift = IS_VK_DOWN(NS_VK_SHIFT);
|
||||
event.isControl = IS_VK_DOWN(NS_VK_CONTROL);
|
||||
event.isMeta = PR_FALSE;
|
||||
event.isAlt = IS_VK_DOWN(NS_VK_ALT);
|
||||
event.accessible = nsnull;
|
||||
|
||||
result = DispatchWindowEvent(&event);
|
||||
DispatchWindowEvent(&event);
|
||||
|
||||
// if the event returned an accesssible get it.
|
||||
if (event.accessible)
|
||||
*aAcc = event.accessible;
|
||||
|
||||
return result;
|
||||
return event.mAccessible;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -4589,7 +4578,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
|
|||
#ifdef ACCESSIBILITY
|
||||
if (nsWindow::sIsAccessibilityOn) {
|
||||
// Create it for the first time so that it can start firing events
|
||||
nsCOMPtr<nsIAccessible> rootAccessible = GetRootAccessible();
|
||||
nsAccessible *rootAccessible = GetRootAccessible();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -4674,7 +4663,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
|
|||
{
|
||||
*aRetValue = 0;
|
||||
if (lParam == OBJID_CLIENT) { // oleacc.dll will be loaded dynamically
|
||||
nsCOMPtr<nsIAccessible> rootAccessible = GetRootAccessible(); // Held by a11y cache
|
||||
nsAccessible *rootAccessible = GetRootAccessible(); // Held by a11y cache
|
||||
if (rootAccessible) {
|
||||
IAccessible *msaaAccessible = NULL;
|
||||
rootAccessible->GetNativeInterface((void**)&msaaAccessible); // does an addref
|
||||
|
@ -6792,7 +6781,8 @@ nsWindow::OnIMESelectionChange(void)
|
|||
#endif //NS_ENABLE_TSF
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
already_AddRefed<nsIAccessible> nsWindow::GetRootAccessible()
|
||||
nsAccessible*
|
||||
nsWindow::GetRootAccessible()
|
||||
{
|
||||
// We want the ability to forcibly disable a11y on windows, because
|
||||
// some non-a11y-related components attempt to bring it up. See bug
|
||||
|
@ -6824,8 +6814,6 @@ already_AddRefed<nsIAccessible> nsWindow::GetRootAccessible()
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
nsIAccessible *rootAccessible = nsnull;
|
||||
|
||||
// If accessibility is turned on, we create this even before it is requested
|
||||
// when the window gets focused. We need it to be created early so it can
|
||||
// generate accessibility events right away
|
||||
|
@ -6839,18 +6827,19 @@ already_AddRefed<nsIAccessible> nsWindow::GetRootAccessible()
|
|||
// Loop through windows and find the first one with accessibility info
|
||||
accessibleWindow = GetNSWindowPtr(accessibleWnd);
|
||||
if (accessibleWindow) {
|
||||
accessibleWindow->DispatchAccessibleEvent(NS_GETACCESSIBLE, &rootAccessible);
|
||||
nsAccessible *rootAccessible =
|
||||
accessibleWindow->DispatchAccessibleEvent(NS_GETACCESSIBLE);
|
||||
if (rootAccessible) {
|
||||
break; // Success, one of the child windows was active
|
||||
// Success, one of the child windows was active.
|
||||
return rootAccessible;
|
||||
}
|
||||
}
|
||||
accessibleWnd = ::GetNextWindow(accessibleWnd, GW_HWNDNEXT);
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
else {
|
||||
DispatchAccessibleEvent(NS_GETACCESSIBLE, &rootAccessible);
|
||||
}
|
||||
return rootAccessible;
|
||||
|
||||
return DispatchAccessibleEvent(NS_GETACCESSIBLE);
|
||||
}
|
||||
|
||||
STDMETHODIMP_(LRESULT)
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "OLEACC.H"
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsAccessible.h"
|
||||
#endif
|
||||
|
||||
#if !defined(WINCE)
|
||||
|
@ -219,8 +219,8 @@ public:
|
|||
void SuppressBlurEvents(PRBool aSuppress); // Called from nsFilePicker
|
||||
PRBool BlurEventsSuppressed();
|
||||
#ifdef ACCESSIBILITY
|
||||
virtual PRBool DispatchAccessibleEvent(PRUint32 aEventType, nsIAccessible** aAccessible, nsIntPoint* aPoint = nsnull);
|
||||
already_AddRefed<nsIAccessible> GetRootAccessible();
|
||||
nsAccessible* DispatchAccessibleEvent(PRUint32 aEventType);
|
||||
nsAccessible* GetRootAccessible();
|
||||
#endif // ACCESSIBILITY
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче