зеркало из https://github.com/mozilla/pjs.git
Bug 740747 - dexpcom nsAccessible::GetName, r=surkov, tbsaunde
This commit is contained in:
Родитель
c93f80ef1d
Коммит
bf3257ec42
|
@ -690,14 +690,15 @@ ApplicationAccessibleWrap::Unload()
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
ENameValueFlag
|
||||||
ApplicationAccessibleWrap::GetName(nsAString& aName)
|
ApplicationAccessibleWrap::Name(nsString& aName)
|
||||||
{
|
{
|
||||||
// ATK doesn't provide a way to obtain an application name (for example,
|
// ATK doesn't provide a way to obtain an application name (for example,
|
||||||
// Firefox or Thunderbird) like IA2 does. Thus let's return an application
|
// Firefox or Thunderbird) like IA2 does. Thus let's return an application
|
||||||
// name as accessible name that was used to get a branding name (for example,
|
// name as accessible name that was used to get a branding name (for example,
|
||||||
// Minefield aka nightly Firefox or Daily aka nightly Thunderbird).
|
// Minefield aka nightly Firefox or Daily aka nightly Thunderbird).
|
||||||
return GetAppName(aName);
|
GetAppName(aName);
|
||||||
|
return eNameOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|
|
@ -57,8 +57,7 @@ public:
|
||||||
virtual bool Init();
|
virtual bool Init();
|
||||||
|
|
||||||
// nsAccessible
|
// nsAccessible
|
||||||
NS_IMETHOD GetName(nsAString &aName);
|
virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
|
||||||
|
|
||||||
virtual bool AppendChild(nsAccessible* aChild);
|
virtual bool AppendChild(nsAccessible* aChild);
|
||||||
virtual bool RemoveChild(nsAccessible* aChild);
|
virtual bool RemoveChild(nsAccessible* aChild);
|
||||||
|
|
||||||
|
|
|
@ -682,20 +682,16 @@ const gchar *
|
||||||
getNameCB(AtkObject* aAtkObj)
|
getNameCB(AtkObject* aAtkObj)
|
||||||
{
|
{
|
||||||
nsAccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
|
nsAccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
|
||||||
if (!accWrap) {
|
if (!accWrap)
|
||||||
return nsnull;
|
return nsnull;
|
||||||
}
|
|
||||||
|
|
||||||
/* nsIAccessible is responsible for the non-NULL name */
|
|
||||||
nsAutoString uniName;
|
nsAutoString uniName;
|
||||||
nsresult rv = accWrap->GetName(uniName);
|
accWrap->Name(uniName);
|
||||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
|
||||||
|
|
||||||
NS_ConvertUTF8toUTF16 objName(aAtkObj->name);
|
NS_ConvertUTF8toUTF16 objName(aAtkObj->name);
|
||||||
if (!uniName.Equals(objName)) {
|
if (!uniName.Equals(objName))
|
||||||
atk_object_set_name(aAtkObj,
|
atk_object_set_name(aAtkObj, NS_ConvertUTF16toUTF8(uniName).get());
|
||||||
NS_ConvertUTF16toUTF8(uniName).get());
|
|
||||||
}
|
|
||||||
return aAtkObj->name;
|
return aAtkObj->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1043,8 +1039,8 @@ nsAccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
|
||||||
|
|
||||||
case nsIAccessibleEvent::EVENT_NAME_CHANGE:
|
case nsIAccessibleEvent::EVENT_NAME_CHANGE:
|
||||||
{
|
{
|
||||||
nsString newName;
|
nsAutoString newName;
|
||||||
accessible->GetName(newName);
|
accessible->Name(newName);
|
||||||
NS_ConvertUTF16toUTF8 utf8Name(newName);
|
NS_ConvertUTF16toUTF8 utf8Name(newName);
|
||||||
if (!atkObj->name || !utf8Name.Equals(atkObj->name))
|
if (!atkObj->name || !utf8Name.Equals(atkObj->name))
|
||||||
atk_object_set_name(atkObj, utf8Name.get());
|
atk_object_set_name(atkObj, utf8Name.get());
|
||||||
|
|
|
@ -211,7 +211,7 @@ private:
|
||||||
nsAutoString role; \
|
nsAutoString role; \
|
||||||
GetAccService()->GetStringRole(aAccessible->Role(), role); \
|
GetAccService()->GetStringRole(aAccessible->Role(), role); \
|
||||||
nsAutoString name; \
|
nsAutoString name; \
|
||||||
aAccessible->GetName(name); \
|
aAccessible->Name(name); \
|
||||||
printf(" role: %s, name: %s; ", NS_ConvertUTF16toUTF8(role).get(), \
|
printf(" role: %s, name: %s; ", NS_ConvertUTF16toUTF8(role).get(), \
|
||||||
NS_ConvertUTF16toUTF8(name).get()); \
|
NS_ConvertUTF16toUTF8(name).get()); \
|
||||||
A11YDEBUG_FOCUS_LOG_DOMNODE(aAccessible->GetNode()) \
|
A11YDEBUG_FOCUS_LOG_DOMNODE(aAccessible->GetNode()) \
|
||||||
|
|
|
@ -209,10 +209,9 @@ nsAccessible::nsAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
|
||||||
NS_ConvertUTF16toUTF8(content->NodeInfo()->QualifiedName()).get(),
|
NS_ConvertUTF16toUTF8(content->NodeInfo()->QualifiedName()).get(),
|
||||||
(void *)content.get());
|
(void *)content.get());
|
||||||
nsAutoString buf;
|
nsAutoString buf;
|
||||||
if (NS_SUCCEEDED(GetName(buf))) {
|
Name(buf);
|
||||||
printf(" Name:[%s]", NS_ConvertUTF16toUTF8(buf).get());
|
printf(" Name:[%s]", NS_ConvertUTF16toUTF8(buf).get());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -278,45 +277,52 @@ nsAccessible::GetName(nsAString& aName)
|
||||||
if (IsDefunct())
|
if (IsDefunct())
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
nsAutoString name;
|
||||||
|
Name(name);
|
||||||
|
aName.Assign(name);
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ENameValueFlag
|
||||||
|
nsAccessible::Name(nsString& aName)
|
||||||
|
{
|
||||||
|
aName.Truncate();
|
||||||
|
|
||||||
GetARIAName(aName);
|
GetARIAName(aName);
|
||||||
if (!aName.IsEmpty())
|
if (!aName.IsEmpty())
|
||||||
return NS_OK;
|
return eNameOK;
|
||||||
|
|
||||||
nsCOMPtr<nsIXBLAccessible> xblAccessible(do_QueryInterface(mContent));
|
nsCOMPtr<nsIXBLAccessible> xblAccessible(do_QueryInterface(mContent));
|
||||||
if (xblAccessible) {
|
if (xblAccessible) {
|
||||||
xblAccessible->GetAccessibleName(aName);
|
xblAccessible->GetAccessibleName(aName);
|
||||||
if (!aName.IsEmpty())
|
if (!aName.IsEmpty())
|
||||||
return NS_OK;
|
return eNameOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult rv = GetNameInternal(aName);
|
nsresult rv = GetNameInternal(aName);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
if (!aName.IsEmpty())
|
if (!aName.IsEmpty())
|
||||||
return NS_OK;
|
return eNameOK;
|
||||||
|
|
||||||
// In the end get the name from tooltip.
|
// In the end get the name from tooltip.
|
||||||
nsIAtom *tooltipAttr = nsnull;
|
if (mContent->IsHTML()) {
|
||||||
|
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::title, aName)) {
|
||||||
if (mContent->IsHTML())
|
aName.CompressWhitespace();
|
||||||
tooltipAttr = nsGkAtoms::title;
|
return eNameFromTooltip;
|
||||||
else if (mContent->IsXUL())
|
}
|
||||||
tooltipAttr = nsGkAtoms::tooltiptext;
|
} else if (mContent->IsXUL()) {
|
||||||
else
|
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext, aName)) {
|
||||||
return NS_OK;
|
aName.CompressWhitespace();
|
||||||
|
return eNameFromTooltip;
|
||||||
// XXX: if CompressWhiteSpace worked on nsAString we could avoid a copy.
|
}
|
||||||
nsAutoString name;
|
} else {
|
||||||
if (mContent->GetAttr(kNameSpaceID_None, tooltipAttr, name)) {
|
return eNameOK;
|
||||||
name.CompressWhitespace();
|
|
||||||
aName = name;
|
|
||||||
return NS_OK_NAME_FROM_TOOLTIP;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rv != NS_OK_EMPTY_NAME)
|
if (rv != NS_OK_EMPTY_NAME)
|
||||||
aName.SetIsVoid(true);
|
aName.SetIsVoid(true);
|
||||||
|
|
||||||
return NS_OK;
|
return eNameOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -364,7 +370,7 @@ nsAccessible::Description(nsString& aDescription)
|
||||||
nsGkAtoms::title;
|
nsGkAtoms::title;
|
||||||
if (mContent->GetAttr(kNameSpaceID_None, descAtom, aDescription)) {
|
if (mContent->GetAttr(kNameSpaceID_None, descAtom, aDescription)) {
|
||||||
nsAutoString name;
|
nsAutoString name;
|
||||||
GetName(name);
|
Name(name);
|
||||||
if (name.IsEmpty() || aDescription == name)
|
if (name.IsEmpty() || aDescription == name)
|
||||||
// Don't use tooltip for a description if this object
|
// Don't use tooltip for a description if this object
|
||||||
// has no name or the tooltip is the same as the name
|
// has no name or the tooltip is the same as the name
|
||||||
|
|
|
@ -65,9 +65,25 @@ class nsHTMLImageMapAccessible;
|
||||||
class nsHTMLLIAccessible;
|
class nsHTMLLIAccessible;
|
||||||
struct nsRoleMapEntry;
|
struct nsRoleMapEntry;
|
||||||
class Relation;
|
class Relation;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace a11y {
|
namespace a11y {
|
||||||
class TableAccessible;
|
class TableAccessible;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name type flags.
|
||||||
|
*/
|
||||||
|
enum ENameValueFlag {
|
||||||
|
/**
|
||||||
|
* Name either
|
||||||
|
* a) present (not empty): !name.IsEmpty()
|
||||||
|
* b) no name (was missed): name.IsVoid()
|
||||||
|
* c) was left empty by the author on demand: name.IsEmpty() && !name.IsVoid()
|
||||||
|
*/
|
||||||
|
eNameOK,
|
||||||
|
eNameFromTooltip // Tooltip was used as a name
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class nsTextAccessible;
|
class nsTextAccessible;
|
||||||
|
@ -140,6 +156,11 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void Value(nsString& aValue);
|
virtual void Value(nsString& aValue);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name of this accessible.
|
||||||
|
*/
|
||||||
|
virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return DOM node associated with this accessible.
|
* Return DOM node associated with this accessible.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -213,26 +213,26 @@ NS_IMPL_RELEASE_INHERITED(nsDocAccessible, nsHyperTextAccessible)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// nsIAccessible
|
// nsIAccessible
|
||||||
|
|
||||||
NS_IMETHODIMP
|
ENameValueFlag
|
||||||
nsDocAccessible::GetName(nsAString& aName)
|
nsDocAccessible::Name(nsString& aName)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
|
||||||
aName.Truncate();
|
aName.Truncate();
|
||||||
|
|
||||||
if (mParent) {
|
if (mParent) {
|
||||||
rv = mParent->GetName(aName); // Allow owning iframe to override the name
|
mParent->Name(aName); // Allow owning iframe to override the name
|
||||||
}
|
}
|
||||||
if (aName.IsEmpty()) {
|
if (aName.IsEmpty()) {
|
||||||
// Allow name via aria-labelledby or title attribute
|
// Allow name via aria-labelledby or title attribute
|
||||||
rv = nsAccessible::GetName(aName);
|
nsAccessible::Name(aName);
|
||||||
}
|
}
|
||||||
if (aName.IsEmpty()) {
|
if (aName.IsEmpty()) {
|
||||||
rv = GetTitle(aName); // Try title element
|
GetTitle(aName); // Try title element
|
||||||
}
|
}
|
||||||
if (aName.IsEmpty()) { // Last resort: use URL
|
if (aName.IsEmpty()) { // Last resort: use URL
|
||||||
rv = GetURL(aName);
|
GetURL(aName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rv;
|
return eNameOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// nsAccessible public method
|
// nsAccessible public method
|
||||||
|
|
|
@ -92,7 +92,6 @@ public:
|
||||||
virtual ~nsDocAccessible();
|
virtual ~nsDocAccessible();
|
||||||
|
|
||||||
// nsIAccessible
|
// nsIAccessible
|
||||||
NS_IMETHOD GetName(nsAString& aName);
|
|
||||||
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
|
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
|
||||||
NS_IMETHOD TakeFocus(void);
|
NS_IMETHOD TakeFocus(void);
|
||||||
|
|
||||||
|
@ -111,6 +110,7 @@ public:
|
||||||
virtual nsIDocument* GetDocumentNode() const { return mDocument; }
|
virtual nsIDocument* GetDocumentNode() const { return mDocument; }
|
||||||
|
|
||||||
// nsAccessible
|
// nsAccessible
|
||||||
|
virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
|
||||||
virtual void Description(nsString& aDescription);
|
virtual void Description(nsString& aDescription);
|
||||||
virtual nsAccessible* FocusedChild();
|
virtual nsAccessible* FocusedChild();
|
||||||
virtual mozilla::a11y::role NativeRole();
|
virtual mozilla::a11y::role NativeRole();
|
||||||
|
|
|
@ -110,27 +110,22 @@ nsRootAccessible::~nsRootAccessible()
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// nsIAccessible
|
// nsAccessible
|
||||||
|
|
||||||
/* readonly attribute AString name; */
|
ENameValueFlag
|
||||||
NS_IMETHODIMP
|
nsRootAccessible::Name(nsString& aName)
|
||||||
nsRootAccessible::GetName(nsAString& aName)
|
|
||||||
{
|
{
|
||||||
aName.Truncate();
|
aName.Truncate();
|
||||||
|
|
||||||
if (!mDocument) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mRoleMapEntry) {
|
if (mRoleMapEntry) {
|
||||||
nsAccessible::GetName(aName);
|
nsAccessible::Name(aName);
|
||||||
if (!aName.IsEmpty()) {
|
if (!aName.IsEmpty())
|
||||||
return NS_OK;
|
return eNameOK;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMDocument> document = do_QueryInterface(mDocument);
|
nsCOMPtr<nsIDOMDocument> document = do_QueryInterface(mDocument);
|
||||||
return document->GetTitle(aName);
|
document->GetTitle(aName);
|
||||||
|
return eNameOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
role
|
role
|
||||||
|
|
|
@ -62,9 +62,6 @@ public:
|
||||||
nsIPresShell* aPresShell);
|
nsIPresShell* aPresShell);
|
||||||
virtual ~nsRootAccessible();
|
virtual ~nsRootAccessible();
|
||||||
|
|
||||||
// nsIAccessible
|
|
||||||
NS_IMETHOD GetName(nsAString& aName);
|
|
||||||
|
|
||||||
// nsIDOMEventListener
|
// nsIDOMEventListener
|
||||||
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
|
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
|
||||||
|
|
||||||
|
@ -72,6 +69,7 @@ public:
|
||||||
virtual void Shutdown();
|
virtual void Shutdown();
|
||||||
|
|
||||||
// nsAccessible
|
// nsAccessible
|
||||||
|
virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
|
||||||
virtual Relation RelationByType(PRUint32 aType);
|
virtual Relation RelationByType(PRUint32 aType);
|
||||||
virtual mozilla::a11y::role NativeRole();
|
virtual mozilla::a11y::role NativeRole();
|
||||||
virtual PRUint64 NativeState();
|
virtual PRUint64 NativeState();
|
||||||
|
|
|
@ -48,6 +48,8 @@
|
||||||
|
|
||||||
#include "nsArrayUtils.h"
|
#include "nsArrayUtils.h"
|
||||||
|
|
||||||
|
using namespace mozilla::a11y;
|
||||||
|
|
||||||
#define NS_OK_NO_NAME_CLAUSE_HANDLED \
|
#define NS_OK_NO_NAME_CLAUSE_HANDLED \
|
||||||
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_GENERAL, 0x24)
|
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_GENERAL, 0x24)
|
||||||
|
|
||||||
|
@ -227,19 +229,16 @@ nsTextEquivUtils::AppendFromAccessible(nsAccessible *aAccessible,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAutoString text;
|
|
||||||
nsresult rv = aAccessible->GetName(text);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
bool isEmptyTextEquiv = true;
|
bool isEmptyTextEquiv = true;
|
||||||
|
|
||||||
// If the name is from tooltip then append it to result string in the end
|
// If the name is from tooltip then append it to result string in the end
|
||||||
// (see h. step of name computation guide).
|
// (see h. step of name computation guide).
|
||||||
if (rv != NS_OK_NAME_FROM_TOOLTIP)
|
nsAutoString text;
|
||||||
|
if (aAccessible->Name(text) != eNameFromTooltip)
|
||||||
isEmptyTextEquiv = !AppendString(aString, text);
|
isEmptyTextEquiv = !AppendString(aString, text);
|
||||||
|
|
||||||
// Implementation of f. step.
|
// Implementation of f. step.
|
||||||
rv = AppendFromValue(aAccessible, aString);
|
nsresult rv = AppendFromValue(aAccessible, aString);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
if (rv != NS_OK_NO_NAME_CLAUSE_HANDLED)
|
if (rv != NS_OK_NO_NAME_CLAUSE_HANDLED)
|
||||||
|
|
|
@ -96,8 +96,8 @@ ApplicationAccessible::GetPreviousSibling(nsIAccessible** aPreviousSibling)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
ENameValueFlag
|
||||||
ApplicationAccessible::GetName(nsAString& aName)
|
ApplicationAccessible::Name(nsString& aName)
|
||||||
{
|
{
|
||||||
aName.Truncate();
|
aName.Truncate();
|
||||||
|
|
||||||
|
@ -105,12 +105,14 @@ ApplicationAccessible::GetName(nsAString& aName)
|
||||||
mozilla::services::GetStringBundleService();
|
mozilla::services::GetStringBundleService();
|
||||||
|
|
||||||
NS_ASSERTION(bundleService, "String bundle service must be present!");
|
NS_ASSERTION(bundleService, "String bundle service must be present!");
|
||||||
NS_ENSURE_STATE(bundleService);
|
if (!bundleService)
|
||||||
|
return eNameOK;
|
||||||
|
|
||||||
nsCOMPtr<nsIStringBundle> bundle;
|
nsCOMPtr<nsIStringBundle> bundle;
|
||||||
nsresult rv = bundleService->CreateBundle("chrome://branding/locale/brand.properties",
|
nsresult rv = bundleService->CreateBundle("chrome://branding/locale/brand.properties",
|
||||||
getter_AddRefs(bundle));
|
getter_AddRefs(bundle));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
if (NS_FAILED(rv))
|
||||||
|
return eNameOK;
|
||||||
|
|
||||||
nsXPIDLString appName;
|
nsXPIDLString appName;
|
||||||
rv = bundle->GetStringFromName(NS_LITERAL_STRING("brandShortName").get(),
|
rv = bundle->GetStringFromName(NS_LITERAL_STRING("brandShortName").get(),
|
||||||
|
@ -121,7 +123,7 @@ ApplicationAccessible::GetName(nsAString& aName)
|
||||||
}
|
}
|
||||||
|
|
||||||
aName.Assign(appName);
|
aName.Assign(appName);
|
||||||
return NS_OK;
|
return eNameOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -79,7 +79,6 @@ public:
|
||||||
NS_IMETHOD GetParent(nsIAccessible **aParent);
|
NS_IMETHOD GetParent(nsIAccessible **aParent);
|
||||||
NS_IMETHOD GetNextSibling(nsIAccessible **aNextSibling);
|
NS_IMETHOD GetNextSibling(nsIAccessible **aNextSibling);
|
||||||
NS_IMETHOD GetPreviousSibling(nsIAccessible **aPreviousSibling);
|
NS_IMETHOD GetPreviousSibling(nsIAccessible **aPreviousSibling);
|
||||||
NS_IMETHOD GetName(nsAString &aName);
|
|
||||||
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
|
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
|
||||||
NS_IMETHOD GroupPosition(PRInt32 *aGroupLevel, PRInt32 *aSimilarItemsInGroup,
|
NS_IMETHOD GroupPosition(PRInt32 *aGroupLevel, PRInt32 *aSimilarItemsInGroup,
|
||||||
PRInt32 *aPositionInGroup);
|
PRInt32 *aPositionInGroup);
|
||||||
|
@ -101,6 +100,7 @@ public:
|
||||||
virtual bool IsPrimaryForNode() const;
|
virtual bool IsPrimaryForNode() const;
|
||||||
|
|
||||||
// nsAccessible
|
// nsAccessible
|
||||||
|
virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
|
||||||
virtual void ApplyARIAState(PRUint64* aState);
|
virtual void ApplyARIAState(PRUint64* aState);
|
||||||
virtual void Description(nsString& aDescription);
|
virtual void Description(nsString& aDescription);
|
||||||
virtual void Value(nsString& aValue);
|
virtual void Value(nsString& aValue);
|
||||||
|
|
|
@ -594,7 +594,7 @@ nsHTMLComboboxAccessible::Value(nsString& aValue)
|
||||||
// Use accessible name of selected option.
|
// Use accessible name of selected option.
|
||||||
nsAccessible* option = SelectedOption();
|
nsAccessible* option = SelectedOption();
|
||||||
if (option)
|
if (option)
|
||||||
option->GetName(aValue);
|
option->Name(aValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
PRUint8
|
PRUint8
|
||||||
|
|
|
@ -68,12 +68,12 @@ nsHTMLTextAccessible::
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTextAccessible, nsTextAccessible)
|
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTextAccessible, nsTextAccessible)
|
||||||
|
|
||||||
NS_IMETHODIMP
|
ENameValueFlag
|
||||||
nsHTMLTextAccessible::GetName(nsAString& aName)
|
nsHTMLTextAccessible::Name(nsString& aName)
|
||||||
{
|
{
|
||||||
// Text node, ARIA can't be used.
|
// Text node, ARIA can't be used.
|
||||||
aName = mText;
|
aName = mText;
|
||||||
return NS_OK;
|
return eNameOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
role
|
role
|
||||||
|
@ -348,14 +348,11 @@ nsHTMLListBulletAccessible::IsPrimaryForNode() const
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// nsHTMLListBulletAccessible: nsAccessible
|
// nsHTMLListBulletAccessible: nsAccessible
|
||||||
|
|
||||||
NS_IMETHODIMP
|
ENameValueFlag
|
||||||
nsHTMLListBulletAccessible::GetName(nsAString &aName)
|
nsHTMLListBulletAccessible::Name(nsString &aName)
|
||||||
{
|
{
|
||||||
aName.Truncate();
|
aName.Truncate();
|
||||||
|
|
||||||
if (IsDefunct())
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
// Native anonymous content, ARIA can't be used. Get list bullet text.
|
// Native anonymous content, ARIA can't be used. Get list bullet text.
|
||||||
nsBlockFrame* blockFrame = do_QueryFrame(mContent->GetPrimaryFrame());
|
nsBlockFrame* blockFrame = do_QueryFrame(mContent->GetPrimaryFrame());
|
||||||
NS_ASSERTION(blockFrame, "No frame for list item!");
|
NS_ASSERTION(blockFrame, "No frame for list item!");
|
||||||
|
@ -366,7 +363,7 @@ nsHTMLListBulletAccessible::GetName(nsAString &aName)
|
||||||
aName.Append(' ');
|
aName.Append(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return eNameOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
role
|
role
|
||||||
|
|
|
@ -55,10 +55,8 @@ public:
|
||||||
// nsISupports
|
// nsISupports
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIAccessible
|
|
||||||
NS_IMETHOD GetName(nsAString& aName);
|
|
||||||
|
|
||||||
// nsAccessible
|
// nsAccessible
|
||||||
|
virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
|
||||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||||
virtual mozilla::a11y::role NativeRole();
|
virtual mozilla::a11y::role NativeRole();
|
||||||
virtual PRUint64 NativeState();
|
virtual PRUint64 NativeState();
|
||||||
|
@ -129,13 +127,11 @@ class nsHTMLListBulletAccessible : public nsLeafAccessible
|
||||||
public:
|
public:
|
||||||
nsHTMLListBulletAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
|
nsHTMLListBulletAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
|
||||||
|
|
||||||
// nsIAccessible
|
|
||||||
NS_IMETHOD GetName(nsAString& aName);
|
|
||||||
|
|
||||||
// nsAccessNode
|
// nsAccessNode
|
||||||
virtual bool IsPrimaryForNode() const;
|
virtual bool IsPrimaryForNode() const;
|
||||||
|
|
||||||
// nsAccessible
|
// nsAccessible
|
||||||
|
virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
|
||||||
virtual mozilla::a11y::role NativeRole();
|
virtual mozilla::a11y::role NativeRole();
|
||||||
virtual PRUint64 NativeState();
|
virtual PRUint64 NativeState();
|
||||||
virtual void AppendTextTo(nsAString& aText, PRUint32 aStartOffset = 0,
|
virtual void AppendTextTo(nsAString& aText, PRUint32 aStartOffset = 0,
|
||||||
|
|
|
@ -514,7 +514,7 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
|
||||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
||||||
nsAutoString title;
|
nsAutoString title;
|
||||||
mGeckoAccessible->GetName (title);
|
mGeckoAccessible->Name(title);
|
||||||
return title.IsEmpty() ? nil : [NSString stringWithCharacters:title.BeginReading() length:title.Length()];
|
return title.IsEmpty() ? nil : [NSString stringWithCharacters:title.BeginReading() length:title.Length()];
|
||||||
|
|
||||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
|
@ -285,9 +285,7 @@ __try {
|
||||||
return CO_E_OBJNOTCONNECTED;
|
return CO_E_OBJNOTCONNECTED;
|
||||||
|
|
||||||
nsAutoString name;
|
nsAutoString name;
|
||||||
nsresult rv = xpAccessible->GetName(name);
|
xpAccessible->Name(name);
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return GetHRESULT(rv);
|
|
||||||
|
|
||||||
// The name was not provided, e.g. no alt attribute for an image. A screen
|
// The name was not provided, e.g. no alt attribute for an image. A screen
|
||||||
// reader may choose to invent its own accessible name, e.g. from an image src
|
// reader may choose to invent its own accessible name, e.g. from an image src
|
||||||
|
|
|
@ -38,6 +38,8 @@
|
||||||
#include "nsXULMenuAccessibleWrap.h"
|
#include "nsXULMenuAccessibleWrap.h"
|
||||||
#include "nsINameSpaceManager.h"
|
#include "nsINameSpaceManager.h"
|
||||||
|
|
||||||
|
using namespace mozilla::a11y;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// nsXULMenuAccessibleWrap
|
// nsXULMenuAccessibleWrap
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -48,21 +50,19 @@ nsXULMenuitemAccessibleWrap::
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
ENameValueFlag
|
||||||
nsXULMenuitemAccessibleWrap::GetName(nsAString& aName)
|
nsXULMenuitemAccessibleWrap::Name(nsString& aName)
|
||||||
{
|
{
|
||||||
// XXX This should be done in get_accName() so that nsIAccessible::GetName()]
|
// XXX This should be done in get_accName() so that nsIAccessible::GetName()]
|
||||||
// provides the same results on all platforms
|
// provides the same results on all platforms
|
||||||
nsresult rv = nsXULMenuitemAccessible::GetName(aName);
|
nsXULMenuitemAccessible::Name(aName);
|
||||||
if (NS_FAILED(rv)) {
|
if (aName.IsEmpty())
|
||||||
return rv;
|
return eNameOK;
|
||||||
}
|
|
||||||
|
|
||||||
nsAutoString accel;
|
nsAutoString accel;
|
||||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::acceltext, accel);
|
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::acceltext, accel);
|
||||||
if (!accel.IsEmpty()) {
|
if (!accel.IsEmpty())
|
||||||
aName += NS_LITERAL_STRING("\t") + accel;
|
aName += NS_LITERAL_STRING("\t") + accel;
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
return eNameOK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ public:
|
||||||
virtual ~nsXULMenuitemAccessibleWrap() {}
|
virtual ~nsXULMenuitemAccessibleWrap() {}
|
||||||
|
|
||||||
// nsIAccessible
|
// nsIAccessible
|
||||||
NS_IMETHOD GetName(nsAString& aName);
|
virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -66,13 +66,13 @@ nsXULAlertAccessible::NativeState()
|
||||||
return nsAccessible::NativeState() | states::ALERT;
|
return nsAccessible::NativeState() | states::ALERT;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
ENameValueFlag
|
||||||
nsXULAlertAccessible::GetName(nsAString& aName)
|
nsXULAlertAccessible::Name(nsString& aName)
|
||||||
{
|
{
|
||||||
// Screen readers need to read contents of alert, not the accessible name.
|
// Screen readers need to read contents of alert, not the accessible name.
|
||||||
// If we have both some screen readers will read the alert twice.
|
// If we have both some screen readers will read the alert twice.
|
||||||
aName.Truncate();
|
aName.Truncate();
|
||||||
return NS_OK;
|
return eNameOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -51,10 +51,8 @@ public:
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIAccessible
|
|
||||||
NS_IMETHOD GetName(nsAString& aName);
|
|
||||||
|
|
||||||
// nsAccessible
|
// nsAccessible
|
||||||
|
virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
|
||||||
virtual mozilla::a11y::role NativeRole();
|
virtual mozilla::a11y::role NativeRole();
|
||||||
virtual PRUint64 NativeState();
|
virtual PRUint64 NativeState();
|
||||||
|
|
||||||
|
|
|
@ -1176,16 +1176,13 @@ NS_IMPL_RELEASE_INHERITED(nsXULTreeItemAccessible, nsXULTreeItemAccessibleBase)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// nsXULTreeItemAccessible: nsIAccessible implementation
|
// nsXULTreeItemAccessible: nsIAccessible implementation
|
||||||
|
|
||||||
NS_IMETHODIMP
|
ENameValueFlag
|
||||||
nsXULTreeItemAccessible::GetName(nsAString& aName)
|
nsXULTreeItemAccessible::Name(nsString& aName)
|
||||||
{
|
{
|
||||||
aName.Truncate();
|
aName.Truncate();
|
||||||
|
|
||||||
if (IsDefunct())
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
GetCellName(mColumn, aName);
|
GetCellName(mColumn, aName);
|
||||||
return NS_OK;
|
return eNameOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1197,7 +1194,7 @@ nsXULTreeItemAccessible::Init()
|
||||||
if (!nsXULTreeItemAccessibleBase::Init())
|
if (!nsXULTreeItemAccessibleBase::Init())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
GetName(mCachedName);
|
Name(mCachedName);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1235,7 +1232,7 @@ nsXULTreeItemAccessible::RowInvalidated(PRInt32 aStartColIdx,
|
||||||
PRInt32 aEndColIdx)
|
PRInt32 aEndColIdx)
|
||||||
{
|
{
|
||||||
nsAutoString name;
|
nsAutoString name;
|
||||||
GetName(name);
|
Name(name);
|
||||||
|
|
||||||
if (name != mCachedName) {
|
if (name != mCachedName) {
|
||||||
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, this);
|
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, this);
|
||||||
|
|
|
@ -267,13 +267,12 @@ public:
|
||||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXULTreeItemAccessible,
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXULTreeItemAccessible,
|
||||||
nsXULTreeItemAccessibleBase)
|
nsXULTreeItemAccessibleBase)
|
||||||
|
|
||||||
NS_IMETHOD GetName(nsAString& aName);
|
|
||||||
|
|
||||||
// nsAccessNode
|
// nsAccessNode
|
||||||
virtual bool Init();
|
virtual bool Init();
|
||||||
virtual void Shutdown();
|
virtual void Shutdown();
|
||||||
|
|
||||||
// nsAccessible
|
// nsAccessible
|
||||||
|
virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
|
||||||
virtual mozilla::a11y::role NativeRole();
|
virtual mozilla::a11y::role NativeRole();
|
||||||
|
|
||||||
// nsXULTreeItemAccessibleBase
|
// nsXULTreeItemAccessibleBase
|
||||||
|
|
|
@ -657,14 +657,11 @@ nsXULTreeGridRowAccessible::NativeRole()
|
||||||
return roles::ROW;
|
return roles::ROW;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
ENameValueFlag
|
||||||
nsXULTreeGridRowAccessible::GetName(nsAString& aName)
|
nsXULTreeGridRowAccessible::Name(nsString& aName)
|
||||||
{
|
{
|
||||||
aName.Truncate();
|
aName.Truncate();
|
||||||
|
|
||||||
if (IsDefunct())
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
// XXX: the row name sholdn't be a concatenation of cell names (bug 664384).
|
// XXX: the row name sholdn't be a concatenation of cell names (bug 664384).
|
||||||
nsCOMPtr<nsITreeColumn> column = nsCoreUtils::GetFirstSensibleColumn(mTree);
|
nsCOMPtr<nsITreeColumn> column = nsCoreUtils::GetFirstSensibleColumn(mTree);
|
||||||
while (column) {
|
while (column) {
|
||||||
|
@ -678,7 +675,7 @@ nsXULTreeGridRowAccessible::GetName(nsAString& aName)
|
||||||
column = nsCoreUtils::GetNextSensibleColumn(column);
|
column = nsCoreUtils::GetNextSensibleColumn(column);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return eNameOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAccessible*
|
nsAccessible*
|
||||||
|
@ -844,13 +841,13 @@ nsXULTreeGridCellAccessible::FocusedChild()
|
||||||
return nsnull;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
ENameValueFlag
|
||||||
nsXULTreeGridCellAccessible::GetName(nsAString& aName)
|
nsXULTreeGridCellAccessible::Name(nsString& aName)
|
||||||
{
|
{
|
||||||
aName.Truncate();
|
aName.Truncate();
|
||||||
|
|
||||||
if (IsDefunct() || !mTreeView)
|
if (!mTreeView)
|
||||||
return NS_ERROR_FAILURE;
|
return eNameOK;
|
||||||
|
|
||||||
mTreeView->GetCellText(mRow, mColumn, aName);
|
mTreeView->GetCellText(mRow, mColumn, aName);
|
||||||
|
|
||||||
|
@ -862,7 +859,7 @@ nsXULTreeGridCellAccessible::GetName(nsAString& aName)
|
||||||
if (aName.IsEmpty())
|
if (aName.IsEmpty())
|
||||||
mTreeView->GetCellValue(mRow, mColumn, aName);
|
mTreeView->GetCellValue(mRow, mColumn, aName);
|
||||||
|
|
||||||
return NS_OK;
|
return eNameOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|
|
@ -103,7 +103,7 @@ public:
|
||||||
|
|
||||||
// nsAccessible
|
// nsAccessible
|
||||||
virtual mozilla::a11y::role NativeRole();
|
virtual mozilla::a11y::role NativeRole();
|
||||||
NS_IMETHOD GetName(nsAString& aName);
|
virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
|
||||||
virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||||
EWhichChildAtPoint aWhichChild);
|
EWhichChildAtPoint aWhichChild);
|
||||||
|
|
||||||
|
@ -155,7 +155,6 @@ public:
|
||||||
|
|
||||||
// nsIAccessible
|
// nsIAccessible
|
||||||
|
|
||||||
NS_IMETHOD GetName(nsAString& aName);
|
|
||||||
NS_IMETHOD GetBounds(PRInt32 *aX, PRInt32 *aY,
|
NS_IMETHOD GetBounds(PRInt32 *aX, PRInt32 *aY,
|
||||||
PRInt32 *aWidth, PRInt32 *aHeight);
|
PRInt32 *aWidth, PRInt32 *aHeight);
|
||||||
|
|
||||||
|
@ -170,6 +169,7 @@ public:
|
||||||
virtual bool IsPrimaryForNode() const;
|
virtual bool IsPrimaryForNode() const;
|
||||||
|
|
||||||
// nsAccessible
|
// nsAccessible
|
||||||
|
virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
|
||||||
virtual nsAccessible* FocusedChild();
|
virtual nsAccessible* FocusedChild();
|
||||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||||
virtual PRInt32 IndexInParent() const;
|
virtual PRInt32 IndexInParent() const;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче