author | Ryan VanderMeulen <ryanvm@gmail.com> |
Sun, 10 Jun 2012 19:44:50 -0400 | |
changeset 101616 | b7f3236f127b6f8d455efa6ad75f82a3a3c5f3d4 |
parent 101615 | c39d36167b99139c4e39c2180f21cebae7ea6dbd |
child 101617 | 17a91ff5dfd7ea94076b5454dbd4a79032731a40 |
push id | 191 |
push user | lsblakk@mozilla.com |
push date | Fri, 05 Oct 2012 17:12:53 +0000 |
treeherder | mozilla-release@ddb22ac6c03b [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;
new file mode 100644 --- /dev/null +++ b/accessible/src/atk/HTMLTableAccessibleWrap.h @@ -0,0 +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 mozilla_a11y_HTMLTableAccessibleWrap_h__ +#define mozilla_a11y_HTMLTableAccessibleWrap_h__ + +#include "HTMLTableAccessible.h" + +namespace mozilla { +namespace a11y { + +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/atk/XULListboxAccessibleWrap.h @@ -0,0 +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 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
new file mode 100644 --- /dev/null +++ b/accessible/src/atk/XULMenuAccessibleWrap.h @@ -0,0 +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 mozilla_a11y_XULMenuAccessibleWrap_h__ +#define mozilla_a11y_XULMenuAccessibleWrap_h__ + +#include "XULMenuAccessible.h" + +namespace mozilla { +namespace a11y { + +typedef class XULMenuitemAccessible XULMenuitemAccessibleWrap; + +} // namespace a11y +} // namespace mozilla + +#endif
new file mode 100644 --- /dev/null +++ b/accessible/src/atk/XULTreeGridAccessibleWrap.h @@ -0,0 +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 mozilla_a11y_XULTreeGridAccessibleWrap_h__ +#define mozilla_a11y_XULTreeGridAccessibleWrap_h__ + +#include "XULTreeGridAccessible.h" + +namespace mozilla { +namespace a11y { + +typedef class XULTreeGridAccessible XULTreeGridAccessibleWrap; +typedef class XULTreeGridCellAccessible XULTreeGridCellAccessibleWrap; + +} // namespace a11y +} // namespace mozilla + +#endif +
deleted file mode 100644 --- a/accessible/src/atk/nsHTMLTableAccessibleWrap.h +++ /dev/null @@ -1,17 +0,0 @@ -/* -*- 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 - -#include "nsHTMLTableAccessible.h" - -typedef class nsHTMLTableAccessible nsHTMLTableAccessibleWrap; -typedef class nsHTMLTableCellAccessible nsHTMLTableCellAccessibleWrap; -typedef class nsHTMLTableHeaderCellAccessible nsHTMLTableHeaderCellAccessibleWrap; - -#endif -
deleted file mode 100644 --- a/accessible/src/atk/nsXULListboxAccessibleWrap.h +++ /dev/null @@ -1,15 +0,0 @@ -/* -*- 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__ - -#include "nsXULListboxAccessible.h" - -typedef class nsXULListboxAccessible nsXULListboxAccessibleWrap; -typedef class nsXULListCellAccessible nsXULListCellAccessibleWrap; - -#endif
deleted file mode 100644 --- a/accessible/src/atk/nsXULMenuAccessibleWrap.h +++ /dev/null @@ -1,14 +0,0 @@ -/* -*- 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__ - -#include "nsXULMenuAccessible.h" - -typedef class nsXULMenuitemAccessible nsXULMenuitemAccessibleWrap; - -#endif
deleted file mode 100644 --- a/accessible/src/atk/nsXULTreeGridAccessibleWrap.h +++ /dev/null @@ -1,16 +0,0 @@ -/* -*- 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__ - -#include "nsXULTreeGridAccessible.h" - -typedef class nsXULTreeGridAccessible nsXULTreeGridAccessibleWrap; -typedef class nsXULTreeGridCellAccessible nsXULTreeGridCellAccessibleWrap; - -#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/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.