2001-09-25 00:48:50 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-17 21:52:36 +00:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
2001-03-04 02:31:28 +00:00
|
|
|
*
|
2004-04-17 21:52:36 +00:00
|
|
|
* 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/
|
2001-03-04 02:31:28 +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-03-04 02:31:28 +00:00
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-17 21:52:36 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-25 00:48:50 +00:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
2001-03-04 02:31:28 +00:00
|
|
|
*
|
2001-09-25 00:48:50 +00:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-17 21:52:36 +00:00
|
|
|
* 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"),
|
2001-09-25 00:48:50 +00:00
|
|
|
* 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
|
2004-04-17 21:52:36 +00:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-25 00:48:50 +00:00
|
|
|
* 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
|
2004-04-17 21:52:36 +00:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-25 00:48:50 +00:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2001-03-04 02:31:28 +00:00
|
|
|
|
|
|
|
#ifndef _nsRootAccessible_H_
|
|
|
|
#define _nsRootAccessible_H_
|
|
|
|
|
2008-06-16 06:16:18 +00:00
|
|
|
#include "nsCaretAccessible.h"
|
2003-04-01 20:02:51 +00:00
|
|
|
#include "nsDocAccessibleWrap.h"
|
2008-06-16 06:16:18 +00:00
|
|
|
|
2001-06-30 00:25:09 +00:00
|
|
|
#include "nsIAccessibleDocument.h"
|
2008-09-05 11:30:19 +00:00
|
|
|
#ifdef MOZ_XUL
|
2009-06-29 15:38:17 +00:00
|
|
|
#include "nsXULTreeAccessible.h"
|
2008-09-05 11:30:19 +00:00
|
|
|
#endif
|
2008-06-16 06:16:18 +00:00
|
|
|
|
|
|
|
#include "nsHashtable.h"
|
2007-06-14 17:12:50 +00:00
|
|
|
#include "nsCaretAccessible.h"
|
2003-04-28 10:24:52 +00:00
|
|
|
#include "nsIDocument.h"
|
|
|
|
#include "nsIDOMFocusListener.h"
|
2001-05-11 21:11:38 +00:00
|
|
|
#include "nsIDOMFormListener.h"
|
2001-09-25 08:34:42 +00:00
|
|
|
|
2006-07-13 05:42:32 +00:00
|
|
|
#define NS_ROOTACCESSIBLE_IMPL_CID \
|
2010-01-20 11:16:32 +00:00
|
|
|
{ /* eaba2cf0-21b1-4e2b-b711-d3a89dcd5e1a */ \
|
|
|
|
0xeaba2cf0, \
|
|
|
|
0x21b1, \
|
|
|
|
0x4e2b, \
|
|
|
|
{ 0xb7, 0x11, 0xd3, 0xa8, 0x9d, 0xcd, 0x5e, 0x1a } \
|
2006-07-13 05:42:32 +00:00
|
|
|
}
|
|
|
|
|
2002-05-08 20:21:03 +00:00
|
|
|
const PRInt32 SCROLL_HASH_START_SIZE = 6;
|
2001-04-17 23:06:38 +00:00
|
|
|
|
2003-04-01 20:02:51 +00:00
|
|
|
class nsRootAccessible : public nsDocAccessibleWrap,
|
2006-04-07 13:51:04 +00:00
|
|
|
public nsIDOMEventListener
|
2001-03-04 02:31:28 +00:00
|
|
|
{
|
2001-04-17 23:06:38 +00:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2009-06-25 02:08:53 +00:00
|
|
|
public:
|
2010-06-11 08:23:18 +00:00
|
|
|
nsRootAccessible(nsIDocument *aDocument, nsIContent *aRootContent,
|
|
|
|
nsIWeakReference *aShell);
|
2009-06-25 02:08:53 +00:00
|
|
|
virtual ~nsRootAccessible();
|
2001-03-04 02:31:28 +00:00
|
|
|
|
2009-06-25 02:08:53 +00:00
|
|
|
// nsIAccessible
|
|
|
|
NS_IMETHOD GetName(nsAString& aName);
|
|
|
|
NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
|
|
|
|
nsIAccessibleRelation **aRelation);
|
2001-03-04 02:31:28 +00:00
|
|
|
|
2009-06-25 02:08:53 +00:00
|
|
|
// nsIDOMEventListener
|
|
|
|
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
|
2007-01-10 20:25:20 +00:00
|
|
|
|
2009-06-25 02:08:53 +00:00
|
|
|
// nsAccessNode
|
2010-06-12 04:04:35 +00:00
|
|
|
virtual void Shutdown();
|
2001-05-17 21:28:37 +00:00
|
|
|
|
2009-06-25 02:08:53 +00:00
|
|
|
// nsAccessible
|
2010-09-05 02:14:01 +00:00
|
|
|
virtual PRUint32 NativeRole();
|
2009-06-25 02:08:53 +00:00
|
|
|
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
2003-04-01 20:02:51 +00:00
|
|
|
|
2009-06-25 02:08:53 +00:00
|
|
|
// nsRootAccessible
|
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ROOTACCESSIBLE_IMPL_CID)
|
2003-04-15 08:45:55 +00:00
|
|
|
|
2010-01-20 11:16:32 +00:00
|
|
|
/**
|
2010-12-12 01:47:30 +00:00
|
|
|
* Fire an accessible focus event for the focused accessible and attach a new
|
|
|
|
* selection listener to real focused element, if necessary.
|
2010-01-20 11:16:32 +00:00
|
|
|
*
|
2010-12-12 01:47:30 +00:00
|
|
|
* @param aFocusAccessible [in] the accessible which has received focus
|
|
|
|
* @param aRealFocusContent [in] the actual DOM element which has received
|
|
|
|
* focus (see @note section)
|
|
|
|
* @param aForceEvent [in, optional] fire a focus event even if
|
|
|
|
* the last focused item was the same
|
|
|
|
* @param aIsFromUserInput [in, optional] specifies whether the event is
|
|
|
|
* from user input
|
|
|
|
*
|
|
|
|
* @note Use the originally focused node where the selection lives as real
|
|
|
|
* focus node. For example, use the anonymous HTML:input instead of
|
|
|
|
* the containing XUL:textbox. In this case, sometimes it is a later
|
|
|
|
* focus event which points to the actual anonymous child with focus,
|
|
|
|
* so to be safe we need to reset the selection listener every time.
|
|
|
|
* This happens because when some bindings handle focus, they
|
|
|
|
* retarget focus to the appropriate child inside of themselves, but
|
|
|
|
* DOM focus stays outside on that binding parent.
|
2010-01-20 11:16:32 +00:00
|
|
|
*/
|
2010-12-12 01:47:30 +00:00
|
|
|
void FireAccessibleFocusEvent(nsAccessible* aFocusAccessible,
|
|
|
|
nsIContent* aRealFocusContent,
|
|
|
|
PRBool aForceEvent = PR_FALSE,
|
|
|
|
EIsFromUserInput aIsFromUserInput = eAutoDetect);
|
2010-01-20 11:16:32 +00:00
|
|
|
|
2008-07-03 07:10:16 +00:00
|
|
|
/**
|
|
|
|
* Fire an accessible focus event for the current focused node,
|
|
|
|
* if there is a focus.
|
|
|
|
*/
|
|
|
|
void FireCurrentFocusEvent();
|
2007-03-10 23:11:04 +00:00
|
|
|
|
2007-06-14 19:19:19 +00:00
|
|
|
nsCaretAccessible *GetCaretAccessible();
|
2007-06-14 17:12:50 +00:00
|
|
|
|
2010-01-25 15:08:08 +00:00
|
|
|
protected:
|
|
|
|
NS_DECL_RUNNABLEMETHOD(nsRootAccessible, FireCurrentFocusEvent)
|
|
|
|
|
2003-07-22 14:55:22 +00:00
|
|
|
nsresult AddEventListeners();
|
|
|
|
nsresult RemoveEventListeners();
|
2010-06-11 08:23:18 +00:00
|
|
|
|
|
|
|
/**
|
2010-07-01 02:18:08 +00:00
|
|
|
* Process "popupshown" event. Used by HandleEvent().
|
2010-06-11 08:23:18 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
nsresult HandlePopupShownEvent(nsAccessible *aAccessible);
|
|
|
|
/*
|
2010-07-01 02:18:08 +00:00
|
|
|
* Process "popuphiding" event. Used by HandleEvent().
|
2010-06-11 08:23:18 +00:00
|
|
|
*/
|
|
|
|
nsresult HandlePopupHidingEvent(nsINode *aNode, nsAccessible *aAccessible);
|
2008-12-03 09:04:02 +00:00
|
|
|
|
2008-09-05 11:30:19 +00:00
|
|
|
#ifdef MOZ_XUL
|
2008-02-08 12:55:57 +00:00
|
|
|
nsresult HandleTreeRowCountChangedEvent(nsIDOMEvent *aEvent,
|
2009-06-29 15:38:17 +00:00
|
|
|
nsXULTreeAccessible *aAccessible);
|
2008-02-08 12:55:57 +00:00
|
|
|
nsresult HandleTreeInvalidatedEvent(nsIDOMEvent *aEvent,
|
2009-06-29 15:38:17 +00:00
|
|
|
nsXULTreeAccessible *aAccessible);
|
2008-02-08 12:55:57 +00:00
|
|
|
|
2007-01-28 03:58:18 +00:00
|
|
|
PRUint32 GetChromeFlags();
|
|
|
|
#endif
|
2006-07-17 14:10:24 +00:00
|
|
|
already_AddRefed<nsIDocShellTreeItem>
|
|
|
|
GetContentDocShell(nsIDocShellTreeItem *aStart);
|
2007-06-14 17:12:50 +00:00
|
|
|
nsRefPtr<nsCaretAccessible> mCaretAccessible;
|
2010-06-11 08:23:18 +00:00
|
|
|
nsCOMPtr<nsINode> mCurrentARIAMenubar;
|
2001-03-04 02:31:28 +00:00
|
|
|
};
|
|
|
|
|
2006-07-13 05:42:32 +00:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsRootAccessible, NS_ROOTACCESSIBLE_IMPL_CID)
|
|
|
|
|
2001-03-04 02:31:28 +00:00
|
|
|
#endif
|