--- 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(45600c50-b06a-11e1-afa6-0800200c9a66)]
+[scriptable, uuid(45ce2c92-4d92-49d2-bff1-855934443261)]
interface nsIAccessible : nsISupports
{
/**
* Parent node in accessible tree.
*/
readonly attribute nsIAccessible parent;
/**
@@ -110,23 +110,31 @@ 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 accessKey;
+ readonly attribute AString keyboardShortcut;
/**
* Provides localized string of global keyboard accelerator for default
* action, such as Ctrl+O for Open file
*/
- readonly attribute AString keyboardShortcut;
+ 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);
/**
* 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;
deleted file mode 100644
--- a/accessible/src/atk/HTMLTableAccessibleWrap.h
+++ /dev/null
@@ -1,23 +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 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
-
deleted file mode 100644
--- a/accessible/src/atk/XULListboxAccessibleWrap.h
+++ /dev/null
@@ -1,21 +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 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
deleted file mode 100644
--- a/accessible/src/atk/XULMenuAccessibleWrap.h
+++ /dev/null
@@ -1,20 +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 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
deleted file mode 100644
--- a/accessible/src/atk/XULTreeGridAccessibleWrap.h
+++ /dev/null
@@ -1,22 +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 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
-
new file mode 100644
--- /dev/null
+++ b/accessible/src/atk/nsHTMLTableAccessibleWrap.h
@@ -0,0 +1,17 @@
+/* -*- 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
+
new file mode 100644
--- /dev/null
+++ b/accessible/src/atk/nsXULListboxAccessibleWrap.h
@@ -0,0 +1,15 @@
+/* -*- 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
new file mode 100644
--- /dev/null
+++ b/accessible/src/atk/nsXULMenuAccessibleWrap.h
@@ -0,0 +1,14 @@
+/* -*- 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
new file mode 100644
--- /dev/null
+++ b/accessible/src/atk/nsXULTreeGridAccessibleWrap.h
@@ -0,0 +1,16 @@
+/* -*- 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,35 +96,31 @@ 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);
@@ -143,20 +139,24 @@ 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(currAcc)) {
+ if (!textAttr->Equal(currElm)) {
offsetFound = true;
break;
}
}
if (offsetFound)
break;
@@ -165,23 +165,27 @@ 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(currAcc)) {
+ if (!textAttr->Equal(currElm)) {
offsetFound = true;
break;
}
}
if (offsetFound)
break;
@@ -197,57 +201,61 @@ 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) {
- nsCoreUtils::GetLanguageFor(aElm, mRootContent, mNativeValue);
- mIsDefined = !mNativeValue.IsEmpty();
- }
+ if (aElm)
+ mIsDefined = GetLang(aElm, mNativeValue);
}
bool
TextAttrsMgr::LangTextAttr::
- GetValueFor(Accessible* aAccessible, nsString* aValue)
+ GetValueFor(nsIContent* aElm, nsString* aValue)
{
- nsCoreUtils::GetLanguageFor(aAccessible->GetContent(), mRootContent, *aValue);
- return !aValue->IsEmpty();
+ return GetLang(aElm, *aValue);
}
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(Accessible* aAccessible, nscolor* aValue)
+ GetValueFor(nsIContent* aElm, nscolor* aValue)
{
- nsIContent* elm = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent());
- nsIFrame* frame = elm->GetPrimaryFrame();
+ nsIFrame* frame = aElm->GetPrimaryFrame();
return frame ? GetColor(frame, aValue) : false;
}
void
TextAttrsMgr::BGColorTextAttr::
ExposeValue(nsIPersistentProperties* aAttributes, const nscolor& aValue)
{
nsAutoString formattedValue;
@@ -297,20 +305,19 @@ TextAttrsMgr::ColorTextAttr::
if (aFrame) {
mNativeValue = aFrame->GetStyleColor()->mColor;
mIsDefined = true;
}
}
bool
TextAttrsMgr::ColorTextAttr::
- GetValueFor(Accessible* aAccessible, nscolor* aValue)
+ GetValueFor(nsIContent* aElm, nscolor* aValue)
{
- nsIContent* elm = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent());
- nsIFrame* frame = elm->GetPrimaryFrame();
+ nsIFrame* frame = aElm->GetPrimaryFrame();
if (frame) {
*aValue = frame->GetStyleColor()->mColor;
return true;
}
return false;
}
@@ -335,20 +342,19 @@ TextAttrsMgr::FontFamilyTextAttr::
mIsRootDefined = GetFontFamily(aRootFrame, mRootNativeValue);
if (aFrame)
mIsDefined = GetFontFamily(aFrame, mNativeValue);
}
bool
TextAttrsMgr::FontFamilyTextAttr::
- GetValueFor(Accessible* aAccessible, nsString* aValue)
+ GetValueFor(nsIContent* aElm, nsString* aValue)
{
- nsIContent* elm = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent());
- nsIFrame* frame = elm->GetPrimaryFrame();
+ nsIFrame* frame = aElm->GetPrimaryFrame();
return frame ? GetFontFamily(frame, *aValue) : false;
}
void
TextAttrsMgr::FontFamilyTextAttr::
ExposeValue(nsIPersistentProperties* aAttributes, const nsString& aValue)
{
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::font_family, aValue);
@@ -385,20 +391,19 @@ TextAttrsMgr::FontSizeTextAttr::
if (aFrame) {
mNativeValue = aFrame->GetStyleFont()->mSize;
mIsDefined = true;
}
}
bool
TextAttrsMgr::FontSizeTextAttr::
- GetValueFor(Accessible* aAccessible, nscoord* aValue)
+ GetValueFor(nsIContent* aElm, nscoord* aValue)
{
- nsIContent* content = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent());
- nsIFrame* frame = content->GetPrimaryFrame();
+ nsIFrame* frame = aElm->GetPrimaryFrame();
if (frame) {
*aValue = frame->GetStyleFont()->mSize;
return true;
}
return false;
}
@@ -441,20 +446,19 @@ TextAttrsMgr::FontStyleTextAttr::
if (aFrame) {
mNativeValue = aFrame->GetStyleFont()->mFont.style;
mIsDefined = true;
}
}
bool
TextAttrsMgr::FontStyleTextAttr::
- GetValueFor(Accessible* aAccessible, nscoord* aValue)
+ GetValueFor(nsIContent* aContent, nscoord* aValue)
{
- nsIContent* elm = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent());
- nsIFrame* frame = elm->GetPrimaryFrame();
+ nsIFrame* frame = aContent->GetPrimaryFrame();
if (frame) {
*aValue = frame->GetStyleFont()->mFont.style;
return true;
}
return false;
}
@@ -483,20 +487,19 @@ TextAttrsMgr::FontWeightTextAttr::
if (aFrame) {
mNativeValue = GetFontWeight(aFrame);
mIsDefined = true;
}
}
bool
TextAttrsMgr::FontWeightTextAttr::
- GetValueFor(Accessible* aAccessible, PRInt32* aValue)
+ GetValueFor(nsIContent* aElm, PRInt32* aValue)
{
- nsIContent* elm = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent());
- nsIFrame* frame = elm->GetPrimaryFrame();
+ nsIFrame* frame = aElm->GetPrimaryFrame();
if (frame) {
*aValue = GetFontWeight(frame);
return true;
}
return false;
}
@@ -542,46 +545,16 @@ 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)
{
@@ -608,20 +581,19 @@ TextAttrsMgr::TextDecorTextAttr::
if (aFrame) {
mNativeValue = TextDecorValue(aFrame);
mIsDefined = mNativeValue.IsDefined();
}
}
bool
TextAttrsMgr::TextDecorTextAttr::
- GetValueFor(Accessible* aAccessible, TextDecorValue* aValue)
+ GetValueFor(nsIContent* aContent, TextDecorValue* aValue)
{
- nsIContent* elm = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent());
- nsIFrame* frame = elm->GetPrimaryFrame();
+ nsIFrame* frame = aContent->GetPrimaryFrame();
if (frame) {
*aValue = TextDecorValue(frame);
return aValue->IsDefined();
}
return false;
}
@@ -671,20 +643,19 @@ TextAttrsMgr::TextPosTextAttr::
if (aFrame) {
mNativeValue = GetTextPosValue(aFrame);
mIsDefined = mNativeValue != eTextPosNone;
}
}
bool
TextAttrsMgr::TextPosTextAttr::
- GetValueFor(Accessible* aAccessible, TextPosValue* aValue)
+ GetValueFor(nsIContent* aContent, TextPosValue* aValue)
{
- nsIContent* elm = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent());
- nsIFrame* frame = elm->GetPrimaryFrame();
+ nsIFrame* frame = aContent->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(Accessible* aAccessible) = 0;
+ virtual bool Equal(nsIContent* aElm) = 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(Accessible* aAccessible)
+ virtual bool Equal(nsIContent* aElm)
{
T nativeValue;
- bool isDefined = GetValueFor(aAccessible, &nativeValue);
+ bool isDefined = GetValueFor(aElm, &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(Accessible* aAccessible, T* aValue) = 0;
+ virtual bool GetValueFor(nsIContent* aElm, 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,38 +193,39 @@ protected:
public:
LangTextAttr(HyperTextAccessible* aRoot, nsIContent* aRootElm,
nsIContent* aElm);
virtual ~LangTextAttr() { }
protected:
// TextAttr
- virtual bool GetValueFor(Accessible* aAccessible, nsString* aValue);
+ virtual bool GetValueFor(nsIContent* aElm, 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(Accessible* aAccessible, nscolor* aValue);
+ virtual bool GetValueFor(nsIContent* aElm, nscolor* aValue);
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
const nscolor& aValue);
private:
bool GetColor(nsIFrame* aFrame, nscolor* aColor);
nsIFrame* mRootFrame;
};
@@ -236,17 +237,17 @@ protected:
{
public:
ColorTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame);
virtual ~ColorTextAttr() { }
protected:
// TTextAttr
- virtual bool GetValueFor(Accessible* aAccessible, nscolor* aValue);
+ virtual bool GetValueFor(nsIContent* aElm, nscolor* aValue);
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
const nscolor& aValue);
};
/**
* Class is used for the work with "font-family" text attribute.
*/
@@ -254,17 +255,17 @@ protected:
{
public:
FontFamilyTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame);
virtual ~FontFamilyTextAttr() { }
protected:
// TTextAttr
- virtual bool GetValueFor(Accessible* aAccessible, nsString* aValue);
+ virtual bool GetValueFor(nsIContent* aElm, nsString* aValue);
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
const nsString& aValue);
private:
bool GetFontFamily(nsIFrame* aFrame, nsString& aFamily);
};
@@ -273,20 +274,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(Accessible* aAccessible, nscoord* aValue);
+ virtual bool GetValueFor(nsIContent* aElm, nscoord* aValue);
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
const nscoord& aValue);
private:
nsDeviceContext* mDC;
};
@@ -297,17 +298,17 @@ protected:
{
public:
FontStyleTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame);
virtual ~FontStyleTextAttr() { }
protected:
// TTextAttr
- virtual bool GetValueFor(Accessible* aContent, nscoord* aValue);
+ virtual bool GetValueFor(nsIContent* aContent, nscoord* aValue);
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
const nscoord& aValue);
};
/**
* Class is used for the work with "font-weight" text attribute.
*/
@@ -315,41 +316,24 @@ protected:
{
public:
FontWeightTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame);
virtual ~FontWeightTextAttr() { }
protected:
// TTextAttr
- virtual bool GetValueFor(Accessible* aAccessible, PRInt32* aValue);
+ virtual bool GetValueFor(nsIContent* aElm, 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
@@ -386,17 +370,17 @@ protected:
{
public:
TextDecorTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame);
virtual ~TextDecorTextAttr() { }
protected:
// TextAttr
- virtual bool GetValueFor(Accessible* aAccessible, TextDecorValue* aValue);
+ virtual bool GetValueFor(nsIContent* aElm, TextDecorValue* aValue);
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
const TextDecorValue& aValue);
};
/**
* Class is used for the work with "text-position" text attribute.
*/
@@ -411,17 +395,17 @@ protected:
{
public:
TextPosTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame);
virtual ~TextPosTextAttr() { }
protected:
// TextAttr
- virtual bool GetValueFor(Accessible* aAccessible, TextPosValue* aValue);
+ virtual bool GetValueFor(nsIContent* aElm, 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
- &nsGkAtoms::alert,
+ {
+ "alert",
roles::ALERT,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates
},
- { // alertdialog
- &nsGkAtoms::alertdialog,
+ {
+ "alertdialog",
roles::DIALOG,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates
},
- { // application
- &nsGkAtoms::application,
+ {
+ "application",
roles::APPLICATION,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates
},
- { // article
- &nsGkAtoms::article,
+ {
+ "article",
roles::DOCUMENT,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates,
eReadonlyUntilEditable
},
- { // button
- &nsGkAtoms::button,
+ {
+ "button",
roles::PUSHBUTTON,
kUseMapRole,
eNoValue,
ePressAction,
eNoLiveAttr,
kNoReqStates,
eARIAPressed
},
- { // checkbox
- &nsGkAtoms::checkbox,
+ {
+ "checkbox",
roles::CHECKBUTTON,
kUseMapRole,
eNoValue,
eCheckUncheckAction,
eNoLiveAttr,
kNoReqStates,
eARIACheckableMixed,
eARIAReadonly
},
- { // columnheader
- &nsGkAtoms::columnheader,
+ {
+ "columnheader",
roles::COLUMNHEADER,
kUseMapRole,
eNoValue,
eSortAction,
eNoLiveAttr,
kNoReqStates,
eARIASelectable,
eARIAReadonly
},
- { // combobox
- &nsGkAtoms::combobox,
+ {
+ "combobox",
roles::COMBOBOX,
kUseMapRole,
eNoValue,
eOpenCloseAction,
eNoLiveAttr,
states::COLLAPSED | states::HASPOPUP,
eARIAAutoComplete,
eARIAReadonly
},
- { // dialog
- &nsGkAtoms::dialog,
+ {
+ "dialog",
roles::DIALOG,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates
},
- { // directory
- &nsGkAtoms::directory,
+ {
+ "directory",
roles::LIST,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates
},
- { // document
- &nsGkAtoms::document,
+ {
+ "document",
roles::DOCUMENT,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates,
eReadonlyUntilEditable
},
- { // form
- &nsGkAtoms::form,
+ {
+ "form",
roles::FORM,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates
},
- { // grid
- &nsGkAtoms::grid,
+ {
+ "grid",
roles::TABLE,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
states::FOCUSABLE,
eARIAMultiSelectable,
eARIAReadonly
},
- { // gridcell
- &nsGkAtoms::gridcell,
+ {
+ "gridcell",
roles::GRID_CELL,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates,
eARIASelectable,
eARIAReadonly
},
- { // group
- &nsGkAtoms::group,
+ {
+ "group",
roles::GROUPING,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates
},
- { // heading
- &nsGkAtoms::heading,
+ {
+ "heading",
roles::HEADING,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates
},
- { // img
- &nsGkAtoms::img,
+ {
+ "img",
roles::GRAPHIC,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates
},
- { // link
- &nsGkAtoms::link,
+ {
+ "link",
roles::LINK,
kUseMapRole,
eNoValue,
eJumpAction,
eNoLiveAttr,
states::LINKED
},
- { // list
- &nsGkAtoms::list,
+ {
+ "list",
roles::LIST,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
states::READONLY
},
- { // listbox
- &nsGkAtoms::listbox,
+ {
+ "listbox",
roles::LISTBOX,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates,
eARIAMultiSelectable,
eARIAReadonly
},
- { // listitem
- &nsGkAtoms::listitem,
+ {
+ "listitem",
roles::LISTITEM,
kUseMapRole,
eNoValue,
eNoAction, // XXX: should depend on state, parent accessible
eNoLiveAttr,
states::READONLY
},
- { // log
- &nsGkAtoms::log_,
+ {
+ "log",
roles::NOTHING,
kUseNativeRole,
eNoValue,
eNoAction,
ePoliteLiveAttr,
kNoReqStates
},
- { // marquee
- &nsGkAtoms::marquee,
+ {
+ "marquee",
roles::ANIMATION,
kUseMapRole,
eNoValue,
eNoAction,
eOffLiveAttr,
kNoReqStates
},
- { // math
- &nsGkAtoms::math,
+ {
+ "math",
roles::FLAT_EQUATION,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates
},
- { // menu
- &nsGkAtoms::menu,
+ {
+ "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
- &nsGkAtoms::menubar,
+ {
+ "menubar",
roles::MENUBAR,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates
},
- { // menuitem
- &nsGkAtoms::menuitem,
+ {
+ "menuitem",
roles::MENUITEM,
kUseMapRole,
eNoValue,
eClickAction,
eNoLiveAttr,
kNoReqStates,
eARIACheckedMixed
},
- { // menuitemcheckbox
- &nsGkAtoms::menuitemcheckbox,
+ {
+ "menuitemcheckbox",
roles::CHECK_MENU_ITEM,
kUseMapRole,
eNoValue,
eClickAction,
eNoLiveAttr,
kNoReqStates,
eARIACheckableMixed
},
- { // menuitemradio
- &nsGkAtoms::menuitemradio,
+ {
+ "menuitemradio",
roles::RADIO_MENU_ITEM,
kUseMapRole,
eNoValue,
eClickAction,
eNoLiveAttr,
kNoReqStates,
eARIACheckableBool
},
- { // note
- &nsGkAtoms::note_,
+ {
+ "note",
roles::NOTE,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates
},
- { // option
- &nsGkAtoms::option,
+ {
+ "option",
roles::OPTION,
kUseMapRole,
eNoValue,
eSelectAction,
eNoLiveAttr,
kNoReqStates,
eARIASelectable,
eARIACheckedMixed
},
- { // presentation
- &nsGkAtoms::presentation,
+ {
+ "presentation",
roles::NOTHING,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates
},
- { // progressbar
- &nsGkAtoms::progressbar,
+ {
+ "progressbar",
roles::PROGRESSBAR,
kUseMapRole,
eHasValueMinMax,
eNoAction,
eNoLiveAttr,
states::READONLY,
eIndeterminateIfNoValue
},
- { // radio
- &nsGkAtoms::radio,
+ {
+ "radio",
roles::RADIOBUTTON,
kUseMapRole,
eNoValue,
eSelectAction,
eNoLiveAttr,
kNoReqStates,
eARIACheckableBool
},
- { // radiogroup
- &nsGkAtoms::radiogroup,
+ {
+ "radiogroup",
roles::GROUPING,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates
},
- { // region
- &nsGkAtoms::region,
+ {
+ "region",
roles::PANE,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates
},
- { // row
- &nsGkAtoms::row,
+ {
+ "row",
roles::ROW,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates,
eARIASelectable
},
- { // rowheader
- &nsGkAtoms::rowheader,
+ {
+ "rowheader",
roles::ROWHEADER,
kUseMapRole,
eNoValue,
eSortAction,
eNoLiveAttr,
kNoReqStates,
eARIASelectable,
eARIAReadonly
},
- { // scrollbar
- &nsGkAtoms::scrollbar,
+ {
+ "scrollbar",
roles::SCROLLBAR,
kUseMapRole,
eHasValueMinMax,
eNoAction,
eNoLiveAttr,
kNoReqStates,
eARIAOrientation,
eARIAReadonly
},
- { // separator
- &nsGkAtoms::separator_,
+ {
+ "separator",
roles::SEPARATOR,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates,
eARIAOrientation
},
- { // slider
- &nsGkAtoms::slider,
+ {
+ "slider",
roles::SLIDER,
kUseMapRole,
eHasValueMinMax,
eNoAction,
eNoLiveAttr,
kNoReqStates,
eARIAOrientation,
eARIAReadonly
},
- { // spinbutton
- &nsGkAtoms::spinbutton,
+ {
+ "spinbutton",
roles::SPINBUTTON,
kUseMapRole,
eHasValueMinMax,
eNoAction,
eNoLiveAttr,
kNoReqStates,
eARIAReadonly
},
- { // status
- &nsGkAtoms::status,
+ {
+ "status",
roles::STATUSBAR,
kUseMapRole,
eNoValue,
eNoAction,
ePoliteLiveAttr,
kNoReqStates
},
- { // tab
- &nsGkAtoms::tab,
+ {
+ "tab",
roles::PAGETAB,
kUseMapRole,
eNoValue,
eSwitchAction,
eNoLiveAttr,
kNoReqStates,
eARIASelectable
},
- { // tablist
- &nsGkAtoms::tablist,
+ {
+ "tablist",
roles::PAGETABLIST,
kUseMapRole,
eNoValue,
eNoAction,
ePoliteLiveAttr,
kNoReqStates
},
- { // tabpanel
- &nsGkAtoms::tabpanel,
+ {
+ "tabpanel",
roles::PROPERTYPAGE,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates
},
- { // textbox
- &nsGkAtoms::textbox,
+ {
+ "textbox",
roles::ENTRY,
kUseMapRole,
eNoValue,
eActivateAction,
eNoLiveAttr,
kNoReqStates,
eARIAAutoComplete,
eARIAMultiline,
eARIAReadonlyOrEditable
},
- { // timer
- &nsGkAtoms::timer,
+ {
+ "timer",
roles::NOTHING,
kUseNativeRole,
eNoValue,
eNoAction,
eOffLiveAttr,
kNoReqStates
},
- { // toolbar
- &nsGkAtoms::toolbar,
+ {
+ "toolbar",
roles::TOOLBAR,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates
},
- { // tooltip
- &nsGkAtoms::tooltip,
+ {
+ "tooltip",
roles::TOOLTIP,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates
},
- { // tree
- &nsGkAtoms::tree,
+ {
+ "tree",
roles::OUTLINE,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates,
eARIAReadonly,
eARIAMultiSelectable
},
- { // treegrid
- &nsGkAtoms::treegrid,
+ {
+ "treegrid",
roles::TREE_TABLE,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates,
eARIAReadonly,
eARIAMultiSelectable
},
- { // treeitem
- &nsGkAtoms::treeitem,
+ {
+ "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 roles;
+ nsAutoString roleString;
if (!content ||
- !content->GetAttr(kNameSpaceID_None, nsGkAtoms::role, roles) ||
- roles.IsEmpty()) {
+ !content->GetAttr(kNameSpaceID_None, nsGkAtoms::role, roleString) ||
+ roleString.IsEmpty()) {
// We treat role="" as if the role attribute is absent (per aria spec:8.1.1)
return nsnull;
}
- nsWhitespaceTokenizer tokenizer(roles);
+ nsWhitespaceTokenizer tokenizer(roleString);
while (tokenizer.hasMoreTokens()) {
// Do a binary search through table for the next role in role list
- const nsDependentSubstring role = tokenizer.nextToken();
+ NS_LossyConvertUTF16toASCII role(tokenizer.nextToken());
PRUint32 low = 0;
PRUint32 high = ArrayLength(sWAIRoleMaps);
while (low < high) {
PRUint32 idx = (low + high) / 2;
- PRInt32 compare = Compare(role, sWAIRoleMaps[idx].ARIARoleString());
- if (compare == 0)
+ PRInt32 compare = strcmp(role.get(), sWAIRoleMaps[idx].roleString);
+ 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,18 +6,17 @@
* 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"
-#include "nsIAtom.h"
-
+class nsIAtom;
class nsIContent;
class nsINode;
////////////////////////////////////////////////////////////////////////////////
// Value constants
/**
* Used to define if role requires to expose nsIAccessibleValue.
@@ -132,31 +131,19 @@ 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"
- nsIAtom** roleAtom;
-
+ const char *roleString;
+
// 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,18 +147,19 @@ 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,
- role->ARIARoleString());
+ nsAccUtils::SetAccAttr(aAttributes,
+ nsGkAtoms::containerLiveRole,
+ NS_ConvertASCIItoUTF16(role->roleString));
}
}
}
// 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,18 +19,22 @@
#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 "XULAlertAccessible.h"
-#include "XULColorPickerAccessible.h"
-#include "XULComboboxAccessible.h"
-#include "XULElementAccessibles.h"
+#include "nsXULAlertAccessible.h"
+#include "nsXULColorPickerAccessible.h"
+#include "nsXULComboboxAccessible.h"
#include "XULFormControlAccessible.h"
-#include "XULListboxAccessibleWrap.h"
-#include "XULMenuAccessibleWrap.h"
-#include "XULSliderAccessible.h"
-#include "XULTabAccessible.h"
-#include "XULTreeGridAccessibleWrap.h"
+#include "nsXULListboxAccessibleWrap.h"
+#include "nsXULMenuAccessibleWrap.h"
+#include "nsXULSliderAccessible.h"
+#include "nsXULTabAccessible.h"
+#include "nsXULTextAccessible.h"
+#include "nsXULTreeGridAccessibleWrap.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 HTMLTableAccessibleWrap(aContent, GetDocAccessible(aPresShell));
+ new nsHTMLTableAccessibleWrap(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateHTMLTableCellAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
- new HTMLTableCellAccessibleWrap(aContent, GetDocAccessible(aPresShell));
+ new nsHTMLTableCellAccessibleWrap(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 HTMLCaptionAccessible(aContent, GetDocAccessible(aPresShell));
+ new nsHTMLCaptionAccessible(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) {
- XULTreeAccessible* treeAcc = accessible->AsXULTree();
+ nsXULTreeAccessible* 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 && roleMapEntry->Is(nsGkAtoms::presentation)) {
+ if (roleMapEntry && !nsCRT::strcmp(roleMapEntry->roleString, "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,17 +1068,18 @@ nsAccessibilityService::GetOrCreateAcces
roleMapEntry = &nsARIAMap::gEmptyRoleMap;
}
break;
}
#ifdef DEBUG
nsRoleMapEntry* tableRoleMapEntry = aria::GetRoleMap(tableContent);
- NS_ASSERTION(tableRoleMapEntry && tableRoleMapEntry->Is(nsGkAtoms::presentation),
+ NS_ASSERTION(tableRoleMapEntry &&
+ !nsCRT::strcmp(tableRoleMapEntry->roleString, "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).
@@ -1308,37 +1309,37 @@ nsAccessibilityService::CreateAccessible
switch (type)
{
#ifdef MOZ_XUL
case nsIAccessibleProvider::NoAccessible:
return nsnull;
// XUL controls
case nsIAccessibleProvider::XULAlert:
- accessible = new XULAlertAccessible(aContent, aDoc);
+ accessible = new nsXULAlertAccessible(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 XULColorPickerAccessible(aContent, aDoc);
+ accessible = new nsXULColorPickerAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULColorPickerTile:
- accessible = new XULColorPickerTileAccessible(aContent, aDoc);
+ accessible = new nsXULColorPickerTileAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULCombobox:
- accessible = new XULComboboxAccessible(aContent, aDoc);
+ accessible = new nsXULComboboxAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULDropmarker:
accessible = new XULDropmarkerAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULGroupbox:
accessible = new XULGroupboxAccessible(aContent, aDoc);
@@ -1351,137 +1352,137 @@ nsAccessibilityService::CreateAccessible
nsGkAtoms::tooltiptext))
return nsnull;
accessible = new ImageAccessibleWrap(aContent, aDoc);
break;
}
case nsIAccessibleProvider::XULLink:
- accessible = new XULLinkAccessible(aContent, aDoc);
+ accessible = new nsXULLinkAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULListbox:
- accessible = new XULListboxAccessibleWrap(aContent, aDoc);
+ accessible = new nsXULListboxAccessibleWrap(aContent, aDoc);
break;
case nsIAccessibleProvider::XULListCell:
- accessible = new XULListCellAccessibleWrap(aContent, aDoc);
+ accessible = new nsXULListCellAccessibleWrap(aContent, aDoc);
break;
case nsIAccessibleProvider::XULListHead:
- accessible = new XULColumAccessible(aContent, aDoc);
+ accessible = new nsXULColumAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULListHeader:
- accessible = new XULColumnItemAccessible(aContent, aDoc);
+ accessible = new nsXULColumnItemAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULListitem:
- accessible = new XULListitemAccessible(aContent, aDoc);
+ accessible = new nsXULListitemAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULMenubar:
- accessible = new XULMenubarAccessible(aContent, aDoc);
+ accessible = new nsXULMenubarAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULMenuitem:
- accessible = new XULMenuitemAccessibleWrap(aContent, aDoc);
+ accessible = new nsXULMenuitemAccessibleWrap(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 XULMenupopupAccessible(aContent, aDoc);
+ accessible = new nsXULMenupopupAccessible(aContent, aDoc);
break;
}
case nsIAccessibleProvider::XULMenuSeparator:
- accessible = new XULMenuSeparatorAccessible(aContent, aDoc);
+ accessible = new nsXULMenuSeparatorAccessible(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 XULSliderAccessible(aContent, aDoc);
+ accessible = new nsXULSliderAccessible(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 XULTabAccessible(aContent, aDoc);
+ accessible = new nsXULTabAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULTabs:
- accessible = new XULTabsAccessible(aContent, aDoc);
+ accessible = new nsXULTabsAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULTabpanels:
- accessible = new XULTabpanelsAccessible(aContent, aDoc);
+ accessible = new nsXULTabpanelsAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULText:
- accessible = new XULLabelAccessible(aContent, aDoc);
+ accessible = new nsXULTextAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULTextBox:
accessible = new XULTextFieldAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULThumb:
- accessible = new XULThumbAccessible(aContent, aDoc);
+ accessible = new nsXULThumbAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULTree:
return CreateAccessibleForXULTree(aContent, aDoc);
case nsIAccessibleProvider::XULTreeColumns:
- accessible = new XULTreeColumAccessible(aContent, aDoc);
+ accessible = new nsXULTreeColumAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULTreeColumnItem:
- accessible = new XULColumnItemAccessible(aContent, aDoc);
+ accessible = new nsXULColumnItemAccessible(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 XULTooltipAccessible(aContent, aDoc);
+ accessible = new nsXULTooltipAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULToolbarButton:
accessible = new XULToolbarButtonAccessible(aContent, aDoc);
break;
#endif // MOZ_XUL
@@ -1654,17 +1655,18 @@ 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 HTMLTableHeaderCellAccessibleWrap(aContent, aDoc);
+ Accessible* accessible = new nsHTMLTableHeaderCellAccessibleWrap(aContent,
+ aDoc);
NS_IF_ADDREF(accessible);
return accessible;
}
if (tag == nsGkAtoms::output) {
Accessible* accessible = new HTMLOutputAccessible(aContent, aDoc);
NS_IF_ADDREF(accessible);
return accessible;
@@ -1764,17 +1766,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 XULTabpanelAccessible(aContent, aDoc);
+ Accessible* accessible = new nsXULTabpanelAccessible(aContent, aDoc);
NS_IF_ADDREF(accessible);
return accessible;
}
#endif
Accessible* accessible = new EnumRoleAccessible(aContent, aDoc,
roles::PROPERTYPAGE);
NS_IF_ADDREF(accessible);
return accessible;
@@ -1798,23 +1800,23 @@ nsAccessibilityService::CreateAccessible
if (!treeColumns)
return nsnull;
PRInt32 count = 0;
treeColumns->GetCount(&count);
// Outline of list accessible.
if (count == 1) {
- Accessible* accessible = new XULTreeAccessible(aContent, aDoc);
+ Accessible* accessible = new nsXULTreeAccessible(aContent, aDoc);
NS_IF_ADDREF(accessible);
return accessible;
}
// Table or tree table accessible.
- Accessible* accessible = new XULTreeGridAccessibleWrap(aContent, aDoc);
+ Accessible* accessible = new nsXULTreeGridAccessibleWrap(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/Accessible.cpp
+++ b/accessible/src/generic/Accessible.cpp
@@ -340,17 +340,17 @@ Accessible::Description(nsString& aDescr
aDescription.Truncate();
}
}
}
aDescription.CompressWhitespace();
}
NS_IMETHODIMP
-Accessible::GetAccessKey(nsAString& aAccessKey)
+Accessible::GetKeyboardShortcut(nsAString& aAccessKey)
{
aAccessKey.Truncate();
if (IsDefunct())
return NS_ERROR_FAILURE;
AccessKey().ToString(aAccessKey);
return NS_OK;
@@ -876,25 +876,99 @@ Accessible::GetDeepestChildAtPoint(PRInt
NS_IF_ADDREF(*aAccessible = ChildAtPoint(aX, aY, eDeepestChild));
return NS_OK;
}
void
Accessible::GetBoundsRect(nsRect& aTotalBounds, nsIFrame** aBoundingFrame)
{
- nsIFrame* frame = GetFrame();
- if (frame) {
- *aBoundingFrame = nsLayoutUtils::GetContainingBlockForClientRect(frame);
- aTotalBounds = nsLayoutUtils::
- GetAllInFlowRectsUnion(frame, *aBoundingFrame,
- nsLayoutUtils::RECTS_ACCOUNT_FOR_TRANSFORMS);
+/*
+ * 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();
}
}
+
/* 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);
@@ -1674,26 +1748,47 @@ Accessible::SetCurrentValue(double aValu
/* void setName (in DOMString name); */
NS_IMETHODIMP
Accessible::SetName(const nsAString& aName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
-Accessible::GetKeyboardShortcut(nsAString& aKeyBinding)
+Accessible::GetDefaultKeyBinding(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
@@ -33,17 +33,16 @@ class Relation;
namespace mozilla {
namespace a11y {
class HTMLImageMapAccessible;
class HTMLLIAccessible;
class ImageAccessible;
class TableAccessible;
class TextLeafAccessible;
-class XULTreeAccessible;
/**
* Name type flags.
*/
enum ENameValueFlag {
/**
* Name either
* a) present (not empty): !name.IsEmpty()
@@ -64,16 +63,18 @@ 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;
@@ -94,18 +95,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();
@@ -310,17 +311,17 @@ public:
//////////////////////////////////////////////////////////////////////////////
// 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()
@@ -501,17 +502,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; }
- mozilla::a11y::XULTreeAccessible* AsXULTree();
+ nsXULTreeAccessible* 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,25 +2001,16 @@ 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 "mozilla/Selection.h"
+#include "nsTypedSelection.h"
#include "gfxSkipChars.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// HyperTextAccessible
////////////////////////////////////////////////////////////////////////////////
--- a/accessible/src/generic/RootAccessible.cpp
+++ b/accessible/src/generic/RootAccessible.cpp
@@ -13,19 +13,16 @@
#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"
@@ -45,19 +42,21 @@
#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;
////////////////////////////////////////////////////////////////////////////////
@@ -320,17 +319,17 @@ RootAccessible::ProcessDOMEvent(nsIDOMEv
Accessible* accessible =
targetDocument->GetAccessibleOrContainer(origTargetNode);
if (!accessible)
return;
nsINode* targetNode = accessible->GetNode();
#ifdef MOZ_XUL
- XULTreeAccessible* treeAcc = accessible->AsXULTree();
+ nsXULTreeAccessible* treeAcc = accessible->AsXULTree();
if (treeAcc) {
if (eventType.EqualsLiteral("TreeRowCountChanged")) {
HandleTreeRowCountChangedEvent(aDOMEvent, treeAcc);
return;
}
if (eventType.EqualsLiteral("TreeInvalidated")) {
HandleTreeInvalidatedEvent(aDOMEvent, treeAcc);
@@ -339,17 +338,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.
- // XULListitemAccessible::GetStateInternal uses STATE_SELECTED in this case,
+ // nsXULListitemAccessible::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) {
@@ -399,17 +398,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. XULTreeAccessible::UpdateTreeSelection();
+ // that state changes. nsXULTreeAccessible::UpdateTreeSelection();
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN,
accessible);
return;
}
nsRefPtr<AccSelChangeEvent> selChangeEvent =
new AccSelChangeEvent(treeAcc, treeItemAcc,
AccSelChangeEvent::eSelectionAdd);
@@ -668,17 +667,17 @@ RootAccessible::HandlePopupHidingEvent(n
new AccStateChangeEvent(widget, states::EXPANDED, false);
document->FireDelayedAccessibleEvent(event);
}
}
#ifdef MOZ_XUL
void
RootAccessible::HandleTreeRowCountChangedEvent(nsIDOMEvent* aEvent,
- XULTreeAccessible* aAccessible)
+ nsXULTreeAccessible* aAccessible)
{
nsCOMPtr<nsIDOMDataContainerEvent> dataEvent(do_QueryInterface(aEvent));
if (!dataEvent)
return;
nsCOMPtr<nsIVariant> indexVariant;
dataEvent->GetData(NS_LITERAL_STRING("index"),
getter_AddRefs(indexVariant));
@@ -695,17 +694,17 @@ RootAccessible::HandleTreeRowCountChange
indexVariant->GetAsInt32(&index);
countVariant->GetAsInt32(&count);
aAccessible->InvalidateCache(index, count);
}
void
RootAccessible::HandleTreeInvalidatedEvent(nsIDOMEvent* aEvent,
- XULTreeAccessible* aAccessible)
+ nsXULTreeAccessible* 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,16 +10,17 @@
#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
{
@@ -70,19 +71,19 @@ protected:
/*
* Process "popuphiding" event. Used by HandleEvent().
*/
void HandlePopupHidingEvent(nsINode* aNode);
#ifdef MOZ_XUL
void HandleTreeRowCountChangedEvent(nsIDOMEvent* aEvent,
- XULTreeAccessible* aAccessible);
+ nsXULTreeAccessible* aAccessible);
void HandleTreeInvalidatedEvent(nsIDOMEvent* aEvent,
- XULTreeAccessible* aAccessible);
+ nsXULTreeAccessible* aAccessible);
PRUint32 GetChromeFlags();
#endif
nsRefPtr<nsCaretAccessible> mCaretAccessible;
};
} // namespace a11y
--- a/accessible/src/generic/TextLeafAccessible.cpp
+++ b/accessible/src/generic/TextLeafAccessible.cpp
@@ -46,13 +46,25 @@ 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,16 +20,17 @@ 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();
deleted file mode 100644
--- a/accessible/src/html/HTMLTableAccessible.cpp
+++ /dev/null
@@ -1,1524 +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/. */
-
-#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"
-#include "Role.h"
-#include "States.h"
-
-#include "nsIAccessibleRelation.h"
-#include "nsIDOMElement.h"
-#include "nsIDOMDocument.h"
-#include "nsIDOMRange.h"
-#include "nsISelectionPrivate.h"
-#include "nsINameSpaceManager.h"
-#include "nsIDOMNodeList.h"
-#include "nsIDOMHTMLCollection.h"
-#include "nsIDOMHTMLTableCellElement.h"
-#include "nsIDOMHTMLTableElement.h"
-#include "nsIDOMHTMLTableRowElement.h"
-#include "nsIDOMHTMLTableSectionElem.h"
-#include "nsIDocument.h"
-#include "nsIPresShell.h"
-#include "nsITableLayout.h"
-#include "nsITableCellLayout.h"
-#include "nsFrameSelection.h"
-#include "nsLayoutErrors.h"
-#include "nsArrayUtils.h"
-#include "nsComponentManagerUtils.h"
-
-using namespace mozilla::a11y;
-
-////////////////////////////////////////////////////////////////////////////////
-// HTMLTableCellAccessible
-////////////////////////////////////////////////////////////////////////////////
-
-HTMLTableCellAccessible::
- HTMLTableCellAccessible(nsIContent* aContent, DocAccessible* aDoc) :
- HyperTextAccessibleWrap(aContent, aDoc)
-{
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// HTMLTableCellAccessible: nsISupports implementation
-
-NS_IMPL_ISUPPORTS_INHERITED1(HTMLTableCellAccessible,
- HyperTextAccessible,
- nsIAccessibleTableCell)
-
-////////////////////////////////////////////////////////////////////////////////
-// HTMLTableCellAccessible: Accessible implementation
-
-role
-HTMLTableCellAccessible::NativeRole()
-{
- return roles::CELL;
-}
-
-PRUint64
-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
-HTMLTableCellAccessible::NativeInteractiveState() const
-{
- return HyperTextAccessibleWrap::NativeInteractiveState() | states::SELECTABLE;
-}
-
-nsresult
-HTMLTableCellAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
-{
- if (IsDefunct())
- return NS_ERROR_FAILURE;
-
- nsresult rv = HyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
- NS_ENSURE_SUCCESS(rv, rv);
-
- // table-cell-index attribute
- nsCOMPtr<nsIAccessibleTable> tableAcc(GetTableAccessible());
- if (!tableAcc)
- return NS_OK;
-
- PRInt32 rowIdx = -1, colIdx = -1;
- rv = GetCellIndexes(rowIdx, colIdx);
- NS_ENSURE_SUCCESS(rv, rv);
-
- PRInt32 idx = -1;
- rv = tableAcc->GetCellIndexAt(rowIdx, colIdx, &idx);
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsAutoString stringIdx;
- stringIdx.AppendInt(idx);
- nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::tableCellIndex, stringIdx);
-
- // abbr attribute
-
- // Pick up object attribute from abbr DOM element (a child of the cell) or
- // from abbr DOM attribute.
- nsAutoString abbrText;