2007-03-27 05:17:11 -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
|
|
|
|
* Mozilla Foundation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2007
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Alexander Surkov <surkov.alexander@gmail.com> (original author)
|
|
|
|
*
|
|
|
|
* 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 ***** */
|
|
|
|
|
2008-10-15 18:52:58 -07:00
|
|
|
#ifndef nsCoreUtils_h_
|
|
|
|
#define nsCoreUtils_h_
|
2007-03-27 05:17:11 -07:00
|
|
|
|
|
|
|
#include "nsAccessibilityAtoms.h"
|
|
|
|
|
|
|
|
#include "nsIDOMNode.h"
|
2007-05-08 14:44:04 -07:00
|
|
|
#include "nsIContent.h"
|
2009-05-06 02:54:26 -07:00
|
|
|
#include "nsIBoxObject.h"
|
|
|
|
#include "nsITreeBoxObject.h"
|
2009-08-19 23:45:19 -07:00
|
|
|
#include "nsITreeColumns.h"
|
2009-05-06 02:54:26 -07:00
|
|
|
|
2007-08-23 21:54:45 -07:00
|
|
|
#include "nsIFrame.h"
|
2007-09-05 00:39:09 -07:00
|
|
|
#include "nsIDocShellTreeItem.h"
|
2010-04-26 23:52:03 -07:00
|
|
|
#include "nsIDOMCSSStyleDeclaration.h"
|
|
|
|
#include "nsIDOMDOMStringList.h"
|
2009-05-13 22:31:09 -07:00
|
|
|
#include "nsIMutableArray.h"
|
2007-09-05 00:39:09 -07:00
|
|
|
#include "nsPoint.h"
|
2010-04-26 23:52:03 -07:00
|
|
|
#include "nsTArray.h"
|
2007-03-27 05:17:11 -07:00
|
|
|
|
2010-04-26 23:52:03 -07:00
|
|
|
/**
|
|
|
|
* Core utils.
|
|
|
|
*/
|
2008-10-15 18:52:58 -07:00
|
|
|
class nsCoreUtils
|
2007-03-27 05:17:11 -07:00
|
|
|
{
|
|
|
|
public:
|
2007-07-05 09:02:55 -07:00
|
|
|
/**
|
2010-02-03 07:00:25 -08:00
|
|
|
* Return true if the given node has registered click, mousedown or mouseup
|
|
|
|
* event listeners.
|
2007-07-05 09:02:55 -07:00
|
|
|
*/
|
2010-02-03 07:00:25 -08:00
|
|
|
static PRBool HasClickListener(nsIContent *aContent);
|
2007-07-05 09:02:55 -07:00
|
|
|
|
2008-08-06 05:16:54 -07:00
|
|
|
/**
|
2009-08-19 23:45:19 -07:00
|
|
|
* Dispatch click event to XUL tree cell.
|
2008-08-06 05:16:54 -07:00
|
|
|
*
|
2009-08-19 23:45:19 -07:00
|
|
|
* @param aTreeBoxObj [in] tree box object
|
|
|
|
* @param aRowIndex [in] row index
|
|
|
|
* @param aColumn [in] column object
|
|
|
|
* @param aPseudoElm [in] pseudo elemenet inside the cell, see
|
|
|
|
* nsITreeBoxObject for available values
|
|
|
|
*/
|
|
|
|
static void DispatchClickEvent(nsITreeBoxObject *aTreeBoxObj,
|
|
|
|
PRInt32 aRowIndex, nsITreeColumn *aColumn,
|
|
|
|
const nsCString& aPseudoElt = EmptyCString());
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Send mouse event to the given element.
|
|
|
|
*
|
|
|
|
* @param aEventType [in] an event type (see nsGUIEvent.h for constants)
|
|
|
|
* @param aPresShell [in] the presshell for the given element
|
|
|
|
* @param aContent [in] the element
|
2008-08-06 05:16:54 -07:00
|
|
|
*/
|
|
|
|
static PRBool DispatchMouseEvent(PRUint32 aEventType,
|
|
|
|
nsIPresShell *aPresShell,
|
|
|
|
nsIContent *aContent);
|
|
|
|
|
2009-08-19 23:45:19 -07:00
|
|
|
/**
|
|
|
|
* Send mouse event to the given element.
|
|
|
|
*
|
|
|
|
* @param aEventType [in] an event type (see nsGUIEvent.h for constants)
|
|
|
|
* @param aX [in] x coordinate in dev pixels
|
|
|
|
* @param aY [in] y coordinate in dev pixels
|
|
|
|
* @param aContent [in] the element
|
|
|
|
* @param aFrame [in] frame of the element
|
|
|
|
* @param aPresShell [in] the presshell for the element
|
|
|
|
* @param aRootWidget [in] the root widget of the element
|
|
|
|
*/
|
|
|
|
static void DispatchMouseEvent(PRUint32 aEventType, PRInt32 aX, PRInt32 aY,
|
|
|
|
nsIContent *aContent, nsIFrame *aFrame,
|
|
|
|
nsIPresShell *aPresShell,
|
|
|
|
nsIWidget *aRootWidget);
|
|
|
|
|
2007-08-28 23:52:46 -07:00
|
|
|
/**
|
|
|
|
* Return an accesskey registered on the given element by
|
|
|
|
* nsIEventStateManager or 0 if there is no registered accesskey.
|
|
|
|
*
|
|
|
|
* @param aContent - the given element.
|
|
|
|
*/
|
|
|
|
static PRUint32 GetAccessKeyFor(nsIContent *aContent);
|
|
|
|
|
2008-07-17 05:06:24 -07:00
|
|
|
/**
|
|
|
|
* Return DOM element related with the given node, i.e.
|
|
|
|
* a) itself if it is DOM element
|
|
|
|
* b) parent element if it is text node
|
2008-10-08 05:50:36 -07:00
|
|
|
* c) body element if it is HTML document node
|
|
|
|
* d) document element if it is document node.
|
2008-07-17 05:06:24 -07:00
|
|
|
*
|
|
|
|
* @param aNode [in] the given DOM node
|
|
|
|
*/
|
|
|
|
static already_AddRefed<nsIDOMElement> GetDOMElementFor(nsIDOMNode *aNode);
|
|
|
|
|
2008-12-16 02:14:20 -08:00
|
|
|
/**
|
|
|
|
* Return DOM node for the given DOM point.
|
|
|
|
*/
|
|
|
|
static already_AddRefed<nsIDOMNode> GetDOMNodeFromDOMPoint(nsIDOMNode *aNode,
|
|
|
|
PRUint32 aOffset);
|
2008-10-17 03:10:43 -07:00
|
|
|
/**
|
|
|
|
* Return the nsIContent* to check for ARIA attributes on -- this may not
|
|
|
|
* always be the DOM node for the accessible. Specifically, for doc
|
|
|
|
* accessibles, it is not the document node, but either the root element or
|
|
|
|
* <body> in HTML. Similar with GetDOMElementFor() method.
|
|
|
|
*
|
|
|
|
* @param aDOMNode DOM node for the accessible that may be affected by ARIA
|
|
|
|
* @return the nsIContent which may have ARIA markup
|
|
|
|
*/
|
|
|
|
static nsIContent *GetRoleContent(nsIDOMNode *aDOMNode);
|
|
|
|
|
2007-08-14 11:47:49 -07:00
|
|
|
/**
|
|
|
|
* Is the first passed in node an ancestor of the second?
|
|
|
|
* Note: A node is not considered to be the ancestor of itself.
|
2010-01-27 03:43:25 -08:00
|
|
|
*
|
|
|
|
* @param aPossibleAncestorNode [in] node to test for ancestor-ness of
|
|
|
|
* aPossibleDescendantNode
|
|
|
|
* @param aPossibleDescendantNode [in] node to test for descendant-ness of
|
|
|
|
* aPossibleAncestorNode
|
|
|
|
* @return PR_TRUE if aPossibleAncestorNode is an ancestor of
|
|
|
|
* aPossibleDescendantNode
|
2007-08-14 11:47:49 -07:00
|
|
|
*/
|
2010-01-27 03:43:25 -08:00
|
|
|
static PRBool IsAncestorOf(nsINode *aPossibleAncestorNode,
|
|
|
|
nsINode *aPossibleDescendantNode);
|
2007-08-20 20:16:27 -07:00
|
|
|
|
2008-03-17 01:13:10 -07:00
|
|
|
/**
|
|
|
|
* Are the first node and the second siblings?
|
2010-01-27 03:43:25 -08:00
|
|
|
*
|
2008-03-17 01:13:10 -07:00
|
|
|
* @return PR_TRUE if aDOMNode1 and aDOMNode2 have same parent
|
|
|
|
*/
|
2010-01-27 03:43:25 -08:00
|
|
|
static PRBool AreSiblings(nsINode *aNode1, nsINode *aNode2);
|
2008-03-17 01:13:10 -07:00
|
|
|
|
2007-08-23 21:54:45 -07:00
|
|
|
/**
|
|
|
|
* Helper method to scroll range into view, used for implementation of
|
|
|
|
* nsIAccessibleText::scrollSubstringTo().
|
|
|
|
*
|
|
|
|
* @param aFrame the frame for accessible the range belongs to.
|
|
|
|
* @param aStartNode start node of a range
|
|
|
|
* @param aStartOffset an offset inside the start node
|
|
|
|
* @param aEndNode end node of a range
|
|
|
|
* @param aEndOffset an offset inside the end node
|
|
|
|
* @param aScrollType the place a range should be scrolled to
|
|
|
|
*/
|
|
|
|
static nsresult ScrollSubstringTo(nsIFrame *aFrame,
|
|
|
|
nsIDOMNode *aStartNode, PRInt32 aStartIndex,
|
|
|
|
nsIDOMNode *aEndNode, PRInt32 aEndIndex,
|
|
|
|
PRUint32 aScrollType);
|
|
|
|
|
2007-09-24 22:48:51 -07:00
|
|
|
/** Helper method to scroll range into view, used for implementation of
|
|
|
|
* nsIAccessibleText::scrollSubstringTo[Point]().
|
|
|
|
*
|
|
|
|
* @param aFrame the frame for accessible the range belongs to.
|
|
|
|
* @param aStartNode start node of a range
|
|
|
|
* @param aStartOffset an offset inside the start node
|
|
|
|
* @param aEndNode end node of a range
|
|
|
|
* @param aEndOffset an offset inside the end node
|
|
|
|
* @param aVPercent how to align vertically, specified in percents
|
|
|
|
* @param aHPercent how to align horizontally, specified in percents
|
|
|
|
*/
|
|
|
|
static nsresult ScrollSubstringTo(nsIFrame *aFrame,
|
|
|
|
nsIDOMNode *aStartNode, PRInt32 aStartIndex,
|
|
|
|
nsIDOMNode *aEndNode, PRInt32 aEndIndex,
|
|
|
|
PRInt16 aVPercent, PRInt16 aHPercent);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Scrolls the given frame to the point, used for implememntation of
|
|
|
|
* nsIAccessNode::scrollToPoint and nsIAccessibleText::scrollSubstringToPoint.
|
|
|
|
*
|
|
|
|
* @param aScrollableFrame the scrollable frame
|
|
|
|
* @param aFrame the frame to scroll
|
|
|
|
* @param aPoint the point scroll to
|
|
|
|
*/
|
|
|
|
static void ScrollFrameToPoint(nsIFrame *aScrollableFrame,
|
|
|
|
nsIFrame *aFrame, const nsIntPoint& aPoint);
|
|
|
|
|
2007-08-23 21:54:45 -07:00
|
|
|
/**
|
|
|
|
* Converts scroll type constant defined in nsIAccessibleScrollType to
|
|
|
|
* vertical and horizontal percents.
|
|
|
|
*/
|
|
|
|
static void ConvertScrollTypeToPercents(PRUint32 aScrollType,
|
|
|
|
PRInt16 *aVPercent,
|
|
|
|
PRInt16 *aHPercent);
|
2007-09-05 00:39:09 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns coordinates relative screen for the top level window.
|
|
|
|
*
|
2007-12-01 09:30:09 -08:00
|
|
|
* @param aNode the DOM node hosted in the window.
|
2007-09-05 00:39:09 -07:00
|
|
|
*/
|
|
|
|
static nsIntPoint GetScreenCoordsForWindow(nsIDOMNode *aNode);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return document shell tree item for the given DOM node.
|
|
|
|
*/
|
|
|
|
static already_AddRefed<nsIDocShellTreeItem>
|
|
|
|
GetDocShellTreeItemFor(nsIDOMNode *aNode);
|
2007-09-18 14:36:41 -07:00
|
|
|
|
2008-08-28 01:31:01 -07:00
|
|
|
/**
|
|
|
|
* Retrun frame for the given DOM element.
|
|
|
|
*/
|
|
|
|
static nsIFrame* GetFrameFor(nsIDOMElement *aElm);
|
|
|
|
|
2008-10-17 03:10:43 -07:00
|
|
|
/**
|
|
|
|
* Retrun true if the type of given frame equals to the given frame type.
|
|
|
|
*
|
|
|
|
* @param aFrame the frame
|
|
|
|
* @param aAtom the frame type
|
|
|
|
*/
|
|
|
|
static PRBool IsCorrectFrameType(nsIFrame* aFrame, nsIAtom* aAtom);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return presShell for the document containing the given DOM node.
|
|
|
|
*/
|
2010-05-17 06:42:32 -07:00
|
|
|
static nsIPresShell *GetPresShellFor(nsIDOMNode *aNode)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsINode> node(do_QueryInterface(aNode));
|
|
|
|
nsIDocument *document = node->GetOwnerDoc();
|
|
|
|
return document ? document->GetPrimaryShell() : nsnull;
|
|
|
|
}
|
2008-10-17 03:10:43 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return document node for the given document shell tree item.
|
|
|
|
*/
|
|
|
|
static already_AddRefed<nsIDOMNode>
|
|
|
|
GetDOMNodeForContainer(nsIDocShellTreeItem *aContainer);
|
|
|
|
|
2007-09-18 14:36:41 -07:00
|
|
|
/**
|
|
|
|
* Get the ID for an element, in some types of XML this may not be the ID attribute
|
|
|
|
* @param aContent Node to get the ID for
|
|
|
|
* @param aID Where to put ID string
|
|
|
|
* @return PR_TRUE if there is an ID set for this node
|
|
|
|
*/
|
|
|
|
static PRBool GetID(nsIContent *aContent, nsAString& aID);
|
2007-09-24 18:19:03 -07:00
|
|
|
|
2010-01-12 11:07:38 -08:00
|
|
|
/**
|
|
|
|
* Convert attribute value of the given node to positive integer. If no
|
|
|
|
* attribute or wrong value then false is returned.
|
|
|
|
*/
|
|
|
|
static PRBool GetUIntAttr(nsIContent *aContent, nsIAtom *aAttr,
|
|
|
|
PRInt32 *aUInt);
|
|
|
|
|
2008-03-30 23:21:35 -07:00
|
|
|
/**
|
|
|
|
* Check if the given element is XLink.
|
|
|
|
*
|
|
|
|
* @param aContent the given element
|
|
|
|
* @return PR_TRUE if the given element is XLink
|
|
|
|
*/
|
|
|
|
static PRBool IsXLink(nsIContent *aContent);
|
|
|
|
|
2008-07-17 05:06:24 -07:00
|
|
|
/**
|
|
|
|
* Returns language for the given node.
|
|
|
|
*
|
|
|
|
* @param aContent [in] the given node
|
|
|
|
* @param aRootContent [in] container of the given node
|
|
|
|
* @param aLanguage [out] language
|
|
|
|
*/
|
|
|
|
static void GetLanguageFor(nsIContent *aContent, nsIContent *aRootContent,
|
|
|
|
nsAString& aLanguage);
|
|
|
|
|
2009-02-10 02:03:30 -08:00
|
|
|
/**
|
|
|
|
* Return the array of elements the given node is referred to by its
|
|
|
|
* IDRefs attribute.
|
|
|
|
*
|
|
|
|
* @param aContent [in] the given node
|
|
|
|
* @param aAttr [in] IDRefs attribute on the given node
|
|
|
|
* @param aRefElements [out] result array of elements
|
|
|
|
*/
|
|
|
|
static void GetElementsByIDRefsAttr(nsIContent *aContent, nsIAtom *aAttr,
|
|
|
|
nsIArray **aRefElements);
|
|
|
|
|
2009-05-13 22:31:09 -07:00
|
|
|
/**
|
|
|
|
* Return the array of elements having IDRefs that points to the given node.
|
|
|
|
*
|
|
|
|
* @param aRootContent [in] root element to search inside
|
|
|
|
* @param aContent [in] an element having ID attribute
|
|
|
|
* @param aIDRefsAttr [in] IDRefs attribute
|
|
|
|
* @param aElements [out] result array of elements
|
|
|
|
*/
|
|
|
|
static void GetElementsHavingIDRefsAttr(nsIContent *aRootContent,
|
|
|
|
nsIContent *aContent,
|
|
|
|
nsIAtom *aIDRefsAttr,
|
|
|
|
nsIArray **aElements);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper method for GetElementsHavingIDRefsAttr.
|
|
|
|
*/
|
|
|
|
static void GetElementsHavingIDRefsAttrImpl(nsIContent *aRootContent,
|
|
|
|
nsCString& aIdWithSpaces,
|
|
|
|
nsIAtom *aIDRefsAttr,
|
|
|
|
nsIMutableArray *aElements);
|
|
|
|
|
2008-10-17 03:10:43 -07:00
|
|
|
/**
|
|
|
|
* Return computed styles declaration for the given node.
|
|
|
|
*/
|
|
|
|
static void GetComputedStyleDeclaration(const nsAString& aPseudoElt,
|
|
|
|
nsIDOMNode *aNode,
|
|
|
|
nsIDOMCSSStyleDeclaration **aCssDecl);
|
|
|
|
|
2007-09-24 18:19:03 -07:00
|
|
|
/**
|
|
|
|
* Search element in neighborhood of the given element by tag name and
|
|
|
|
* attribute value that equals to ID attribute of the given element.
|
|
|
|
* ID attribute can be either 'id' attribute or 'anonid' if the element is
|
|
|
|
* anonymous.
|
2008-01-21 19:17:37 -08:00
|
|
|
* The first matched content will be returned.
|
2007-09-24 18:19:03 -07:00
|
|
|
*
|
|
|
|
* @param aForNode - the given element the search is performed for
|
2008-01-21 19:17:37 -08:00
|
|
|
* @param aRelationAttrs - an array of attributes, element is attribute name of searched element, ignored if aAriaProperty passed in
|
|
|
|
* @param aAttrNum - how many attributes in aRelationAttrs
|
2007-12-11 18:10:26 -08:00
|
|
|
* @param aTagName - tag name of searched element, or nsnull for any -- ignored if aAriaProperty passed in
|
2007-09-24 18:19:03 -07:00
|
|
|
* @param aAncestorLevelsToSearch - points how is the neighborhood of the
|
|
|
|
* given element big.
|
|
|
|
*/
|
|
|
|
static nsIContent *FindNeighbourPointingToNode(nsIContent *aForNode,
|
2008-01-21 19:17:37 -08:00
|
|
|
nsIAtom **aRelationAttrs,
|
|
|
|
PRUint32 aAttrNum,
|
|
|
|
nsIAtom *aTagName = nsnull,
|
|
|
|
PRUint32 aAncestorLevelsToSearch = 5);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Overloaded version of FindNeighbourPointingToNode to accept only one
|
|
|
|
* relation attribute.
|
|
|
|
*/
|
|
|
|
static nsIContent *FindNeighbourPointingToNode(nsIContent *aForNode,
|
|
|
|
nsIAtom *aRelationAttr,
|
2007-09-24 18:19:03 -07:00
|
|
|
nsIAtom *aTagName = nsnull,
|
|
|
|
PRUint32 aAncestorLevelsToSearch = 5);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Search for element that satisfies the requirements in subtree of the given
|
|
|
|
* element. The requirements are tag name, attribute name and value of
|
|
|
|
* attribute.
|
2008-01-21 19:17:37 -08:00
|
|
|
* The first matched content will be returned.
|
2007-09-24 18:19:03 -07:00
|
|
|
*
|
|
|
|
* @param aId - value of searched attribute
|
|
|
|
* @param aLookContent - element that search is performed inside
|
2008-01-21 19:17:37 -08:00
|
|
|
* @param aRelationAttrs - an array of searched attributes
|
|
|
|
* @param aAttrNum - how many attributes in aRelationAttrs
|
|
|
|
* @param if both aAriaProperty and aRelationAttrs are null, then any element with aTagType will do
|
2007-09-24 18:19:03 -07:00
|
|
|
* @param aExcludeContent - element that is skiped for search
|
|
|
|
* @param aTagType - tag name of searched element, by default it is 'label' --
|
|
|
|
* ignored if aAriaProperty passed in
|
|
|
|
*/
|
2008-01-21 19:17:37 -08:00
|
|
|
static nsIContent *FindDescendantPointingToID(const nsString *aId,
|
|
|
|
nsIContent *aLookContent,
|
|
|
|
nsIAtom **aRelationAttrs,
|
|
|
|
PRUint32 aAttrNum = 1,
|
|
|
|
nsIContent *aExcludeContent = nsnull,
|
|
|
|
nsIAtom *aTagType = nsAccessibilityAtoms::label);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Overloaded version of FindDescendantPointingToID to accept only one
|
|
|
|
* relation attribute.
|
|
|
|
*/
|
2007-09-24 18:19:03 -07:00
|
|
|
static nsIContent *FindDescendantPointingToID(const nsString *aId,
|
|
|
|
nsIContent *aLookContent,
|
2007-12-11 18:10:26 -08:00
|
|
|
nsIAtom *aRelationAttr,
|
2007-09-24 18:19:03 -07:00
|
|
|
nsIContent *aExcludeContent = nsnull,
|
|
|
|
nsIAtom *aTagType = nsAccessibilityAtoms::label);
|
|
|
|
|
|
|
|
// Helper for FindDescendantPointingToID(), same args
|
|
|
|
static nsIContent *FindDescendantPointingToIDImpl(nsCString& aIdWithSpaces,
|
|
|
|
nsIContent *aLookContent,
|
2008-01-21 19:17:37 -08:00
|
|
|
nsIAtom **aRelationAttrs,
|
|
|
|
PRUint32 aAttrNum = 1,
|
2007-09-24 18:19:03 -07:00
|
|
|
nsIContent *aExcludeContent = nsnull,
|
|
|
|
nsIAtom *aTagType = nsAccessibilityAtoms::label);
|
2008-10-17 03:10:43 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the label element for the given DOM element.
|
|
|
|
*/
|
|
|
|
static nsIContent *GetLabelContent(nsIContent *aForNode);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the HTML label element for the given HTML element.
|
|
|
|
*/
|
|
|
|
static nsIContent *GetHTMLLabelContent(nsIContent *aForNode);
|
|
|
|
|
2009-05-06 02:54:26 -07:00
|
|
|
/**
|
|
|
|
* Return box object for XUL treechildren element by tree box object.
|
|
|
|
*/
|
|
|
|
static already_AddRefed<nsIBoxObject>
|
|
|
|
GetTreeBodyBoxObject(nsITreeBoxObject *aTreeBoxObj);
|
2009-05-13 22:31:09 -07:00
|
|
|
|
2009-08-19 23:45:19 -07:00
|
|
|
/**
|
|
|
|
* Return tree box object from any levels DOMNode under the XUL tree.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
GetTreeBoxObject(nsIDOMNode* aDOMNode, nsITreeBoxObject** aBoxObject);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return first sensible column for the given tree box object.
|
|
|
|
*/
|
|
|
|
static already_AddRefed<nsITreeColumn>
|
|
|
|
GetFirstSensibleColumn(nsITreeBoxObject *aTree);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return last sensible column for the given tree box object.
|
|
|
|
*/
|
|
|
|
static already_AddRefed<nsITreeColumn>
|
|
|
|
GetLastSensibleColumn(nsITreeBoxObject *aTree);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return sensible columns count for the given tree box object.
|
|
|
|
*/
|
2009-12-10 11:12:19 -08:00
|
|
|
static PRUint32 GetSensibleColumnCount(nsITreeBoxObject *aTree);
|
2009-08-19 23:45:19 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return sensible column at the given index for the given tree box object.
|
|
|
|
*/
|
|
|
|
static already_AddRefed<nsITreeColumn>
|
|
|
|
GetSensibleColumnAt(nsITreeBoxObject *aTree, PRUint32 aIndex);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return next sensible column for the given column.
|
|
|
|
*/
|
|
|
|
static already_AddRefed<nsITreeColumn>
|
|
|
|
GetNextSensibleColumn(nsITreeColumn *aColumn);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return previous sensible column for the given column.
|
|
|
|
*/
|
|
|
|
static already_AddRefed<nsITreeColumn>
|
|
|
|
GetPreviousSensibleColumn(nsITreeColumn *aColumn);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the given column is hidden (i.e. not sensible).
|
|
|
|
*/
|
|
|
|
static PRBool IsColumnHidden(nsITreeColumn *aColumn);
|
|
|
|
|
2009-05-13 22:31:09 -07:00
|
|
|
/**
|
|
|
|
* Return true if the given node is table header element.
|
|
|
|
*/
|
|
|
|
static PRBool IsHTMLTableHeader(nsIContent *aContent)
|
|
|
|
{
|
|
|
|
return aContent->NodeInfo()->Equals(nsAccessibilityAtoms::th) ||
|
|
|
|
aContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::scope);
|
|
|
|
}
|
2009-11-09 21:58:52 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Generates frames for popup subtree.
|
|
|
|
*
|
|
|
|
* @param aNode [in] DOM node containing the menupopup element as a child
|
|
|
|
* @param aIsAnon [in] specifies whether popup should be searched inside of
|
|
|
|
* anonymous or explicit content
|
|
|
|
*/
|
|
|
|
static void GeneratePopupTree(nsIDOMNode *aNode, PRBool aIsAnon = PR_FALSE);
|
2007-03-27 05:17:11 -07:00
|
|
|
};
|
|
|
|
|
2010-01-25 07:08:08 -08:00
|
|
|
|
|
|
|
/**
|
2010-04-26 23:52:03 -07:00
|
|
|
* nsIDOMDOMStringList implementation.
|
2010-01-25 07:08:08 -08:00
|
|
|
*/
|
2010-04-26 23:52:03 -07:00
|
|
|
class nsAccessibleDOMStringList : public nsIDOMDOMStringList
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsAccessibleDOMStringList() {};
|
|
|
|
virtual ~nsAccessibleDOMStringList() {};
|
2010-01-25 07:08:08 -08:00
|
|
|
|
2010-04-26 23:52:03 -07:00
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIDOMDOMSTRINGLIST
|
2010-01-25 07:08:08 -08:00
|
|
|
|
2010-04-26 23:52:03 -07:00
|
|
|
PRBool Add(const nsAString& aName) {
|
|
|
|
return mNames.AppendElement(aName) != nsnull;
|
|
|
|
}
|
2010-01-25 07:08:08 -08:00
|
|
|
|
2010-04-26 23:52:03 -07:00
|
|
|
private:
|
|
|
|
nsTArray<nsString> mNames;
|
2010-01-25 07:08:08 -08:00
|
|
|
};
|
|
|
|
|
2007-03-31 00:14:03 -07:00
|
|
|
#endif
|
2007-08-23 21:54:45 -07:00
|
|
|
|