☠☠ backed out by f0229f4c8282 ☠ ☠ | |
author | Trevor Saunders <trev.saunders@gmail.com> |
Tue, 10 Jan 2012 11:43:27 -0500 | |
changeset 89370 | 5ca407ff5564c5ac1ad4a231e1e161908f49bf66 |
parent 89369 | 62b24f89b354f3b0488135b449bd587505fd062f |
child 89371 | 27f0028890e7d104d9074479a00b38ec4821899f |
push id | 136 |
push user | lsblakk@mozilla.com |
push date | Fri, 01 Jun 2012 02:39:32 +0000 |
treeherder | mozilla-release@7ebf7352c959 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | davidb, surkov |
bugs | 672507 |
milestone | 13.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/accessible/public/Makefile.in +++ b/accessible/public/Makefile.in @@ -56,17 +56,16 @@ XPIDLSRCS = \ nsIAccessible.idl \ nsIAccessibleApplication.idl \ nsIAccessibleRelation.idl \ nsIAccessibleRole.idl \ nsIAccessibleStates.idl \ nsIAccessibleDocument.idl \ nsIAccessibleProvider.idl \ nsIAccessibleSelectable.idl \ - nsIAccessNode.idl \ nsIAccessibleCursorable.idl \ nsIAccessibleEvent.idl \ nsIAccessibleEditableText.idl \ nsIAccessibleHyperLink.idl \ nsIAccessibleHyperText.idl \ nsIAccessiblePivot.idl \ nsIAccessibleTable.idl \ nsIAccessibleText.idl \
--- a/accessible/public/msaa/ISimpleDOMNode.idl +++ b/accessible/public/msaa/ISimpleDOMNode.idl @@ -112,17 +112,17 @@ cpp_quote("// DOM navigation - get a dif cpp_quote("//") cpp_quote("// get_innerHTML(/* [out] */ BSTR *htmlText);") cpp_quote("// ---------------------------------------------------------------------------------------------------=") cpp_quote("// Returns HTML of this DOM node's subtree. Does not include the start and end tag for this node/element.") cpp_quote("//") cpp_quote("//") cpp_quote("// get_localInterface(/* [out] */ void **localInterface);") cpp_quote("// ---------------------------------------------------------------------------------------------------=") -cpp_quote("// Only available in Gecko's process - casts to an XPCOM nsIAccessNode interface pointer") +cpp_quote("// Only available in Gecko's process - casts to an XPCOM nsAccessNode object pointer") cpp_quote("//") cpp_quote("//") cpp_quote("// get_language(/* [out] */ BSTR *htmlText);") cpp_quote("// ---------------------------------------------------------------------------------------------------=") cpp_quote("// Returns the computed language for this node, or empty string if unknown.") cpp_quote("//") cpp_quote("//") cpp_quote("///////////////////////////////////////////////////////////////////////////////////////////////////////")
deleted file mode 100644 --- a/accessible/public/nsIAccessNode.idl +++ /dev/null @@ -1,126 +0,0 @@ -/* -*- 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) 2003 - * the Initial Developer. All Rights Reserved. - * - * Original Author: Aaron Leventhal (aaronl@netscape.com) - * Contributor(s): - * - * 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 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 ***** */ - -#include "nsISupports.idl" - -interface nsIDOMNode; -interface nsIAccessibleDocument; -interface nsIDOMCSSPrimitiveValue; - -/** - * An interface used by in-process accessibility clients - * to get style, window, markup and other information about - * a DOM node. When accessibility is active in Gecko, - * every DOM node can have one nsIAccessNode for each - * pres shell the DOM node is rendered in. - * The nsIAccessNode implementations are instantiated lazily. - * The nsIAccessNode tree for a given dom window - * has a one to one relationship to the DOM tree. - * If the DOM node for this access node is "accessible", - * then a QueryInterface to nsIAccessible will succeed. - */ -[scriptable, uuid(08bb2c50-1b30-11e1-bddb-0800200c9a66)] -interface nsIAccessNode : nsISupports -{ - /** - * The DOM node this nsIAccessNode is associated with. - */ - readonly attribute nsIDOMNode DOMNode; - - /** - * The document accessible that this access node resides in. - */ - readonly attribute nsIAccessibleDocument document; - - /** - * The root document accessible that this access node resides in. - */ - readonly attribute nsIAccessibleDocument rootDocument; - - /** - * The innerHTML for the DOM node - * This is a text string of all the markup inside the DOM - * node, not including the start and end tag for the node. - */ - readonly attribute DOMString innerHTML; - - /** - * Makes an object visible on screen. - * - * @param scrollType - defines where the object should be placed on - * the screen (see nsIAccessibleScrollType for - * available constants). - */ - void scrollTo(in unsigned long aScrollType); - - /** - * Moves the top left of an object to a specified location. - * - * @param coordinateType - specifies whether the coordinates are relative to - * the screen or the parent object (for available - * constants refer to nsIAccessibleCoordinateType) - * @param aX - defines the x coordinate - * @param aY - defines the y coordinate - */ - void scrollToPoint(in unsigned long aCoordinateType, in long aX, in long aY); - - /** - * Retrieve the computed style value for this DOM node, if it is a DOM element. - * Note: the meanings of width, height and other size measurements depend - * on the version of CSS being used. Therefore, for bounds information, - * it is better to use nsIAccessible::accGetBounds. - * @param pseudoElt The pseudo element to retrieve style for, or NULL - * for general computed style information for this node. - * @param propertyName Retrieve the computed style value for this property name, - * for example "border-bottom". - */ - DOMString getComputedStyleValue(in DOMString pseudoElt, in DOMString propertyName); - - /** - * The method is similar to getComputedStyleValue() excepting that this one - * returns nsIDOMCSSPrimitiveValue. - */ - nsIDOMCSSPrimitiveValue getComputedStyleCSSValue(in DOMString pseudoElt, - in DOMString propertyName); - - /** - * The language for the current DOM node, e.g. en, de, etc. - */ - readonly attribute DOMString language; -}; -
--- a/accessible/public/nsIAccessible.idl +++ b/accessible/public/nsIAccessible.idl @@ -38,17 +38,20 @@ * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "nsISupports.idl" #include "nsIArray.idl" interface nsIPersistentProperties; +interface nsIDOMCSSPrimitiveValue; interface nsIDOMDOMStringList; +interface nsIDOMNode; +interface nsIAccessibleDocument; interface nsIAccessibleRelation; /** * A cross-platform interface that supports platform-specific * accessibility APIs like MSAA and ATK. Contains the sum of what's needed * to support IAccessible as well as ATK's generic accessibility objects. * Can also be used by in-process accessibility clients to get information * about objects in the accessible tree. The accessible tree is a subset of @@ -96,16 +99,63 @@ interface nsIAccessible : nsISupports /** * The 0-based index of this accessible in its parent's list of children, * or -1 if this accessible does not have a parent. */ readonly attribute long indexInParent; /** + * The innerHTML for the HTML element associated with this accessible if applicable. + * This is a text string of all the markup inside the DOM + * node, not including the start and end tag for the node. + */ + readonly attribute DOMString innerHTML; + + /** + * Retrieve the computed style value for this DOM node, if it is a DOM element. + * Note: the meanings of width, height and other size measurements depend + * on the version of CSS being used. Therefore, for bounds information, + * it is better to use nsIAccessible::accGetBounds. + * + * @param pseudoElt [in] The pseudo element to retrieve style for, or NULL + * for general computed style information for this node. + * @param propertyName [in] Retrieve the computed style value for this property name, + * for example "border-bottom". + */ + DOMString getComputedStyleValue(in DOMString pseudoElt, in DOMString propertyName); + + /** + * The method is similar to getComputedStyleValue() excepting that this one + * returns nsIDOMCSSPrimitiveValue. + */ + nsIDOMCSSPrimitiveValue getComputedStyleCSSValue(in DOMString pseudoElt, + in DOMString propertyName); + + /** + * The DOM node this nsIAccessible is associated with. + */ + readonly attribute nsIDOMNode DOMNode; + + /** + * The document accessible that this access node resides in. + */ + readonly attribute nsIAccessibleDocument document; + + /** + * The root document accessible that this access node resides in. + */ + readonly attribute nsIAccessibleDocument rootDocument; + + /** + * The language for the current DOM node, e.g. en, de, etc. + */ + readonly attribute DOMString language; + + /** * Accessible name -- the main text equivalent for this node. The name is * specified by ARIA or by native markup. Example of ARIA markup is * aria-labelledby attribute placed on element of this accessible. Example * of native markup is HTML label linked with HTML element of this accessible. * * Value can be string or null. A null value indicates that AT may attempt to * compute the name. Any string value, including the empty string, should be * considered author-intentional, and respected. @@ -281,14 +331,34 @@ interface nsIAccessible : nsISupports /** * Perform the accessible action at the given zero-based index * Action number 0 is the default action */ void doAction(in PRUint8 index); /** + * Makes an object visible on screen. + * + * @param scrollType - defines where the object should be placed on + * the screen (see nsIAccessibleScrollType for + * available constants). + */ + void scrollTo(in unsigned long aScrollType); + + /** + * Moves the top left of an object to a specified location. + * + * @param coordinateType [in] - specifies whether the coordinates are relative to + * the screen or the parent object (for available + * constants refer to nsIAccessibleCoordinateType) + * @param x [in] - defines the x coordinate + * @param y [in] - defines the y coordinate + */ + void scrollToPoint(in unsigned long coordinateType, in long x, in long y); + + /** * Get a pointer to accessibility interface for this node, which is specific * to the OS/accessibility toolkit we're running on. */ [noscript] void getNativeInterface(out voidPtr aOutAccessible); };
--- a/accessible/public/nsIAccessibleDocument.idl +++ b/accessible/public/nsIAccessibleDocument.idl @@ -34,31 +34,29 @@ * 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 ***** */ #include "nsISupports.idl" interface nsIAccessible; -interface nsIAccessNode; interface nsIDOMDocument; interface nsIDOMNode; interface nsIDOMWindow; /** * An interface for in-process accessibility clients * that wish to retrieve information about a document. * When accessibility is turned on in Gecko, * there is an nsIAccessibleDocument for each document * whether it is XUL, HTML or whatever. - * You can QueryInterface to nsIAccessibleDocument from - * the nsIAccessible or nsIAccessNode for the root node - * of a document. You can also get one from - * nsIAccessNode::GetAccessibleDocument() or + * You can QueryInterface to nsIAccessibleDocument from the nsIAccessible for + * the root node of a document. You can also get one from + * nsIAccessible::GetAccessibleDocument() or * nsIAccessibleEvent::GetAccessibleDocument() */ [scriptable, uuid(451242bd-8a0c-4198-ae88-c053609a4e5d)] interface nsIAccessibleDocument : nsISupports { /** * The URL of the document */
--- a/accessible/public/nsIAccessibleRetrieval.idl +++ b/accessible/public/nsIAccessibleRetrieval.idl @@ -38,25 +38,22 @@ #include "nsISupports.idl" interface nsIDOMNode; interface nsIAccessible; interface nsIWeakReference; interface nsIPresShell; interface nsIDOMWindow; -interface nsIAccessNode; interface nsIDOMDOMStringList; interface nsIAccessiblePivot; /** - * An interface for in-process accessibility clients - * wishing to get an nsIAccessible or nsIAccessNode for - * a given DOM node. - * More documentation at: + * An interface for in-process accessibility clients wishing to get an + * nsIAccessible for a given DOM node. More documentation at: * http://www.mozilla.org/projects/ui/accessibility */ [scriptable, uuid(310ce77d-c92b-4761-82e8-77e1a728e8d4)] interface nsIAccessibleRetrieval : nsISupports { /** * Return application accessible. */
--- a/accessible/src/atk/nsMaiInterfaceDocument.cpp +++ b/accessible/src/atk/nsMaiInterfaceDocument.cpp @@ -74,17 +74,17 @@ documentInterfaceInitCB(AtkDocumentIface const gchar * getDocumentLocaleCB(AtkDocument *aDocument) { nsAccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument)); if (!accWrap) return nsnull; nsAutoString locale; - accWrap->GetLanguage(locale); + accWrap->Language(locale); return locale.IsEmpty() ? nsnull : nsAccessibleWrap::ReturnString(locale); } static inline GSList * prependToList(GSList *aList, const char *const aName, const nsAutoString &aValue) { if (aValue.IsEmpty()) return aList;
--- a/accessible/src/base/nsAccUtils.h +++ b/accessible/src/base/nsAccUtils.h @@ -35,17 +35,16 @@ * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef nsAccUtils_h_ #define nsAccUtils_h_ #include "nsIAccessible.h" -#include "nsIAccessNode.h" #include "nsIAccessibleRole.h" #include "nsIAccessibleText.h" #include "nsIAccessibleTable.h" #include "nsARIAMap.h" #include "nsAccessibilityService.h" #include "nsCoreUtils.h"
--- a/accessible/src/base/nsAccessNode.cpp +++ b/accessible/src/base/nsAccessNode.cpp @@ -31,47 +31,37 @@ * 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 ***** */ -#include "nsDocAccessible.h" +#include "nsAccessNode.h" -#include "nsIAccessible.h" - -#include "nsAccCache.h" +#include "nsAccessibilityService.h" #include "nsAccUtils.h" +#include "nsApplicationAccessibleWrap.h" #include "nsCoreUtils.h" +#include "nsRootAccessible.h" -#include "nsHashtable.h" -#include "nsAccessibilityService.h" -#include "nsApplicationAccessibleWrap.h" #include "nsIDocShell.h" #include "nsIDocShellTreeItem.h" -#include "nsIDocument.h" -#include "nsIDOMCSSPrimitiveValue.h" -#include "nsIDOMDocument.h" -#include "nsIDOMElement.h" -#include "nsIDOMHTMLElement.h" #include "nsIDOMWindow.h" -#include "nsPIDOMWindow.h" +#include "nsIFrame.h" #include "nsIInterfaceRequestorUtils.h" -#include "nsIFrame.h" +#include "nsIObserverService.h" +#include "nsIPrefBranch.h" #include "nsIPrefService.h" -#include "nsIPrefBranch.h" -#include "nsPresContext.h" #include "nsIPresShell.h" #include "nsIServiceManager.h" #include "nsIStringBundle.h" -#include "nsRootAccessible.h" #include "nsFocusManager.h" -#include "nsIObserverService.h" +#include "nsPresContext.h" #include "mozilla/Services.h" /* For documentation of the accessibility architecture, * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html */ nsIStringBundle *nsAccessNode::gStringBundle = 0; @@ -84,19 +74,17 @@ nsApplicationAccessible *nsAccessNode::g */ //////////////////////////////////////////////////////////////////////////////// // nsAccessible. nsISupports NS_IMPL_CYCLE_COLLECTION_1(nsAccessNode, mContent) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsAccessNode) - NS_INTERFACE_MAP_ENTRY(nsIAccessNode) NS_INTERFACE_MAP_ENTRY(nsAccessNode) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAccessNode) NS_INTERFACE_MAP_END NS_IMPL_CYCLE_COLLECTING_ADDREF(nsAccessNode) NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_DESTROY(nsAccessNode, LastRelease()) //////////////////////////////////////////////////////////////////////////////// // nsAccessNode construction/desctruction @@ -282,136 +270,38 @@ nsAccessNode::GetFrame() const bool nsAccessNode::IsPrimaryForNode() const { return true; } //////////////////////////////////////////////////////////////////////////////// -// nsIAccessNode - -NS_IMETHODIMP -nsAccessNode::GetDOMNode(nsIDOMNode **aDOMNode) -{ - NS_ENSURE_ARG_POINTER(aDOMNode); - *aDOMNode = nsnull; - - nsINode *node = GetNode(); - if (node) - CallQueryInterface(node, aDOMNode); - - return NS_OK; -} - -NS_IMETHODIMP -nsAccessNode::GetDocument(nsIAccessibleDocument **aDocument) -{ - NS_ENSURE_ARG_POINTER(aDocument); - - NS_IF_ADDREF(*aDocument = GetDocAccessible()); - return NS_OK; -} - -NS_IMETHODIMP -nsAccessNode::GetRootDocument(nsIAccessibleDocument **aRootDocument) -{ - NS_ENSURE_ARG_POINTER(aRootDocument); - - nsRootAccessible* rootDocument = RootAccessible(); - NS_IF_ADDREF(*aRootDocument = rootDocument); - return NS_OK; -} - -NS_IMETHODIMP -nsAccessNode::GetInnerHTML(nsAString& aInnerHTML) -{ - aInnerHTML.Truncate(); - - nsCOMPtr<nsIDOMHTMLElement> htmlElement = do_QueryInterface(mContent); - NS_ENSURE_TRUE(htmlElement, NS_ERROR_NULL_POINTER); - - return htmlElement->GetInnerHTML(aInnerHTML); -} - -NS_IMETHODIMP +void nsAccessNode::ScrollTo(PRUint32 aScrollType) { if (IsDefunct()) - return NS_ERROR_FAILURE; + return; nsCOMPtr<nsIPresShell> shell(GetPresShell()); - NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE); + if (!shell) + return; nsIFrame *frame = GetFrame(); - NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE); + if (!frame) + return; - nsCOMPtr<nsIContent> content = frame->GetContent(); - NS_ENSURE_TRUE(content, NS_ERROR_FAILURE); + nsIContent* content = frame->GetContent(); + if (!content) + return; PRInt16 vPercent, hPercent; nsCoreUtils::ConvertScrollTypeToPercents(aScrollType, &vPercent, &hPercent); - return shell->ScrollContentIntoView(content, vPercent, hPercent, - nsIPresShell::SCROLL_OVERFLOW_HIDDEN); -} - -NS_IMETHODIMP -nsAccessNode::ScrollToPoint(PRUint32 aCoordinateType, PRInt32 aX, PRInt32 aY) -{ - nsIFrame *frame = GetFrame(); - if (!frame) - return NS_ERROR_FAILURE; - - nsIntPoint coords; - nsresult rv = nsAccUtils::ConvertToScreenCoords(aX, aY, aCoordinateType, - this, &coords); - NS_ENSURE_SUCCESS(rv, rv); - - nsIFrame *parentFrame = frame; - while ((parentFrame = parentFrame->GetParent())) - nsCoreUtils::ScrollFrameToPoint(parentFrame, frame, coords); - - return NS_OK; -} - -NS_IMETHODIMP -nsAccessNode::GetComputedStyleValue(const nsAString& aPseudoElt, - const nsAString& aPropertyName, - nsAString& aValue) -{ - if (IsDefunct()) - return NS_ERROR_FAILURE; - - nsCOMPtr<nsIDOMCSSStyleDeclaration> styleDecl = - nsCoreUtils::GetComputedStyleDeclaration(aPseudoElt, mContent); - NS_ENSURE_TRUE(styleDecl, NS_ERROR_FAILURE); - - return styleDecl->GetPropertyValue(aPropertyName, aValue); -} - -NS_IMETHODIMP -nsAccessNode::GetComputedStyleCSSValue(const nsAString& aPseudoElt, - const nsAString& aPropertyName, - nsIDOMCSSPrimitiveValue **aCSSValue) -{ - NS_ENSURE_ARG_POINTER(aCSSValue); - *aCSSValue = nsnull; - - if (IsDefunct()) - return NS_ERROR_FAILURE; - - nsCOMPtr<nsIDOMCSSStyleDeclaration> styleDecl = - nsCoreUtils::GetComputedStyleDeclaration(aPseudoElt, mContent); - NS_ENSURE_STATE(styleDecl); - - nsCOMPtr<nsIDOMCSSValue> cssValue; - styleDecl->GetPropertyCSSValue(aPropertyName, getter_AddRefs(cssValue)); - NS_ENSURE_TRUE(cssValue, NS_ERROR_FAILURE); - - return CallQueryInterface(cssValue, aCSSValue); + shell->ScrollContentIntoView(content, vPercent, hPercent, + nsIPresShell::SCROLL_OVERFLOW_HIDDEN); } // nsAccessNode public already_AddRefed<nsINode> nsAccessNode::GetCurrentFocus() { // XXX: consider to use nsFocusManager directly, it allows us to avoid // unnecessary query interface calls. @@ -438,25 +328,23 @@ nsAccessNode::GetCurrentFocus() focusedWindow->GetDocument(getter_AddRefs(doc)); if (doc) CallQueryInterface(doc, &focusedNode); } return focusedNode; } -NS_IMETHODIMP -nsAccessNode::GetLanguage(nsAString& aLanguage) +void +nsAccessNode::Language(nsAString& aLanguage) { aLanguage.Truncate(); if (IsDefunct()) - return NS_ERROR_FAILURE; + return; nsCoreUtils::GetLanguageFor(mContent, nsnull, aLanguage); - if (aLanguage.IsEmpty()) { // Nothing found, so use document's language mContent->OwnerDoc()->GetHeaderData(nsGkAtoms::headerContentLanguage, aLanguage); } - - return NS_OK; } +
--- a/accessible/src/base/nsAccessNode.h +++ b/accessible/src/base/nsAccessNode.h @@ -38,17 +38,16 @@ /* For documentation of the accessibility architecture, * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html */ #ifndef _nsAccessNode_H_ #define _nsAccessNode_H_ -#include "nsIAccessNode.h" #include "nsIAccessibleTypes.h" #include "a11yGeneric.h" #include "nsIContent.h" #include "nsIDOMNode.h" #include "nsINameSpaceManager.h" #include "nsIStringBundle.h" @@ -63,36 +62,25 @@ class nsRootAccessible; class nsIPresShell; class nsPresContext; class nsIFrame; class nsIDocShellTreeItem; #define ACCESSIBLE_BUNDLE_URL "chrome://global-platform/locale/accessible.properties" #define PLATFORM_KEYS_BUNDLE_URL "chrome://global-platform/locale/platformKeys.properties" -#define NS_ACCESSNODE_IMPL_CID \ -{ /* 2b07e3d7-00b3-4379-aa0b-ea22e2c8ffda */ \ - 0x2b07e3d7, \ - 0x00b3, \ - 0x4379, \ - { 0xaa, 0x0b, 0xea, 0x22, 0xe2, 0xc8, 0xff, 0xda } \ -} - -class nsAccessNode: public nsIAccessNode +class nsAccessNode: public nsISupports { public: nsAccessNode(nsIContent *aContent, nsIWeakReference *aShell); virtual ~nsAccessNode(); NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsAccessNode, nsIAccessNode) - - NS_DECL_NSIACCESSNODE - NS_DECLARE_STATIC_IID_ACCESSOR(NS_ACCESSNODE_IMPL_CID) + NS_DECL_CYCLE_COLLECTION_CLASS(nsAccessNode) static void InitXPAccessibility(); static void ShutdownXPAccessibility(); /** * Return an application accessible. */ static nsApplicationAccessible* GetApplicationAccessible(); @@ -129,28 +117,16 @@ public: * Returns true when the accessible is defunct. */ virtual bool IsDefunct() const; /** * Return frame for the given access node object. */ virtual nsIFrame* GetFrame() const; - - /** - * Return DOM node associated with this accessible. - */ - already_AddRefed<nsIDOMNode> GetDOMNode() const - { - nsIDOMNode *DOMNode = nsnull; - if (GetNode()) - CallQueryInterface(GetNode(), &DOMNode); - return DOMNode; - } - /** * Return DOM node associated with the accessible. */ virtual nsINode* GetNode() const { return mContent; } nsIContent* GetContent() const { return mContent; } virtual nsIDocument* GetDocumentNode() const { return mContent ? mContent->OwnerDoc() : nsnull; } @@ -190,16 +166,28 @@ public: * Return true if the accessible is primary accessible for the given DOM node. * * Accessible hierarchy may be complex for single DOM node, in this case * these accessibles share the same DOM node. The primary accessible "owns" * that DOM node in terms it gets stored in the accessible to node map. */ virtual bool IsPrimaryForNode() const; + /** + * Return the string bundle + */ + static nsIStringBundle* GetStringBundle() + { return gStringBundle; } + + /** + * Interface methods on nsIAccessible shared with ISimpleDOM. + */ + void Language(nsAString& aLocale); + void ScrollTo(PRUint32 aType); + protected: nsPresContext* GetPresContext(); void LastRelease(); nsCOMPtr<nsIContent> mContent; nsCOMPtr<nsIWeakReference> mWeakShell; @@ -216,13 +204,10 @@ protected: private: nsAccessNode(); nsAccessNode(const nsAccessNode&); nsAccessNode& operator =(const nsAccessNode&); static nsApplicationAccessible *gApplicationAccessible; }; -NS_DEFINE_STATIC_IID_ACCESSOR(nsAccessNode, - NS_ACCESSNODE_IMPL_CID) - #endif
--- a/accessible/src/base/nsAccessible.cpp +++ b/accessible/src/base/nsAccessible.cpp @@ -47,21 +47,24 @@ #include "nsDocAccessible.h" #include "nsEventShell.h" #include "nsAccEvent.h" #include "nsAccessibleRelation.h" #include "nsAccessibilityService.h" #include "nsAccTreeWalker.h" #include "nsIAccessibleRelation.h" +#include "nsRootAccessible.h" #include "nsTextEquivUtils.h" #include "Relation.h" #include "Role.h" #include "States.h" +#include "nsIDOMCSSValue.h" +#include "nsIDOMCSSPrimitiveValue.h" #include "nsIDOMElement.h" #include "nsIDOMDocument.h" #include "nsIDOMDocumentXBL.h" #include "nsIDOMHTMLDocument.h" #include "nsIDOMHTMLFormElement.h" #include "nsIDOMNodeFilter.h" #include "nsIDOMHTMLElement.h" #include "nsIDOMTreeWalker.h" @@ -225,16 +228,102 @@ nsAccessible::~nsAccessible() void nsAccessible::SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry) { mRoleMapEntry = aRoleMapEntry; } NS_IMETHODIMP +nsAccessible::GetComputedStyleValue(const nsAString& aPseudoElt, + const nsAString& aPropertyName, + nsAString& aValue) +{ + if (IsDefunct()) + return NS_ERROR_FAILURE; + + nsCOMPtr<nsIDOMCSSStyleDeclaration> styleDecl = + nsCoreUtils::GetComputedStyleDeclaration(aPseudoElt, mContent); + NS_ENSURE_TRUE(styleDecl, NS_ERROR_FAILURE); + + return styleDecl->GetPropertyValue(aPropertyName, aValue); +} + +NS_IMETHODIMP +nsAccessible::GetComputedStyleCSSValue(const nsAString& aPseudoElt, + const nsAString& aPropertyName, + nsIDOMCSSPrimitiveValue **aCSSValue) { + NS_ENSURE_ARG_POINTER(aCSSValue); + *aCSSValue = nsnull; + + if (IsDefunct()) + return NS_ERROR_FAILURE; + + nsCOMPtr<nsIDOMCSSStyleDeclaration> styleDecl = + nsCoreUtils::GetComputedStyleDeclaration(aPseudoElt, mContent); + NS_ENSURE_STATE(styleDecl); + + nsCOMPtr<nsIDOMCSSValue> cssValue; + styleDecl->GetPropertyCSSValue(aPropertyName, getter_AddRefs(cssValue)); + NS_ENSURE_TRUE(cssValue, NS_ERROR_FAILURE); + + return CallQueryInterface(cssValue, aCSSValue); +} + +NS_IMETHODIMP +nsAccessible::GetDocument(nsIAccessibleDocument **aDocument) +{ + NS_ENSURE_ARG_POINTER(aDocument); + + NS_IF_ADDREF(*aDocument = GetDocAccessible()); + return NS_OK; +} + +NS_IMETHODIMP +nsAccessible::GetDOMNode(nsIDOMNode **aDOMNode) +{ + NS_ENSURE_ARG_POINTER(aDOMNode); + *aDOMNode = nsnull; + + nsINode *node = GetNode(); + if (node) + CallQueryInterface(node, aDOMNode); + + return NS_OK; +} + +NS_IMETHODIMP +nsAccessible::GetRootDocument(nsIAccessibleDocument **aRootDocument) +{ + NS_ENSURE_ARG_POINTER(aRootDocument); + + nsRootAccessible* rootDocument = RootAccessible(); + NS_IF_ADDREF(*aRootDocument = rootDocument); + return NS_OK; +} + +NS_IMETHODIMP +nsAccessible::GetInnerHTML(nsAString& aInnerHTML) +{ + aInnerHTML.Truncate(); + + nsCOMPtr<nsIDOMHTMLElement> htmlElement = do_QueryInterface(mContent); + NS_ENSURE_TRUE(htmlElement, NS_ERROR_NULL_POINTER); + + return htmlElement->GetInnerHTML(aInnerHTML); +} + +NS_IMETHODIMP +nsAccessible::GetLanguage(nsAString& aLanguage) +{ + Language(aLanguage); + return NS_OK; +} + +NS_IMETHODIMP nsAccessible::GetName(nsAString& aName) { aName.Truncate(); if (IsDefunct()) return NS_ERROR_FAILURE; GetARIAName(aName); @@ -2171,16 +2260,42 @@ nsAccessible::DispatchClickEvent(nsICont bool res = nsCoreUtils::DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, presShell, aContent); if (!res) return; nsCoreUtils::DispatchMouseEvent(NS_MOUSE_BUTTON_UP, presShell, aContent); } +NS_IMETHODIMP +nsAccessible::ScrollTo(PRUint32 aHow) +{ + nsAccessNode::ScrollTo(aHow); + return NS_OK; +} + +NS_IMETHODIMP +nsAccessible::ScrollToPoint(PRUint32 aCoordinateType, PRInt32 aX, PRInt32 aY) +{ + nsIFrame *frame = GetFrame(); + if (!frame) + return NS_ERROR_FAILURE; + + nsIntPoint coords; + nsresult rv = nsAccUtils::ConvertToScreenCoords(aX, aY, aCoordinateType, + this, &coords); + NS_ENSURE_SUCCESS(rv, rv); + + nsIFrame *parentFrame = frame; + while ((parentFrame = parentFrame->GetParent())) + nsCoreUtils::ScrollFrameToPoint(parentFrame, frame, coords); + + return NS_OK; +} + // nsIAccessibleSelectable NS_IMETHODIMP nsAccessible::GetSelectedChildren(nsIArray **aSelectedAccessibles) { NS_ENSURE_ARG_POINTER(aSelectedAccessibles); *aSelectedAccessibles = nsnull; if (IsDefunct() || !IsSelect()) return NS_ERROR_FAILURE;
--- a/accessible/src/base/nsAccessible.h +++ b/accessible/src/base/nsAccessible.h @@ -125,16 +125,27 @@ public: // Public methods /** * get the description of this accessible */ virtual void Description(nsString& aDescription); /** + * Return DOM node associated with this accessible. + */ + inline already_AddRefed<nsIDOMNode> DOMNode() const + { + nsIDOMNode *DOMNode = nsnull; + if (GetNode()) + CallQueryInterface(GetNode(), &DOMNode); + return DOMNode; + } + + /** * Returns the accessible name specified by ARIA. */ nsresult GetARIAName(nsAString& aName); /** * Maps ARIA state attributes to state of accessible. Note the given state * argument should hold states for accessible before you pass it into this * method.
--- a/accessible/src/base/nsApplicationAccessible.cpp +++ b/accessible/src/base/nsApplicationAccessible.cpp @@ -416,17 +416,17 @@ nsApplicationAccessible::GetSiblingAtOff { if (aError) *aError = NS_OK; // fail peacefully return nsnull; } //////////////////////////////////////////////////////////////////////////////// -// nsIAccessNode and nsAccessNode +// nsIAccessible NS_IMETHODIMP nsApplicationAccessible::GetDOMNode(nsIDOMNode **aDOMNode) { NS_ENSURE_ARG_POINTER(aDOMNode); *aDOMNode = nsnull; return NS_OK; }
--- a/accessible/src/base/nsApplicationAccessible.h +++ b/accessible/src/base/nsApplicationAccessible.h @@ -64,32 +64,30 @@ class nsApplicationAccessible: public ns { public: nsApplicationAccessible(); // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIAccessNode + // nsIAccessible NS_SCRIPTABLE NS_IMETHOD GetDOMNode(nsIDOMNode** aDOMNode); NS_SCRIPTABLE NS_IMETHOD GetDocument(nsIAccessibleDocument** aDocument); NS_SCRIPTABLE NS_IMETHOD GetRootDocument(nsIAccessibleDocument** aRootDocument); NS_SCRIPTABLE NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML); NS_SCRIPTABLE NS_IMETHOD ScrollTo(PRUint32 aScrollType); NS_SCRIPTABLE NS_IMETHOD ScrollToPoint(PRUint32 aCoordinateType, PRInt32 aX, PRInt32 aY); NS_SCRIPTABLE NS_IMETHOD GetComputedStyleValue(const nsAString& aPseudoElt, const nsAString& aPropertyName, nsAString& aValue NS_OUTPARAM); NS_SCRIPTABLE NS_IMETHOD GetComputedStyleCSSValue(const nsAString& aPseudoElt, const nsAString& aPropertyName, nsIDOMCSSPrimitiveValue** aValue NS_OUTPARAM); NS_SCRIPTABLE NS_IMETHOD GetLanguage(nsAString& aLanguage); - - // nsIAccessible NS_IMETHOD GetParent(nsIAccessible **aParent); NS_IMETHOD GetNextSibling(nsIAccessible **aNextSibling); NS_IMETHOD GetPreviousSibling(nsIAccessible **aPreviousSibling); NS_IMETHOD GetName(nsAString &aName); NS_IMETHOD GetValue(nsAString &aValue); NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes); NS_IMETHOD GroupPosition(PRInt32 *aGroupLevel, PRInt32 *aSimilarItemsInGroup, PRInt32 *aPositionInGroup);
--- a/accessible/src/base/nsCoreUtils.h +++ b/accessible/src/base/nsCoreUtils.h @@ -186,17 +186,17 @@ public: */ 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. + * nsIAccessible::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);
--- a/accessible/src/base/nsTextAttrs.cpp +++ b/accessible/src/base/nsTextAttrs.cpp @@ -278,18 +278,18 @@ nsTextAttrsMgr::GetRange(const nsTArray< //////////////////////////////////////////////////////////////////////////////// // nsLangTextAttr nsLangTextAttr::nsLangTextAttr(nsHyperTextAccessible *aRootAcc, nsIContent *aRootContent, nsIContent *aContent) : nsTextAttr<nsAutoString>(aContent == nsnull), mRootContent(aRootContent) { - nsresult rv = aRootAcc->GetLanguage(mRootNativeValue); - mIsRootDefined = NS_SUCCEEDED(rv) && !mRootNativeValue.IsEmpty(); + aRootAcc->Language(mRootNativeValue); + mIsRootDefined = !mRootNativeValue.IsEmpty(); if (aContent) mIsDefined = GetLang(aContent, mNativeValue); } bool nsLangTextAttr::GetValueFor(nsIContent *aElm, nsAutoString *aValue) {
--- a/accessible/src/html/nsHyperTextAccessible.cpp +++ b/accessible/src/html/nsHyperTextAccessible.cpp @@ -1143,17 +1143,17 @@ nsHyperTextAccessible::GetTextAttributes accAtOffsetIdx); nsresult rv = textAttrsMgr.GetAttributes(*aAttributes, &startOffset, &endOffset); NS_ENSURE_SUCCESS(rv, rv); // Compute spelling attributes on text accessible only. nsIFrame *offsetFrame = accAtOffset->GetFrame(); if (offsetFrame && offsetFrame->GetType() == nsGkAtoms::textFrame) { - nsCOMPtr<nsIDOMNode> node = accAtOffset->GetDOMNode(); + nsCOMPtr<nsIDOMNode> node = accAtOffset->DOMNode(); PRInt32 nodeOffset = 0; nsresult rv = RenderedToContentOffset(offsetFrame, offsetInAcc, &nodeOffset); NS_ENSURE_SUCCESS(rv, rv); // Set 'misspelled' text attribute. rv = GetSpellTextAttribute(node, nodeOffset, &startOffset, &endOffset, @@ -2250,20 +2250,18 @@ nsHyperTextAccessible::GetDOMPointByFram { NS_ENSURE_ARG(aAccessible); nsCOMPtr<nsIDOMNode> node; if (!aFrame) { // If the given frame is null then set offset after the DOM node of the // given accessible. - nsCOMPtr<nsIAccessNode> accessNode(do_QueryInterface(aAccessible)); - nsCOMPtr<nsIDOMNode> DOMNode; - accessNode->GetDOMNode(getter_AddRefs(DOMNode)); + aAccessible->GetDOMNode(getter_AddRefs(DOMNode)); nsCOMPtr<nsIContent> content(do_QueryInterface(DOMNode)); NS_ENSURE_STATE(content); nsCOMPtr<nsIContent> parent(content->GetParent()); NS_ENSURE_STATE(parent); *aNodeOffset = parent->IndexOf(content) + 1; node = do_QueryInterface(parent);
--- a/accessible/src/msaa/CAccessibleComponent.cpp +++ b/accessible/src/msaa/CAccessibleComponent.cpp @@ -150,17 +150,17 @@ CAccessibleComponent::get_background(IA2 HRESULT CAccessibleComponent::GetARGBValueFromCSSProperty(const nsAString& aPropName, IA2Color *aColorValue) { __try { *aColorValue = 0; - nsCOMPtr<nsIAccessNode> acc(do_QueryObject(this)); + nsRefPtr<nsAccessible> acc(do_QueryObject(this)); if (!acc) return E_FAIL; nsCOMPtr<nsIDOMCSSPrimitiveValue> cssValue; nsresult rv = acc->GetComputedStyleCSSValue(EmptyString(), aPropName, getter_AddRefs(cssValue)); if (NS_FAILED(rv) || !cssValue) return GetHRESULT(rv);
--- a/accessible/src/msaa/nsAccessNodeWrap.cpp +++ b/accessible/src/msaa/nsAccessNodeWrap.cpp @@ -391,19 +391,18 @@ STDMETHODIMP nsAccessNodeWrap::get_compu STDMETHODIMP nsAccessNodeWrap::scrollTo(/* [in] */ boolean aScrollTopLeft) { __try { PRUint32 scrollType = aScrollTopLeft ? nsIAccessibleScrollType::SCROLL_TYPE_TOP_LEFT : nsIAccessibleScrollType::SCROLL_TYPE_BOTTOM_RIGHT; - nsresult rv = ScrollTo(scrollType); - if (NS_SUCCEEDED(rv)) - return S_OK; + ScrollTo(scrollType); + return S_OK; } __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { } return E_FAIL; } ISimpleDOMNode* nsAccessNodeWrap::MakeAccessNode(nsINode *aNode) { @@ -549,20 +548,17 @@ nsAccessNodeWrap::get_innerHTML(BSTR __R STDMETHODIMP nsAccessNodeWrap::get_language(BSTR __RPC_FAR *aLanguage) { __try { *aLanguage = NULL; nsAutoString language; - if (NS_FAILED(GetLanguage(language))) { - return E_FAIL; - } - + Language(language); if (language.IsEmpty()) return S_FALSE; *aLanguage = ::SysAllocStringLen(language.get(), language.Length()); if (!*aLanguage) return E_OUTOFMEMORY; } __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { } @@ -570,17 +566,17 @@ nsAccessNodeWrap::get_language(BSTR __RP return S_OK; } STDMETHODIMP nsAccessNodeWrap::get_localInterface( /* [out] */ void __RPC_FAR *__RPC_FAR *localInterface) { __try { - *localInterface = static_cast<nsIAccessNode*>(this); + *localInterface = static_cast<nsAccessNode*>(this); NS_ADDREF_THIS(); } __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { } return S_OK; } void nsAccessNodeWrap::InitAccessibility() { Compatibility::Init();
--- a/accessible/src/msaa/nsAccessibleWrap.cpp +++ b/accessible/src/msaa/nsAccessibleWrap.cpp @@ -1140,18 +1140,18 @@ nsAccessibleWrap::role(long *aRole) } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { } return E_FAIL; } STDMETHODIMP nsAccessibleWrap::scrollTo(enum IA2ScrollType aScrollType) { __try { - nsresult rv = ScrollTo(aScrollType); - return GetHRESULT(rv); + nsAccessNode::ScrollTo(aScrollType); + return S_OK; } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { } return E_FAIL; } STDMETHODIMP nsAccessibleWrap::scrollToPoint(enum IA2CoordinateType aCoordType, long aX, long aY) @@ -1361,19 +1361,17 @@ nsAccessibleWrap::get_locale(IA2Locale * { __try { // Language codes consist of a primary code and a possibly empty series of // subcodes: language-code = primary-code ( "-" subcode )* // Two-letter primary codes are reserved for [ISO639] language abbreviations. // Any two-letter subcode is understood to be a [ISO3166] country code. nsAutoString lang; - nsresult rv = GetLanguage(lang); - if (NS_FAILED(rv)) - return GetHRESULT(rv); + Language(lang); // If primary code consists from two letters then expose it as language. PRInt32 offset = lang.FindChar('-', 0); if (offset == -1) { if (lang.Length() == 2) { aLocale->language = ::SysAllocString(lang.get()); return S_OK; }
--- a/accessible/src/xul/nsXULFormControlAccessible.cpp +++ b/accessible/src/xul/nsXULFormControlAccessible.cpp @@ -657,27 +657,20 @@ nsXULToolbarButtonAccessible::GetPositio *aPosInSet = posInSet; *aSetSize = setSize; } bool nsXULToolbarButtonAccessible::IsSeparator(nsAccessible *aAccessible) { - nsCOMPtr<nsIDOMNode> domNode; - aAccessible->GetDOMNode(getter_AddRefs(domNode)); - nsCOMPtr<nsIContent> contentDomNode(do_QueryInterface(domNode)); - - if (!contentDomNode) - return false; - - return (contentDomNode->Tag() == nsGkAtoms::toolbarseparator) || - (contentDomNode->Tag() == nsGkAtoms::toolbarspacer) || - (contentDomNode->Tag() == nsGkAtoms::toolbarspring); -} + nsIContent* content = aAccessible->GetContent(); + return content && ((content->Tag() == nsGkAtoms::toolbarseparator) || + (content->Tag() == nsGkAtoms::toolbarspacer) || + (content->Tag() == nsGkAtoms::toolbarspring)); } //////////////////////////////////////////////////////////////////////////////// // nsXULToolbarAccessible //////////////////////////////////////////////////////////////////////////////// nsXULToolbarAccessible:: nsXULToolbarAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
--- a/accessible/src/xul/nsXULTabAccessible.cpp +++ b/accessible/src/xul/nsXULTabAccessible.cpp @@ -148,19 +148,19 @@ nsXULTabAccessible::RelationByType(PRUin return rel; // Expose 'LABEL_FOR' relation on tab accessible for tabpanel accessible. nsCOMPtr<nsIDOMXULRelatedElement> tabsElm = do_QueryInterface(mContent->GetParent()); if (!tabsElm) return rel; - nsCOMPtr<nsIDOMNode> DOMNode(GetDOMNode()); + nsCOMPtr<nsIDOMNode> domNode(DOMNode()); nsCOMPtr<nsIDOMNode> tabpanelNode; - tabsElm->GetRelatedElement(DOMNode, getter_AddRefs(tabpanelNode)); + tabsElm->GetRelatedElement(domNode, getter_AddRefs(tabpanelNode)); if (!tabpanelNode) return rel; nsCOMPtr<nsIContent> tabpanelContent(do_QueryInterface(tabpanelNode)); rel.AppendTarget(tabpanelContent); return rel; } @@ -250,18 +250,18 @@ nsXULTabpanelAccessible::RelationByType( return rel; // Expose 'LABELLED_BY' relation on tabpanel accessible for tab accessible. nsCOMPtr<nsIDOMXULRelatedElement> tabpanelsElm = do_QueryInterface(mContent->GetParent()); if (!tabpanelsElm) return rel; - nsCOMPtr<nsIDOMNode> DOMNode(GetDOMNode()); + nsCOMPtr<nsIDOMNode> domNode(DOMNode()); nsCOMPtr<nsIDOMNode> tabNode; - tabpanelsElm->GetRelatedElement(DOMNode, getter_AddRefs(tabNode)); + tabpanelsElm->GetRelatedElement(domNode, getter_AddRefs(tabNode)); if (!tabNode) return rel; nsCOMPtr<nsIContent> tabContent(do_QueryInterface(tabNode)); rel.AppendTarget(tabContent); return rel; }
--- a/accessible/tests/mochitest/common.js +++ b/accessible/tests/mochitest/common.js @@ -13,17 +13,16 @@ const nsIAccessibleTextChangeEvent = const nsIAccessibleStates = Components.interfaces.nsIAccessibleStates; const nsIAccessibleRole = Components.interfaces.nsIAccessibleRole; const nsIAccessibleScrollType = Components.interfaces.nsIAccessibleScrollType; const nsIAccessibleCoordinateType = Components.interfaces.nsIAccessibleCoordinateType; const nsIAccessibleRelation = Components.interfaces.nsIAccessibleRelation; -const nsIAccessNode = Components.interfaces.nsIAccessNode; const nsIAccessible = Components.interfaces.nsIAccessible; const nsIAccessibleDocument = Components.interfaces.nsIAccessibleDocument; const nsIAccessibleApplication = Components.interfaces.nsIAccessibleApplication; const nsIAccessibleText = Components.interfaces.nsIAccessibleText; const nsIAccessibleEditableText = Components.interfaces.nsIAccessibleEditableText; @@ -116,20 +115,18 @@ function addA11yLoadEvent(aFunc, aWindow function getNode(aAccOrNodeOrID) { if (!aAccOrNodeOrID) return null; if (aAccOrNodeOrID instanceof nsIDOMNode) return aAccOrNodeOrID; - if (aAccOrNodeOrID instanceof nsIAccessible) { - aAccOrNodeOrID.QueryInterface(nsIAccessNode); + if (aAccOrNodeOrID instanceof nsIAccessible) return aAccOrNodeOrID.DOMNode; - } node = document.getElementById(aAccOrNodeOrID); if (!node) { ok(false, "Can't get DOM element for " + aAccOrNodeOrID); return null; } return node; @@ -162,17 +159,16 @@ const DONOTFAIL_IF_NO_INTERFACE = 2; function getAccessible(aAccOrElmOrID, aInterfaces, aElmObj, aDoNotFailIf) { if (!aAccOrElmOrID) return null; var elm = null; if (aAccOrElmOrID instanceof nsIAccessible) { - aAccOrElmOrID.QueryInterface(nsIAccessNode); elm = aAccOrElmOrID.DOMNode; } else if (aAccOrElmOrID instanceof nsIDOMNode) { elm = aAccOrElmOrID; } else { elm = document.getElementById(aAccOrElmOrID); if (!elm) { @@ -194,18 +190,16 @@ function getAccessible(aAccOrElmOrID, aI if (!acc) { if (!(aDoNotFailIf & DONOTFAIL_IF_NO_ACC)) ok(false, "Can't get accessible for " + aAccOrElmOrID); return null; } } - acc.QueryInterface(nsIAccessNode); - if (!aInterfaces) return acc; if (aInterfaces instanceof Array) { for (var index = 0; index < aInterfaces.length; index++) { try { acc.QueryInterface(aInterfaces[index]); } catch (e) { @@ -252,31 +246,29 @@ function getContainerAccessible(aAccOrEl return node ? getAccessible(node) : null; } /** * Return root accessible for the given identifier. */ function getRootAccessible(aAccOrElmOrID) { - var acc = getAccessible(aAccOrElmOrID ? aAccOrElmOrID : document, - [nsIAccessNode]); + var acc = getAccessible(aAccOrElmOrID ? aAccOrElmOrID : document); return acc ? acc.rootDocument.QueryInterface(nsIAccessible) : null; } /** * Return tab document accessible the given accessible is contained by. */ function getTabDocAccessible(aAccOrElmOrID) { - var acc = getAccessible(aAccOrElmOrID ? aAccOrElmOrID : document, - [nsIAccessNode]); + var acc = getAccessible(aAccOrElmOrID ? aAccOrElmOrID : document); var docAcc = acc.document.QueryInterface(nsIAccessible); - var containerDocAcc = docAcc.parent.QueryInterface(nsIAccessNode).document; + var containerDocAcc = docAcc.parent.document; // Test is running is stand-alone mode. if (acc.rootDocument == containerDocAcc) return docAcc; // In the case of running all tests together. return containerDocAcc.QueryInterface(nsIAccessible); } @@ -579,17 +571,17 @@ function getTextFromClipboard() } /** * Return pretty name for identifier, it may be ID, DOM node or accessible. */ function prettyName(aIdentifier) { if (aIdentifier instanceof nsIAccessible) { - var acc = getAccessible(aIdentifier, [nsIAccessNode]); + var acc = getAccessible(aIdentifier); var msg = "[" + getNodePrettyName(acc.DOMNode); try { msg += ", role: " + roleToString(acc.role); if (acc.name) msg += ", name: '" + acc.name + "'"; } catch (e) { msg += "defunct"; }
--- a/accessible/tests/mochitest/events/test_contextmenu.html +++ b/accessible/tests/mochitest/events/test_contextmenu.html @@ -86,17 +86,17 @@ function getFocusedMenuItem() { var menu = getAccessible(getAccessible(getContextMenuNode())); for (var idx = 0; idx < menu.childCount; idx++) { var item = menu.getChildAt(idx); if (hasState(item, STATE_FOCUSED)) - return getAccessible(item, [nsIAccessNode]); + return getAccessible(item); } return null; } //////////////////////////////////////////////////////////////////////////// // Do tests var gQueue = null;
--- a/accessible/tests/mochitest/hypertext/test_update.html +++ b/accessible/tests/mochitest/hypertext/test_update.html @@ -55,17 +55,17 @@ return "Add links for '" + aContainerID + "'"; } } function updateText(aContainerID) { this.containerNode = getNode(aContainerID); this.container = getAccessible(this.containerNode, nsIAccessibleHyperText); - this.text = this.container.firstChild.QueryInterface(nsIAccessNode); + this.text = this.container.firstChild; this.textNode = this.text.DOMNode; this.textLen = this.textNode.data.length; this.eventSeq = [ new invokerChecker(EVENT_TEXT_INSERTED, this.containerNode) ]; this.invoke = function updateText_invoke()
--- a/accessible/tests/mochitest/test_nsIAccessNode_utils.html +++ b/accessible/tests/mochitest/test_nsIAccessNode_utils.html @@ -10,25 +10,25 @@ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> <script type="application/javascript" src="common.js"></script> <script type="application/javascript"> function doTest() { var elmObj = {}; - var acc = getAccessible("span", [nsIAccessNode], elmObj); + var acc = getAccessible("span", null, elmObj); computedStyle = document.defaultView.getComputedStyle(elmObj.value, ""); // html:span element is(acc.getComputedStyleValue("", "color"), computedStyle.color, "Wrong color for element with ID 'span'"); // text child of html:span element - acc = getAccessible(acc.firstChild, [nsIAccessNode]); + acc = getAccessible(acc.firstChild); is(acc.getComputedStyleValue("", "color"), computedStyle.color, "Wrong color for text child of element with ID 'span'"); SimpleTest.finish(); } SimpleTest.waitForExplicitFinish(); addA11yLoadEvent(doTest);
--- a/accessible/tests/mochitest/treeupdate/test_doc.html +++ b/accessible/tests/mochitest/treeupdate/test_doc.html @@ -59,18 +59,18 @@ this.eventSeq = [ new invokerChecker(EVENT_HIDE, null), new invokerChecker(EVENT_REORDER, getDocNode, aID) ]; this.preinvoke = function rootContentRemoved_preinvoke() { // Set up target for hide event before we invoke. - var text = getAccessible(getAccessible(getDocNode(aID)).firstChild, - [nsIAccessNode]).DOMNode; + var text = + getAccessible(getAccessible(getDocNode(aID)).firstChild).DOMNode; this.eventSeq[0].target = text; } this.finalCheck = function rootContentRemoved_finalCheck() { var tree = { role: ROLE_DOCUMENT, states: {