author | David Anderson <danderson@mozilla.com> |
Tue, 12 Jun 2012 17:44:22 -0700 | |
changeset 106295 | 3f2823d467bfae54c95cc2242194ab2357e6934f |
parent 106294 | 71b71dcbf9fe83c291054970712c9d2d93375557 (current diff) |
parent 96457 | d39501066aa4b8f0f9691235cb899c3d724034dc (diff) |
child 106296 | 17e811e71344e1700b4f7fbc6c3fced69c31a8f4 |
push id | 23447 |
push user | danderson@mozilla.com |
push date | Tue, 11 Sep 2012 17:34:27 +0000 |
treeherder | mozilla-central@fdfaef738a00 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
milestone | 16.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/nsIAccessible.idl +++ b/accessible/public/nsIAccessible.idl @@ -18,17 +18,17 @@ interface nsIAccessibleRelation; * 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 * nodes in the DOM tree -- such as documents, focusable elements and text. * Mozilla creates the implementations of nsIAccessible on demand. * See http://www.mozilla.org/projects/ui/accessibility for more information. */ -[scriptable, uuid(45ce2c92-4d92-49d2-bff1-855934443261)] +[scriptable, uuid(45600c50-b06a-11e1-afa6-0800200c9a66)] interface nsIAccessible : nsISupports { /** * Parent node in accessible tree. */ readonly attribute nsIAccessible parent; /** @@ -110,31 +110,23 @@ interface nsIAccessible : nsISupports */ readonly attribute AString description; /** * Provides localized string of accesskey name, such as Alt+D. * The modifier may be affected by user and platform preferences. * Usually alt+letter, or just the letter alone for menu items. */ - readonly attribute AString keyboardShortcut; + readonly attribute AString accessKey; /** * Provides localized string of global keyboard accelerator for default * action, such as Ctrl+O for Open file */ - readonly attribute AString defaultKeyBinding; - - /** - * Provides array of localized string of global keyboard accelerator for - * the given action index supported by accessible. - * - * @param aActionIndex - index of the given action - */ - nsIDOMDOMStringList getKeyBindings(in PRUint8 aActionIndex); + readonly attribute AString keyboardShortcut; /** * Enumerated accessible role (see the constants defined in nsIAccessibleRole). * * @note The values might depend on platform because of variations. Widgets * can use ARIA role attribute to force the final role. */ readonly attribute unsigned long role;
rename from accessible/src/atk/nsHTMLTableAccessibleWrap.h rename to accessible/src/atk/HTMLTableAccessibleWrap.h --- a/accessible/src/atk/nsHTMLTableAccessibleWrap.h +++ b/accessible/src/atk/HTMLTableAccessibleWrap.h @@ -1,17 +1,23 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef _NSHTMLTABLEACCESSIBLEWRAP_H -#define _NSHTMLTABLEACCESSIBLEWRAP_H +#ifndef mozilla_a11y_HTMLTableAccessibleWrap_h__ +#define mozilla_a11y_HTMLTableAccessibleWrap_h__ + +#include "HTMLTableAccessible.h" -#include "nsHTMLTableAccessible.h" +namespace mozilla { +namespace a11y { -typedef class nsHTMLTableAccessible nsHTMLTableAccessibleWrap; -typedef class nsHTMLTableCellAccessible nsHTMLTableCellAccessibleWrap; -typedef class nsHTMLTableHeaderCellAccessible nsHTMLTableHeaderCellAccessibleWrap; +typedef class HTMLTableAccessible HTMLTableAccessibleWrap; +typedef class HTMLTableCellAccessible HTMLTableCellAccessibleWrap; +typedef class HTMLTableHeaderCellAccessible HTMLTableHeaderCellAccessibleWrap; + +} // namespace a11y +} // namespace mozilla #endif
rename from accessible/src/atk/nsXULListboxAccessibleWrap.h rename to accessible/src/atk/XULListboxAccessibleWrap.h --- a/accessible/src/atk/nsXULListboxAccessibleWrap.h +++ b/accessible/src/atk/XULListboxAccessibleWrap.h @@ -1,15 +1,21 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef __nsXULListboxAccessibleWrap_h__ -#define __nsXULListboxAccessibleWrap_h__ +#ifndef mozilla_a11y_XULListboxAccessibleWrap_h__ +#define mozilla_a11y_XULListboxAccessibleWrap_h__ + +#include "XULListboxAccessible.h" -#include "nsXULListboxAccessible.h" +namespace mozilla { +namespace a11y { -typedef class nsXULListboxAccessible nsXULListboxAccessibleWrap; -typedef class nsXULListCellAccessible nsXULListCellAccessibleWrap; +typedef class XULListboxAccessible XULListboxAccessibleWrap; +typedef class XULListCellAccessible XULListCellAccessibleWrap; + +} // namespace a11y +} // namespace mozilla #endif
rename from accessible/src/atk/nsXULMenuAccessibleWrap.h rename to accessible/src/atk/XULMenuAccessibleWrap.h --- a/accessible/src/atk/nsXULMenuAccessibleWrap.h +++ b/accessible/src/atk/XULMenuAccessibleWrap.h @@ -1,14 +1,20 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef __nsXULMenuAccessibleWrap_h__ -#define __nsXULMenuAccessibleWrap_h__ +#ifndef mozilla_a11y_XULMenuAccessibleWrap_h__ +#define mozilla_a11y_XULMenuAccessibleWrap_h__ + +#include "XULMenuAccessible.h" -#include "nsXULMenuAccessible.h" +namespace mozilla { +namespace a11y { -typedef class nsXULMenuitemAccessible nsXULMenuitemAccessibleWrap; +typedef class XULMenuitemAccessible XULMenuitemAccessibleWrap; + +} // namespace a11y +} // namespace mozilla #endif
rename from accessible/src/atk/nsXULTreeGridAccessibleWrap.h rename to accessible/src/atk/XULTreeGridAccessibleWrap.h --- a/accessible/src/atk/nsXULTreeGridAccessibleWrap.h +++ b/accessible/src/atk/XULTreeGridAccessibleWrap.h @@ -1,16 +1,22 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef __nsXULTreeGridAccessibleWrap_h__ -#define __nsXULTreeGridAccessibleWrap_h__ +#ifndef mozilla_a11y_XULTreeGridAccessibleWrap_h__ +#define mozilla_a11y_XULTreeGridAccessibleWrap_h__ + +#include "XULTreeGridAccessible.h" -#include "nsXULTreeGridAccessible.h" +namespace mozilla { +namespace a11y { -typedef class nsXULTreeGridAccessible nsXULTreeGridAccessibleWrap; -typedef class nsXULTreeGridCellAccessible nsXULTreeGridCellAccessibleWrap; +typedef class XULTreeGridAccessible XULTreeGridAccessibleWrap; +typedef class XULTreeGridCellAccessible XULTreeGridCellAccessibleWrap; + +} // namespace a11y +} // namespace mozilla #endif
--- a/accessible/src/base/AccIterator.cpp +++ b/accessible/src/base/AccIterator.cpp @@ -6,16 +6,17 @@ #include "nsAccessibilityService.h" #include "Accessible.h" #include "mozilla/dom/Element.h" #include "nsBindingManager.h" using namespace mozilla; +using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// // AccIterator //////////////////////////////////////////////////////////////////////////////// AccIterator::AccIterator(Accessible* aAccessible, filters::FilterFuncPtr aFilterFunc, IterationType aIterationType) :
--- a/accessible/src/base/AccIterator.h +++ b/accessible/src/base/AccIterator.h @@ -17,17 +17,17 @@ */ class AccIterable { public: virtual ~AccIterable() { } virtual Accessible* Next() = 0; private: - friend class Relation; + friend class mozilla::a11y::Relation; nsAutoPtr<AccIterable> mNextIter; }; /** * Allows to iterate through accessible children or subtree complying with * filter function. */ class AccIterator : public AccIterable
--- a/accessible/src/base/Relation.h +++ b/accessible/src/base/Relation.h @@ -4,16 +4,19 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef RELATION_H_ #define RELATION_H_ #include "AccIterator.h" +namespace mozilla { +namespace a11y { + /** * This class is used to return Relation objects from functions. A copy * constructor doesn't work here because we need to mutate the old relation to * have its nsAutoPtr forget what it points to. */ struct RelationCopyHelper { RelationCopyHelper(AccIterable* aFirstIter, AccIterable* aLastIter) : @@ -112,10 +115,13 @@ public: private: Relation& operator = (const Relation&); nsAutoPtr<AccIterable> mFirstIter; AccIterable* mLastIter; }; +} // namespace a11y +} // namespace mozilla + #endif
--- a/accessible/src/base/TextAttrs.cpp +++ b/accessible/src/base/TextAttrs.cpp @@ -96,31 +96,35 @@ TextAttrsMgr::GetAttributes(nsIPersisten FontSizeTextAttr fontSizeTextAttr(rootFrame, frame); // "font-style" text attribute FontStyleTextAttr fontStyleTextAttr(rootFrame, frame); // "font-weight" text attribute FontWeightTextAttr fontWeightTextAttr(rootFrame, frame); + // "auto-generated" text attribute + AutoGeneratedTextAttr autoGenTextAttr(mHyperTextAcc, mOffsetAcc); + // "text-underline(line-through)-style(color)" text attributes TextDecorTextAttr textDecorTextAttr(rootFrame, frame); // "text-position" text attribute TextPosTextAttr textPosTextAttr(rootFrame, frame); TextAttr* attrArray[] = { &langTextAttr, &bgColorTextAttr, &colorTextAttr, &fontFamilyTextAttr, &fontSizeTextAttr, &fontStyleTextAttr, &fontWeightTextAttr, + &autoGenTextAttr, &textDecorTextAttr, &textPosTextAttr }; // Expose text attributes if applicable. if (aAttributes) { for (PRUint32 idx = 0; idx < ArrayLength(attrArray); idx++) attrArray[idx]->Expose(aAttributes, mIncludeDefAttrs); @@ -139,24 +143,20 @@ TextAttrsMgr::GetRange(TextAttr* aAttrAr for (PRInt32 childIdx = mOffsetAccIdx - 1; childIdx >= 0; childIdx--) { Accessible* currAcc = mHyperTextAcc->GetChildAt(childIdx); // Stop on embedded accessible since embedded accessibles are combined into // own range. if (nsAccUtils::IsEmbeddedObject(currAcc)) break; - nsIContent* currElm = nsCoreUtils::GetDOMElementFor(currAcc->GetContent()); - if (!currElm) - return; - bool offsetFound = false; for (PRUint32 attrIdx = 0; attrIdx < aAttrArrayLen; attrIdx++) { TextAttr* textAttr = aAttrArray[attrIdx]; - if (!textAttr->Equal(currElm)) { + if (!textAttr->Equal(currAcc)) { offsetFound = true; break; } } if (offsetFound) break; @@ -165,27 +165,23 @@ TextAttrsMgr::GetRange(TextAttr* aAttrAr // Navigate forward from anchor accessible to find end offset. PRUint32 childLen = mHyperTextAcc->ChildCount(); for (PRUint32 childIdx = mOffsetAccIdx + 1; childIdx < childLen; childIdx++) { Accessible* currAcc = mHyperTextAcc->GetChildAt(childIdx); if (nsAccUtils::IsEmbeddedObject(currAcc)) break; - nsIContent* currElm = nsCoreUtils::GetDOMElementFor(currAcc->GetContent()); - if (!currElm) - return; - bool offsetFound = false; for (PRUint32 attrIdx = 0; attrIdx < aAttrArrayLen; attrIdx++) { TextAttr* textAttr = aAttrArray[attrIdx]; // Alter the end offset when text attribute changes its value and stop // the search. - if (!textAttr->Equal(currElm)) { + if (!textAttr->Equal(currAcc)) { offsetFound = true; break; } } if (offsetFound) break; @@ -201,61 +197,57 @@ TextAttrsMgr::GetRange(TextAttr* aAttrAr TextAttrsMgr::LangTextAttr:: LangTextAttr(HyperTextAccessible* aRoot, nsIContent* aRootElm, nsIContent* aElm) : TTextAttr<nsString>(!aElm), mRootContent(aRootElm) { aRoot->Language(mRootNativeValue); mIsRootDefined = !mRootNativeValue.IsEmpty(); - if (aElm) - mIsDefined = GetLang(aElm, mNativeValue); + if (aElm) { + nsCoreUtils::GetLanguageFor(aElm, mRootContent, mNativeValue); + mIsDefined = !mNativeValue.IsEmpty(); + } } bool TextAttrsMgr::LangTextAttr:: - GetValueFor(nsIContent* aElm, nsString* aValue) + GetValueFor(Accessible* aAccessible, nsString* aValue) { - return GetLang(aElm, *aValue); + nsCoreUtils::GetLanguageFor(aAccessible->GetContent(), mRootContent, *aValue); + return !aValue->IsEmpty(); } void TextAttrsMgr::LangTextAttr:: ExposeValue(nsIPersistentProperties* aAttributes, const nsString& aValue) { nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::language, aValue); } -bool -TextAttrsMgr::LangTextAttr:: - GetLang(nsIContent* aElm, nsAString& aLang) -{ - nsCoreUtils::GetLanguageFor(aElm, mRootContent, aLang); - return !aLang.IsEmpty(); -} - //////////////////////////////////////////////////////////////////////////////// // BGColorTextAttr //////////////////////////////////////////////////////////////////////////////// TextAttrsMgr::BGColorTextAttr:: BGColorTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame) : TTextAttr<nscolor>(!aFrame), mRootFrame(aRootFrame) { mIsRootDefined = GetColor(mRootFrame, &mRootNativeValue); if (aFrame) mIsDefined = GetColor(aFrame, &mNativeValue); } bool TextAttrsMgr::BGColorTextAttr:: - GetValueFor(nsIContent* aElm, nscolor* aValue) + GetValueFor(Accessible* aAccessible, nscolor* aValue) { - nsIFrame* frame = aElm->GetPrimaryFrame(); + nsIContent* elm = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent()); + nsIFrame* frame = elm->GetPrimaryFrame(); return frame ? GetColor(frame, aValue) : false; } void TextAttrsMgr::BGColorTextAttr:: ExposeValue(nsIPersistentProperties* aAttributes, const nscolor& aValue) { nsAutoString formattedValue; @@ -305,19 +297,20 @@ TextAttrsMgr::ColorTextAttr:: if (aFrame) { mNativeValue = aFrame->GetStyleColor()->mColor; mIsDefined = true; } } bool TextAttrsMgr::ColorTextAttr:: - GetValueFor(nsIContent* aElm, nscolor* aValue) + GetValueFor(Accessible* aAccessible, nscolor* aValue) { - nsIFrame* frame = aElm->GetPrimaryFrame(); + nsIContent* elm = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent()); + nsIFrame* frame = elm->GetPrimaryFrame(); if (frame) { *aValue = frame->GetStyleColor()->mColor; return true; } return false; } @@ -342,19 +335,20 @@ TextAttrsMgr::FontFamilyTextAttr:: mIsRootDefined = GetFontFamily(aRootFrame, mRootNativeValue); if (aFrame) mIsDefined = GetFontFamily(aFrame, mNativeValue); } bool TextAttrsMgr::FontFamilyTextAttr:: - GetValueFor(nsIContent* aElm, nsString* aValue) + GetValueFor(Accessible* aAccessible, nsString* aValue) { - nsIFrame* frame = aElm->GetPrimaryFrame(); + nsIContent* elm = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent()); + nsIFrame* frame = elm->GetPrimaryFrame(); return frame ? GetFontFamily(frame, *aValue) : false; } void TextAttrsMgr::FontFamilyTextAttr:: ExposeValue(nsIPersistentProperties* aAttributes, const nsString& aValue) { nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::font_family, aValue); @@ -391,19 +385,20 @@ TextAttrsMgr::FontSizeTextAttr:: if (aFrame) { mNativeValue = aFrame->GetStyleFont()->mSize; mIsDefined = true; } } bool TextAttrsMgr::FontSizeTextAttr:: - GetValueFor(nsIContent* aElm, nscoord* aValue) + GetValueFor(Accessible* aAccessible, nscoord* aValue) { - nsIFrame* frame = aElm->GetPrimaryFrame(); + nsIContent* content = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent()); + nsIFrame* frame = content->GetPrimaryFrame(); if (frame) { *aValue = frame->GetStyleFont()->mSize; return true; } return false; } @@ -446,19 +441,20 @@ TextAttrsMgr::FontStyleTextAttr:: if (aFrame) { mNativeValue = aFrame->GetStyleFont()->mFont.style; mIsDefined = true; } } bool TextAttrsMgr::FontStyleTextAttr:: - GetValueFor(nsIContent* aContent, nscoord* aValue) + GetValueFor(Accessible* aAccessible, nscoord* aValue) { - nsIFrame* frame = aContent->GetPrimaryFrame(); + nsIContent* elm = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent()); + nsIFrame* frame = elm->GetPrimaryFrame(); if (frame) { *aValue = frame->GetStyleFont()->mFont.style; return true; } return false; } @@ -487,19 +483,20 @@ TextAttrsMgr::FontWeightTextAttr:: if (aFrame) { mNativeValue = GetFontWeight(aFrame); mIsDefined = true; } } bool TextAttrsMgr::FontWeightTextAttr:: - GetValueFor(nsIContent* aElm, PRInt32* aValue) + GetValueFor(Accessible* aAccessible, PRInt32* aValue) { - nsIFrame* frame = aElm->GetPrimaryFrame(); + nsIContent* elm = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent()); + nsIFrame* frame = elm->GetPrimaryFrame(); if (frame) { *aValue = GetFontWeight(frame); return true; } return false; } @@ -545,16 +542,46 @@ TextAttrsMgr::FontWeightTextAttr:: // On Mac, font->GetStyle()->weight will just give the same number as // getComputedStyle(). fontEntry->Weight() will give the weight of the font // face used. gfxFontEntry *fontEntry = font->GetFontEntry(); return fontEntry->Weight(); #endif } +//////////////////////////////////////////////////////////////////////////////// +// AutoGeneratedTextAttr +//////////////////////////////////////////////////////////////////////////////// +TextAttrsMgr::AutoGeneratedTextAttr:: + AutoGeneratedTextAttr(HyperTextAccessible* aHyperTextAcc, + Accessible* aAccessible) : + TTextAttr<bool>(!aAccessible) +{ + mRootNativeValue = false; + mIsRootDefined = false; + + if (aAccessible) + mIsDefined = mNativeValue = (aAccessible->NativeRole() == roles::STATICTEXT); +} + +bool +TextAttrsMgr::AutoGeneratedTextAttr:: + GetValueFor(Accessible* aAccessible, bool* aValue) +{ + return *aValue = (aAccessible->NativeRole() == roles::STATICTEXT); +} + +void +TextAttrsMgr::AutoGeneratedTextAttr:: + ExposeValue(nsIPersistentProperties* aAttributes, const bool& aValue) +{ + nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::auto_generated, + aValue ? NS_LITERAL_STRING("true") : NS_LITERAL_STRING("false")); +} + //////////////////////////////////////////////////////////////////////////////// // TextDecorTextAttr //////////////////////////////////////////////////////////////////////////////// TextAttrsMgr::TextDecorValue:: TextDecorValue(nsIFrame* aFrame) { @@ -581,19 +608,20 @@ TextAttrsMgr::TextDecorTextAttr:: if (aFrame) { mNativeValue = TextDecorValue(aFrame); mIsDefined = mNativeValue.IsDefined(); } } bool TextAttrsMgr::TextDecorTextAttr:: - GetValueFor(nsIContent* aContent, TextDecorValue* aValue) + GetValueFor(Accessible* aAccessible, TextDecorValue* aValue) { - nsIFrame* frame = aContent->GetPrimaryFrame(); + nsIContent* elm = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent()); + nsIFrame* frame = elm->GetPrimaryFrame(); if (frame) { *aValue = TextDecorValue(frame); return aValue->IsDefined(); } return false; } @@ -643,19 +671,20 @@ TextAttrsMgr::TextPosTextAttr:: if (aFrame) { mNativeValue = GetTextPosValue(aFrame); mIsDefined = mNativeValue != eTextPosNone; } } bool TextAttrsMgr::TextPosTextAttr:: - GetValueFor(nsIContent* aContent, TextPosValue* aValue) + GetValueFor(Accessible* aAccessible, TextPosValue* aValue) { - nsIFrame* frame = aContent->GetPrimaryFrame(); + nsIContent* elm = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent()); + nsIFrame* frame = elm->GetPrimaryFrame(); if (frame) { *aValue = GetTextPosValue(frame); return *aValue != eTextPosNone; } return false; }
--- a/accessible/src/base/TextAttrs.h +++ b/accessible/src/base/TextAttrs.h @@ -105,17 +105,17 @@ protected: */ virtual void Expose(nsIPersistentProperties* aAttributes, bool aIncludeDefAttrValue) = 0; /** * Return true if the text attribute value on the given element equals with * predefined attribute value. */ - virtual bool Equal(nsIContent* aElm) = 0; + virtual bool Equal(Accessible* aAccessible) = 0; }; /** * Base class to work with text attributes. See derived classes below. */ template<class T> class TTextAttr : public TextAttr @@ -138,20 +138,20 @@ protected: ExposeValue(aAttributes, mNativeValue); return; } if (aIncludeDefAttrValue && mIsRootDefined) ExposeValue(aAttributes, mRootNativeValue); } - virtual bool Equal(nsIContent* aElm) + virtual bool Equal(Accessible* aAccessible) { T nativeValue; - bool isDefined = GetValueFor(aElm, &nativeValue); + bool isDefined = GetValueFor(aAccessible, &nativeValue); if (!mIsDefined && !isDefined) return true; if (mIsDefined && isDefined) return nativeValue == mNativeValue; if (mIsDefined) @@ -162,17 +162,17 @@ protected: protected: // Expose the text attribute with the given value to attribute set. virtual void ExposeValue(nsIPersistentProperties* aAttributes, const T& aValue) = 0; // Return native value for the given DOM element. - virtual bool GetValueFor(nsIContent* aElm, T* aValue) = 0; + virtual bool GetValueFor(Accessible* aAccessible, T* aValue) = 0; // Indicates if root value should be exposed. bool mGetRootValue; // Native value and flag indicating if the value is defined (initialized in // derived classes). Note, undefined native value means it is inherited // from root. T mNativeValue; @@ -193,39 +193,38 @@ protected: public: LangTextAttr(HyperTextAccessible* aRoot, nsIContent* aRootElm, nsIContent* aElm); virtual ~LangTextAttr() { } protected: // TextAttr - virtual bool GetValueFor(nsIContent* aElm, nsString* aValue); + virtual bool GetValueFor(Accessible* aAccessible, nsString* aValue); virtual void ExposeValue(nsIPersistentProperties* aAttributes, const nsString& aValue); private: - bool GetLang(nsIContent* aElm, nsAString& aLang); nsCOMPtr<nsIContent> mRootContent; }; /** * Class is used for the work with 'background-color' text attribute. */ class BGColorTextAttr : public TTextAttr<nscolor> { public: BGColorTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame); virtual ~BGColorTextAttr() { } protected: // TextAttr - virtual bool GetValueFor(nsIContent* aElm, nscolor* aValue); + virtual bool GetValueFor(Accessible* aAccessible, nscolor* aValue); virtual void ExposeValue(nsIPersistentProperties* aAttributes, const nscolor& aValue); private: bool GetColor(nsIFrame* aFrame, nscolor* aColor); nsIFrame* mRootFrame; }; @@ -237,17 +236,17 @@ protected: { public: ColorTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame); virtual ~ColorTextAttr() { } protected: // TTextAttr - virtual bool GetValueFor(nsIContent* aElm, nscolor* aValue); + virtual bool GetValueFor(Accessible* aAccessible, nscolor* aValue); virtual void ExposeValue(nsIPersistentProperties* aAttributes, const nscolor& aValue); }; /** * Class is used for the work with "font-family" text attribute. */ @@ -255,17 +254,17 @@ protected: { public: FontFamilyTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame); virtual ~FontFamilyTextAttr() { } protected: // TTextAttr - virtual bool GetValueFor(nsIContent* aElm, nsString* aValue); + virtual bool GetValueFor(Accessible* aAccessible, nsString* aValue); virtual void ExposeValue(nsIPersistentProperties* aAttributes, const nsString& aValue); private: bool GetFontFamily(nsIFrame* aFrame, nsString& aFamily); }; @@ -274,20 +273,20 @@ protected: * Class is used for the work with "font-size" text attribute. */ class FontSizeTextAttr : public TTextAttr<nscoord> { public: FontSizeTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame); virtual ~FontSizeTextAttr() { } - protected: + protected: // TTextAttr - virtual bool GetValueFor(nsIContent* aElm, nscoord* aValue); + virtual bool GetValueFor(Accessible* aAccessible, nscoord* aValue); virtual void ExposeValue(nsIPersistentProperties* aAttributes, const nscoord& aValue); private: nsDeviceContext* mDC; }; @@ -298,17 +297,17 @@ protected: { public: FontStyleTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame); virtual ~FontStyleTextAttr() { } protected: // TTextAttr - virtual bool GetValueFor(nsIContent* aContent, nscoord* aValue); + virtual bool GetValueFor(Accessible* aContent, nscoord* aValue); virtual void ExposeValue(nsIPersistentProperties* aAttributes, const nscoord& aValue); }; /** * Class is used for the work with "font-weight" text attribute. */ @@ -316,24 +315,41 @@ protected: { public: FontWeightTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame); virtual ~FontWeightTextAttr() { } protected: // TTextAttr - virtual bool GetValueFor(nsIContent* aElm, PRInt32* aValue); + virtual bool GetValueFor(Accessible* aAccessible, PRInt32* aValue); virtual void ExposeValue(nsIPersistentProperties* aAttributes, const PRInt32& aValue); private: PRInt32 GetFontWeight(nsIFrame* aFrame); }; + /** + * Class is used for the work with 'auto-generated' text attribute. + */ + class AutoGeneratedTextAttr : public TTextAttr<bool> + { + public: + AutoGeneratedTextAttr(HyperTextAccessible* aHyperTextAcc, + Accessible* aAccessible); + virtual ~AutoGeneratedTextAttr() { } + + protected: + // TextAttr + virtual bool GetValueFor(Accessible* aAccessible, bool* aValue); + virtual void ExposeValue(nsIPersistentProperties* aAttributes, + const bool& aValue); + }; + /** * TextDecorTextAttr class is used for the work with * "text-line-through-style", "text-line-through-color", * "text-underline-style" and "text-underline-color" text attributes. */ class TextDecorValue @@ -370,17 +386,17 @@ protected: { public: TextDecorTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame); virtual ~TextDecorTextAttr() { } protected: // TextAttr - virtual bool GetValueFor(nsIContent* aElm, TextDecorValue* aValue); + virtual bool GetValueFor(Accessible* aAccessible, TextDecorValue* aValue); virtual void ExposeValue(nsIPersistentProperties* aAttributes, const TextDecorValue& aValue); }; /** * Class is used for the work with "text-position" text attribute. */ @@ -395,17 +411,17 @@ protected: { public: TextPosTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame); virtual ~TextPosTextAttr() { } protected: // TextAttr - virtual bool GetValueFor(nsIContent* aElm, TextPosValue* aValue); + virtual bool GetValueFor(Accessible* aAccessible, TextPosValue* aValue); virtual void ExposeValue(nsIPersistentProperties* aAttributes, const TextPosValue& aValue); private: TextPosValue GetTextPosValue(nsIFrame* aFrame) const; }; }; // TextAttrMgr
--- a/accessible/src/base/TextUpdater.h +++ b/accessible/src/base/TextUpdater.h @@ -1,36 +1,37 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef TextUpdater_h_ -#define TextUpdater_h_ +#ifndef mozilla_a11y_TextUpdater_h__ +#define mozilla_a11y_TextUpdater_h__ #include "AccEvent.h" #include "HyperTextAccessible.h" +namespace mozilla { +namespace a11y { + /** * Used to find a difference between old and new text and fire text change * events. */ class TextUpdater { public: /** * Start text of the text leaf update. */ - static void Run(DocAccessible* aDocument, - mozilla::a11y::TextLeafAccessible* aTextLeaf, + static void Run(DocAccessible* aDocument, TextLeafAccessible* aTextLeaf, const nsAString& aNewText); private: - TextUpdater(DocAccessible* aDocument, - mozilla::a11y::TextLeafAccessible* aTextLeaf) : + TextUpdater(DocAccessible* aDocument, TextLeafAccessible* aTextLeaf) : mDocument(aDocument), mTextLeaf(aTextLeaf), mHyperText(nsnull), mTextOffset(-1) { } ~TextUpdater() { mDocument = nsnull; mTextLeaf = nsnull; mHyperText = nsnull; } /** * Update text of the text leaf accessible, fire text change and value change @@ -79,14 +80,17 @@ private: /** * The constant used to skip string difference calculation in case of long * strings. */ const static PRUint32 kMaxStrLen = 1 << 6; private: DocAccessible* mDocument; - mozilla::a11y::TextLeafAccessible* mTextLeaf; + TextLeafAccessible* mTextLeaf; HyperTextAccessible* mHyperText; PRInt32 mTextOffset; }; +} // namespace a11y +} // namespace mozilla + #endif
--- a/accessible/src/base/nsARIAMap.cpp +++ b/accessible/src/base/nsARIAMap.cpp @@ -30,550 +30,550 @@ using namespace mozilla::a11y::aria; * In addition, in MSAA, the unmapped role will also be exposed as a BSTR string role. * * There are no nsIAccessibleRole enums for the following landmark roles: * banner, contentinfo, main, navigation, note, search, secondary, seealso, breadcrumbs */ static nsRoleMapEntry sWAIRoleMaps[] = { - { - "alert", + { // alert + &nsGkAtoms::alert, roles::ALERT, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates }, - { - "alertdialog", + { // alertdialog + &nsGkAtoms::alertdialog, roles::DIALOG, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates }, - { - "application", + { // application + &nsGkAtoms::application, roles::APPLICATION, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates }, - { - "article", + { // article + &nsGkAtoms::article, roles::DOCUMENT, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates, eReadonlyUntilEditable }, - { - "button", + { // button + &nsGkAtoms::button, roles::PUSHBUTTON, kUseMapRole, eNoValue, ePressAction, eNoLiveAttr, kNoReqStates, eARIAPressed }, - { - "checkbox", + { // checkbox + &nsGkAtoms::checkbox, roles::CHECKBUTTON, kUseMapRole, eNoValue, eCheckUncheckAction, eNoLiveAttr, kNoReqStates, eARIACheckableMixed, eARIAReadonly }, - { - "columnheader", + { // columnheader + &nsGkAtoms::columnheader, roles::COLUMNHEADER, kUseMapRole, eNoValue, eSortAction, eNoLiveAttr, kNoReqStates, eARIASelectable, eARIAReadonly }, - { - "combobox", + { // combobox + &nsGkAtoms::combobox, roles::COMBOBOX, kUseMapRole, eNoValue, eOpenCloseAction, eNoLiveAttr, states::COLLAPSED | states::HASPOPUP, eARIAAutoComplete, eARIAReadonly }, - { - "dialog", + { // dialog + &nsGkAtoms::dialog, roles::DIALOG, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates }, - { - "directory", + { // directory + &nsGkAtoms::directory, roles::LIST, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates }, - { - "document", + { // document + &nsGkAtoms::document, roles::DOCUMENT, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates, eReadonlyUntilEditable }, - { - "form", + { // form + &nsGkAtoms::form, roles::FORM, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates }, - { - "grid", + { // grid + &nsGkAtoms::grid, roles::TABLE, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, states::FOCUSABLE, eARIAMultiSelectable, eARIAReadonly }, - { - "gridcell", + { // gridcell + &nsGkAtoms::gridcell, roles::GRID_CELL, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates, eARIASelectable, eARIAReadonly }, - { - "group", + { // group + &nsGkAtoms::group, roles::GROUPING, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates }, - { - "heading", + { // heading + &nsGkAtoms::heading, roles::HEADING, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates }, - { - "img", + { // img + &nsGkAtoms::img, roles::GRAPHIC, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates }, - { - "link", + { // link + &nsGkAtoms::link, roles::LINK, kUseMapRole, eNoValue, eJumpAction, eNoLiveAttr, states::LINKED }, - { - "list", + { // list + &nsGkAtoms::list, roles::LIST, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, states::READONLY }, - { - "listbox", + { // listbox + &nsGkAtoms::listbox, roles::LISTBOX, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates, eARIAMultiSelectable, eARIAReadonly }, - { - "listitem", + { // listitem + &nsGkAtoms::listitem, roles::LISTITEM, kUseMapRole, eNoValue, eNoAction, // XXX: should depend on state, parent accessible eNoLiveAttr, states::READONLY }, - { - "log", + { // log + &nsGkAtoms::log_, roles::NOTHING, kUseNativeRole, eNoValue, eNoAction, ePoliteLiveAttr, kNoReqStates }, - { - "marquee", + { // marquee + &nsGkAtoms::marquee, roles::ANIMATION, kUseMapRole, eNoValue, eNoAction, eOffLiveAttr, kNoReqStates }, - { - "math", + { // math + &nsGkAtoms::math, roles::FLAT_EQUATION, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates }, - { - "menu", + { // menu + &nsGkAtoms::menu, roles::MENUPOPUP, kUseMapRole, eNoValue, eNoAction, // XXX: technically accessibles of menupopup role haven't // any action, but menu can be open or close. eNoLiveAttr, kNoReqStates }, - { - "menubar", + { // menubar + &nsGkAtoms::menubar, roles::MENUBAR, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates }, - { - "menuitem", + { // menuitem + &nsGkAtoms::menuitem, roles::MENUITEM, kUseMapRole, eNoValue, eClickAction, eNoLiveAttr, kNoReqStates, eARIACheckedMixed }, - { - "menuitemcheckbox", + { // menuitemcheckbox + &nsGkAtoms::menuitemcheckbox, roles::CHECK_MENU_ITEM, kUseMapRole, eNoValue, eClickAction, eNoLiveAttr, kNoReqStates, eARIACheckableMixed }, - { - "menuitemradio", + { // menuitemradio + &nsGkAtoms::menuitemradio, roles::RADIO_MENU_ITEM, kUseMapRole, eNoValue, eClickAction, eNoLiveAttr, kNoReqStates, eARIACheckableBool }, - { - "note", + { // note + &nsGkAtoms::note_, roles::NOTE, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates }, - { - "option", + { // option + &nsGkAtoms::option, roles::OPTION, kUseMapRole, eNoValue, eSelectAction, eNoLiveAttr, kNoReqStates, eARIASelectable, eARIACheckedMixed }, - { - "presentation", + { // presentation + &nsGkAtoms::presentation, roles::NOTHING, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates }, - { - "progressbar", + { // progressbar + &nsGkAtoms::progressbar, roles::PROGRESSBAR, kUseMapRole, eHasValueMinMax, eNoAction, eNoLiveAttr, states::READONLY, eIndeterminateIfNoValue }, - { - "radio", + { // radio + &nsGkAtoms::radio, roles::RADIOBUTTON, kUseMapRole, eNoValue, eSelectAction, eNoLiveAttr, kNoReqStates, eARIACheckableBool }, - { - "radiogroup", + { // radiogroup + &nsGkAtoms::radiogroup, roles::GROUPING, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates }, - { - "region", + { // region + &nsGkAtoms::region, roles::PANE, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates }, - { - "row", + { // row + &nsGkAtoms::row, roles::ROW, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates, eARIASelectable }, - { - "rowheader", + { // rowheader + &nsGkAtoms::rowheader, roles::ROWHEADER, kUseMapRole, eNoValue, eSortAction, eNoLiveAttr, kNoReqStates, eARIASelectable, eARIAReadonly }, - { - "scrollbar", + { // scrollbar + &nsGkAtoms::scrollbar, roles::SCROLLBAR, kUseMapRole, eHasValueMinMax, eNoAction, eNoLiveAttr, kNoReqStates, eARIAOrientation, eARIAReadonly }, - { - "separator", + { // separator + &nsGkAtoms::separator_, roles::SEPARATOR, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates, eARIAOrientation }, - { - "slider", + { // slider + &nsGkAtoms::slider, roles::SLIDER, kUseMapRole, eHasValueMinMax, eNoAction, eNoLiveAttr, kNoReqStates, eARIAOrientation, eARIAReadonly }, - { - "spinbutton", + { // spinbutton + &nsGkAtoms::spinbutton, roles::SPINBUTTON, kUseMapRole, eHasValueMinMax, eNoAction, eNoLiveAttr, kNoReqStates, eARIAReadonly }, - { - "status", + { // status + &nsGkAtoms::status, roles::STATUSBAR, kUseMapRole, eNoValue, eNoAction, ePoliteLiveAttr, kNoReqStates }, - { - "tab", + { // tab + &nsGkAtoms::tab, roles::PAGETAB, kUseMapRole, eNoValue, eSwitchAction, eNoLiveAttr, kNoReqStates, eARIASelectable }, - { - "tablist", + { // tablist + &nsGkAtoms::tablist, roles::PAGETABLIST, kUseMapRole, eNoValue, eNoAction, ePoliteLiveAttr, kNoReqStates }, - { - "tabpanel", + { // tabpanel + &nsGkAtoms::tabpanel, roles::PROPERTYPAGE, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates }, - { - "textbox", + { // textbox + &nsGkAtoms::textbox, roles::ENTRY, kUseMapRole, eNoValue, eActivateAction, eNoLiveAttr, kNoReqStates, eARIAAutoComplete, eARIAMultiline, eARIAReadonlyOrEditable }, - { - "timer", + { // timer + &nsGkAtoms::timer, roles::NOTHING, kUseNativeRole, eNoValue, eNoAction, eOffLiveAttr, kNoReqStates }, - { - "toolbar", + { // toolbar + &nsGkAtoms::toolbar, roles::TOOLBAR, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates }, - { - "tooltip", + { // tooltip + &nsGkAtoms::tooltip, roles::TOOLTIP, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates }, - { - "tree", + { // tree + &nsGkAtoms::tree, roles::OUTLINE, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates, eARIAReadonly, eARIAMultiSelectable }, - { - "treegrid", + { // treegrid + &nsGkAtoms::treegrid, roles::TREE_TABLE, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates, eARIAReadonly, eARIAMultiSelectable }, - { - "treeitem", + { // treeitem + &nsGkAtoms::treeitem, roles::OUTLINEITEM, kUseMapRole, eNoValue, eActivateAction, // XXX: should expose second 'expand/collapse' action based // on states eNoLiveAttr, kNoReqStates, eARIASelectable, eARIACheckedMixed } }; static nsRoleMapEntry sLandmarkRoleMap = { - "", + &nsGkAtoms::_empty, roles::NOTHING, kUseNativeRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates }; nsRoleMapEntry nsARIAMap::gEmptyRoleMap = { - "", + &nsGkAtoms::_empty, roles::NOTHING, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kNoReqStates }; @@ -636,34 +636,34 @@ nsAttributeCharacteristics nsARIAMap::gW }; PRUint32 nsARIAMap::gWAIUnivAttrMapLength = NS_ARRAY_LENGTH(nsARIAMap::gWAIUnivAttrMap); nsRoleMapEntry* aria::GetRoleMap(nsINode* aNode) { nsIContent* content = nsCoreUtils::GetRoleContent(aNode); - nsAutoString roleString; + nsAutoString roles; if (!content || - !content->GetAttr(kNameSpaceID_None, nsGkAtoms::role, roleString) || - roleString.IsEmpty()) { + !content->GetAttr(kNameSpaceID_None, nsGkAtoms::role, roles) || + roles.IsEmpty()) { // We treat role="" as if the role attribute is absent (per aria spec:8.1.1) return nsnull; } - nsWhitespaceTokenizer tokenizer(roleString); + nsWhitespaceTokenizer tokenizer(roles); while (tokenizer.hasMoreTokens()) { // Do a binary search through table for the next role in role list - NS_LossyConvertUTF16toASCII role(tokenizer.nextToken()); + const nsDependentSubstring role = tokenizer.nextToken(); PRUint32 low = 0; PRUint32 high = ArrayLength(sWAIRoleMaps); while (low < high) { PRUint32 idx = (low + high) / 2; - PRInt32 compare = strcmp(role.get(), sWAIRoleMaps[idx].roleString); - if (compare == 0) + PRInt32 compare = Compare(role, sWAIRoleMaps[idx].ARIARoleString()); + if (compare == 0) return sWAIRoleMaps + idx; if (compare < 0) high = idx; else low = idx + 1; } }
--- a/accessible/src/base/nsARIAMap.h +++ b/accessible/src/base/nsARIAMap.h @@ -6,17 +6,18 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef _nsARIAMap_H_ #define _nsARIAMap_H_ #include "ARIAStateMap.h" #include "mozilla/a11y/Role.h" -class nsIAtom; +#include "nsIAtom.h" + class nsIContent; class nsINode; //////////////////////////////////////////////////////////////////////////////// // Value constants /** * Used to define if role requires to expose nsIAccessibleValue. @@ -131,19 +132,31 @@ enum EDefaultStateRule //////////////////////////////////////////////////////////////////////////////// // Role map entry /** * For each ARIA role, this maps the nsIAccessible information. */ struct nsRoleMapEntry { + /** + * Return true if matches to the given ARIA role. + */ + bool Is(nsIAtom* aARIARole) const + { return *roleAtom == aARIARole; } + + /** + * Return ARIA role. + */ + const nsDependentAtomString ARIARoleString() const + { return nsDependentAtomString(*roleAtom); } + // ARIA role: string representation such as "button" - const char *roleString; - + nsIAtom** roleAtom; + // Role mapping rule: maps to this nsIAccessibleRole mozilla::a11y::role role; // Role rule: whether to use mapped role or native semantics bool roleRule; // Value mapping rule: how to compute nsIAccessible value EValueRule valueRule;
--- a/accessible/src/base/nsAccUtils.cpp +++ b/accessible/src/base/nsAccUtils.cpp @@ -147,19 +147,18 @@ nsAccUtils::SetLiveContainerAttributes(n ancestor->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_live, live); } else if (role) { GetLiveAttrValue(role->liveAttRule, live); } if (!live.IsEmpty()) { SetAccAttr(aAttributes, nsGkAtoms::containerLive, live); if (role) { - nsAccUtils::SetAccAttr(aAttributes, - nsGkAtoms::containerLiveRole, - NS_ConvertASCIItoUTF16(role->roleString)); + nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::containerLiveRole, + role->ARIARoleString()); } } } // container-atomic attribute if (atomic.IsEmpty() && nsAccUtils::HasDefinedARIAToken(ancestor, nsGkAtoms::aria_atomic) && ancestor->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_atomic, atomic))
--- a/accessible/src/base/nsAccUtils.h +++ b/accessible/src/base/nsAccUtils.h @@ -19,22 +19,18 @@ #include "nsIDOMNode.h" #include "nsIPersistentProperties2.h" #include "nsIPresShell.h" #include "nsPoint.h" class nsAccessNode; class Accessible; class HyperTextAccessible; -class nsHTMLTableAccessible; class DocAccessible; struct nsRoleMapEntry; -#ifdef MOZ_XUL -class nsXULTreeAccessible; -#endif class nsAccUtils { public: /** * Returns value of attribute from the given attributes container. * * @param aAttributes - attributes container
--- a/accessible/src/base/nsAccessibilityService.cpp +++ b/accessible/src/base/nsAccessibilityService.cpp @@ -15,22 +15,22 @@ #include "DocAccessible-inl.h" #include "FocusManager.h" #include "HTMLCanvasAccessible.h" #include "HTMLElementAccessibles.h" #include "HTMLImageMapAccessible.h" #include "HTMLLinkAccessible.h" #include "HTMLListAccessible.h" #include "HTMLSelectAccessible.h" +#include "HTMLTableAccessibleWrap.h" #include "HyperTextAccessibleWrap.h" #include "nsAccessiblePivot.h" #include "nsAccUtils.h" #include "nsARIAMap.h" #include "nsIAccessibleProvider.h" -#include "nsHTMLTableAccessibleWrap.h" #include "nsXFormsFormControlsAccessible.h" #include "nsXFormsWidgetsAccessible.h" #include "OuterDocAccessible.h" #include "Role.h" #include "RootAccessibleWrap.h" #include "States.h" #include "Statistics.h" #ifdef XP_WIN @@ -62,26 +62,26 @@ #include "nsObjectFrame.h" #include "nsTextFragment.h" #include "mozilla/FunctionTimer.h" #include "mozilla/dom/Element.h" #include "mozilla/Services.h" #include "mozilla/Util.h" #ifdef MOZ_XUL -#include "nsXULAlertAccessible.h" -#include "nsXULColorPickerAccessible.h" -#include "nsXULComboboxAccessible.h" +#include "XULAlertAccessible.h" +#include "XULColorPickerAccessible.h" +#include "XULComboboxAccessible.h" +#include "XULElementAccessibles.h" #include "XULFormControlAccessible.h" -#include "nsXULListboxAccessibleWrap.h" -#include "nsXULMenuAccessibleWrap.h" -#include "nsXULSliderAccessible.h" -#include "nsXULTabAccessible.h" -#include "nsXULTextAccessible.h" -#include "nsXULTreeGridAccessibleWrap.h" +#include "XULListboxAccessibleWrap.h" +#include "XULMenuAccessibleWrap.h" +#include "XULSliderAccessible.h" +#include "XULTabAccessible.h" +#include "XULTreeGridAccessibleWrap.h" #endif using namespace mozilla; using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// // nsAccessibilityService //////////////////////////////////////////////////////////////////////////////// @@ -380,27 +380,27 @@ nsAccessibilityService::CreateHTMLRadioB return accessible; } already_AddRefed<Accessible> nsAccessibilityService::CreateHTMLTableAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { Accessible* accessible = - new nsHTMLTableAccessibleWrap(aContent, GetDocAccessible(aPresShell)); + new HTMLTableAccessibleWrap(aContent, GetDocAccessible(aPresShell)); NS_ADDREF(accessible); return accessible; } already_AddRefed<Accessible> nsAccessibilityService::CreateHTMLTableCellAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { Accessible* accessible = - new nsHTMLTableCellAccessibleWrap(aContent, GetDocAccessible(aPresShell)); + new HTMLTableCellAccessibleWrap(aContent, GetDocAccessible(aPresShell)); NS_ADDREF(accessible); return accessible; } already_AddRefed<Accessible> nsAccessibilityService::CreateHTMLTableRowAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { @@ -460,17 +460,17 @@ nsAccessibilityService::CreateHTMLBRAcce return accessible; } already_AddRefed<Accessible> nsAccessibilityService::CreateHTMLCaptionAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { Accessible* accessible = - new nsHTMLCaptionAccessible(aContent, GetDocAccessible(aPresShell)); + new HTMLCaptionAccessible(aContent, GetDocAccessible(aPresShell)); NS_ADDREF(accessible); return accessible; } void nsAccessibilityService::ContentRangeInserted(nsIPresShell* aPresShell, nsIContent* aContainer, nsIContent* aStartChild, @@ -525,17 +525,17 @@ void nsAccessibilityService::TreeViewChanged(nsIPresShell* aPresShell, nsIContent* aContent, nsITreeView* aView) { DocAccessible* document = GetDocAccessible(aPresShell); if (document) { Accessible* accessible = document->GetAccessible(aContent); if (accessible) { - nsXULTreeAccessible* treeAcc = accessible->AsXULTree(); + XULTreeAccessible* treeAcc = accessible->AsXULTree(); if (treeAcc) treeAcc->TreeViewChanged(aView); } } } void nsAccessibilityService::UpdateListBullet(nsIPresShell* aPresShell, @@ -1021,17 +1021,17 @@ nsAccessibilityService::GetOrCreateAcces newAcc = new HyperTextAccessibleWrap(content, docAcc); if (docAcc->BindToDocument(newAcc, aria::GetRoleMap(aNode))) return newAcc; return nsnull; } nsRoleMapEntry* roleMapEntry = aria::GetRoleMap(aNode); - if (roleMapEntry && !nsCRT::strcmp(roleMapEntry->roleString, "presentation")) { + if (roleMapEntry && roleMapEntry->Is(nsGkAtoms::presentation)) { // Ignore presentation role if element is focusable (focus event shouldn't // be ever lost and should be sensible). if (content->IsFocusable()) roleMapEntry = nsnull; else return nsnull; } @@ -1068,18 +1068,17 @@ nsAccessibilityService::GetOrCreateAcces roleMapEntry = &nsARIAMap::gEmptyRoleMap; } break; } #ifdef DEBUG nsRoleMapEntry* tableRoleMapEntry = aria::GetRoleMap(tableContent); - NS_ASSERTION(tableRoleMapEntry && - !nsCRT::strcmp(tableRoleMapEntry->roleString, "presentation"), + NS_ASSERTION(tableRoleMapEntry && tableRoleMapEntry->Is(nsGkAtoms::presentation), "No accessible for parent table and it didn't have role of presentation"); #endif if (!roleMapEntry && !content->IsFocusable()) { // Table-related descendants of presentation table are also // presentation if they aren't focusable and have not explicit ARIA // role (don't create accessibles for them unless they need to fire // focus events). @@ -1309,37 +1308,37 @@ nsAccessibilityService::CreateAccessible switch (type) { #ifdef MOZ_XUL case nsIAccessibleProvider::NoAccessible: return nsnull; // XUL controls case nsIAccessibleProvider::XULAlert: - accessible = new nsXULAlertAccessible(aContent, aDoc); + accessible = new XULAlertAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULButton: accessible = new XULButtonAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULCheckbox: accessible = new XULCheckboxAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULColorPicker: - accessible = new nsXULColorPickerAccessible(aContent, aDoc); + accessible = new XULColorPickerAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULColorPickerTile: - accessible = new nsXULColorPickerTileAccessible(aContent, aDoc); + accessible = new XULColorPickerTileAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULCombobox: - accessible = new nsXULComboboxAccessible(aContent, aDoc); + accessible = new XULComboboxAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULDropmarker: accessible = new XULDropmarkerAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULGroupbox: accessible = new XULGroupboxAccessible(aContent, aDoc); @@ -1352,137 +1351,137 @@ nsAccessibilityService::CreateAccessible nsGkAtoms::tooltiptext)) return nsnull; accessible = new ImageAccessibleWrap(aContent, aDoc); break; } case nsIAccessibleProvider::XULLink: - accessible = new nsXULLinkAccessible(aContent, aDoc); + accessible = new XULLinkAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULListbox: - accessible = new nsXULListboxAccessibleWrap(aContent, aDoc); + accessible = new XULListboxAccessibleWrap(aContent, aDoc); break; case nsIAccessibleProvider::XULListCell: - accessible = new nsXULListCellAccessibleWrap(aContent, aDoc); + accessible = new XULListCellAccessibleWrap(aContent, aDoc); break; case nsIAccessibleProvider::XULListHead: - accessible = new nsXULColumAccessible(aContent, aDoc); + accessible = new XULColumAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULListHeader: - accessible = new nsXULColumnItemAccessible(aContent, aDoc); + accessible = new XULColumnItemAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULListitem: - accessible = new nsXULListitemAccessible(aContent, aDoc); + accessible = new XULListitemAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULMenubar: - accessible = new nsXULMenubarAccessible(aContent, aDoc); + accessible = new XULMenubarAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULMenuitem: - accessible = new nsXULMenuitemAccessibleWrap(aContent, aDoc); + accessible = new XULMenuitemAccessibleWrap(aContent, aDoc); break; case nsIAccessibleProvider::XULMenupopup: { #ifdef MOZ_ACCESSIBILITY_ATK // ATK considers this node to be redundant when within menubars, and it makes menu // navigation with assistive technologies more difficult // XXX In the future we will should this for consistency across the nsIAccessible // implementations on each platform for a consistent scripting environment, but // then strip out redundant accessibles in the AccessibleWrap class for each platform. nsIContent *parent = aContent->GetParent(); if (parent && parent->NodeInfo()->Equals(nsGkAtoms::menu, kNameSpaceID_XUL)) return nsnull; #endif - accessible = new nsXULMenupopupAccessible(aContent, aDoc); + accessible = new XULMenupopupAccessible(aContent, aDoc); break; } case nsIAccessibleProvider::XULMenuSeparator: - accessible = new nsXULMenuSeparatorAccessible(aContent, aDoc); + accessible = new XULMenuSeparatorAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULPane: accessible = new EnumRoleAccessible(aContent, aDoc, roles::PANE); break; case nsIAccessibleProvider::XULProgressMeter: accessible = new XULProgressMeterAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULStatusBar: accessible = new XULStatusBarAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULScale: - accessible = new nsXULSliderAccessible(aContent, aDoc); + accessible = new XULSliderAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULRadioButton: accessible = new XULRadioButtonAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULRadioGroup: accessible = new XULRadioGroupAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULTab: - accessible = new nsXULTabAccessible(aContent, aDoc); + accessible = new XULTabAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULTabs: - accessible = new nsXULTabsAccessible(aContent, aDoc); + accessible = new XULTabsAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULTabpanels: - accessible = new nsXULTabpanelsAccessible(aContent, aDoc); + accessible = new XULTabpanelsAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULText: - accessible = new nsXULTextAccessible(aContent, aDoc); + accessible = new XULLabelAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULTextBox: accessible = new XULTextFieldAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULThumb: - accessible = new nsXULThumbAccessible(aContent, aDoc); + accessible = new XULThumbAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULTree: return CreateAccessibleForXULTree(aContent, aDoc); case nsIAccessibleProvider::XULTreeColumns: - accessible = new nsXULTreeColumAccessible(aContent, aDoc); + accessible = new XULTreeColumAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULTreeColumnItem: - accessible = new nsXULColumnItemAccessible(aContent, aDoc); + accessible = new XULColumnItemAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULToolbar: accessible = new XULToolbarAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULToolbarSeparator: accessible = new XULToolbarSeparatorAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULTooltip: - accessible = new nsXULTooltipAccessible(aContent, aDoc); + accessible = new XULTooltipAccessible(aContent, aDoc); break; case nsIAccessibleProvider::XULToolbarButton: accessible = new XULToolbarButtonAccessible(aContent, aDoc); break; #endif // MOZ_XUL @@ -1655,18 +1654,17 @@ nsAccessibilityService::CreateHTMLAccess tag == nsGkAtoms::h6 || tag == nsGkAtoms::q) { Accessible* accessible = new HyperTextAccessibleWrap(aContent, aDoc); NS_IF_ADDREF(accessible); return accessible; } if (nsCoreUtils::IsHTMLTableHeader(aContent)) { - Accessible* accessible = new nsHTMLTableHeaderCellAccessibleWrap(aContent, - aDoc); + Accessible* accessible = new HTMLTableHeaderCellAccessibleWrap(aContent, aDoc); NS_IF_ADDREF(accessible); return accessible; } if (tag == nsGkAtoms::output) { Accessible* accessible = new HTMLOutputAccessible(aContent, aDoc); NS_IF_ADDREF(accessible); return accessible; @@ -1766,17 +1764,17 @@ nsAccessibilityService::CreateAccessible nsIFrame* parentFrame = aFrame->GetParent(); if (parentFrame && parentFrame->GetType() == nsGkAtoms::deckFrame) { // If deck frame is for xul:tabpanels element then the given node has // tabpanel accessible. nsCOMPtr<nsIContent> parentContent = parentFrame->GetContent(); #ifdef MOZ_XUL if (parentContent->NodeInfo()->Equals(nsGkAtoms::tabpanels, kNameSpaceID_XUL)) { - Accessible* accessible = new nsXULTabpanelAccessible(aContent, aDoc); + Accessible* accessible = new XULTabpanelAccessible(aContent, aDoc); NS_IF_ADDREF(accessible); return accessible; } #endif Accessible* accessible = new EnumRoleAccessible(aContent, aDoc, roles::PROPERTYPAGE); NS_IF_ADDREF(accessible); return accessible; @@ -1800,23 +1798,23 @@ nsAccessibilityService::CreateAccessible if (!treeColumns) return nsnull; PRInt32 count = 0; treeColumns->GetCount(&count); // Outline of list accessible. if (count == 1) { - Accessible* accessible = new nsXULTreeAccessible(aContent, aDoc); + Accessible* accessible = new XULTreeAccessible(aContent, aDoc); NS_IF_ADDREF(accessible); return accessible; } // Table or tree table accessible. - Accessible* accessible = new nsXULTreeGridAccessibleWrap(aContent, aDoc); + Accessible* accessible = new XULTreeGridAccessibleWrap(aContent, aDoc); NS_IF_ADDREF(accessible); return accessible; } #endif //////////////////////////////////////////////////////////////////////////////// // Services ////////////////////////////////////////////////////////////////////////////////
--- a/accessible/src/base/nsAccessibilityService.h +++ b/accessible/src/base/nsAccessibilityService.h @@ -165,17 +165,17 @@ public: */ static bool IsShutdown() { return gIsShutdown; } /** * Return an accessible for the given DOM node from the cache or create new * one. * * @param aNode [in] the given node - * @param aDoc [in] the doc accessible of the node + * @param aDoc [in] the doc accessible of the node * @param aIsSubtreeHidden [out, optional] indicates whether the node's * frame and its subtree is hidden */ Accessible* GetOrCreateAccessible(nsINode* aNode, DocAccessible* aDoc, bool* aIsSubtreeHidden = nsnull); private: // nsAccessibilityService creation is controlled by friend
--- a/accessible/src/generic/ARIAGridAccessible.cpp +++ b/accessible/src/generic/ARIAGridAccessible.cpp @@ -503,60 +503,44 @@ ARIAGridAccessible::GetSelectedRowIndice *aRows = static_cast<PRInt32*>( nsMemory::Clone(selRows.Elements(), selrowCount * sizeof(PRInt32))); NS_ENSURE_TRUE(*aRows, NS_ERROR_OUT_OF_MEMORY); *aRowCount = selrowCount; return NS_OK; } -NS_IMETHODIMP -ARIAGridAccessible::SelectRow(PRInt32 aRow) +void +ARIAGridAccessible::SelectRow(PRUint32 aRowIdx) { - NS_ENSURE_ARG(IsValidRow(aRow)); - - if (IsDefunct()) - return NS_ERROR_FAILURE; - AccIterator rowIter(this, filters::GetRow); Accessible* row = nsnull; for (PRInt32 rowIdx = 0; (row = rowIter.Next()); rowIdx++) { - nsresult rv = SetARIASelected(row, rowIdx == aRow); - NS_ENSURE_SUCCESS(rv, rv); + nsresult rv = SetARIASelected(row, rowIdx == aRowIdx); + NS_ASSERTION(NS_SUCCEEDED(rv), "SetARIASelected() Shouldn't fail!"); } - - return NS_OK; } -NS_IMETHODIMP -ARIAGridAccessible::SelectColumn(PRInt32 aColumn) +void +ARIAGridAccessible::SelectCol(PRUint32 aColIdx) { - NS_ENSURE_ARG(IsValidColumn(aColumn)); - - if (IsDefunct()) - return NS_ERROR_FAILURE; - AccIterator rowIter(this, filters::GetRow); Accessible* row = nsnull; while ((row = rowIter.Next())) { // Unselect all cells in the row. nsresult rv = SetARIASelected(row, false); - NS_ENSURE_SUCCESS(rv, rv); + NS_ASSERTION(NS_SUCCEEDED(rv), "SetARIASelected() Shouldn't fail!"); // Select cell at the column index. - Accessible* cell = GetCellInRowAt(row, aColumn); - if (cell) { - rv = SetARIASelected(cell, true); - NS_ENSURE_SUCCESS(rv, rv); - } + Accessible* cell = GetCellInRowAt(row, aColIdx); + if (cell) + SetARIASelected(cell, true); } - - return NS_OK; } void ARIAGridAccessible::UnselectRow(PRUint32 aRowIdx) { Accessible* row = GetRowAt(aRowIdx); if (row)
--- a/accessible/src/generic/ARIAGridAccessible.h +++ b/accessible/src/generic/ARIAGridAccessible.h @@ -37,16 +37,18 @@ public: // nsAccessNode virtual void Shutdown(); // TableAccessible virtual PRUint32 ColCount(); virtual PRUint32 RowCount(); virtual Accessible* CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex); + virtual void SelectCol(PRUint32 aColIdx); + virtual void SelectRow(PRUint32 aRowIdx); virtual void UnselectCol(PRUint32 aColIdx); virtual void UnselectRow(PRUint32 aRowIdx); protected: /** * Return true if the given row index is valid. */ bool IsValidRow(PRInt32 aRow);
--- a/accessible/src/generic/Accessible.cpp +++ b/accessible/src/generic/Accessible.cpp @@ -340,17 +340,17 @@ Accessible::Description(nsString& aDescr aDescription.Truncate(); } } } aDescription.CompressWhitespace(); } NS_IMETHODIMP -Accessible::GetKeyboardShortcut(nsAString& aAccessKey) +Accessible::GetAccessKey(nsAString& aAccessKey) { aAccessKey.Truncate(); if (IsDefunct()) return NS_ERROR_FAILURE; AccessKey().ToString(aAccessKey); return NS_OK; @@ -876,99 +876,25 @@ Accessible::GetDeepestChildAtPoint(PRInt NS_IF_ADDREF(*aAccessible = ChildAtPoint(aX, aY, eDeepestChild)); return NS_OK; } void Accessible::GetBoundsRect(nsRect& aTotalBounds, nsIFrame** aBoundingFrame) { -/* - * This method is used to determine the bounds of a content node. - * Because HTML wraps and links are not always rectangular, this - * method uses the following algorithm: - * - * 1) Start with an empty rectangle - * 2) Add the rect for the primary frame from for the DOM node. - * 3) For each next frame at the same depth with the same DOM node, add that rect to total - * 4) If that frame is an inline frame, search deeper at that point in the tree, adding all rects - */ - - // Initialization area - *aBoundingFrame = nsnull; - nsIFrame* firstFrame = GetFrame(); - if (!firstFrame) - return; - - // Find common relative parent - // This is an ancestor frame that will incompass all frames for this content node. - // We need the relative parent so we can get absolute screen coordinates - nsIFrame *ancestorFrame = firstFrame; - - while (ancestorFrame) { - *aBoundingFrame = ancestorFrame; - // If any other frame type, we only need to deal with the primary frame - // Otherwise, there may be more frames attached to the same content node - if (ancestorFrame->GetType() != nsGkAtoms::inlineFrame && - ancestorFrame->GetType() != nsGkAtoms::textFrame) - break; - ancestorFrame = ancestorFrame->GetParent(); - } - - nsIFrame *iterFrame = firstFrame; - nsCOMPtr<nsIContent> firstContent(mContent); - nsIContent* iterContent = firstContent; - PRInt32 depth = 0; - - // Look only at frames below this depth, or at this depth (if we're still on the content node we started with) - while (iterContent == firstContent || depth > 0) { - // Coordinates will come back relative to parent frame - nsRect currFrameBounds = iterFrame->GetRect(); - - // Make this frame's bounds relative to common parent frame - currFrameBounds += - iterFrame->GetParent()->GetOffsetToExternal(*aBoundingFrame); - - // Add this frame's bounds to total - aTotalBounds.UnionRect(aTotalBounds, currFrameBounds); - - nsIFrame *iterNextFrame = nsnull; - - if (iterFrame->GetType() == nsGkAtoms::inlineFrame) { - // Only do deeper bounds search if we're on an inline frame - // Inline frames can contain larger frames inside of them - iterNextFrame = iterFrame->GetFirstPrincipalChild(); - } - - if (iterNextFrame) - ++depth; // Child was found in code above this: We are going deeper in this iteration of the loop - else { - // Use next sibling if it exists, or go back up the tree to get the first next-in-flow or next-sibling - // within our search - while (iterFrame) { - iterNextFrame = iterFrame->GetNextContinuation(); - if (!iterNextFrame) - iterNextFrame = iterFrame->GetNextSibling(); - if (iterNextFrame || --depth < 0) - break; - iterFrame = iterFrame->GetParent(); - } - } - - // Get ready for the next round of our loop - iterFrame = iterNextFrame; - if (iterFrame == nsnull) - break; - iterContent = nsnull; - if (depth == 0) - iterContent = iterFrame->GetContent(); + nsIFrame* frame = GetFrame(); + if (frame) { + *aBoundingFrame = nsLayoutUtils::GetContainingBlockForClientRect(frame); + aTotalBounds = nsLayoutUtils:: + GetAllInFlowRectsUnion(frame, *aBoundingFrame, + nsLayoutUtils::RECTS_ACCOUNT_FOR_TRANSFORMS); } } - /* void getBounds (out long x, out long y, out long width, out long height); */ NS_IMETHODIMP Accessible::GetBounds(PRInt32* aX, PRInt32* aY, PRInt32* aWidth, PRInt32* aHeight) { NS_ENSURE_ARG_POINTER(aX); *aX = 0; NS_ENSURE_ARG_POINTER(aY); @@ -1748,47 +1674,26 @@ Accessible::SetCurrentValue(double aValu /* void setName (in DOMString name); */ NS_IMETHODIMP Accessible::SetName(const nsAString& aName) { return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP -Accessible::GetDefaultKeyBinding(nsAString& aKeyBinding) +Accessible::GetKeyboardShortcut(nsAString& aKeyBinding) { aKeyBinding.Truncate(); if (IsDefunct()) return NS_ERROR_FAILURE; KeyboardShortcut().ToString(aKeyBinding); return NS_OK; } -NS_IMETHODIMP -Accessible::GetKeyBindings(PRUint8 aActionIndex, - nsIDOMDOMStringList** aKeyBindings) -{ - // Currently we support only unique key binding on element for default action. - NS_ENSURE_TRUE(aActionIndex == 0, NS_ERROR_INVALID_ARG); - - nsAccessibleDOMStringList* keyBindings = new nsAccessibleDOMStringList(); - NS_ENSURE_TRUE(keyBindings, NS_ERROR_OUT_OF_MEMORY); - - nsAutoString defaultKey; - nsresult rv = GetDefaultKeyBinding(defaultKey); - NS_ENSURE_SUCCESS(rv, rv); - - if (!defaultKey.IsEmpty()) - keyBindings->Add(defaultKey); - - NS_ADDREF(*aKeyBindings = keyBindings); - return NS_OK; -} - role Accessible::ARIATransformRole(role aRole) { // XXX: these unfortunate exceptions don't fit into the ARIA table. This is // where the accessible role depends on both the role and ARIA state. if (aRole == roles::PUSHBUTTON) { if (nsAccUtils::HasDefinedARIAToken(mContent, nsGkAtoms::aria_pressed)) { // For simplicity, any existing pressed attribute except "" or "undefined"
--- a/accessible/src/generic/Accessible.h +++ b/accessible/src/generic/Accessible.h @@ -23,26 +23,27 @@ class AccEvent; class AccGroupInfo; class EmbeddedObjCollector; class KeyBinding; class Accessible; class HyperTextAccessible; struct nsRoleMapEntry; -class Relation; namespace mozilla { namespace a11y { class HTMLImageMapAccessible; class HTMLLIAccessible; class ImageAccessible; +class Relation; class TableAccessible; class TextLeafAccessible; +class XULTreeAccessible; /** * Name type flags. */ enum ENameValueFlag { /** * Name either * a) present (not empty): !name.IsEmpty() @@ -63,18 +64,16 @@ struct GroupPos PRInt32 level; PRInt32 posInSet; PRInt32 setSize; }; } // namespace a11y } // namespace mozilla -class nsXULTreeAccessible; - struct nsRect; class nsIContent; class nsIFrame; class nsIAtom; class nsIView; typedef nsRefPtrHashtable<nsPtrHashKey<const void>, Accessible> AccessibleHashtable; @@ -95,18 +94,18 @@ NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODUL #define NS_ACCESSIBLE_IMPL_IID \ { /* 133c8bf4-4913-4355-bd50-426bd1d6e1ad */ \ 0x133c8bf4, \ 0x4913, \ 0x4355, \ { 0xbd, 0x50, 0x42, 0x6b, 0xd1, 0xd6, 0xe1, 0xad } \ } -class Accessible : public nsAccessNodeWrap, - public nsIAccessible, +class Accessible : public nsAccessNodeWrap, + public nsIAccessible, public nsIAccessibleHyperLink, public nsIAccessibleSelectable, public nsIAccessibleValue { public: Accessible(nsIContent* aContent, DocAccessible* aDoc); virtual ~Accessible(); @@ -302,26 +301,26 @@ public: * @param aSetSize [out] the group size */ virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet, PRInt32 *aSetSize); /** * Get the relation of the given type. */ - virtual Relation RelationByType(PRUint32 aType); + virtual mozilla::a11y::Relation RelationByType(PRUint32 aType); ////////////////////////////////////////////////////////////////////////////// // Initializing methods /** * Set the ARIA role map entry for a new accessible. * For a newly created accessible, specify which role map entry should be used. * - * @param aRoleMapEntry The ARIA nsRoleMapEntry* for the accessible, or + * @param aRoleMapEntry The ARIA nsRoleMapEntry* for the accessible, or * nsnull if none. */ virtual void SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry); /** * Update the children cache. */ inline bool UpdateChildren() @@ -502,17 +501,17 @@ public: inline bool IsImage() const { return mFlags & eImageAccessible; } mozilla::a11y::ImageAccessible* AsImage(); bool IsImageMapAccessible() const { return mFlags & eImageMapAccessible; } mozilla::a11y::HTMLImageMapAccessible* AsImageMap(); inline bool IsXULTree() const { return mFlags & eXULTreeAccessible; } - nsXULTreeAccessible* AsXULTree(); + mozilla::a11y::XULTreeAccessible* AsXULTree(); inline bool IsListControl() const { return mFlags & eListControlAccessible; } inline bool IsMenuButton() const { return mFlags & eMenuButtonAccessible; } inline bool IsMenuPopup() const { return mFlags & eMenuPopupAccessible; } inline bool IsRoot() const { return mFlags & eRootAccessible; }
--- a/accessible/src/generic/DocAccessible.cpp +++ b/accessible/src/generic/DocAccessible.cpp @@ -2001,16 +2001,25 @@ DocAccessible::CacheChildrenInSubtree(Ac PRUint32 count = aRoot->ContentChildCount(); for (PRUint32 idx = 0; idx < count; idx++) { Accessible* child = aRoot->ContentChildAt(idx); NS_ASSERTION(child, "Illicit tree change while tree is created!"); // Don't cross document boundaries. if (child && child->IsContent()) CacheChildrenInSubtree(child); } + + // Fire document load complete on ARIA documents. + // XXX: we should delay an event if the ARIA document has aria-busy. + if (aRoot->HasARIARole() && !aRoot->IsDoc()) { + a11y::role role = aRoot->ARIARole(); + if (role == roles::DIALOG || role == roles::DOCUMENT) + FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE, + aRoot->GetContent()); + } } void DocAccessible::UncacheChildrenInSubtree(Accessible* aRoot) { if (aRoot->IsElement()) RemoveDependentIDsFor(aRoot);
--- a/accessible/src/generic/HyperTextAccessible.cpp +++ b/accessible/src/generic/HyperTextAccessible.cpp @@ -26,17 +26,17 @@ #include "nsFrameSelection.h" #include "nsILineIterator.h" #include "nsIInterfaceRequestorUtils.h" #include "nsIPlaintextEditor.h" #include "nsIScrollableFrame.h" #include "nsISelectionPrivate.h" #include "nsIServiceManager.h" #include "nsTextFragment.h" -#include "nsTypedSelection.h" +#include "mozilla/Selection.h" #include "gfxSkipChars.h" using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// // HyperTextAccessible //////////////////////////////////////////////////////////////////////////////// @@ -1219,16 +1219,19 @@ HyperTextAccessible::GetAttributesIntern nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::xmlroles, NS_LITERAL_STRING("region")); else if (mContent->Tag() == nsGkAtoms::footer) nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::xmlroles, NS_LITERAL_STRING("contentinfo")); else if (mContent->Tag() == nsGkAtoms::aside) nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::xmlroles, NS_LITERAL_STRING("complementary")); + else if (mContent->Tag() == nsGkAtoms::article) + nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::xmlroles, + NS_LITERAL_STRING("article")); return NS_OK; } /* * Given an offset, the x, y, width, and height values are filled appropriately. */ NS_IMETHODIMP
--- a/accessible/src/generic/RootAccessible.cpp +++ b/accessible/src/generic/RootAccessible.cpp @@ -13,16 +13,19 @@ #include "Accessible-inl.h" #include "DocAccessible-inl.h" #include "nsAccessibilityService.h" #include "nsAccUtils.h" #include "nsCoreUtils.h" #include "Relation.h" #include "Role.h" #include "States.h" +#ifdef MOZ_XUL +#include "XULTreeAccessible.h" +#endif #include "mozilla/dom/Element.h" #include "nsIAccessibleRelation.h" #include "nsIDocShell.h" #include "nsIDocShellTreeItem.h" #include "nsIDocShellTreeNode.h" #include "nsIDocShellTreeOwner.h" @@ -42,21 +45,19 @@ #include "nsIFrame.h" #include "nsIHTMLDocument.h" #include "nsIInterfaceRequestorUtils.h" #include "nsISelectionPrivate.h" #include "nsIServiceManager.h" #include "nsPIDOMWindow.h" #include "nsIWebBrowserChrome.h" #include "nsReadableUtils.h" -#include "nsIPrivateDOMEvent.h" #include "nsFocusManager.h" #ifdef MOZ_XUL -#include "nsXULTreeAccessible.h" #include "nsIXULDocument.h" #include "nsIXULWindow.h" #endif using namespace mozilla; using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// @@ -319,17 +320,17 @@ RootAccessible::ProcessDOMEvent(nsIDOMEv Accessible* accessible = targetDocument->GetAccessibleOrContainer(origTargetNode); if (!accessible) return; nsINode* targetNode = accessible->GetNode(); #ifdef MOZ_XUL - nsXULTreeAccessible* treeAcc = accessible->AsXULTree(); + XULTreeAccessible* treeAcc = accessible->AsXULTree(); if (treeAcc) { if (eventType.EqualsLiteral("TreeRowCountChanged")) { HandleTreeRowCountChangedEvent(aDOMEvent, treeAcc); return; } if (eventType.EqualsLiteral("TreeInvalidated")) { HandleTreeInvalidatedEvent(aDOMEvent, treeAcc); @@ -338,17 +339,17 @@ RootAccessible::ProcessDOMEvent(nsIDOMEv } #endif if (eventType.EqualsLiteral("RadioStateChange")) { PRUint64 state = accessible->State(); // radiogroup in prefWindow is exposed as a list, // and panebutton is exposed as XULListitem in A11y. - // nsXULListitemAccessible::GetStateInternal uses STATE_SELECTED in this case, + // XULListitemAccessible::GetStateInternal uses STATE_SELECTED in this case, // so we need to check states::SELECTED also. bool isEnabled = (state & (states::CHECKED | states::SELECTED)) != 0; nsRefPtr<AccEvent> accEvent = new AccStateChangeEvent(accessible, states::CHECKED, isEnabled); nsEventShell::FireEvent(accEvent); if (isEnabled) { @@ -398,17 +399,17 @@ RootAccessible::ProcessDOMEvent(nsIDOMEv nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSel = do_QueryInterface(targetNode); nsAutoString selType; multiSel->GetSelType(selType); if (selType.IsEmpty() || !selType.EqualsLiteral("single")) { // XXX: We need to fire EVENT_SELECTION_ADD and EVENT_SELECTION_REMOVE // for each tree item. Perhaps each tree item will need to cache its // selection state and fire an event after a DOM "select" event when - // that state changes. nsXULTreeAccessible::UpdateTreeSelection(); + // that state changes. XULTreeAccessible::UpdateTreeSelection(); nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN, accessible); return; } nsRefPtr<AccSelChangeEvent> selChangeEvent = new AccSelChangeEvent(treeAcc, treeItemAcc, AccSelChangeEvent::eSelectionAdd); @@ -667,17 +668,17 @@ RootAccessible::HandlePopupHidingEvent(n new AccStateChangeEvent(widget, states::EXPANDED, false); document->FireDelayedAccessibleEvent(event); } } #ifdef MOZ_XUL void RootAccessible::HandleTreeRowCountChangedEvent(nsIDOMEvent* aEvent, - nsXULTreeAccessible* aAccessible) + XULTreeAccessible* aAccessible) { nsCOMPtr<nsIDOMDataContainerEvent> dataEvent(do_QueryInterface(aEvent)); if (!dataEvent) return; nsCOMPtr<nsIVariant> indexVariant; dataEvent->GetData(NS_LITERAL_STRING("index"), getter_AddRefs(indexVariant)); @@ -694,17 +695,17 @@ RootAccessible::HandleTreeRowCountChange indexVariant->GetAsInt32(&index); countVariant->GetAsInt32(&count); aAccessible->InvalidateCache(index, count); } void RootAccessible::HandleTreeInvalidatedEvent(nsIDOMEvent* aEvent, - nsXULTreeAccessible* aAccessible) + XULTreeAccessible* aAccessible) { nsCOMPtr<nsIDOMDataContainerEvent> dataEvent(do_QueryInterface(aEvent)); if (!dataEvent) return; PRInt32 startRow = 0, endRow = -1, startCol = 0, endCol = -1; nsCOMPtr<nsIVariant> startRowVariant;
--- a/accessible/src/generic/RootAccessible.h +++ b/accessible/src/generic/RootAccessible.h @@ -10,19 +10,16 @@ #include "DocAccessibleWrap.h" #include "nsHashtable.h" #include "nsCaretAccessible.h" #include "nsIDocument.h" #include "nsIDOMEventListener.h" -class nsXULTreeAccessible; -class Relation; - namespace mozilla { namespace a11y { class RootAccessible : public DocAccessibleWrap, public nsIDOMEventListener { NS_DECL_ISUPPORTS_INHERITED @@ -71,19 +68,19 @@ protected: /* * Process "popuphiding" event. Used by HandleEvent(). */ void HandlePopupHidingEvent(nsINode* aNode); #ifdef MOZ_XUL void HandleTreeRowCountChangedEvent(nsIDOMEvent* aEvent, - nsXULTreeAccessible* aAccessible); + XULTreeAccessible* aAccessible); void HandleTreeInvalidatedEvent(nsIDOMEvent* aEvent, - nsXULTreeAccessible* aAccessible); + XULTreeAccessible* aAccessible); PRUint32 GetChromeFlags(); #endif nsRefPtr<nsCaretAccessible> mCaretAccessible; }; } // namespace a11y
--- a/accessible/src/generic/TextLeafAccessible.cpp +++ b/accessible/src/generic/TextLeafAccessible.cpp @@ -46,25 +46,13 @@ TextLeafAccessible::AppendTextTo(nsAStri ENameValueFlag TextLeafAccessible::Name(nsString& aName) { // Text node, ARIA can't be used. aName = mText; return eNameOK; } -nsresult -TextLeafAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes) -{ - if (NativeRole() == roles::STATICTEXT) { - nsAutoString oldValueUnused; - aAttributes->SetStringProperty(NS_LITERAL_CSTRING("auto-generated"), - NS_LITERAL_STRING("true"), oldValueUnused); - } - - return NS_OK; -} - void TextLeafAccessible::CacheChildren() { // No children for text accessible. }
--- a/accessible/src/generic/TextLeafAccessible.h +++ b/accessible/src/generic/TextLeafAccessible.h @@ -20,17 +20,16 @@ public: TextLeafAccessible(nsIContent* aContent, DocAccessible* aDoc); virtual ~TextLeafAccessible(); // Accessible virtual mozilla::a11y::role NativeRole(); virtual void AppendTextTo(nsAString& aText, PRUint32 aStartOffset = 0, PRUint32 aLength = PR_UINT32_MAX); virtual ENameValueFlag Name(nsString& aName); - virtual nsresult GetAttributesInternal(nsIPersistentProperties* aAttributes); // TextLeafAccessible void SetText(const nsAString& aText) { mText = aText; } const nsString& Text() const { return mText; } protected: // Accessible virtual void CacheChildren();
rename from accessible/src/html/nsHTMLTableAccessible.cpp rename to accessible/src/html/HTMLTableAccessible.cpp --- a/accessible/src/html/nsHTMLTableAccessible.cpp +++ b/accessible/src/html/HTMLTableAccessible.cpp @@ -1,14 +1,14 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "nsHTMLTableAccessible.h" +#include "HTMLTableAccessible.h" #include "Accessible-inl.h" #include "nsAccessibilityService.h" #include "nsAccTreeWalker.h" #include "nsAccUtils.h" #include "DocAccessible.h" #include "nsTextEquivUtils.h" #include "Relation.h" @@ -34,63 +34,63 @@ #include "nsFrameSelection.h" #include "nsLayoutErrors.h" #include "nsArrayUtils.h" #include "nsComponentManagerUtils.h" using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// -// nsHTMLTableCellAccessible +// HTMLTableCellAccessible //////////////////////////////////////////////////////////////////////////////// -nsHTMLTableCellAccessible:: - nsHTMLTableCellAccessible(nsIContent* aContent, DocAccessible* aDoc) : +HTMLTableCellAccessible:: + HTMLTableCellAccessible(nsIContent* aContent, DocAccessible* aDoc) : HyperTextAccessibleWrap(aContent, aDoc) { } //////////////////////////////////////////////////////////////////////////////// -// nsHTMLTableCellAccessible: nsISupports implementation +// HTMLTableCellAccessible: nsISupports implementation -NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLTableCellAccessible, +NS_IMPL_ISUPPORTS_INHERITED1(HTMLTableCellAccessible, HyperTextAccessible, nsIAccessibleTableCell) //////////////////////////////////////////////////////////////////////////////// -// nsHTMLTableCellAccessible: Accessible implementation +// HTMLTableCellAccessible: Accessible implementation role -nsHTMLTableCellAccessible::NativeRole() +HTMLTableCellAccessible::NativeRole() { return roles::CELL; } PRUint64 -nsHTMLTableCellAccessible::NativeState() +HTMLTableCellAccessible::NativeState() { PRUint64 state = HyperTextAccessibleWrap::NativeState(); nsIFrame *frame = mContent->GetPrimaryFrame(); NS_ASSERTION(frame, "No frame for valid cell accessible!"); if (frame && frame->IsSelected()) state |= states::SELECTED; return state; } PRUint64 -nsHTMLTableCellAccessible::NativeInteractiveState() const +HTMLTableCellAccessible::NativeInteractiveState() const { return HyperTextAccessibleWrap::NativeInteractiveState() | states::SELECTABLE; } nsresult -nsHTMLTableCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes) +HTMLTableCellAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes) { if (IsDefunct()) return NS_ERROR_FAILURE; nsresult rv = HyperTextAccessibleWrap::GetAttributesInternal(aAttributes); NS_ENSURE_SUCCESS(rv, rv); // table-cell-index attribute @@ -134,119 +134,119 @@ nsHTMLTableCellAccessible::GetAttributes mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::axis, axisText); if (!axisText.IsEmpty()) nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::axis, axisText); return NS_OK; } //////////////////////////////////////////////////////////////////////////////// -// nsHTMLTableCellAccessible: nsIAccessibleTableCell implementation +// HTMLTableCellAccessible: nsIAccessibleTableCell implementation NS_IMETHODIMP -nsHTMLTableCellAccessible::GetTable(nsIAccessibleTable **aTable) +HTMLTableCellAccessible::GetTable(nsIAccessibleTable** aTable) { NS_ENSURE_ARG_POINTER(aTable); *aTable = nsnull; if (IsDefunct()) return NS_OK; nsCOMPtr<nsIAccessibleTable> table = GetTableAccessible(); table.swap(*aTable); return NS_OK; } NS_IMETHODIMP -nsHTMLTableCellAccessible::GetColumnIndex(PRInt32 *aColumnIndex) +HTMLTableCellAccessible::GetColumnIndex(PRInt32* aColumnIndex) { NS_ENSURE_ARG_POINTER(aColumnIndex); *aColumnIndex = -1; if (IsDefunct()) return NS_ERROR_FAILURE; nsITableCellLayout* cellLayout = GetCellLayout(); NS_ENSURE_STATE(cellLayout); return cellLayout->GetColIndex(*aColumnIndex); } NS_IMETHODIMP -nsHTMLTableCellAccessible::GetRowIndex(PRInt32 *aRowIndex) +HTMLTableCellAccessible::GetRowIndex(PRInt32* aRowIndex) { NS_ENSURE_ARG_POINTER(aRowIndex); *aRowIndex = -1; if (IsDefunct()) return NS_ERROR_FAILURE; nsITableCellLayout* cellLayout = GetCellLayout(); NS_ENSURE_STATE(cellLayout); return cellLayout->GetRowIndex(*aRowIndex); } NS_IMETHODIMP -nsHTMLTableCellAccessible::GetColumnExtent(PRInt32 *aExtentCount) +HTMLTableCellAccessible::GetColumnExtent(PRInt32* aExtentCount) { NS_ENSURE_ARG_POINTER(aExtentCount); *aExtentCount = 1; PRInt32 rowIdx = -1, colIdx = -1; GetCellIndexes(rowIdx, colIdx); nsCOMPtr<nsIAccessibleTable> table = GetTableAccessible(); NS_ENSURE_STATE(table); return table->GetColumnExtentAt(rowIdx, colIdx, aExtentCount); } NS_IMETHODIMP -nsHTMLTableCellAccessible::GetRowExtent(PRInt32 *aExtentCount) +HTMLTableCellAccessible::GetRowExtent(PRInt32* aExtentCount) { NS_ENSURE_ARG_POINTER(aExtentCount); *aExtentCount = 1; PRInt32 rowIdx = -1, colIdx = -1; GetCellIndexes(rowIdx, colIdx); nsCOMPtr<nsIAccessibleTable> table = GetTableAccessible(); NS_ENSURE_STATE(table); return table->GetRowExtentAt(rowIdx, colIdx, aExtentCount); } NS_IMETHODIMP -nsHTMLTableCellAccessible::GetColumnHeaderCells(nsIArray **aHeaderCells) +HTMLTableCellAccessible::GetColumnHeaderCells(nsIArray** aHeaderCells) { NS_ENSURE_ARG_POINTER(aHeaderCells); *aHeaderCells = nsnull; if (IsDefunct()) return NS_ERROR_FAILURE; return GetHeaderCells(nsAccUtils::eColumnHeaderCells, aHeaderCells); } NS_IMETHODIMP -nsHTMLTableCellAccessible::GetRowHeaderCells(nsIArray **aHeaderCells) +HTMLTableCellAccessible::GetRowHeaderCells(nsIArray** aHeaderCells) { NS_ENSURE_ARG_POINTER(aHeaderCells); *aHeaderCells = nsnull; if (IsDefunct()) return NS_ERROR_FAILURE; return GetHeaderCells(nsAccUtils::eRowHeaderCells, aHeaderCells); } NS_IMETHODIMP -nsHTMLTableCellAccessible::IsSelected(bool *aIsSelected) +HTMLTableCellAccessible::IsSelected(bool* aIsSelected) { NS_ENSURE_ARG_POINTER(aIsSelected); *aIsSelected = false; if (IsDefunct()) return NS_ERROR_FAILURE; PRInt32 rowIdx = -1, colIdx = -1; @@ -254,59 +254,58 @@ nsHTMLTableCellAccessible::IsSelected(bo nsCOMPtr<nsIAccessibleTable> table = GetTableAccessible(); NS_ENSURE_STATE(table); return table->IsCellSelected(rowIdx, colIdx, aIsSelected); } //////////////////////////////////////////////////////////////////////////////// -// nsHTMLTableCellAccessible: protected implementation +// HTMLTableCellAccessible: protected implementation already_AddRefed<nsIAccessibleTable> -nsHTMLTableCellAccessible::GetTableAccessible() +HTMLTableCellAccessible::GetTableAccessible() { Accessible* parent = this; while ((parent = parent->Parent())) { roles::Role role = parent->Role(); if (role == roles::TABLE || role == roles::TREE_TABLE) { nsIAccessibleTable* tableAcc = nsnull; CallQueryInterface(parent, &tableAcc); return tableAcc; } } return nsnull; } nsITableCellLayout* -nsHTMLTableCellAccessible::GetCellLayout() +HTMLTableCellAccessible::GetCellLayout() { nsIFrame *frame = mContent->GetPrimaryFrame(); NS_ASSERTION(frame, "The frame cannot be obtaied for HTML table cell."); if (!frame) return nsnull; nsITableCellLayout *cellLayout = do_QueryFrame(frame); return cellLayout; } nsresult -nsHTMLTableCellAccessible::GetCellIndexes(PRInt32& aRowIndex, - PRInt32& aColIndex) +HTMLTableCellAccessible::GetCellIndexes(PRInt32& aRowIndex, PRInt32& aColIndex) { nsITableCellLayout *cellLayout = GetCellLayout(); NS_ENSURE_STATE(cellLayout); return cellLayout->GetCellIndexes(aRowIndex, aColIndex); } nsresult -nsHTMLTableCellAccessible::GetHeaderCells(PRInt32 aRowOrColumnHeaderCell, - nsIArray **aHeaderCells) +HTMLTableCellAccessible::GetHeaderCells(PRInt32 aRowOrColumnHeaderCell, + nsIArray** aHeaderCells) { // Get header cells from @header attribute. IDRefsIterator iter(mDoc, mContent, nsGkAtoms::headers); nsIContent* headerCellElm = iter.NextElem(); if (headerCellElm) { nsresult rv = NS_OK; nsCOMPtr<nsIMutableArray> headerCells = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv); @@ -336,31 +335,30 @@ nsHTMLTableCellAccessible::GetHeaderCell return nsAccUtils::GetHeaderCellsFor(table, this, aRowOrColumnHeaderCell, aHeaderCells); } return NS_OK; } //////////////////////////////////////////////////////////////////////////////// -// nsHTMLTableHeaderAccessible +// HTMLTableHeaderCellAccessible //////////////////////////////////////////////////////////////////////////////// -nsHTMLTableHeaderCellAccessible:: - nsHTMLTableHeaderCellAccessible(nsIContent* aContent, - DocAccessible* aDoc) : - nsHTMLTableCellAccessible(aContent, aDoc) +HTMLTableHeaderCellAccessible:: + HTMLTableHeaderCellAccessible(nsIContent* aContent, DocAccessible* aDoc) : + HTMLTableCellAccessible(aContent, aDoc) { } //////////////////////////////////////////////////////////////////////////////// -// nsHTMLTableHeaderAccessible: Accessible implementation +// HTMLTableHeaderCellAccessible: Accessible implementation role -nsHTMLTableHeaderCellAccessible::NativeRole() +HTMLTableHeaderCellAccessible::NativeRole() { // Check value of @scope attribute. static nsIContent::AttrValuesArray scopeValues[] = {&nsGkAtoms::col, &nsGkAtoms::row, nsnull}; PRInt32 valueIdx = mContent->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::scope, scopeValues, eCaseMatters); @@ -396,47 +394,47 @@ nsHTMLTableHeaderCellAccessible::NativeR } // No elements in siblings what means the table has one column only. Therefore // it should be column header. return roles::COLUMNHEADER; } //////////////////////////////////////////////////////////////////////////////// -// nsHTMLTableAccessible +// HTMLTableAccessible //////////////////////////////////////////////////////////////////////////////// -nsHTMLTableAccessible:: - nsHTMLTableAccessible(nsIContent* aContent, DocAccessible* aDoc) : +HTMLTableAccessible:: + HTMLTableAccessible(nsIContent* aContent, DocAccessible* aDoc) : AccessibleWrap(aContent, aDoc), xpcAccessibleTable(this) { } //////////////////////////////////////////////////////////////////////////////// -// nsHTMLTableAccessible: nsISupports implementation +// HTMLTableAccessible: nsISupports implementation -NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLTableAccessible, Accessible, +NS_IMPL_ISUPPORTS_INHERITED1(HTMLTableAccessible, Accessible, nsIAccessibleTable) //////////////////////////////////////////////////////////////////////////////// //nsAccessNode void -nsHTMLTableAccessible::Shutdown() +HTMLTableAccessible::Shutdown() { mTable = nsnull; AccessibleWrap::Shutdown(); } //////////////////////////////////////////////////////////////////////////////// -// nsHTMLTableAccessible: Accessible implementation +// HTMLTableAccessible: Accessible implementation void -nsHTMLTableAccessible::CacheChildren() +HTMLTableAccessible::CacheChildren() { // Move caption accessible so that it's the first child. Check for the first // caption only, because nsAccessibilityService ensures we don't create // accessibles for the other captions, since only the first is actually // visible. nsAccTreeWalker walker(mDoc, mContent, CanHaveAnonChildren()); Accessible* child = nsnull; @@ -446,29 +444,29 @@ nsHTMLTableAccessible::CacheChildren() while ((child = walker.NextChild()) && AppendChild(child)); break; } AppendChild(child); } } role -nsHTMLTableAccessible::NativeRole() +HTMLTableAccessible::NativeRole() { return roles::TABLE; } PRUint64 -nsHTMLTableAccessible::NativeState() +HTMLTableAccessible::NativeState() { return Accessible::NativeState() | states::READONLY; } nsresult -nsHTMLTableAccessible::GetNameInternal(nsAString& aName) +HTMLTableAccessible::GetNameInternal(nsAString& aName) { Accessible::GetNameInternal(aName); if (!aName.IsEmpty()) return NS_OK; // Use table caption as a name. Accessible* caption = Caption(); if (caption) { @@ -481,88 +479,88 @@ nsHTMLTableAccessible::GetNameInternal(n } // If no caption then use summary as a name. mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::summary, aName); return NS_OK; } nsresult -nsHTMLTableAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes) +HTMLTableAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes) { nsresult rv = AccessibleWrap::GetAttributesInternal(aAttributes); NS_ENSURE_SUCCESS(rv, rv); if (IsProbablyLayoutTable()) { nsAutoString oldValueUnused; aAttributes->SetStringProperty(NS_LITERAL_CSTRING("layout-guess"), NS_LITERAL_STRING("true"), oldValueUnused); } return NS_OK; } //////////////////////////////////////////////////////////////////////////////// -// nsHTMLTableAccessible: nsIAccessible implementation +// HTMLTableAccessible: nsIAccessible implementation Relation -nsHTMLTableAccessible::RelationByType(PRUint32 aType) +HTMLTableAccessible::RelationByType(PRUint32 aType) { Relation rel = AccessibleWrap::RelationByType(aType); if (aType == nsIAccessibleRelation::RELATION_LABELLED_BY) rel.AppendTarget(Caption()); return rel; } //////////////////////////////////////////////////////////////////////////////// -// nsHTMLTableAccessible: nsIAccessibleTable implementation +// HTMLTableAccessible: nsIAccessibleTable implementation Accessible* -nsHTMLTableAccessible::Caption() +HTMLTableAccessible::Caption() { Accessible* child = mChildren.SafeElementAt(0, nsnull); return child && child->Role() == roles::CAPTION ? child : nsnull; } void -nsHTMLTableAccessible::Summary(nsString& aSummary) +HTMLTableAccessible::Summary(nsString& aSummary) { nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mContent)); if (table) table->GetSummary(aSummary); } PRUint32 -nsHTMLTableAccessible::ColCount() +HTMLTableAccessible::ColCount() { nsITableLayout* tableLayout = GetTableLayout(); if (!tableLayout) return 0; PRInt32 rowCount = 0, colCount = 0; tableLayout->GetTableSize(rowCount, colCount); return colCount; } PRUint32 -nsHTMLTableAccessible::RowCount() +HTMLTableAccessible::RowCount() { nsITableLayout* tableLayout = GetTableLayout(); if (!tableLayout) return 0; PRInt32 rowCount = 0, colCount = 0; tableLayout->GetTableSize(rowCount, colCount); return rowCount; } NS_IMETHODIMP -nsHTMLTableAccessible::GetSelectedCellCount(PRUint32* aCount) +HTMLTableAccessible::GetSelectedCellCount(PRUint32* aCount) { NS_ENSURE_ARG_POINTER(aCount); *aCount = 0; PRInt32 rowCount = 0; nsresult rv = GetRowCount(&rowCount); NS_ENSURE_SUCCESS(rv, rv); @@ -595,17 +593,17 @@ nsHTMLTableAccessible::GetSelectedCellCo } } } return NS_OK; } NS_IMETHODIMP -nsHTMLTableAccessible::GetSelectedColumnCount(PRUint32* aCount) +HTMLTableAccessible::GetSelectedColumnCount(PRUint32* aCount) { NS_ENSURE_ARG_POINTER(aCount); *aCount = 0; PRInt32 count = 0; nsresult rv = GetColumnCount(&count); NS_ENSURE_SUCCESS(rv, rv); @@ -618,17 +616,17 @@ nsHTMLTableAccessible::GetSelectedColumn if (state) (*aCount)++; } return NS_OK; } NS_IMETHODIMP -nsHTMLTableAccessible::GetSelectedRowCount(PRUint32* aCount) +HTMLTableAccessible::GetSelectedRowCount(PRUint32* aCount) { NS_ENSURE_ARG_POINTER(aCount); *aCount = 0; PRInt32 count = 0; nsresult rv = GetRowCount(&count); NS_ENSURE_SUCCESS(rv, rv); @@ -641,17 +639,17 @@ nsHTMLTableAccessible::GetSelectedRowCou if (state) (*aCount)++; } return NS_OK; } NS_IMETHODIMP -nsHTMLTableAccessible::GetSelectedCells(nsIArray **aCells) +HTMLTableAccessible::GetSelectedCells(nsIArray** aCells) { NS_ENSURE_ARG_POINTER(aCells); *aCells = nsnull; PRInt32 rowCount = 0; nsresult rv = GetRowCount(&rowCount); NS_ENSURE_SUCCESS(rv, rv); @@ -691,18 +689,18 @@ nsHTMLTableAccessible::GetSelectedCells( } } NS_ADDREF(*aCells = selCells); return NS_OK; } NS_IMETHODIMP -nsHTMLTableAccessible::GetSelectedCellIndices(PRUint32 *aNumCells, - PRInt32 **aCells) +HTMLTableAccessible::GetSelectedCellIndices(PRUint32* aNumCells, + PRInt32** aCells) { NS_ENSURE_ARG_POINTER(aNumCells); *aNumCells = 0; NS_ENSURE_ARG_POINTER(aCells); *aCells = nsnull; PRInt32 rowCount = 0; nsresult rv = GetRowCount(&rowCount); @@ -761,18 +759,18 @@ nsHTMLTableAccessible::GetSelectedCellIn } } *aCells = cellsArray; return NS_OK; } NS_IMETHODIMP -nsHTMLTableAccessible::GetSelectedColumnIndices(PRUint32 *aNumColumns, - PRInt32 **aColumns) +HTMLTableAccessible::GetSelectedColumnIndices(PRUint32* aNumColumns, + PRInt32** aColumns) { nsresult rv = NS_OK; PRInt32 columnCount; rv = GetColumnCount(&columnCount); NS_ENSURE_SUCCESS(rv, rv); bool *states = new bool[columnCount]; @@ -803,18 +801,18 @@ nsHTMLTableAccessible::GetSelectedColumn } delete []states; *aColumns = outArray; return rv; } NS_IMETHODIMP -nsHTMLTableAccessible::GetSelectedRowIndices(PRUint32 *aNumRows, - PRInt32 **aRows) +HTMLTableAccessible::GetSelectedRowIndices(PRUint32* aNumRows, + PRInt32** aRows) { nsresult rv = NS_OK; PRInt32 rowCount; rv = GetRowCount(&rowCount); NS_ENSURE_SUCCESS(rv, rv); bool *states = new bool[rowCount]; @@ -845,17 +843,17 @@ nsHTMLTableAccessible::GetSelectedRowInd } delete []states; *aRows = outArray; return rv; } Accessible* -nsHTMLTableAccessible::CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex) +HTMLTableAccessible::CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex) { nsCOMPtr<nsIDOMElement> cellElement; GetCellAt(aRowIndex, aColumnIndex, *getter_AddRefs(cellElement)); if (!cellElement) return nsnull; nsCOMPtr<nsIContent> cellContent(do_QueryInterface(cellElement)); if (!cellContent) @@ -864,27 +862,27 @@ nsHTMLTableAccessible::CellAt(PRUint32 a Accessible* cell = mDoc->GetAccessible(cellContent); // XXX bug 576838: crazy tables (like table6 in tables/test_table2.html) may // return itself as a cell what makes Orca hang. return cell == this ? nsnull : cell; } PRInt32 -nsHTMLTableAccessible::CellIndexAt(PRUint32 aRowIdx, PRUint32 aColIdx) +HTMLTableAccessible::CellIndexAt(PRUint32 aRowIdx, PRUint32 aColIdx) { nsITableLayout* tableLayout = GetTableLayout(); PRInt32 index = -1; tableLayout->GetIndexByRowAndColumn(aRowIdx, aColIdx, &index); return index; } NS_IMETHODIMP -nsHTMLTableAccessible::GetColumnIndexAt(PRInt32 aIndex, PRInt32 *aColumn) +HTMLTableAccessible::GetColumnIndexAt(PRInt32 aIndex, PRInt32* aColumn) { NS_ENSURE_ARG_POINTER(aColumn); if (IsDefunct()) return NS_ERROR_FAILURE; nsITableLayout *tableLayout = GetTableLayout(); NS_ENSURE_STATE(tableLayout); @@ -892,17 +890,17 @@ nsHTMLTableAccessible::GetColumnIndexAt( PRInt32 row; nsresult rv = tableLayout->GetRowAndColumnByIndex(aIndex, &row, aColumn); NS_ENSURE_SUCCESS(rv, rv); return (row == -1 || *aColumn == -1) ? NS_ERROR_INVALID_ARG : NS_OK; } NS_IMETHODIMP -nsHTMLTableAccessible::GetRowIndexAt(PRInt32 aIndex, PRInt32 *aRow) +HTMLTableAccessible::GetRowIndexAt(PRInt32 aIndex, PRInt32* aRow) { NS_ENSURE_ARG_POINTER(aRow); if (IsDefunct()) return NS_ERROR_FAILURE; nsITableLayout *tableLayout = GetTableLayout(); NS_ENSURE_STATE(tableLayout); @@ -910,19 +908,19 @@ nsHTMLTableAccessible::GetRowIndexAt(PRI PRInt32 column; nsresult rv = tableLayout->GetRowAndColumnByIndex(aIndex, aRow, &column); NS_ENSURE_SUCCESS(rv, rv); return (*aRow == -1 || column == -1) ? NS_ERROR_INVALID_ARG : NS_OK; } NS_IMETHODIMP -nsHTMLTableAccessible::GetRowAndColumnIndicesAt(PRInt32 aIndex, - PRInt32* aRowIdx, - PRInt32* aColumnIdx) +HTMLTableAccessible::GetRowAndColumnIndicesAt(PRInt32 aIndex, + PRInt32* aRowIdx, + PRInt32* aColumnIdx) { NS_ENSURE_ARG_POINTER(aRowIdx); *aRowIdx = -1; NS_ENSURE_ARG_POINTER(aColumnIdx); *aColumnIdx = -1; if (IsDefunct()) return NS_ERROR_FAILURE; @@ -930,17 +928,17 @@ nsHTMLTableAccessible::GetRowAndColumnIn nsITableLayout* tableLayout = GetTableLayout(); if (tableLayout) tableLayout->GetRowAndColumnByIndex(aIndex, aRowIdx, aColumnIdx); return (*aRowIdx == -1 || *aColumnIdx == -1) ? NS_ERROR_INVALID_ARG : NS_OK; } PRUint32 -nsHTMLTableAccessible::ColExtentAt(PRUint32 aRowIdx, PRUint32 aColIdx) +HTMLTableAccessible::ColExtentAt(PRUint32 aRowIdx, PRUint32 aColIdx) { nsITableLayout* tableLayout = GetTableLayout(); if (!tableLayout) return 0; nsCOMPtr<nsIDOMElement> domElement; PRInt32 startRowIndex, startColIndex, rowSpan, colSpan, actualRowSpan; bool isSelected; @@ -950,17 +948,17 @@ nsHTMLTableAccessible::ColExtentAt(PRUin GetCellDataAt(aRowIdx, aColIdx, *getter_AddRefs(domElement), startRowIndex, startColIndex, rowSpan, colSpan, actualRowSpan, columnExtent, isSelected); return columnExtent; } PRUint32 -nsHTMLTableAccessible::RowExtentAt(PRUint32 aRowIdx, PRUint32 aColIdx) +HTMLTableAccessible::RowExtentAt(PRUint32 aRowIdx, PRUint32 aColIdx) { nsITableLayout* tableLayout = GetTableLayout(); if (!tableLayout) return 0; nsCOMPtr<nsIDOMElement> domElement; PRInt32 startRowIndex, startColIndex, rowSpan, colSpan, actualColSpan; bool isSelected; @@ -970,29 +968,29 @@ nsHTMLTableAccessible::RowExtentAt(PRUin GetCellDataAt(aRowIdx, aColIdx, *getter_AddRefs(domElement), startRowIndex, startColIndex, rowSpan, colSpan, rowExtent, actualColSpan, isSelected); return rowExtent; } NS_IMETHODIMP -nsHTMLTableAccessible::GetColumnDescription(PRInt32 aColumn, nsAString &_retval) +HTMLTableAccessible::GetColumnDescription(PRInt32 aColumn, nsAString& _retval) { return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP -nsHTMLTableAccessible::GetRowDescription(PRInt32 aRow, nsAString &_retval) +HTMLTableAccessible::GetRowDescription(PRInt32 aRow, nsAString& _retval) { return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP -nsHTMLTableAccessible::IsColumnSelected(PRInt32 aColumn, bool *aIsSelected) +HTMLTableAccessible::IsColumnSelected(PRInt32 aColumn, bool* aIsSelected) { NS_ENSURE_ARG_POINTER(aIsSelected); *aIsSelected = false; PRInt32 colCount = 0; nsresult rv = GetColumnCount(&colCount); NS_ENSURE_SUCCESS(rv, rv); @@ -1012,17 +1010,17 @@ nsHTMLTableAccessible::IsColumnSelected( break; } } return NS_OK; } NS_IMETHODIMP -nsHTMLTableAccessible::IsRowSelected(PRInt32 aRow, bool *aIsSelected) +HTMLTableAccessible::IsRowSelected(PRInt32 aRow, bool* aIsSelected) { NS_ENSURE_ARG_POINTER(aIsSelected); *aIsSelected = false; PRInt32 rowCount = 0; nsresult rv = GetRowCount(&rowCount); NS_ENSURE_SUCCESS(rv, rv); @@ -1042,18 +1040,18 @@ nsHTMLTableAccessible::IsRowSelected(PRI break; } } return NS_OK; } NS_IMETHODIMP -nsHTMLTableAccessible::IsCellSelected(PRInt32 aRow, PRInt32 aColumn, - bool *aIsSelected) +HTMLTableAccessible::IsCellSelected(PRInt32 aRow, PRInt32 aColumn, + bool* aIsSelected) { NS_ENSURE_ARG_POINTER(aIsSelected); *aIsSelected = false; nsITableLayout *tableLayout = GetTableLayout(); NS_ENSURE_STATE(tableLayout); nsCOMPtr<nsIDOMElement> domElement; @@ -1065,67 +1063,58 @@ nsHTMLTableAccessible::IsCellSelected(PR startRowIndex, startColIndex, rowSpan, colSpan, actualRowSpan, actualColSpan, *aIsSelected); if (rv == NS_TABLELAYOUT_CELL_NOT_FOUND) return NS_ERROR_INVALID_ARG; return rv; } -NS_IMETHODIMP -nsHTMLTableAccessible::SelectRow(PRInt32 aRow) +void +HTMLTableAccessible::SelectRow(PRUint32 aRowIdx) { - if (IsDefunct()) - return NS_ERROR_FAILURE; - - nsresult rv = - RemoveRowsOrColumnsFromSelection(aRow, - nsISelectionPrivate::TABLESELECTION_ROW, - true); - NS_ENSURE_SUCCESS(rv, rv); + nsresult rv = RemoveRowsOrColumnsFromSelection(aRowIdx, + nsISelectionPrivate::TABLESELECTION_ROW, + true); + NS_ASSERTION(NS_SUCCEEDED(rv), + "RemoveRowsOrColumnsFromSelection() Shouldn't fail!"); - return AddRowOrColumnToSelection(aRow, - nsISelectionPrivate::TABLESELECTION_ROW); -} - -NS_IMETHODIMP -nsHTMLTableAccessible::SelectColumn(PRInt32 aColumn) -{ - if (IsDefunct()) - return NS_ERROR_FAILURE; - - nsresult rv = - RemoveRowsOrColumnsFromSelection(aColumn, - nsISelectionPrivate::TABLESELECTION_COLUMN, - true); - NS_ENSURE_SUCCESS(rv, rv); - - return AddRowOrColumnToSelection(aColumn, - nsISelectionPrivate::TABLESELECTION_COLUMN); + AddRowOrColumnToSelection(aRowIdx, nsISelectionPrivate::TABLESELECTION_ROW); } void -nsHTMLTableAccessible::UnselectRow(PRUint32 aRowIdx) +HTMLTableAccessible::SelectCol(PRUint32 aColIdx) +{ + nsresult rv = RemoveRowsOrColumnsFromSelection(aColIdx, + nsISelectionPrivate::TABLESELECTION_COLUMN, + true); + NS_ASSERTION(NS_SUCCEEDED(rv), + "RemoveRowsOrColumnsFromSelection() Shouldn't fail!"); + + AddRowOrColumnToSelection(aColIdx, nsISelectionPrivate::TABLESELECTION_COLUMN); +} + +void +HTMLTableAccessible::UnselectRow(PRUint32 aRowIdx) { RemoveRowsOrColumnsFromSelection(aRowIdx, nsISelectionPrivate::TABLESELECTION_ROW, false); } void -nsHTMLTableAccessible::UnselectCol(PRUint32 aColIdx) +HTMLTableAccessible::UnselectCol(PRUint32 aColIdx) { RemoveRowsOrColumnsFromSelection(aColIdx, nsISelectionPrivate::TABLESELECTION_COLUMN, false); } nsresult -nsHTMLTableAccessible::AddRowOrColumnToSelection(PRInt32 aIndex, - PRUint32 aTarget) +HTMLTableAccessible::AddRowOrColumnToSelection(PRInt32 aIndex, PRUint32 aTarget) { bool doSelectRow = (aTarget == nsISelectionPrivate::TABLESELECTION_ROW); nsITableLayout *tableLayout = GetTableLayout(); NS_ENSURE_STATE(tableLayout); nsCOMPtr<nsIDOMElement> cellElm; PRInt32 startRowIdx, startColIdx, rowSpan, colSpan, @@ -1161,19 +1150,19 @@ nsHTMLTableAccessible::AddRowOrColumnToS NS_ENSURE_SUCCESS(rv, rv); } } return NS_OK; } nsresult -nsHTMLTableAccessible::RemoveRowsOrColumnsFromSelection(PRInt32 aIndex, - PRUint32 aTarget, - bool aIsOuter) +HTMLTableAccessible::RemoveRowsOrColumnsFromSelection(PRInt32 aIndex, + PRUint32 aTarget, + bool aIsOuter) { nsITableLayout *tableLayout = GetTableLayout(); NS_ENSURE_STATE(tableLayout); nsIPresShell* presShell(mDoc->PresShell()); nsRefPtr<nsFrameSelection> tableSelection = const_cast<nsFrameSelection*>(presShell->ConstFrameSelection()); @@ -1193,30 +1182,29 @@ nsHTMLTableAccessible::RemoveRowsOrColum endRowIdx, endColIdx); return tableSelection->RemoveCellsFromSelection(mContent, startRowIdx, startColIdx, endRowIdx, endColIdx); } nsITableLayout* -nsHTMLTableAccessible::GetTableLayout() +HTMLTableAccessible::GetTableLayout() { nsIFrame *frame = mContent->GetPrimaryFrame(); if (!frame) return nsnull; nsITableLayout *tableLayout = do_QueryFrame(frame); return tableLayout; } nsresult -nsHTMLTableAccessible::GetCellAt(PRInt32 aRowIndex, - PRInt32 aColIndex, - nsIDOMElement* &aCell) +HTMLTableAccessible::GetCellAt(PRInt32 aRowIndex, PRInt32 aColIndex, + nsIDOMElement*& aCell) { PRInt32 startRowIndex = 0, startColIndex = 0, rowSpan, colSpan, actualRowSpan, actualColSpan; bool isSelected; nsITableLayout *tableLayout = GetTableLayout(); NS_ENSURE_STATE(tableLayout); @@ -1225,17 +1213,17 @@ nsHTMLTableAccessible::GetCellAt(PRInt32 rowSpan, colSpan, actualRowSpan, actualColSpan, isSelected); if (rv == NS_TABLELAYOUT_CELL_NOT_FOUND) return NS_ERROR_INVALID_ARG; return rv; } void -nsHTMLTableAccessible::Description(nsString& aDescription) +HTMLTableAccessible::Description(nsString& aDescription) { // Helpful for debugging layout vs. data tables aDescription.Truncate(); Accessible::Description(aDescription); if (!aDescription.IsEmpty()) return; // Use summary as description if it weren't used as a name. @@ -1260,18 +1248,17 @@ nsHTMLTableAccessible::Description(nsStr bool isProbablyForLayout = IsProbablyLayoutTable(); aDescription = mLayoutHeuristic; } printf("\nTABLE: %s\n", NS_ConvertUTF16toUTF8(mLayoutHeuristic).get()); #endif } bool -nsHTMLTableAccessible::HasDescendant(const nsAString& aTagName, - bool aAllowEmpty) +HTMLTableAccessible::HasDescendant(const nsAString& aTagName, bool aAllowEmpty) { nsCOMPtr<nsIDOMElement> tableElt(do_QueryInterface(mContent)); NS_ENSURE_TRUE(tableElt, false); nsCOMPtr<nsIDOMNodeList> nodeList; tableElt->GetElementsByTagName(aTagName, getter_AddRefs(nodeList)); NS_ENSURE_TRUE(nodeList, false); @@ -1294,23 +1281,23 @@ nsHTMLTableAccessible::HasDescendant(con return true; // If we found more than one node then return true not depending on // aAllowEmpty flag. // XXX it might be dummy but bug 501375 where we changed this addresses // performance problems only. Note, currently 'aAllowEmpty' flag is used for // caption element only. On another hand we create accessible object for // the first entry of caption element (see - // nsHTMLTableAccessible::CacheChildren). + // HTMLTableAccessible::CacheChildren). nodeList->Item(1, getter_AddRefs(foundItem)); return !!foundItem; } bool -nsHTMLTableAccessible::IsProbablyLayoutTable() +HTMLTableAccessible::IsProbablyLayoutTable() { // Implement a heuristic to determine if table is most likely used for layout // XXX do we want to look for rowspan or colspan, especialy that span all but a couple cells // at the beginning or end of a row/col, and especially when they occur at the edge of a table? // XXX expose this info via object attributes to AT-SPI // XXX For now debugging descriptions are always on via SHOW_LAYOUT_HEURISTIC // This will allow release trunk builds to be used by testers to refine the algorithm @@ -1504,26 +1491,26 @@ nsHTMLTableAccessible::IsProbablyLayoutT RETURN_LAYOUT_ANSWER(true, "Has no borders, and has iframe, object, applet or iframe, typical of advertisements"); } RETURN_LAYOUT_ANSWER(false, "no layout factor strong enough, so will guess data"); } //////////////////////////////////////////////////////////////////////////////// -// nsHTMLCaptionAccessible +// HTMLCaptionAccessible //////////////////////////////////////////////////////////////////////////////// Relation -nsHTMLCaptionAccessible::RelationByType(PRUint32 aType) +HTMLCaptionAccessible::RelationByType(PRUint32 aType) { Relation rel = HyperTextAccessible::RelationByType(aType); if (aType == nsIAccessibleRelation::RELATION_LABEL_FOR) rel.AppendTarget(Parent()); return rel; } role -nsHTMLCaptionAccessible::NativeRole() +HTMLCaptionAccessible::NativeRole() { return roles::CAPTION; }
rename from accessible/src/html/nsHTMLTableAccessible.h rename to accessible/src/html/HTMLTableAccessible.h --- a/accessible/src/html/nsHTMLTableAccessible.h +++ b/accessible/src/html/HTMLTableAccessible.h @@ -1,41 +1,44 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef _nsHTMLTableAccessible_H_ -#define _nsHTMLTableAccessible_H_ +#ifndef mozilla_a11y_HTMLTableAccessible_h__ +#define mozilla_a11y_HTMLTableAccessible_h__ #include "HyperTextAccessibleWrap.h" #include "nsIAccessibleTable.h" #include "TableAccessible.h" #include "xpcAccessibleTable.h" class nsITableLayout; class nsITableCellLayout; +namespace mozilla { +namespace a11y { + /** * HTML table cell accessible (html:td). */ -class nsHTMLTableCellAccessible : public HyperTextAccessibleWrap, - public nsIAccessibleTableCell +class HTMLTableCellAccessible : public HyperTextAccessibleWrap, + public nsIAccessibleTableCell { public: - nsHTMLTableCellAccessible(nsIContent* aContent, DocAccessible* aDoc); + HTMLTableCellAccessible(nsIContent* aContent, DocAccessible* aDoc); // nsISupports NS_DECL_ISUPPORTS_INHERITED // nsIAccessibleTableCell NS_DECL_NSIACCESSIBLETABLECELL // Accessible - virtual mozilla::a11y::role NativeRole(); + virtual a11y::role NativeRole(); virtual PRUint64 NativeState(); virtual PRUint64 NativeInteractiveState() const; virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes); protected: /** * Return host table accessible. */ @@ -57,75 +60,76 @@ protected: nsresult GetHeaderCells(PRInt32 aRowOrColumnHeaderCell, nsIArray **aHeaderCells); }; /** * HTML table row/column header accessible (html:th or html:td@scope). */ -class nsHTMLTableHeaderCellAccessible : public nsHTMLTableCellAccessible +class HTMLTableHeaderCellAccessible : public HTMLTableCellAccessible { public: - nsHTMLTableHeaderCellAccessible(nsIContent* aContent, - DocAccessible* aDoc); + HTMLTableHeaderCellAccessible(nsIContent* aContent, DocAccessible* aDoc); // Accessible - virtual mozilla::a11y::role NativeRole(); + virtual a11y::role NativeRole(); }; /** * HTML table accessible (html:table). */ // To turn on table debugging descriptions define SHOW_LAYOUT_HEURISTIC // This allow release trunk builds to be used by testers to refine the // data vs. layout heuristic // #define SHOW_LAYOUT_HEURISTIC -class nsHTMLTableAccessible : public AccessibleWrap, - public xpcAccessibleTable, - public nsIAccessibleTable, - public mozilla::a11y::TableAccessible +class HTMLTableAccessible : public AccessibleWrap, + public xpcAccessibleTable, + public nsIAccessibleTable, + public TableAccessible { public: - nsHTMLTableAccessible(nsIContent* aContent, DocAccessible* aDoc); + HTMLTableAccessible(nsIContent* aContent, DocAccessible* aDoc); NS_DECL_ISUPPORTS_INHERITED // nsIAccessible Table NS_DECL_OR_FORWARD_NSIACCESSIBLETABLE_WITH_XPCACCESSIBLETABLE // TableAccessible virtual Accessible* Caption(); virtual void Summary(nsString& aSummary); virtual PRUint32 ColCount(); virtual PRUint32 RowCount(); virtual Accessible* CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex); virtual PRInt32 CellIndexAt(PRUint32 aRowIdx, PRUint32 aColIdx); virtual PRUint32 ColExtentAt(PRUint32 aRowIdx, PRUint32 aColIdx); virtual PRUint32 RowExtentAt(PRUint32 aRowIdx, PRUint32 aColIdx); + virtual void SelectCol(PRUint32 aColIdx); + virtual void SelectRow(PRUint32 aRowIdx); virtual void UnselectCol(PRUint32 aColIdx); virtual void UnselectRow(PRUint32 aRowIdx); virtual bool IsProbablyLayoutTable(); // nsAccessNode virtual void Shutdown(); // Accessible virtual mozilla::a11y::TableAccessible* AsTable() { return this; } virtual void Description(nsString& aDescription); virtual nsresult GetNameInternal(nsAString& aName); - virtual mozilla::a11y::role NativeRole(); + virtual a11y::role NativeRole(); virtual PRUint64 NativeState(); virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes); virtual Relation RelationByType(PRUint32 aRelationType); - // nsHTMLTableAccessible + // HTMLTableAccessible /** * Retun cell element at the given row and column index. */ nsresult GetCellAt(PRInt32 aRowIndex, PRInt32 aColIndex, nsIDOMElement* &aCell); /** @@ -133,17 +137,17 @@ public: */ nsITableLayout* GetTableLayout(); protected: // Accessible virtual void CacheChildren(); - // nsHTMLTableAccessible + // HTMLTableAccessible /** * Add row or column to selection. * * @param aIndex [in] index of row or column to be selected * @param aTarget [in] indicates what should be selected, either row or column * (see nsISelectionPrivate) */ @@ -174,23 +178,26 @@ protected: #ifdef SHOW_LAYOUT_HEURISTIC nsString mLayoutHeuristic; #endif }; /** * HTML caption accessible (html:caption). */ -class nsHTMLCaptionAccessible : public HyperTextAccessibleWrap +class HTMLCaptionAccessible : public HyperTextAccessibleWrap { public: - nsHTMLCaptionAccessible(nsIContent* aContent, DocAccessible* aDoc) : + HTMLCaptionAccessible(nsIContent* aContent, DocAccessible* aDoc) : HyperTextAccessibleWrap(aContent, aDoc) { } - virtual ~nsHTMLCaptionAccessible() { } + virtual ~HTMLCaptionAccessible() { } // nsIAccessible // Accessible - virtual mozilla::a11y::role NativeRole(); + virtual a11y::role NativeRole(); virtual Relation RelationByType(PRUint32 aRelationType); }; -#endif +} // namespace a11y +} // namespace mozilla + +#endif
--- a/accessible/src/html/Makefile.in +++ b/accessible/src/html/Makefile.in @@ -19,17 +19,17 @@ LIBXUL_LIBRARY = 1 CPPSRCS = \ HTMLCanvasAccessible.cpp \ HTMLElementAccessibles.cpp \ HTMLFormControlAccessible.cpp \ HTMLImageMapAccessible.cpp \ HTMLLinkAccessible.cpp \ HTMLListAccessible.cpp \ HTMLSelectAccessible.cpp \ - nsHTMLTableAccessible.cpp \ + HTMLTableAccessible.cpp \ $(NULL) # we don't want the shared lib, but we want to force the creation of a static lib. FORCE_STATIC_LIB = 1 include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES = \
--- a/accessible/src/mac/AccessibleWrap.h +++ b/accessible/src/mac/AccessibleWrap.h @@ -104,13 +104,9 @@ private: /** * We have created our native. This does not mean there is one. * This can never go back to false. * We need it because checking whether we need a native object cost time. */ bool mNativeInited; }; -// Define unsupported wrap classes here -typedef class nsHTMLTableCellAccessible nsHTMLTableCellAccessibleWrap; -typedef class nsHTMLTableAccessible nsHTMLTableAccessibleWrap; - #endif
rename from accessible/src/mac/nsHTMLTableAccessibleWrap.h rename to accessible/src/mac/HTMLTableAccessibleWrap.h --- a/accessible/src/mac/nsHTMLTableAccessibleWrap.h +++ b/accessible/src/mac/HTMLTableAccessibleWrap.h @@ -1,18 +1,24 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim:expandtab:shiftwidth=2:tabstop=2: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef _NSHTMLTABLEACCESSIBLEWRAP_H -#define _NSHTMLTABLEACCESSIBLEWRAP_H +#ifndef mozilla_a11y_HTMLTableAccessibleWrap_h__ +#define mozilla_a11y_HTMLTableAccessibleWrap_h__ + +#include "HTMLTableAccessible.h" -#include "nsHTMLTableAccessible.h" +namespace mozilla { +namespace a11y { -typedef class nsHTMLTableAccessible nsHTMLTableAccessibleWrap; -typedef class nsHTMLTableCellAccessible nsHTMLTableCellAccessibleWrap; -typedef class nsHTMLTableHeaderCellAccessible nsHTMLTableHeaderCellAccessibleWrap; +typedef class HTMLTableAccessible HTMLTableAccessibleWrap; +typedef class HTMLTableCellAccessible HTMLTableCellAccessibleWrap; +typedef class HTMLTableHeaderCellAccessible HTMLTableHeaderCellAccessibleWrap; + +} // namespace a11y +} // namespace mozilla #endif
rename from accessible/src/mac/nsXULListboxAccessibleWrap.h rename to accessible/src/mac/XULListboxAccessibleWrap.h --- a/accessible/src/mac/nsXULListboxAccessibleWrap.h +++ b/accessible/src/mac/XULListboxAccessibleWrap.h @@ -1,14 +1,20 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef __nsXULListboxAccessibleWrap_h__ -#define __nsXULListboxAccessibleWrap_h__ +#ifndef mozilla_a11y_XULListboxAccessibleWrap_h__ +#define mozilla_a11y_XULListboxAccessibleWrap_h__ + +#include "XULListboxAccessible.h" -#include "nsXULListboxAccessible.h" +namespace mozilla { +namespace a11y { -typedef class nsXULListboxAccessible nsXULListboxAccessibleWrap; -typedef class nsXULListCellAccessible nsXULListCellAccessibleWrap; +typedef class XULListboxAccessible XULListboxAccessibleWrap; +typedef class XULListCellAccessible XULListCellAccessibleWrap; + +} // namespace a11y +} // namespace mozilla #endif
rename from accessible/src/mac/nsXULMenuAccessibleWrap.h rename to accessible/src/mac/XULMenuAccessibleWrap.h --- a/accessible/src/mac/nsXULMenuAccessibleWrap.h +++ b/accessible/src/mac/XULMenuAccessibleWrap.h @@ -1,13 +1,19 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef __nsXULMenuAccessibleWrap_h__ -#define __nsXULMenuAccessibleWrap_h__ +#ifndef mozilla_a11y_XULMenuAccessibleWrap_h__ +#define mozilla_a11y_XULMenuAccessibleWrap_h__ + +#include "XULMenuAccessible.h" -#include "nsXULMenuAccessible.h" +namespace mozilla { +namespace a11y { -typedef class nsXULMenuitemAccessible nsXULMenuitemAccessibleWrap; +typedef class XULMenuitemAccessible XULMenuitemAccessibleWrap; + +} // namespace a11y +} // namespace mozilla #endif
rename from accessible/src/mac/nsXULTreeGridAccessibleWrap.h rename to accessible/src/mac/XULTreeGridAccessibleWrap.h --- a/accessible/src/mac/nsXULTreeGridAccessibleWrap.h +++ b/accessible/src/mac/XULTreeGridAccessibleWrap.h @@ -1,14 +1,20 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef __nsXULTreeGridAccessibleWrap_h__ -#define __nsXULTreeGridAccessibleWrap_h__ +#ifndef mozilla_a11y_XULTreeGridAccessibleWrap_h__ +#define mozilla_a11y_XULTreeGridAccessibleWrap_h__ + +#include "XULTreeGridAccessible.h" -#include "nsXULTreeGridAccessible.h" +namespace mozilla { +namespace a11y { -typedef class nsXULTreeGridAccessible nsXULTreeGridAccessibleWrap; -typedef class nsXULTreeGridCellAccessible nsXULTreeGridCellAccessibleWrap; +typedef class XULTreeGridAccessible XULTreeGridAccessibleWrap; +typedef class XULTreeGridCellAccessible XULTreeGridCellAccessibleWrap; + +} // namespace a11y +} // namespace mozilla #endif
--- a/accessible/src/mac/mozActionElements.mm +++ b/accessible/src/mac/mozActionElements.mm @@ -2,17 +2,17 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #import "mozActionElements.h" #import "MacUtils.h" #include "Accessible-inl.h" -#include "nsXULTabAccessible.h" +#include "XULTabAccessible.h" #include "nsObjCExceptions.h" using namespace mozilla::a11y; enum CheckboxValue { // these constants correspond to the values in the OS kUnchecked = 0,
--- a/accessible/src/msaa/AccessibleWrap.h +++ b/accessible/src/msaa/AccessibleWrap.h @@ -307,13 +307,9 @@ protected: NAVRELATION_POPUP_FOR = 0x100b, NAVRELATION_PARENT_WINDOW_OF = 0x100c, NAVRELATION_DEFAULT_BUTTON = 0x100d, NAVRELATION_DESCRIBED_BY = 0x100e, NAVRELATION_DESCRIPTION_FOR = 0x100f }; }; -// Define unsupported wrap classes here -typedef class nsHTMLTextFieldAccessible nsHTMLTextFieldAccessibleWrap; -typedef class nsXULTextFieldAccessible nsXULTextFieldAccessibleWrap; - #endif
rename from accessible/src/msaa/nsHTMLTableAccessibleWrap.cpp rename to accessible/src/msaa/HTMLTableAccessibleWrap.cpp --- a/accessible/src/msaa/nsHTMLTableAccessibleWrap.cpp +++ b/accessible/src/msaa/HTMLTableAccessibleWrap.cpp @@ -1,43 +1,45 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim:expandtab:shiftwidth=2:tabstop=2: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "nsHTMLTableAccessibleWrap.h" +#include "HTMLTableAccessibleWrap.h" + +using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// -// nsHTMLTableAccessibleWrap +// HTMLTableAccessibleWrap //////////////////////////////////////////////////////////////////////////////// -NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTableAccessibleWrap, - nsHTMLTableAccessible) +NS_IMPL_ISUPPORTS_INHERITED0(HTMLTableAccessibleWrap, + HTMLTableAccessible) -IMPL_IUNKNOWN_INHERITED1(nsHTMLTableAccessibleWrap, +IMPL_IUNKNOWN_INHERITED1(HTMLTableAccessibleWrap, AccessibleWrap, CAccessibleTable) //////////////////////////////////////////////////////////////////////////////// -// nsHTMLTableCellAccessibleWrap +// HTMLTableCellAccessibleWrap //////////////////////////////////////////////////////////////////////////////// -NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTableCellAccessibleWrap, - nsHTMLTableCellAccessible) +NS_IMPL_ISUPPORTS_INHERITED0(HTMLTableCellAccessibleWrap, + HTMLTableCellAccessible) -IMPL_IUNKNOWN_INHERITED1(nsHTMLTableCellAccessibleWrap, +IMPL_IUNKNOWN_INHERITED1(HTMLTableCellAccessibleWrap, HyperTextAccessibleWrap, CAccessibleTableCell) //////////////////////////////////////////////////////////////////////////////// -// nsHTMLTableCellAccessibleWrap +// HTMLTableCellAccessibleWrap //////////////////////////////////////////////////////////////////////////////// -NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTableHeaderCellAccessibleWrap, - nsHTMLTableHeaderCellAccessible) +NS_IMPL_ISUPPORTS_INHERITED0(HTMLTableHeaderCellAccessibleWrap, + HTMLTableHeaderCellAccessible) -IMPL_IUNKNOWN_INHERITED1(nsHTMLTableHeaderCellAccessibleWrap, +IMPL_IUNKNOWN_INHERITED1(HTMLTableHeaderCellAccessibleWrap, HyperTextAccessibleWrap, CAccessibleTableCell)
rename from accessible/src/msaa/nsHTMLTableAccessibleWrap.h rename to accessible/src/msaa/HTMLTableAccessibleWrap.h --- a/accessible/src/msaa/nsHTMLTableAccessibleWrap.h +++ b/accessible/src/msaa/HTMLTableAccessibleWrap.h @@ -1,74 +1,80 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim:expandtab:shiftwidth=2:tabstop=2: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef _NSHTMLTABLEACCESSIBLEWRAP_H -#define _NSHTMLTABLEACCESSIBLEWRAP_H +#ifndef mozilla_a11y_HTMLTableAccessibleWrap_h__ +#define mozilla_a11y_HTMLTableAccessibleWrap_h__ -#include "nsHTMLTableAccessible.h" +#include "HTMLTableAccessible.h" #include "CAccessibleTable.h" #include "CAccessibleTableCell.h" +namespace mozilla { +namespace a11y { + /** - * IA2 wrapper class for nsHTMLTableAccessible implementing IAccessibleTable + * IA2 wrapper class for HTMLTableAccessible implementing IAccessibleTable * and IAccessibleTable2 interfaces. */ -class nsHTMLTableAccessibleWrap : public nsHTMLTableAccessible, - public CAccessibleTable +class HTMLTableAccessibleWrap : public HTMLTableAccessible, + public CAccessibleTable { public: - nsHTMLTableAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) : - nsHTMLTableAccessible(aContent, aDoc) {} + HTMLTableAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) : + HTMLTableAccessible(aContent, aDoc) {} // IUnknown DECL_IUNKNOWN_INHERITED // nsISupports NS_DECL_ISUPPORTS_INHERITED }; /** - * IA2 wrapper class for nsHTMLTableCellAccessible implementing + * IA2 wrapper class for HTMLTableCellAccessible implementing * IAccessibleTableCell interface. */ -class nsHTMLTableCellAccessibleWrap : public nsHTMLTableCellAccessible, - public CAccessibleTableCell +class HTMLTableCellAccessibleWrap : public HTMLTableCellAccessible, + public CAccessibleTableCell { public: - nsHTMLTableCellAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) : - nsHTMLTableCellAccessible(aContent, aDoc) {} + HTMLTableCellAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) : + HTMLTableCellAccessible(aContent, aDoc) {} // IUnknown DECL_IUNKNOWN_INHERITED // nsISupports NS_DECL_ISUPPORTS_INHERITED }; /** - * IA2 wrapper class for nsHTMLTableHeaderCellAccessible implementing + * IA2 wrapper class for HTMLTableHeaderCellAccessible implementing * IAccessibleTableCell interface. */ -class nsHTMLTableHeaderCellAccessibleWrap : public nsHTMLTableHeaderCellAccessible, - public CAccessibleTableCell +class HTMLTableHeaderCellAccessibleWrap : public HTMLTableHeaderCellAccessible, + public CAccessibleTableCell { public: - nsHTMLTableHeaderCellAccessibleWrap(nsIContent* aContent, - DocAccessible* aDoc) : - nsHTMLTableHeaderCellAccessible(aContent, aDoc) {} + HTMLTableHeaderCellAccessibleWrap(nsIContent* aContent, + DocAccessible* aDoc) : + HTMLTableHeaderCellAccessible(aContent, aDoc) {} // IUnknown DECL_IUNKNOWN_INHERITED // nsISupports NS_DECL_ISUPPORTS_INHERITED }; +} // namespace a11y +} // namespace mozilla + #endif
--- a/accessible/src/msaa/Makefile.in +++ b/accessible/src/msaa/Makefile.in @@ -15,24 +15,21 @@ EXPORT_LIBRARY = .. LIBXUL_LIBRARY = 1 CPPSRCS = \ AccessibleWrap.cpp \ ApplicationAccessibleWrap.cpp \ ARIAGridAccessibleWrap.cpp \ DocAccessibleWrap.cpp \ + HTMLTableAccessibleWrap.cpp \ HyperTextAccessibleWrap.cpp \ ImageAccessibleWrap.cpp \ nsAccessNodeWrap.cpp \ nsHTMLWin32ObjectAccessible.cpp \ - nsXULMenuAccessibleWrap.cpp \ - nsXULListboxAccessibleWrap.cpp \ - nsXULTreeGridAccessibleWrap.cpp \ - nsHTMLTableAccessibleWrap.cpp \ nsWinUtils.cpp \ CAccessibleText.cpp \ CAccessibleEditableText.cpp \ CAccessibleHyperlink.cpp \ CAccessibleTable.cpp \ CAccessibleTableCell.cpp \ CAccessibleValue.cpp \ Compatibility.cpp \ @@ -41,16 +38,24 @@ CPPSRCS = \ ia2AccessibleComponent.cpp \ ia2AccessibleImage.cpp \ ia2AccessibleHypertext.cpp \ ia2AccessibleRelation.cpp \ RootAccessibleWrap.cpp \ TextLeafAccessibleWrap.cpp \ $(NULL) +ifdef MOZ_XUL +CPPSRCS += \ + XULListboxAccessibleWrap.cpp \ + XULMenuAccessibleWrap.cpp \ + XULTreeGridAccessibleWrap.cpp \ + $(NULL) +endif + EXPORTS = \ nsAccessNodeWrap.h \ $(NULL) # we don't want the shared lib, but we want to force the creation of a static lib. FORCE_STATIC_LIB = 1 include $(topsrcdir)/config/config.mk
rename from accessible/src/msaa/nsXULListboxAccessibleWrap.cpp rename to accessible/src/msaa/XULListboxAccessibleWrap.cpp --- a/accessible/src/msaa/nsXULListboxAccessibleWrap.cpp +++ b/accessible/src/msaa/XULListboxAccessibleWrap.cpp @@ -1,42 +1,44 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "nsXULListboxAccessibleWrap.h" +#include "XULListboxAccessibleWrap.h" + +using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// -// nsXULListboxAccessibleWrap +// XULListboxAccessibleWrap //////////////////////////////////////////////////////////////////////////////// -nsXULListboxAccessibleWrap:: - nsXULListboxAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) : - nsXULListboxAccessible(aContent, aDoc) +XULListboxAccessibleWrap:: + XULListboxAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) : + XULListboxAccessible(aContent, aDoc) { } -NS_IMPL_ISUPPORTS_INHERITED0(nsXULListboxAccessibleWrap, - nsXULListboxAccessible) +NS_IMPL_ISUPPORTS_INHERITED0(XULListboxAccessibleWrap, + XULListboxAccessible) -IMPL_IUNKNOWN_QUERY_HEAD(nsXULListboxAccessibleWrap) +IMPL_IUNKNOWN_QUERY_HEAD(XULListboxAccessibleWrap) IMPL_IUNKNOWN_QUERY_ENTRY_COND(CAccessibleTable, IsMulticolumn()); IMPL_IUNKNOWN_QUERY_ENTRY(AccessibleWrap) IMPL_IUNKNOWN_QUERY_TAIL //////////////////////////////////////////////////////////////////////////////// -// nsXULListCellAccessibleWrap +// XULListCellAccessibleWrap //////////////////////////////////////////////////////////////////////////////// -nsXULListCellAccessibleWrap:: - nsXULListCellAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) : - nsXULListCellAccessible(aContent, aDoc) +XULListCellAccessibleWrap:: + XULListCellAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) : + XULListCellAccessible(aContent, aDoc) { } -NS_IMPL_ISUPPORTS_INHERITED0(nsXULListCellAccessibleWrap, - nsXULListCellAccessible) +NS_IMPL_ISUPPORTS_INHERITED0(XULListCellAccessibleWrap, + XULListCellAccessible) -IMPL_IUNKNOWN_INHERITED1(nsXULListCellAccessibleWrap, +IMPL_IUNKNOWN_INHERITED1(XULListCellAccessibleWrap, HyperTextAccessibleWrap, CAccessibleTableCell)
rename from accessible/src/msaa/nsXULListboxAccessibleWrap.h rename to accessible/src/msaa/XULListboxAccessibleWrap.h --- a/accessible/src/msaa/nsXULListboxAccessibleWrap.h +++ b/accessible/src/msaa/XULListboxAccessibleWrap.h @@ -1,48 +1,54 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef __nsXULListboxAccessibleWrap_h__ -#define __nsXULListboxAccessibleWrap_h__ +#ifndef mozilla_a11y_XULListboxAccessibleWrap_h__ +#define mozilla_a11y_XULListboxAccessibleWrap_h__ -#include "nsXULListboxAccessible.h" +#include "XULListboxAccessible.h" #include "CAccessibleTable.h" #include "CAccessibleTableCell.h" +namespace mozilla { +namespace a11y { + /** - * IA2 wrapper class for nsXULListboxAccessible class implementing + * IA2 wrapper class for XULListboxAccessible class implementing * IAccessibleTable and IAccessibleTable2 interfaces. */ -class nsXULListboxAccessibleWrap : public nsXULListboxAccessible, - public CAccessibleTable +class XULListboxAccessibleWrap : public XULListboxAccessible, + public CAccessibleTable { public: - nsXULListboxAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc); + XULListboxAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc); // IUnknown DECL_IUNKNOWN_INHERITED // nsISupports NS_DECL_ISUPPORTS_INHERITED }; /** - * IA2 wrapper class for nsXULListCellAccessible class, implements + * IA2 wrapper class for XULListCellAccessible class, implements * IAccessibleTableCell interface. */ -class nsXULListCellAccessibleWrap : public nsXULListCellAccessible, - public CAccessibleTableCell +class XULListCellAccessibleWrap : public XULListCellAccessible, + public CAccessibleTableCell { public: - nsXULListCellAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc); + XULListCellAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc); // IUnknown DECL_IUNKNOWN_INHERITED // nsISupports NS_DECL_ISUPPORTS_INHERITED }; +} // namespace a11y +} // namespace mozilla + #endif
rename from accessible/src/msaa/nsXULMenuAccessibleWrap.cpp rename to accessible/src/msaa/XULMenuAccessibleWrap.cpp --- a/accessible/src/msaa/nsXULMenuAccessibleWrap.cpp +++ b/accessible/src/msaa/XULMenuAccessibleWrap.cpp @@ -1,34 +1,34 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "nsXULMenuAccessibleWrap.h" +#include "XULMenuAccessibleWrap.h" #include "nsINameSpaceManager.h" using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// -// nsXULMenuAccessibleWrap +// XULMenuAccessibleWrap //////////////////////////////////////////////////////////////////////////////// -nsXULMenuitemAccessibleWrap:: - nsXULMenuitemAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) : - nsXULMenuitemAccessible(aContent, aDoc) +XULMenuitemAccessibleWrap:: + XULMenuitemAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) : + XULMenuitemAccessible(aContent, aDoc) { } ENameValueFlag -nsXULMenuitemAccessibleWrap::Name(nsString& aName) +XULMenuitemAccessibleWrap::Name(nsString& aName) { // XXX This should be done in get_accName() so that nsIAccessible::GetName()] // provides the same results on all platforms - nsXULMenuitemAccessible::Name(aName); + XULMenuitemAccessible::Name(aName); if (aName.IsEmpty()) return eNameOK; nsAutoString accel; mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::acceltext, accel); if (!accel.IsEmpty()) aName += NS_LITERAL_STRING("\t") + accel;
rename from accessible/src/msaa/nsXULMenuAccessibleWrap.h rename to accessible/src/msaa/XULMenuAccessibleWrap.h --- a/accessible/src/msaa/nsXULMenuAccessibleWrap.h +++ b/accessible/src/msaa/XULMenuAccessibleWrap.h @@ -1,21 +1,27 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef __nsXULMenuAccessibleWrap_h__ -#define __nsXULMenuAccessibleWrap_h__ +#ifndef mozilla_a11y_XULMenuAccessibleWrap_h__ +#define mozilla_a11y_XULMenuAccessibleWrap_h__ + +#include "XULMenuAccessible.h" -#include "nsXULMenuAccessible.h" +namespace mozilla { +namespace a11y { -class nsXULMenuitemAccessibleWrap : public nsXULMenuitemAccessible +class XULMenuitemAccessibleWrap : public XULMenuitemAccessible { public: - nsXULMenuitemAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc); - virtual ~nsXULMenuitemAccessibleWrap() {} + XULMenuitemAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc); + virtual ~XULMenuitemAccessibleWrap() {} // nsIAccessible virtual mozilla::a11y::ENameValueFlag Name(nsString& aName); }; +} // namespace a11y +} // namespace mozilla + #endif
rename from accessible/src/msaa/nsXULTreeGridAccessibleWrap.cpp rename to accessible/src/msaa/XULTreeGridAccessibleWrap.cpp --- a/accessible/src/msaa/nsXULTreeGridAccessibleWrap.cpp +++ b/accessible/src/msaa/XULTreeGridAccessibleWrap.cpp @@ -1,47 +1,49 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "nsXULTreeGridAccessibleWrap.h" +#include "XULTreeGridAccessibleWrap.h" + +using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// -// nsXULTreeGridAccessibleWrap +// XULTreeGridAccessibleWrap //////////////////////////////////////////////////////////////////////////////// -nsXULTreeGridAccessibleWrap:: - nsXULTreeGridAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) : - nsXULTreeGridAccessible(aContent, aDoc) +XULTreeGridAccessibleWrap:: + XULTreeGridAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) : + XULTreeGridAccessible(aContent, aDoc) { } -NS_IMPL_ISUPPORTS_INHERITED0(nsXULTreeGridAccessibleWrap, - nsXULTreeGridAccessible) +NS_IMPL_ISUPPORTS_INHERITED0(XULTreeGridAccessibleWrap, + XULTreeGridAccessible) -IMPL_IUNKNOWN_INHERITED1(nsXULTreeGridAccessibleWrap, +IMPL_IUNKNOWN_INHERITED1(XULTreeGridAccessibleWrap, AccessibleWrap, CAccessibleTable) //////////////////////////////////////////////////////////////////////////////// -// nsXULTreeGridCellAccessibleWrap +// XULTreeGridCellAccessibleWrap //////////////////////////////////////////////////////////////////////////////// -nsXULTreeGridCellAccessibleWrap:: - nsXULTreeGridCellAccessibleWrap(nsIContent* aContent, - DocAccessible* aDoc, - nsXULTreeGridRowAccessible* aRowAcc, - nsITreeBoxObject* aTree, - nsITreeView* aTreeView, - PRInt32 aRow, nsITreeColumn* aColumn) : - nsXULTreeGridCellAccessible(aContent, aDoc, aRowAcc, aTree, aTreeView, - aRow, aColumn) +XULTreeGridCellAccessibleWrap:: + XULTreeGridCellAccessibleWrap(nsIContent* aContent, + DocAccessible* aDoc, + XULTreeGridRowAccessible* aRowAcc, + nsITreeBoxObject* aTree, + nsITreeView* aTreeView, + PRInt32 aRow, nsITreeColumn* aColumn) : + XULTreeGridCellAccessible(aContent, aDoc, aRowAcc, aTree, aTreeView, + aRow, aColumn) { } -NS_IMPL_ISUPPORTS_INHERITED0(nsXULTreeGridCellAccessibleWrap, - nsXULTreeGridCellAccessible) +NS_IMPL_ISUPPORTS_INHERITED0(XULTreeGridCellAccessibleWrap, + XULTreeGridCellAccessible) -IMPL_IUNKNOWN_INHERITED1(nsXULTreeGridCellAccessibleWrap, +IMPL_IUNKNOWN_INHERITED1(XULTreeGridCellAccessibleWrap, AccessibleWrap, CAccessibleTableCell)
rename from accessible/src/msaa/nsXULTreeGridAccessibleWrap.h rename to accessible/src/msaa/XULTreeGridAccessibleWrap.h --- a/accessible/src/msaa/nsXULTreeGridAccessibleWrap.h +++ b/accessible/src/msaa/XULTreeGridAccessibleWrap.h @@ -1,53 +1,59 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef __nsXULTreeGridAccessibleWrap_h__ -#define __nsXULTreeGridAccessibleWrap_h__ +#ifndef mozilla_a11y_XULTreeGridAccessibleWrap_h__ +#define mozilla_a11y_XULTreeGridAccessibleWrap_h__ -#include "nsXULTreeGridAccessible.h" +#include "XULTreeGridAccessible.h" #include "CAccessibleTable.h" #include "CAccessibleTableCell.h" +namespace mozilla { +namespace a11y { + /** - * IA2 wrapper class for nsXULTreeGridAccessible class implementing + * IA2 wrapper class for XULTreeGridAccessible class implementing * IAccessibleTable and IAccessibleTable2 interfaces. */ -class nsXULTreeGridAccessibleWrap : public nsXULTreeGridAccessible, - public CAccessibleTable +class XULTreeGridAccessibleWrap : public XULTreeGridAccessible, + public CAccessibleTable { public: - nsXULTreeGridAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc); + XULTreeGridAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc); // IUnknown DECL_IUNKNOWN_INHERITED // nsISupports NS_DECL_ISUPPORTS_INHERITED }; /** - * IA2 wrapper class for nsXULTreeGridCellAccessible class, implements + * IA2 wrapper class for XULTreeGridCellAccessible class, implements * IAccessibleTableCell interface. */ -class nsXULTreeGridCellAccessibleWrap : public nsXULTreeGridCellAccessible, - public CAccessibleTableCell +class XULTreeGridCellAccessibleWrap : public XULTreeGridCellAccessible, + public CAccessibleTableCell { public: - nsXULTreeGridCellAccessibleWrap(nsIContent* aContent, - DocAccessible* aDoc, - nsXULTreeGridRowAccessible* aRowAcc, - nsITreeBoxObject* aTree, - nsITreeView* aTreeView, - PRInt32 aRow, nsITreeColumn* aColumn); + XULTreeGridCellAccessibleWrap(nsIContent* aContent, + DocAccessible* aDoc, + XULTreeGridRowAccessible* aRowAcc, + nsITreeBoxObject* aTree, + nsITreeView* aTreeView, + PRInt32 aRow, nsITreeColumn* aColumn); // IUnknown DECL_IUNKNOWN_INHERITED // nsISupports NS_DECL_ISUPPORTS_INHERITED }; +} // namespace a11y +} // namespace mozilla + #endif
--- a/accessible/src/msaa/ia2AccessibleRelation.cpp +++ b/accessible/src/msaa/ia2AccessibleRelation.cpp @@ -9,16 +9,18 @@ #include "Relation.h" #include "nsIAccessibleRelation.h" #include "nsID.h" #include "AccessibleRelation_i.c" +using namespace mozilla::a11y; + ia2AccessibleRelation::ia2AccessibleRelation(PRUint32 aType, Relation* aRel) : mType(aType), mReferences(0) { Accessible* target = nsnull; while ((target = aRel->Next())) mTargets.AppendElement(target); }
--- a/accessible/src/msaa/ia2AccessibleRelation.h +++ b/accessible/src/msaa/ia2AccessibleRelation.h @@ -9,16 +9,19 @@ #define _NS_ACCESSIBLE_RELATION_WRAP_H #include "Accessible.h" #include "nsTArray.h" #include "AccessibleRelation.h" +namespace mozilla { +namespace a11y { + class ia2AccessibleRelation : public IAccessibleRelation { public: ia2AccessibleRelation(PRUint32 aType, Relation* aRel); virtual ~ia2AccessibleRelation() { } // IUnknown virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID aIID, void** aOutPtr); @@ -52,10 +55,13 @@ private: ia2AccessibleRelation(const ia2AccessibleRelation&); ia2AccessibleRelation& operator = (const ia2AccessibleRelation&); PRUint32 mType; nsTArray<nsRefPtr<Accessible> > mTargets; ULONG mReferences; }; +} // namespace a11y +} // namespace mozilla + #endif
rename from accessible/src/other/nsHTMLTableAccessibleWrap.h rename to accessible/src/other/HTMLTableAccessibleWrap.h --- a/accessible/src/other/nsHTMLTableAccessibleWrap.h +++ b/accessible/src/other/HTMLTableAccessibleWrap.h @@ -1,18 +1,24 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim:expandtab:shiftwidth=2:tabstop=2: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef _NSHTMLTABLEACCESSIBLEWRAP_H -#define _NSHTMLTABLEACCESSIBLEWRAP_H +#ifndef mozilla_a11y_HTMLTableAccessibleWrap_h__ +#define mozilla_a11y_HTMLTableAccessibleWrap_h__ + +#include "HTMLTableAccessible.h" -#include "nsHTMLTableAccessible.h" +namespace mozilla { +namespace a11y { -typedef class nsHTMLTableAccessible nsHTMLTableAccessibleWrap; -typedef class nsHTMLTableCellAccessible nsHTMLTableCellAccessibleWrap; -typedef class nsHTMLTableHeaderCellAccessible nsHTMLTableHeaderCellAccessibleWrap; +typedef class HTMLTableAccessible HTMLTableAccessibleWrap; +typedef class HTMLTableCellAccessible HTMLTableCellAccessibleWrap; +typedef class HTMLTableHeaderCellAccessible HTMLTableHeaderCellAccessibleWrap; + +} // namespace a11y +} // namespace mozilla #endif
new file mode 100644 --- /dev/null +++ b/accessible/src/other/XULListboxAccessibleWrap.h @@ -0,0 +1,20 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef mozilla_a11y_XULListboxAccessibleWrap_h__ +#define mozilla_a11y_XULListboxAccessibleWrap_h__ + +#include "XULListboxAccessible.h" + +namespace mozilla { +namespace a11y { + +typedef class XULListboxAccessible XULListboxAccessibleWrap; +typedef class XULListCellAccessible XULListCellAccessibleWrap; + +} // namespace a11y +} // namespace mozilla + +#endif
rename from accessible/src/other/nsXULMenuAccessibleWrap.h rename to accessible/src/other/XULMenuAccessibleWrap.h --- a/accessible/src/other/nsXULMenuAccessibleWrap.h +++ b/accessible/src/other/XULMenuAccessibleWrap.h @@ -1,13 +1,19 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef __nsXULMenuAccessibleWrap_h__ -#define __nsXULMenuAccessibleWrap_h__ +#ifndef mozilla_a11y_XULMenuAccessibleWrap_h__ +#define mozilla_a11y_XULMenuAccessibleWrap_h__ + +#include "XULMenuAccessible.h" -#include "nsXULMenuAccessible.h" +namespace mozilla { +namespace a11y { -typedef class nsXULMenuitemAccessible nsXULMenuitemAccessibleWrap; +typedef class XULMenuitemAccessible XULMenuitemAccessibleWrap; + +} // namespace a11y +} // namespace mozilla #endif
rename from accessible/src/other/nsXULTreeGridAccessibleWrap.h rename to accessible/src/other/XULTreeGridAccessibleWrap.h --- a/accessible/src/other/nsXULTreeGridAccessibleWrap.h +++ b/accessible/src/other/XULTreeGridAccessibleWrap.h @@ -1,14 +1,20 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef __nsXULTreeGridAccessibleWrap_h__ -#define __nsXULTreeGridAccessibleWrap_h__ +#ifndef mozilla_a11y_XULTreeGridAccessibleWrap_h__ +#define mozilla_a11y_XULTreeGridAccessibleWrap_h__ + +#include "XULTreeGridAccessible.h" -#include "nsXULTreeGridAccessible.h" +namespace mozilla { +namespace a11y { -typedef class nsXULTreeGridAccessible nsXULTreeGridAccessibleWrap; -typedef class nsXULTreeGridCellAccessible nsXULTreeGridCellAccessibleWrap; +typedef class XULTreeGridAccessible XULTreeGridAccessibleWrap; +typedef class XULTreeGridCellAccessible XULTreeGridCellAccessibleWrap; + +} // namespace a11y +} // namespace mozilla #endif
deleted file mode 100644 --- a/accessible/src/other/nsXULListboxAccessibleWrap.h +++ /dev/null @@ -1,14 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef __nsXULListboxAccessibleWrap_h__ -#define __nsXULListboxAccessibleWrap_h__ - -#include "nsXULListboxAccessible.h" - -typedef class nsXULListboxAccessible nsXULListboxAccessibleWrap; -typedef class nsXULListCellAccessible nsXULListCellAccessibleWrap; - -#endif
--- a/accessible/src/xpcom/nsAccessibleRelation.cpp +++ b/accessible/src/xpcom/nsAccessibleRelation.cpp @@ -6,16 +6,18 @@ #include "nsAccessibleRelation.h" #include "Relation.h" #include "Accessible.h" #include "nsArrayUtils.h" #include "nsComponentManagerUtils.h" +using namespace mozilla::a11y; + nsAccessibleRelation::nsAccessibleRelation(PRUint32 aType, Relation* aRel) : mType(aType) { mTargets = do_CreateInstance(NS_ARRAY_CONTRACTID); nsIAccessible* targetAcc = nsnull; while ((targetAcc = aRel->Next())) mTargets->AppendElement(targetAcc, false);
--- a/accessible/src/xpcom/nsAccessibleRelation.h +++ b/accessible/src/xpcom/nsAccessibleRelation.h @@ -6,16 +6,19 @@ #ifndef _nsAccessibleRelation_H_ #define _nsAccessibleRelation_H_ #include "nsIAccessibleRelation.h" #include "nsCOMPtr.h" #include "nsIMutableArray.h" +namespace mozilla { +namespace a11y { + class Relation; /** * Class represents an accessible relation. */ class nsAccessibleRelation : public nsIAccessibleRelation { public: @@ -28,9 +31,12 @@ private: nsAccessibleRelation(); nsAccessibleRelation(const nsAccessibleRelation&); nsAccessibleRelation& operator = (const nsAccessibleRelation&); PRUint32 mType; nsCOMPtr<nsIMutableArray> mTargets; }; +} // namespace a11y +} // namespace mozilla + #endif
--- a/accessible/src/xpcom/xpcAccessibleTable.cpp +++ b/accessible/src/xpcom/xpcAccessibleTable.cpp @@ -140,16 +140,42 @@ xpcAccessibleTable::IsProbablyForLayout( if (!mTable) return NS_ERROR_FAILURE; *aResult = mTable->IsProbablyLayoutTable(); return NS_OK; } nsresult +xpcAccessibleTable::SelectColumn(PRInt32 aColIdx) +{ + if (!mTable) + return NS_ERROR_FAILURE; + + if (aColIdx < 0 || static_cast<PRUint32>(aColIdx) >= mTable->ColCount()) + return NS_ERROR_INVALID_ARG; + + mTable->SelectCol(aColIdx); + return NS_OK; +} + +nsresult +xpcAccessibleTable::SelectRow(PRInt32 aRowIdx) +{ + if (!mTable) + return NS_ERROR_FAILURE; + + if (aRowIdx < 0 || static_cast<PRUint32>(aRowIdx) >= mTable->RowCount()) + return NS_ERROR_INVALID_ARG; + + mTable->SelectRow(aRowIdx); + return NS_OK; +} + +nsresult xpcAccessibleTable::UnselectColumn(PRInt32 aColIdx) { if (!mTable) return NS_ERROR_FAILURE; if (aColIdx < 0 || aColIdx >= mTable->ColCount()) return NS_ERROR_INVALID_ARG;
--- a/accessible/src/xpcom/xpcAccessibleTable.h +++ b/accessible/src/xpcom/xpcAccessibleTable.h @@ -29,16 +29,18 @@ public: nsresult GetCellAt(PRInt32 aRowIndex, PRInt32 aColumnIndex, nsIAccessible** aCell); nsresult GetCellIndexAt(PRInt32 aRowIndex, PRInt32 aColumnIndex, PRInt32* aCellIndex); nsresult GetColumnExtentAt(PRInt32 row, PRInt32 column, PRInt32* aColumnExtent); nsresult GetRowExtentAt(PRInt32 row, PRInt32 column, PRInt32* aRowExtent); + nsresult SelectColumn(PRInt32 aColIdx); + nsresult SelectRow(PRInt32 aRowIdx); nsresult UnselectColumn(PRInt32 aColIdx); nsresult UnselectRow(PRInt32 aRowIdx); nsresult IsProbablyForLayout(bool* aIsForLayout); protected: mozilla::a11y::TableAccessible* mTable; }; @@ -69,18 +71,20 @@ protected: NS_SCRIPTABLE NS_IMETHOD IsCellSelected(PRInt32 rowIndex, PRInt32 columnIndex, bool *_retval NS_OUTPARAM); \ NS_SCRIPTABLE NS_IMETHOD GetSelectedCellCount(PRUint32 *aSelectedCellCount); \ NS_SCRIPTABLE NS_IMETHOD GetSelectedColumnCount(PRUint32 *aSelectedColumnCount); \ NS_SCRIPTABLE NS_IMETHOD GetSelectedRowCount(PRUint32 *aSelectedRowCount); \ NS_SCRIPTABLE NS_IMETHOD GetSelectedCells(nsIArray * *aSelectedCells); \ NS_SCRIPTABLE NS_IMETHOD GetSelectedCellIndices(PRUint32 *cellsArraySize NS_OUTPARAM, PRInt32 **cellsArray NS_OUTPARAM); \ NS_SCRIPTABLE NS_IMETHOD GetSelectedColumnIndices(PRUint32 *rowsArraySize NS_OUTPARAM, PRInt32 **rowsArray NS_OUTPARAM); \ NS_SCRIPTABLE NS_IMETHOD GetSelectedRowIndices(PRUint32 *rowsArraySize NS_OUTPARAM, PRInt32 **rowsArray NS_OUTPARAM); \ - NS_SCRIPTABLE NS_IMETHOD SelectRow(PRInt32 rowIndex); \ - NS_SCRIPTABLE NS_IMETHOD SelectColumn(PRInt32 columnIndex); \ + NS_SCRIPTABLE NS_IMETHOD SelectRow(PRInt32 aRowIdx) \ + { return xpcAccessibleTable::SelectRow(aRowIdx); } \ + NS_SCRIPTABLE NS_IMETHOD SelectColumn(PRInt32 aColIdx) \ + { return xpcAccessibleTable::SelectColumn(aColIdx); } \ NS_SCRIPTABLE NS_IMETHOD UnselectColumn(PRInt32 aColIdx) \ { return xpcAccessibleTable::UnselectColumn(aColIdx); } \ NS_IMETHOD UnselectRow(PRInt32 aRowIdx) \ { return xpcAccessibleTable::UnselectRow(aRowIdx); } \ NS_IMETHOD IsProbablyForLayout(bool* aResult) \ { return xpcAccessibleTable::IsProbablyForLayout(aResult); } \ #endif // MOZILLA_A11Y_XPCOM_XPACCESSIBLETABLE_H_
--- a/accessible/src/xul/Makefile.in +++ b/accessible/src/xul/Makefile.in @@ -12,28 +12,28 @@ include $(DEPTH)/config/autoconf.mk MODULE = accessibility LIBRARY_NAME = accessibility_xul_s LIBXUL_LIBRARY = 1 CPPSRCS = \ - XULSelectControlAccessible.cpp \ - nsXULAlertAccessible.cpp \ - nsXULColorPickerAccessible.cpp \ - nsXULComboboxAccessible.cpp \ + XULAlertAccessible.cpp \ + XULColorPickerAccessible.cpp \ + XULComboboxAccessible.cpp \ + XULElementAccessibles.cpp \ XULFormControlAccessible.cpp \ - nsXULListboxAccessible.cpp \ - nsXULMenuAccessible.cpp \ - nsXULSliderAccessible.cpp \ - nsXULTabAccessible.cpp \ - nsXULTextAccessible.cpp \ - nsXULTreeAccessible.cpp \ - nsXULTreeGridAccessible.cpp \ + XULListboxAccessible.cpp \ + XULMenuAccessible.cpp \ + XULSelectControlAccessible.cpp \ + XULSliderAccessible.cpp \ + XULTabAccessible.cpp \ + XULTreeAccessible.cpp \ + XULTreeGridAccessible.cpp \ $(NULL) # we don't want the shared lib, but we want to force the creation of a static lib. FORCE_STATIC_LIB = 1 include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES = \
rename from accessible/src/xul/nsXULAlertAccessible.cpp rename to accessible/src/xul/XULAlertAccessible.cpp --- a/accessible/src/xul/nsXULAlertAccessible.cpp +++ b/accessible/src/xul/XULAlertAccessible.cpp @@ -1,62 +1,62 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "nsXULAlertAccessible.h" +#include "XULAlertAccessible.h" #include "Role.h" #include "States.h" using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// -// nsXULAlertAccessible +// XULAlertAccessible //////////////////////////////////////////////////////////////////////////////// -nsXULAlertAccessible:: - nsXULAlertAccessible(nsIContent* aContent, DocAccessible* aDoc) : +XULAlertAccessible:: + XULAlertAccessible(nsIContent* aContent, DocAccessible* aDoc) : AccessibleWrap(aContent, aDoc) { } -NS_IMPL_ISUPPORTS_INHERITED0(nsXULAlertAccessible, Accessible) +NS_IMPL_ISUPPORTS_INHERITED0(XULAlertAccessible, Accessible) role -nsXULAlertAccessible::NativeRole() +XULAlertAccessible::NativeRole() { return roles::ALERT; } PRUint64 -nsXULAlertAccessible::NativeState() +XULAlertAccessible::NativeState() { return Accessible::NativeState() | states::ALERT; } ENameValueFlag -nsXULAlertAccessible::Name(nsString& aName) +XULAlertAccessible::Name(nsString& aName) { // Screen readers need to read contents of alert, not the accessible name. // If we have both some screen readers will read the alert twice. aName.Truncate(); return eNameOK; } //////////////////////////////////////////////////////////////////////////////// // Widgets bool -nsXULAlertAccessible::IsWidget() const +XULAlertAccessible::IsWidget() const { return true; } Accessible* -nsXULAlertAccessible::ContainerWidget() const +XULAlertAccessible::ContainerWidget() const { // If a part of colorpicker widget. if (mParent && mParent->IsMenuButton()) return mParent; return nsnull; }
rename from accessible/src/xul/nsXULAlertAccessible.h rename to accessible/src/xul/XULAlertAccessible.h --- a/accessible/src/xul/nsXULAlertAccessible.h +++ b/accessible/src/xul/XULAlertAccessible.h @@ -1,32 +1,38 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef _nsXULAlertAccessible_H_ -#define _nsXULAlertAccessible_H_ +#ifndef mozilla_a11y_XULAlertAccessible_h__ +#define mozilla_a11y_XULAlertAccessible_h__ #include "AccessibleWrap.h" +namespace mozilla { +namespace a11y { + /** * Accessible for supporting XUL alerts. */ -class nsXULAlertAccessible : public AccessibleWrap +class XULAlertAccessible : public AccessibleWrap { public: - nsXULAlertAccessible(nsIContent* aContent, DocAccessible* aDoc); + XULAlertAccessible(nsIContent* aContent, DocAccessible* aDoc); NS_DECL_ISUPPORTS_INHERITED // Accessible virtual mozilla::a11y::ENameValueFlag Name(nsString& aName); - virtual mozilla::a11y::role NativeRole(); + virtual a11y::role NativeRole(); virtual PRUint64 NativeState(); // Widgets virtual bool IsWidget() const; virtual Accessible* ContainerWidget() const; }; +} // namespace a11y +} // namespace mozilla + #endif
rename from accessible/src/xul/nsXULColorPickerAccessible.cpp rename to accessible/src/xul/XULColorPickerAccessible.cpp --- a/accessible/src/xul/nsXULColorPickerAccessible.cpp +++ b/accessible/src/xul/XULColorPickerAccessible.cpp @@ -1,148 +1,148 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "nsXULColorPickerAccessible.h" +#include "XULColorPickerAccessible.h" #include "Accessible-inl.h" #include "nsAccUtils.h" #include "nsAccTreeWalker.h" #include "nsCoreUtils.h" #include "DocAccessible.h" #include "Role.h" #include "States.h" #include "nsIDOMElement.h" #include "nsMenuPopupFrame.h" using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// -// nsXULColorPickerTileAccessible +// XULColorPickerTileAccessible //////////////////////////////////////////////////////////////////////////////// -nsXULColorPickerTileAccessible:: - nsXULColorPickerTileAccessible(nsIContent* aContent, DocAccessible* aDoc) : +XULColorPickerTileAccessible:: + XULColorPickerTileAccessible(nsIContent* aContent, DocAccessible* aDoc) : AccessibleWrap(aContent, aDoc) { } //////////////////////////////////////////////////////////////////////////////// -// nsXULColorPickerTileAccessible: nsIAccessible +// XULColorPickerTileAccessible: nsIAccessible void -nsXULColorPickerTileAccessible::Value(nsString& aValue) +XULColorPickerTileAccessible::Value(nsString& aValue) { aValue.Truncate(); mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::color, aValue); } //////////////////////////////////////////////////////////////////////////////// -// nsXULColorPickerTileAccessible: Accessible +// XULColorPickerTileAccessible: Accessible role -nsXULColorPickerTileAccessible::NativeRole() +XULColorPickerTileAccessible::NativeRole() { return roles::PUSHBUTTON; } PRUint64 -nsXULColorPickerTileAccessible::NativeState() +XULColorPickerTileAccessible::NativeState() { PRUint64 state = AccessibleWrap::NativeState(); if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::selected)) state |= states::SELECTED; return state; } PRUint64 -nsXULColorPickerTileAccessible::NativeInteractiveState() const +XULColorPickerTileAccessible::NativeInteractiveState() const { return NativelyUnavailable() ? states::UNAVAILABLE : states::FOCUSABLE | states::SELECTABLE; } //////////////////////////////////////////////////////////////////////////////// -// nsXULColorPickerTileAccessible: Widgets +// XULColorPickerTileAccessible: Widgets Accessible* -nsXULColorPickerTileAccessible::ContainerWidget() const +XULColorPickerTileAccessible::ContainerWidget() const { Accessible* parent = Parent(); if (parent) { Accessible* grandParent = parent->Parent(); if (grandParent && grandParent->IsMenuButton()) return grandParent; } return nsnull; } //////////////////////////////////////////////////////////////////////////////// -// nsXULColorPickerAccessible +// XULColorPickerAccessible //////////////////////////////////////////////////////////////////////////////// -nsXULColorPickerAccessible:: - nsXULColorPickerAccessible(nsIContent* aContent, DocAccessible* aDoc) : - nsXULColorPickerTileAccessible(aContent, aDoc) +XULColorPickerAccessible:: + XULColorPickerAccessible(nsIContent* aContent, DocAccessible* aDoc) : + XULColorPickerTileAccessible(aContent, aDoc) { mFlags |= eMenuButtonAccessible; } //////////////////////////////////////////////////////////////////////////////// -// nsXULColorPickerAccessible: Accessible +// XULColorPickerAccessible: Accessible PRUint64 -nsXULColorPickerAccessible::NativeState() +XULColorPickerAccessible::NativeState() { PRUint64 state = AccessibleWrap::NativeState(); return state | states::HASPOPUP; } role -nsXULColorPickerAccessible::NativeRole() +XULColorPickerAccessible::NativeRole() { return roles::BUTTONDROPDOWNGRID; } //////////////////////////////////////////////////////////////////////////////// -// nsXULColorPickerAccessible: Widgets +// XULColorPickerAccessible: Widgets bool -nsXULColorPickerAccessible::IsWidget() const +XULColorPickerAccessible::IsWidget() const { return true; } bool -nsXULColorPickerAccessible::IsActiveWidget() const +XULColorPickerAccessible::IsActiveWidget() const { return FocusMgr()->HasDOMFocus(mContent); } bool -nsXULColorPickerAccessible::AreItemsOperable() const +XULColorPickerAccessible::AreItemsOperable() const { Accessible* menuPopup = mChildren.SafeElementAt(0, nsnull); if (menuPopup) { nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(menuPopup->GetFrame()); return menuPopupFrame && menuPopupFrame->IsOpen(); } return false; } //////////////////////////////////////////////////////////////////////////////// -// nsXULColorPickerAccessible: protected Accessible +// XULColorPickerAccessible: protected Accessible void -nsXULColorPickerAccessible::CacheChildren() +XULColorPickerAccessible::CacheChildren() { NS_ENSURE_TRUE(mDoc,); nsAccTreeWalker walker(mDoc, mContent, true); Accessible* child = nsnull; while ((child = walker.NextChild())) { PRUint32 role = child->Role();
rename from accessible/src/xul/nsXULColorPickerAccessible.h rename to accessible/src/xul/XULColorPickerAccessible.h --- a/accessible/src/xul/nsXULColorPickerAccessible.h +++ b/accessible/src/xul/XULColorPickerAccessible.h @@ -1,54 +1,60 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef _nsXULColorPickerAccessible_H_ -#define _nsXULColorPickerAccessible_H_ +#ifndef mozilla_a11y_XULColorPickerAccessible_h__ +#define mozilla_a11y_XULColorPickerAccessible_h__ #include "AccessibleWrap.h" +namespace mozilla { +namespace a11y { + /** * Used for color button in colorpicker palette. */ -class nsXULColorPickerTileAccessible : public AccessibleWrap +class XULColorPickerTileAccessible : public AccessibleWrap { public: - nsXULColorPickerTileAccessible(nsIContent* aContent, - DocAccessible* aDoc); + XULColorPickerTileAccessible(nsIContent* aContent, + DocAccessible* aDoc); // Accessible virtual void Value(nsString& aValue); - virtual mozilla::a11y::role NativeRole(); + virtual a11y::role NativeRole(); virtual PRUint64 NativeState(); virtual PRUint64 NativeInteractiveState() const; // Widgets virtual Accessible* ContainerWidget() const; }; /** * Used for colorpicker button (xul:colorpicker@type="button"). */ -class nsXULColorPickerAccessible : public nsXULColorPickerTileAccessible +class XULColorPickerAccessible : public XULColorPickerTileAccessible { public: - nsXULColorPickerAccessible(nsIContent* aContent, DocAccessible* aDoc); + XULColorPickerAccessible(nsIContent* aContent, DocAccessible* aDoc); // Accessible - virtual mozilla::a11y::role NativeRole(); + virtual a11y::role NativeRole(); virtual PRUint64 NativeState(); // Widgets virtual bool IsWidget() const; virtual bool IsActiveWidget() const; virtual bool AreItemsOperable() const; protected: // Accessible virtual void CacheChildren(); }; +} // namespace a11y +} // namespace mozilla + #endif
rename from accessible/src/xul/nsXULComboboxAccessible.cpp rename to accessible/src/xul/XULComboboxAccessible.cpp --- a/accessible/src/xul/nsXULComboboxAccessible.cpp +++ b/accessible/src/xul/XULComboboxAccessible.cpp @@ -1,51 +1,51 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "nsXULComboboxAccessible.h" +#include "XULComboboxAccessible.h" #include "Accessible-inl.h" #include "nsAccessibilityService.h" #include "DocAccessible.h" #include "nsCoreUtils.h" #include "Role.h" #include "States.h" #include "nsIAutoCompleteInput.h" #include "nsIDOMXULMenuListElement.h" #include "nsIDOMXULSelectCntrlItemEl.h" using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// -// nsXULComboboxAccessible +// XULComboboxAccessible //////////////////////////////////////////////////////////////////////////////// -nsXULComboboxAccessible:: - nsXULComboboxAccessible(nsIContent* aContent, DocAccessible* aDoc) : +XULComboboxAccessible:: + XULComboboxAccessible(nsIContent* aContent, DocAccessible* aDoc) : AccessibleWrap(aContent, aDoc) { if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type, nsGkAtoms::autocomplete, eIgnoreCase)) mFlags |= eAutoCompleteAccessible; else mFlags |= eComboboxAccessible; } role -nsXULComboboxAccessible::NativeRole() +XULComboboxAccessible::NativeRole() { return IsAutoComplete() ? roles::AUTOCOMPLETE : roles::COMBOBOX; } PRUint64 -nsXULComboboxAccessible::NativeState() +XULComboboxAccessible::NativeState() { // As a nsComboboxAccessible we can have the following states: // STATE_FOCUSED // STATE_FOCUSABLE // STATE_HASPOPUP // STATE_EXPANDED // STATE_COLLAPSED @@ -61,17 +61,17 @@ nsXULComboboxAccessible::NativeState() else state |= states::COLLAPSED; } return state | states::HASPOPUP; } void -nsXULComboboxAccessible::Description(nsString& aDescription) +XULComboboxAccessible::Description(nsString& aDescription) { aDescription.Truncate(); // Use description of currently focused option nsCOMPtr<nsIDOMXULMenuListElement> menuListElm(do_QueryInterface(mContent)); if (!menuListElm) return; nsCOMPtr<nsIDOMXULSelectControlItemElement> focusedOptionItem; @@ -81,53 +81,54 @@ nsXULComboboxAccessible::Description(nsS if (focusedOptionContent && mDoc) { Accessible* focusedOptionAcc = mDoc->GetAccessible(focusedOptionContent); if (focusedOptionAcc) focusedOptionAcc->Description(aDescription); } } void -nsXULComboboxAccessible::Value(nsString& aValue) +XULComboboxAccessible::Value(nsString& aValue) { aValue.Truncate(); // The value is the option or text shown entered in the combobox. nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mContent)); if (menuList) menuList->GetLabel(aValue); } bool -nsXULComboboxAccessible::CanHaveAnonChildren() +XULComboboxAccessible::CanHaveAnonChildren() { if (mContent->NodeInfo()->Equals(nsGkAtoms::textbox, kNameSpaceID_XUL) || mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::editable, nsGkAtoms::_true, eIgnoreCase)) { // Both the XUL <textbox type="autocomplete"> and <menulist editable="true"> widgets - // use nsXULComboboxAccessible. We need to walk the anonymous children for these + // use XULComboboxAccessible. We need to walk the anonymous children for these // so that the entry field is a child return true; } // Argument of false indicates we don't walk anonymous children for // menuitems return false; } + PRUint8 -nsXULComboboxAccessible::ActionCount() +XULComboboxAccessible::ActionCount() { // Just one action (click). return 1; } NS_IMETHODIMP -nsXULComboboxAccessible::DoAction(PRUint8 aIndex) +XULComboboxAccessible::DoAction(PRUint8 aIndex) { - if (aIndex != nsXULComboboxAccessible::eAction_Click) { + if (aIndex != XULComboboxAccessible::eAction_Click) { return NS_ERROR_INVALID_ARG; } if (IsDefunct()) return NS_ERROR_FAILURE; // Programmaticaly toggle the combo box. nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mContent)); @@ -135,19 +136,19 @@ nsXULComboboxAccessible::DoAction(PRUint return NS_ERROR_FAILURE; } bool isDroppedDown; menuList->GetOpen(&isDroppedDown); return menuList->SetOpen(!isDroppedDown); } NS_IMETHODIMP -nsXULComboboxAccessible::GetActionName(PRUint8 aIndex, nsAString& aName) +XULComboboxAccessible::GetActionName(PRUint8 aIndex, nsAString& aName) { - if (aIndex != nsXULComboboxAccessible::eAction_Click) { + if (aIndex != XULComboboxAccessible::eAction_Click) { return NS_ERROR_INVALID_ARG; } if (IsDefunct()) return NS_ERROR_FAILURE; // Our action name is the reverse of our state: // if we are close -> open is our name. @@ -167,17 +168,17 @@ nsXULComboboxAccessible::GetActionName(P return NS_OK; } //////////////////////////////////////////////////////////////////////////////// // Widgets bool -nsXULComboboxAccessible::IsActiveWidget() const +XULComboboxAccessible::IsActiveWidget() const { if (IsAutoComplete() || mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::editable, nsGkAtoms::_true, eIgnoreCase)) { PRInt32 childCount = mChildren.Length(); for (PRInt32 idx = 0; idx < childCount; idx++) { Accessible* child = mChildren[idx]; if (child->Role() == roles::ENTRY) @@ -185,17 +186,17 @@ nsXULComboboxAccessible::IsActiveWidget( } return false; } return FocusMgr()->HasDOMFocus(mContent); } bool -nsXULComboboxAccessible::AreItemsOperable() const +XULComboboxAccessible::AreItemsOperable() const { if (IsAutoComplete()) { nsCOMPtr<nsIAutoCompleteInput> autoCompleteInputElm = do_QueryInterface(mContent); if (autoCompleteInputElm) { bool isOpen = false; autoCompleteInputElm->GetPopupOpen(&isOpen); return isOpen;
rename from accessible/src/xul/nsXULComboboxAccessible.h rename to accessible/src/xul/XULComboboxAccessible.h --- a/accessible/src/xul/nsXULComboboxAccessible.h +++ b/accessible/src/xul/XULComboboxAccessible.h @@ -1,40 +1,46 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef __nsXULComboboxAccessible_h__ -#define __nsXULComboboxAccessible_h__ +#ifndef mozilla_a11y_XULComboboxAccessible_h__ +#define mozilla_a11y_XULComboboxAccessible_h__ -#include "nsXULMenuAccessible.h" +#include "XULMenuAccessible.h" + +namespace mozilla { +namespace a11y { /** * Used for XUL comboboxes like xul:menulist and autocomplete textbox. */ -class nsXULComboboxAccessible : public AccessibleWrap +class XULComboboxAccessible : public AccessibleWrap { public: enum { eAction_Click = 0 }; - nsXULComboboxAccessible(nsIContent* aContent, DocAccessible* aDoc); + XULComboboxAccessible(nsIContent* aContent, DocAccessible* aDoc); // nsIAccessible NS_IMETHOD DoAction(PRUint8 aIndex); NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName); // Accessible virtual void Description(nsString& aDescription); virtual void Value(nsString& aValue); - virtual mozilla::a11y::role NativeRole(); + virtual a11y::role NativeRole(); virtual PRUint64 NativeState(); virtual bool CanHaveAnonChildren(); // ActionAccessible virtual PRUint8 ActionCount(); // Widgets virtual bool IsActiveWidget() const; virtual bool AreItemsOperable() const; }; +} // namespace a11y +} // namespace mozilla + #endif
rename from accessible/src/xul/nsXULTextAccessible.cpp rename to accessible/src/xul/XULElementAccessibles.cpp --- a/accessible/src/xul/nsXULTextAccessible.cpp +++ b/accessible/src/xul/XULElementAccessibles.cpp @@ -1,15 +1,14 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -// NOTE: groups are alphabetically ordered -#include "nsXULTextAccessible.h" +#include "XULElementAccessibles.h" #include "Accessible-inl.h" #include "BaseAccessibles.h" #include "nsAccUtils.h" #include "nsCoreUtils.h" #include "nsTextEquivUtils.h" #include "Relation.h" #include "Role.h" @@ -19,50 +18,50 @@ #include "nsIDOMXULDescriptionElement.h" #include "nsINameSpaceManager.h" #include "nsString.h" #include "nsNetUtil.h" using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// -// nsXULTextAccessible +// XULLabelAccessible //////////////////////////////////////////////////////////////////////////////// -nsXULTextAccessible:: - nsXULTextAccessible(nsIContent* aContent, DocAccessible* aDoc) : +XULLabelAccessible:: + XULLabelAccessible(nsIContent* aContent, DocAccessible* aDoc) : HyperTextAccessibleWrap(aContent, aDoc) { } nsresult -nsXULTextAccessible::GetNameInternal(nsAString& aName) +XULLabelAccessible::GetNameInternal(nsAString& aName) { // if the value attr doesn't exist, the screen reader must get the accessible text // from the accessible text interface or from the children mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::value, aName); return NS_OK; } role -nsXULTextAccessible::NativeRole() +XULLabelAccessible::NativeRole() { return roles::LABEL; } PRUint64 -nsXULTextAccessible::NativeState() +XULLabelAccessible::NativeState() { // Labels and description have read only state // They are not focusable or selectable return HyperTextAccessibleWrap::NativeState() | states::READONLY; } Relation -nsXULTextAccessible::RelationByType(PRUint32 aType) +XULLabelAccessible::RelationByType(PRUint32 aType) { Relation rel = HyperTextAccessibleWrap::RelationByType(aType); if (aType == nsIAccessibleRelation::RELATION_LABEL_FOR) { // Caption is the label for groupbox nsIContent *parent = mContent->GetParent(); if (parent && parent->Tag() == nsGkAtoms::caption) { Accessible* parent = Parent(); if (parent && parent->Role() == roles::GROUPING) @@ -70,150 +69,150 @@ nsXULTextAccessible::RelationByType(PRUi } } return rel; } //////////////////////////////////////////////////////////////////////////////// -// nsXULTooltipAccessible +// XULTooltipAccessible //////////////////////////////////////////////////////////////////////////////// -nsXULTooltipAccessible:: - nsXULTooltipAccessible(nsIContent* aContent, DocAccessible* aDoc) : +XULTooltipAccessible:: + XULTooltipAccessible(nsIContent* aContent, DocAccessible* aDoc) : LeafAccessible(aContent, aDoc) { } PRUint64 -nsXULTooltipAccessible::NativeState() +XULTooltipAccessible::NativeState() { return LeafAccessible::NativeState() | states::READONLY; } role -nsXULTooltipAccessible::NativeRole() +XULTooltipAccessible::NativeRole() { return roles::TOOLTIP; } //////////////////////////////////////////////////////////////////////////////// -// nsXULLinkAccessible +// XULLinkAccessible //////////////////////////////////////////////////////////////////////////////// -nsXULLinkAccessible:: - nsXULLinkAccessible(nsIContent* aContent, DocAccessible* aDoc) : +XULLinkAccessible:: + XULLinkAccessible(nsIContent* aContent, DocAccessible* aDoc) : HyperTextAccessibleWrap(aContent, aDoc) { } // Expose nsIAccessibleHyperLink unconditionally -NS_IMPL_ISUPPORTS_INHERITED1(nsXULLinkAccessible, HyperTextAccessibleWrap, +NS_IMPL_ISUPPORTS_INHERITED1(XULLinkAccessible, HyperTextAccessibleWrap, nsIAccessibleHyperLink) //////////////////////////////////////////////////////////////////////////////// -// nsXULLinkAccessible. nsIAccessible +// XULLinkAccessible. nsIAccessible void -nsXULLinkAccessible::Value(nsString& aValue) +XULLinkAccessible::Value(nsString& aValue) { aValue.Truncate(); mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::href, aValue); } nsresult -nsXULLinkAccessible::GetNameInternal(nsAString& aName) +XULLinkAccessible::GetNameInternal(nsAString& aName) { mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::value, aName); if (!aName.IsEmpty()) return NS_OK; return nsTextEquivUtils::GetNameFromSubtree(this, aName); } role -nsXULLinkAccessible::NativeRole() +XULLinkAccessible::NativeRole() { return roles::LINK; } PRUint64 -nsXULLinkAccessible::NativeLinkState() const +XULLinkAccessible::NativeLinkState() const { return states::LINKED; } PRUint8 -nsXULLinkAccessible::ActionCount() +XULLinkAccessible::ActionCount() { return 1; } NS_IMETHODIMP -nsXULLinkAccessible::GetActionName(PRUint8 aIndex, nsAString& aName) +XULLinkAccessible::GetActionName(PRUint8 aIndex, nsAString& aName) { aName.Truncate(); if (aIndex != eAction_Jump) return NS_ERROR_INVALID_ARG; - + aName.AssignLiteral("jump"); return NS_OK; } NS_IMETHODIMP -nsXULLinkAccessible::DoAction(PRUint8 aIndex) +XULLinkAccessible::DoAction(PRUint8 aIndex) { if (aIndex != eAction_Jump) return NS_ERROR_INVALID_ARG; if (IsDefunct()) return NS_ERROR_FAILURE; DoCommand(); return NS_OK; } //////////////////////////////////////////////////////////////////////////////// -// nsXULLinkAccessible: HyperLinkAccessible +// XULLinkAccessible: HyperLinkAccessible bool -nsXULLinkAccessible::IsLink() +XULLinkAccessible::IsLink() { // Expose HyperLinkAccessible unconditionally. return true; } PRUint32 -nsXULLinkAccessible::StartOffset() +XULLinkAccessible::StartOffset() { // If XUL link accessible is not contained by hypertext accessible then // start offset matches index in parent because the parent doesn't contains // a text. // XXX: accessible parent of XUL link accessible should be a hypertext // accessible. if (Accessible::IsLink()) return Accessible::StartOffset(); return IndexInParent(); } PRUint32 -nsXULLinkAccessible::EndOffset() +XULLinkAccessible::EndOffset() { if (Accessible::IsLink()) return Accessible::EndOffset(); return IndexInParent() + 1; } already_AddRefed<nsIURI> -nsXULLinkAccessible::AnchorURIAt(PRUint32 aAnchorIndex) +XULLinkAccessible::AnchorURIAt(PRUint32 aAnchorIndex) { if (aAnchorIndex != 0) return nsnull; nsAutoString href; mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::href, href); nsCOMPtr<nsIURI> baseURI = mContent->GetBaseURI();
rename from accessible/src/xul/nsXULTextAccessible.h rename to accessible/src/xul/XULElementAccessibles.h --- a/accessible/src/xul/nsXULTextAccessible.h +++ b/accessible/src/xul/XULElementAccessibles.h @@ -1,73 +1,79 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef _nsXULTextAccessible_H_ -#define _nsXULTextAccessible_H_ +#ifndef mozilla_a11y_XULElementAccessibles_h__ +#define mozilla_a11y_XULElementAccessibles_h__ #include "BaseAccessibles.h" #include "HyperTextAccessibleWrap.h" +namespace mozilla { +namespace a11y { + /** * Used for XUL description and label elements. */ -class nsXULTextAccessible : public HyperTextAccessibleWrap +class XULLabelAccessible : public HyperTextAccessibleWrap { public: - nsXULTextAccessible(nsIContent* aContent, DocAccessible* aDoc); + XULLabelAccessible(nsIContent* aContent, DocAccessible* aDoc); // Accessible virtual nsresult GetNameInternal(nsAString& aName); - virtual mozilla::a11y::role NativeRole(); + virtual a11y::role NativeRole(); virtual PRUint64 NativeState(); virtual Relation RelationByType(PRUint32 aRelationType); }; /** * Used for XUL tooltip element. */ -class nsXULTooltipAccessible : public mozilla::a11y::LeafAccessible +class XULTooltipAccessible : public LeafAccessible { public: - nsXULTooltipAccessible(nsIContent* aContent, DocAccessible* aDoc); + XULTooltipAccessible(nsIContent* aContent, DocAccessible* aDoc); // Accessible - virtual mozilla::a11y::role NativeRole(); + virtual a11y::role NativeRole(); virtual PRUint64 NativeState(); }; -class nsXULLinkAccessible : public HyperTextAccessibleWrap +class XULLinkAccessible : public HyperTextAccessibleWrap { public: - nsXULLinkAccessible(nsIContent* aContent, DocAccessible* aDoc); + XULLinkAccessible(nsIContent* aContent, DocAccessible* aDoc); NS_DECL_ISUPPORTS_INHERITED // nsIAccessible NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName); NS_IMETHOD DoAction(PRUint8 aIndex); // Accessible virtual void Value(nsString& aValue); virtual nsresult GetNameInternal(nsAString& aName); - virtual mozilla::a11y::role NativeRole(); + virtual a11y::role NativeRole(); virtual PRUint64 NativeLinkState() const; // ActionAccessible virtual PRUint8 ActionCount(); // HyperLinkAccessible virtual bool IsLink(); virtual PRUint32 StartOffset(); virtual PRUint32 EndOffset(); virtual already_AddRefed<nsIURI> AnchorURIAt(PRUint32 aAnchorIndex); protected: enum { eAction_Jump = 0 }; }; -#endif +} // namespace a11y +} // namespace mozilla + +#endif
--- a/accessible/src/xul/XULFormControlAccessible.cpp +++ b/accessible/src/xul/XULFormControlAccessible.cpp @@ -7,20 +7,20 @@ #include "Accessible-inl.h" #include "HTMLFormControlAccessible.h" #include "nsAccUtils.h" #include "nsAccTreeWalker.h" #include "nsCoreUtils.h" #include "DocAccessible.h" #include "nsIAccessibleRelation.h" -#include "nsXULMenuAccessible.h" #include "Relation.h" #include "Role.h" #include "States.h" +#include "XULMenuAccessible.h" #include "nsIDOMHTMLInputElement.h" #include "nsIDOMNSEditableElement.h" #include "nsIDOMXULButtonElement.h" #include "nsIDOMXULCheckboxElement.h" #include "nsIDOMXULMenuListElement.h" #include "nsIDOMXULSelectCntrlItemEl.h" #include "nsIDOMXULTextboxElement.h"
new file mode 100644 --- /dev/null +++ b/accessible/src/xul/XULListboxAccessible.cpp @@ -0,0 +1,1163 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "XULListboxAccessible.h" + +#include "Accessible-inl.h" +#include "nsAccessibilityService.h" +#include "nsAccUtils.h" +#include "DocAccessible.h" +#include "Role.h" +#include "States.h" + +#include "nsComponentManagerUtils.h" +#include "nsIAutoCompleteInput.h" +#include "nsIAutoCompletePopup.h" +#include "nsIDOMXULMenuListElement.h" +#include "nsIDOMXULMultSelectCntrlEl.h" +#include "nsIDOMNodeList.h" +#include "nsIDOMXULPopupElement.h" +#include "nsIDOMXULSelectCntrlItemEl.h" + +using namespace mozilla::a11y; + +//////////////////////////////////////////////////////////////////////////////// +// XULColumAccessible +//////////////////////////////////////////////////////////////////////////////// + +XULColumAccessible:: + XULColumAccessible(nsIContent* aContent, DocAccessible* aDoc) : + AccessibleWrap(aContent, aDoc) +{ +} + +role +XULColumAccessible::NativeRole() +{ + return roles::LIST; +} + +PRUint64 +XULColumAccessible::NativeState() +{ + return states::READONLY; +} + + +//////////////////////////////////////////////////////////////////////////////// +// XULColumnItemAccessible +//////////////////////////////////////////////////////////////////////////////// + +XULColumnItemAccessible:: + XULColumnItemAccessible(nsIContent* aContent, DocAccessible* aDoc) : + LeafAccessible(aContent, aDoc) +{ +} + +role +XULColumnItemAccessible::NativeRole() +{ + return roles::COLUMNHEADER; +} + +PRUint64 +XULColumnItemAccessible::NativeState() +{ + return states::READONLY; +} + +PRUint8 +XULColumnItemAccessible::ActionCount() +{ + return 1; +} + +NS_IMETHODIMP +XULColumnItemAccessible::GetActionName(PRUint8 aIndex, nsAString& aName) +{ + if (aIndex != eAction_Click) + return NS_ERROR_INVALID_ARG; + + aName.AssignLiteral("click"); + return NS_OK; +} + +NS_IMETHODIMP +XULColumnItemAccessible::DoAction(PRUint8 aIndex) +{ + if (aIndex != eAction_Click) + return NS_ERROR_INVALID_ARG; + + DoCommand(); + return NS_OK; +} + +//////////////////////////////////////////////////////////////////////////////// +// XULListboxAccessible +//////////////////////////////////////////////////////////////////////////////// + +XULListboxAccessible:: + XULListboxAccessible(nsIContent* aContent, DocAccessible* aDoc) : + XULSelectControlAccessible(aContent, aDoc), xpcAccessibleTable(this) +{ + nsIContent* parentContent = mContent->GetParent(); + if (parentContent) { + nsCOMPtr<nsIAutoCompletePopup> autoCompletePopupElm = + do_QueryInterface(parentContent); + if (autoCompletePopupElm) + mFlags |= eAutoCompletePopupAccessible; + } +} + +NS_IMPL_ADDREF_INHERITED(XULListboxAccessible, XULSelectControlAccessible) +NS_IMPL_RELEASE_INHERITED(XULListboxAccessible, XULSelectControlAccessible) + +nsresult +XULListboxAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + nsresult rv = XULSelectControlAccessible::QueryInterface(aIID, aInstancePtr); + if (*aInstancePtr) + return rv; + + if (aIID.Equals(NS_GET_IID(nsIAccessibleTable)) && IsMulticolumn()) { + *aInstancePtr = static_cast<nsIAccessibleTable*>(this); + NS_ADDREF_THIS(); + return NS_OK; + } + + return NS_ERROR_NO_INTERFACE; +} + +//////////////////////////////////////////////////////////////////////////////// +//nsAccessNode + +void +XULListboxAccessible::Shutdown() +{ + mTable = nsnull; + XULSelectControlAccessible::Shutdown(); +} + +bool +XULListboxAccessible::IsMulticolumn() +{ + PRInt32 numColumns = 0; + nsresult rv = GetColumnCount(&numColumns); + if (NS_FAILED(rv)) + return false; + + return numColumns > 1; +} + +//////////////////////////////////////////////////////////////////////////////// +// XULListboxAccessible. nsIAccessible + +PRUint64 +XULListboxAccessible::NativeState() +{ + // As a XULListboxAccessible we can have the following states: + // FOCUSED, READONLY, FOCUSABLE + + // Get focus status from base class + PRUint64 states = Accessible::NativeState(); + + // see if we are multiple select if so set ourselves as such + + if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::seltype, + nsGkAtoms::multiple, eCaseMatters)) { + states |= states::MULTISELECTABLE | states::EXTSELECTABLE; + } + + return states; +} + +/** + * Our value is the label of our ( first ) selected child. + */ +void +XULListboxAccessible::Value(nsString& aValue)