2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either of 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 MPL, 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 MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#ifndef _nsRootAccessible_H_
|
|
|
|
#define _nsRootAccessible_H_
|
|
|
|
|
2008-06-15 23:16:18 -07:00
|
|
|
#include "nsCaretAccessible.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsDocAccessibleWrap.h"
|
2008-06-15 23:16:18 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIAccessibleDocument.h"
|
2008-09-05 04:30:19 -07:00
|
|
|
#ifdef MOZ_XUL
|
2008-06-15 23:16:18 -07:00
|
|
|
#include "nsIAccessibleTreeCache.h"
|
2008-09-05 04:30:19 -07:00
|
|
|
#endif
|
2008-06-15 23:16:18 -07:00
|
|
|
|
|
|
|
#include "nsHashtable.h"
|
2007-06-14 10:12:50 -07:00
|
|
|
#include "nsCaretAccessible.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIDocument.h"
|
|
|
|
#include "nsIDOMFocusListener.h"
|
|
|
|
#include "nsIDOMFormListener.h"
|
|
|
|
#include "nsIDOMXULListener.h"
|
|
|
|
#include "nsITimer.h"
|
|
|
|
|
|
|
|
#define NS_ROOTACCESSIBLE_IMPL_CID \
|
|
|
|
{ /* 7565f0d1-1465-4b71-906c-a623ac279f5d */ \
|
|
|
|
0x7565f0d1, \
|
|
|
|
0x1465, \
|
|
|
|
0x4b71, \
|
|
|
|
{ 0x90, 0x6c, 0xa6, 0x23, 0xac, 0x27, 0x9f, 0x5d } \
|
|
|
|
}
|
|
|
|
|
|
|
|
const PRInt32 SCROLL_HASH_START_SIZE = 6;
|
|
|
|
|
|
|
|
class nsRootAccessible : public nsDocAccessibleWrap,
|
|
|
|
public nsIDOMEventListener
|
|
|
|
{
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
public:
|
|
|
|
nsRootAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell);
|
|
|
|
virtual ~nsRootAccessible();
|
|
|
|
|
2007-06-01 20:01:38 -07:00
|
|
|
// nsIAccessible
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD GetName(nsAString& aName);
|
|
|
|
NS_IMETHOD GetParent(nsIAccessible * *aParent);
|
|
|
|
NS_IMETHOD GetRole(PRUint32 *aRole);
|
|
|
|
NS_IMETHOD GetAccessibleRelated(PRUint32 aRelationType,
|
|
|
|
nsIAccessible **aRelated);
|
|
|
|
|
|
|
|
// ----- nsPIAccessibleDocument -----------------------
|
|
|
|
NS_IMETHOD FireDocLoadEvents(PRUint32 aEventType);
|
|
|
|
|
|
|
|
// ----- nsIDOMEventListener --------------------------
|
|
|
|
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
|
|
|
|
|
2008-10-31 20:58:07 -07:00
|
|
|
// nsAccessNode
|
|
|
|
virtual nsresult Init();
|
|
|
|
virtual nsresult Shutdown();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-11-03 19:37:46 -08:00
|
|
|
// nsAccessible
|
|
|
|
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
void ShutdownAll();
|
|
|
|
|
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ROOTACCESSIBLE_IMPL_CID)
|
|
|
|
|
2007-04-09 06:40:25 -07:00
|
|
|
/**
|
|
|
|
* Fire an accessible focus event for the current focusAccssible
|
|
|
|
* and attach a new selection listener, if necessary.
|
|
|
|
* @param aFocusAccessible The accessible which has received focus.
|
|
|
|
* @param aFocusNode The DOM Node which has received focus.
|
|
|
|
* @param aFocusEvent DOM focus event that caused the node/accessible to receive focus
|
|
|
|
* @param aForceEvent Fire a focus event even if the last focused item was the same
|
|
|
|
* @return Boolean -- was a focus event actually fired
|
|
|
|
*/
|
|
|
|
PRBool FireAccessibleFocusEvent(nsIAccessible *aFocusAccessible,
|
|
|
|
nsIDOMNode *aFocusNode,
|
|
|
|
nsIDOMEvent *aFocusEvent,
|
2007-08-10 18:44:44 -07:00
|
|
|
PRBool aForceEvent = PR_FALSE,
|
|
|
|
PRBool aIsAsynch = PR_FALSE);
|
2008-07-03 00:10:16 -07:00
|
|
|
/**
|
|
|
|
* Fire an accessible focus event for the current focused node,
|
|
|
|
* if there is a focus.
|
|
|
|
*/
|
|
|
|
void FireCurrentFocusEvent();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-06-14 12:19:19 -07:00
|
|
|
nsCaretAccessible *GetCaretAccessible();
|
2007-06-14 10:12:50 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
private:
|
|
|
|
nsCOMPtr<nsITimer> mFireFocusTimer;
|
|
|
|
static void FireFocusCallback(nsITimer *aTimer, void *aClosure);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
nsresult AddEventListeners();
|
|
|
|
nsresult RemoveEventListeners();
|
2007-05-28 23:53:50 -07:00
|
|
|
nsresult HandleEventWithTarget(nsIDOMEvent* aEvent,
|
|
|
|
nsIDOMNode* aTargetNode);
|
2007-03-22 10:30:00 -07:00
|
|
|
static void GetTargetNode(nsIDOMEvent *aEvent, nsIDOMNode **aTargetNode);
|
|
|
|
void TryFireEarlyLoadEvent(nsIDOMNode *aDocNode);
|
|
|
|
void GetChromeEventHandler(nsIDOMEventTarget **aChromeTarget);
|
2008-02-08 04:55:57 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles 'TreeRowCountChanged' event. Used in HandleEventWithTarget().
|
|
|
|
*/
|
2008-09-05 04:30:19 -07:00
|
|
|
#ifdef MOZ_XUL
|
2008-02-08 04:55:57 -08:00
|
|
|
nsresult HandleTreeRowCountChangedEvent(nsIDOMEvent *aEvent,
|
2008-06-15 23:16:18 -07:00
|
|
|
nsIAccessibleTreeCache *aAccessible);
|
2008-02-08 04:55:57 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles 'TreeInvalidated' event. Used in HandleEventWithTarget().
|
|
|
|
*/
|
|
|
|
nsresult HandleTreeInvalidatedEvent(nsIDOMEvent *aEvent,
|
2008-06-15 23:16:18 -07:00
|
|
|
nsIAccessibleTreeCache *aAccessible);
|
2008-02-08 04:55:57 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
PRUint32 GetChromeFlags();
|
|
|
|
#endif
|
|
|
|
already_AddRefed<nsIDocShellTreeItem>
|
|
|
|
GetContentDocShell(nsIDocShellTreeItem *aStart);
|
2007-06-14 10:12:50 -07:00
|
|
|
nsRefPtr<nsCaretAccessible> mCaretAccessible;
|
2007-11-09 10:44:18 -08:00
|
|
|
nsCOMPtr<nsIDOMNode> mCurrentARIAMenubar;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsRootAccessible, NS_ROOTACCESSIBLE_IMPL_CID)
|
|
|
|
|
|
|
|
#endif
|