2001-09-25 00:48:50 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
2001-02-14 20:51:33 +00:00
|
|
|
*
|
2001-09-25 00:48:50 +00:00
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
* compliance with the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/NPL/
|
2001-02-14 20:51:33 +00:00
|
|
|
*
|
2001-09-25 00:48:50 +00:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
2001-02-14 20:51:33 +00:00
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2001-09-25 00:48:50 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
2001-02-14 20:51:33 +00:00
|
|
|
*
|
2001-09-25 00:48:50 +00:00
|
|
|
* Contributor(s):
|
2001-10-09 21:52:36 +00:00
|
|
|
* John Gaunt (jgaunt@netscape.com)
|
2001-09-25 00:48:50 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the NPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2001-02-14 20:51:33 +00:00
|
|
|
|
|
|
|
#ifndef _nsAccessible_H_
|
|
|
|
#define _nsAccessible_H_
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
2001-10-09 21:52:36 +00:00
|
|
|
#include "nsGenericAccessible.h"
|
|
|
|
#include "nsIAccessible.h"
|
Bug 109851, bug 108629, bug 109921, bug 109977, bug 109153, bug 109187, bug 109213, bug 109221. Check in latest XUL accessibility support - menus, <colorpicker>, <progressmeter>, <groupbox>, mixed states for checkboxes, buttons that can be 'checked' ie pressed down, fixes extra MSAA events being generated, couldn't see HTML content
2001-11-20 02:05:26 +00:00
|
|
|
#include "nsIAccessibilityService.h"
|
2001-02-14 20:51:33 +00:00
|
|
|
#include "nsIDOMNode.h"
|
2001-05-11 21:11:38 +00:00
|
|
|
#include "nsIFocusController.h"
|
2001-10-09 21:52:36 +00:00
|
|
|
#include "nsIPresContext.h"
|
|
|
|
#include "nsIPresShell.h"
|
2001-05-11 21:11:38 +00:00
|
|
|
#include "nsPoint.h"
|
2001-10-09 21:52:36 +00:00
|
|
|
#include "nsRect.h"
|
|
|
|
#include "nsWeakReference.h"
|
2001-10-26 23:47:52 +00:00
|
|
|
#include "nsIDOMNodeList.h"
|
|
|
|
#include "nsIBindingManager.h"
|
2001-05-11 21:11:38 +00:00
|
|
|
|
2002-02-07 22:52:20 +00:00
|
|
|
#define ACCESSIBLE_BUNDLE_URL "chrome://global-platform/locale/accessible.properties"
|
2001-02-14 20:51:33 +00:00
|
|
|
|
2001-10-09 21:52:36 +00:00
|
|
|
class nsIContent;
|
2001-05-11 21:11:38 +00:00
|
|
|
class nsIDocShell;
|
2001-10-09 21:52:36 +00:00
|
|
|
class nsIFrame;
|
2001-05-11 21:11:38 +00:00
|
|
|
class nsIWebShell;
|
2001-02-14 20:51:33 +00:00
|
|
|
|
2001-10-26 23:47:52 +00:00
|
|
|
enum { eSiblingsUninitialized = -1, eSiblingsWalkNormalDOM = -2}; // Used in sibling index field as flags
|
|
|
|
|
2001-06-30 00:25:09 +00:00
|
|
|
class nsAccessible : public nsGenericAccessible
|
2001-02-14 20:51:33 +00:00
|
|
|
{
|
2001-06-30 00:25:09 +00:00
|
|
|
public:
|
2001-11-07 00:12:16 +00:00
|
|
|
// to eliminate the confusion of "magic numbers" -- if ( 0 ){ foo; }
|
2002-04-26 04:50:21 +00:00
|
|
|
enum { eAction_Switch=0, eAction_Jump=0, eAction_Click=0, eAction_Select=0 };
|
2001-11-07 00:12:16 +00:00
|
|
|
// how many actions
|
|
|
|
enum { eNo_Action=0, eSingle_Action=1 };
|
|
|
|
|
Bug 109851, bug 108629, bug 109921, bug 109977, bug 109153, bug 109187, bug 109213, bug 109221. Check in latest XUL accessibility support - menus, <colorpicker>, <progressmeter>, <groupbox>, mixed states for checkboxes, buttons that can be 'checked' ie pressed down, fixes extra MSAA events being generated, couldn't see HTML content
2001-11-20 02:05:26 +00:00
|
|
|
nsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
|
|
|
virtual ~nsAccessible();
|
|
|
|
|
2002-03-23 21:52:27 +00:00
|
|
|
NS_IMETHOD GetAccName(nsAString& _retval);
|
2001-06-30 00:25:09 +00:00
|
|
|
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
|
|
|
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
|
|
|
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
|
|
|
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
|
|
|
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
|
|
|
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
|
|
|
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
|
|
|
NS_IMETHOD GetAccFocused(nsIAccessible **_retval);
|
|
|
|
NS_IMETHOD AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval);
|
|
|
|
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
|
|
|
|
NS_IMETHOD AccRemoveSelection(void);
|
|
|
|
NS_IMETHOD AccTakeSelection(void);
|
|
|
|
NS_IMETHOD AccTakeFocus(void);
|
|
|
|
NS_IMETHOD AccGetDOMNode(nsIDOMNode **_retval);
|
2001-02-14 20:51:33 +00:00
|
|
|
|
|
|
|
protected:
|
2001-03-04 02:31:28 +00:00
|
|
|
virtual nsIFrame* GetFrame();
|
2001-03-28 00:49:05 +00:00
|
|
|
virtual nsIFrame* GetBoundsFrame();
|
2001-05-17 23:52:32 +00:00
|
|
|
virtual void GetBounds(nsRect& aRect, nsIFrame** aRelativeFrame);
|
2001-03-04 02:31:28 +00:00
|
|
|
virtual void GetPresContext(nsCOMPtr<nsIPresContext>& aContext);
|
2002-01-16 03:07:03 +00:00
|
|
|
PRBool IsPartiallyVisible();
|
2002-03-23 21:52:27 +00:00
|
|
|
NS_IMETHOD AppendLabelText(nsIDOMNode *aLabelNode, nsAString& _retval);
|
|
|
|
NS_IMETHOD AppendLabelFor(nsIContent *aLookNode, const nsAString *aId, nsAString *aLabel);
|
|
|
|
NS_IMETHOD GetHTMLAccName(nsAString& _retval);
|
|
|
|
NS_IMETHOD GetXULAccName(nsAString& _retval);
|
|
|
|
NS_IMETHOD AppendFlatStringFromSubtree(nsIContent *aContent, nsAString *aFlatString);
|
|
|
|
NS_IMETHOD AppendFlatStringFromContentNode(nsIContent *aContent, nsAString *aFlatString);
|
|
|
|
NS_IMETHOD AppendStringWithSpaces(nsAString *aFlatString, const nsAString& textEquivalent);
|
2001-10-26 23:47:52 +00:00
|
|
|
NS_IMETHOD GetFocusedElement(nsIDOMElement **aFocusedElement);
|
|
|
|
NS_IMETHOD CacheOptimizations(nsIAccessible *aParent, PRInt32 aSiblingIndex, nsIDOMNodeList *aSiblingList);
|
Bug 109851, bug 108629, bug 109921, bug 109977, bug 109153, bug 109187, bug 109213, bug 109221. Check in latest XUL accessibility support - menus, <colorpicker>, <progressmeter>, <groupbox>, mixed states for checkboxes, buttons that can be 'checked' ie pressed down, fixes extra MSAA events being generated, couldn't see HTML content
2001-11-20 02:05:26 +00:00
|
|
|
// helper method to verify frames
|
|
|
|
static PRBool IsCorrectFrameType(nsIFrame* aFrame, nsIAtom* aAtom);
|
2002-03-23 21:52:27 +00:00
|
|
|
static nsresult GetTranslatedString(const nsAString& aKey, nsAString& aStringOut);
|
2002-01-15 05:20:27 +00:00
|
|
|
void GetScrollOffset(nsRect *aRect);
|
Bug 109851, bug 108629, bug 109921, bug 109977, bug 109153, bug 109187, bug 109213, bug 109221. Check in latest XUL accessibility support - menus, <colorpicker>, <progressmeter>, <groupbox>, mixed states for checkboxes, buttons that can be 'checked' ie pressed down, fixes extra MSAA events being generated, couldn't see HTML content
2001-11-20 02:05:26 +00:00
|
|
|
void GetScreenOrigin(nsIPresContext *aPresContext, nsIFrame *aFrame, nsRect *aRect);
|
2001-09-25 22:32:32 +00:00
|
|
|
|
2001-05-11 21:11:38 +00:00
|
|
|
// Data Members
|
|
|
|
nsCOMPtr<nsIDOMNode> mDOMNode;
|
2001-03-05 20:21:39 +00:00
|
|
|
nsCOMPtr<nsIWeakReference> mPresShell;
|
2001-10-26 23:47:52 +00:00
|
|
|
nsCOMPtr<nsIAccessible> mParent;
|
|
|
|
nsCOMPtr<nsIDOMNodeList> mSiblingList; // If some of our computed siblings are anonymous content nodes, cache node list
|
|
|
|
PRInt32 mSiblingIndex; // Cache where we are in list of kids that we got from nsIBindingManager::GetContentList(parentContent)
|
2001-02-14 20:51:33 +00:00
|
|
|
};
|
|
|
|
|
Bug 109851, bug 108629, bug 109921, bug 109977, bug 109153, bug 109187, bug 109213, bug 109221. Check in latest XUL accessibility support - menus, <colorpicker>, <progressmeter>, <groupbox>, mixed states for checkboxes, buttons that can be 'checked' ie pressed down, fixes extra MSAA events being generated, couldn't see HTML content
2001-11-20 02:05:26 +00:00
|
|
|
|
|
|
|
/** This class is used to walk the DOM tree. It skips
|
|
|
|
* everything but nodes that either implement nsIAccessible
|
|
|
|
* or have primary frames that implement "GetAccessible"
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct WalkState {
|
|
|
|
nsCOMPtr<nsIAccessible> accessible;
|
|
|
|
nsCOMPtr<nsIDOMNode> domNode;
|
|
|
|
nsCOMPtr<nsIDOMNodeList> siblingList;
|
|
|
|
PRInt32 siblingIndex; // Holds a state flag or an index into the siblingList
|
|
|
|
WalkState *prevState;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class nsAccessibleTreeWalker {
|
|
|
|
public:
|
|
|
|
nsAccessibleTreeWalker(nsIWeakReference* aShell, nsIDOMNode* aContent,
|
|
|
|
PRInt32 aCachedSiblingIndex, nsIDOMNodeList *aCachedSiblingList, PRBool mWalkAnonymousContent);
|
|
|
|
~nsAccessibleTreeWalker();
|
|
|
|
|
|
|
|
NS_IMETHOD GetNextSibling();
|
|
|
|
NS_IMETHOD GetPreviousSibling();
|
|
|
|
NS_IMETHOD GetParent();
|
|
|
|
NS_IMETHOD GetFirstChild();
|
|
|
|
NS_IMETHOD GetLastChild();
|
|
|
|
PRInt32 GetChildCount();
|
|
|
|
WalkState mState;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
NS_IMETHOD GetChildBefore(nsIDOMNode* aParent, nsIDOMNode* aChild);
|
|
|
|
PRBool IsHidden();
|
|
|
|
PRBool GetAccessible();
|
|
|
|
NS_IMETHOD GetFullTreeParentNode(nsIDOMNode *aChildNode, nsIDOMNode **aParentNodeOut);
|
|
|
|
void GetSiblings(nsIDOMNode *aOneOfTheSiblings);
|
|
|
|
void GetKids(nsIDOMNode *aParent);
|
|
|
|
|
|
|
|
void ClearState();
|
|
|
|
NS_IMETHOD PushState();
|
|
|
|
NS_IMETHOD PopState();
|
|
|
|
|
|
|
|
nsCOMPtr<nsIWeakReference> mPresShell;
|
|
|
|
nsCOMPtr<nsIAccessibilityService> mAccService;
|
|
|
|
nsCOMPtr<nsIBindingManager> mBindingManager;
|
|
|
|
};
|
|
|
|
|
2001-02-14 20:51:33 +00:00
|
|
|
#endif
|