Bug 740758 - dexpcom nsAccessible::GetValue, r=tbsaunde, f=surkov

This commit is contained in:
Mark Capella 2012-04-09 18:48:41 +09:00
parent 410f4e95ea
commit 85ec17c936
40 changed files with 156 additions and 203 deletions

View File

@ -1661,17 +1661,25 @@ nsAccessible::ApplyARIAState(PRUint64* aState)
aria::MapToState(mRoleMapEntry->attributeMap3, element, aState);
}
/* DOMString getValue (); */
NS_IMETHODIMP
nsAccessible::GetValue(nsAString& aValue)
{
if (IsDefunct())
return NS_ERROR_FAILURE;
if (mRoleMapEntry) {
if (mRoleMapEntry->valueRule == eNoValue) {
nsAutoString value;
Value(value);
aValue.Assign(value);
return NS_OK;
}
}
void
nsAccessible::Value(nsString& aValue)
{
if (mRoleMapEntry) {
if (mRoleMapEntry->valueRule == eNoValue)
return;
// aria-valuenow is a number, and aria-valuetext is the optional text equivalent
// For the string value, we will try the optional text equivalent first
@ -1683,18 +1691,16 @@ nsAccessible::GetValue(nsAString& aValue)
}
if (!aValue.IsEmpty())
return NS_OK;
return;
// Check if it's a simple xlink.
if (nsCoreUtils::IsXLink(mContent)) {
nsIPresShell* presShell = mDoc->PresShell();
if (presShell) {
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
return presShell->GetLinkLocation(DOMNode, aValue);
presShell->GetLinkLocation(DOMNode, aValue);
}
}
return NS_OK;
}
// nsIAccessibleValue

View File

@ -131,10 +131,15 @@ public:
// Public methods
/**
* get the description of this accessible
* Get the description of this accessible.
*/
virtual void Description(nsString& aDescription);
/**
* Get the value of this accessible.
*/
virtual void Value(nsString& aValue);
/**
* Return DOM node associated with this accessible.
*/

View File

@ -124,19 +124,18 @@ nsApplicationAccessible::GetName(nsAString& aName)
return NS_OK;
}
NS_IMETHODIMP
nsApplicationAccessible::GetValue(nsAString &aValue)
{
aValue.Truncate();
return NS_OK;
}
void
nsApplicationAccessible::Description(nsString &aDescription)
{
aDescription.Truncate();
}
void
nsApplicationAccessible::Value(nsString& aValue)
{
aValue.Truncate();
}
PRUint64
nsApplicationAccessible::State()
{

View File

@ -80,7 +80,6 @@ public:
NS_IMETHOD GetNextSibling(nsIAccessible **aNextSibling);
NS_IMETHOD GetPreviousSibling(nsIAccessible **aPreviousSibling);
NS_IMETHOD GetName(nsAString &aName);
NS_IMETHOD GetValue(nsAString &aValue);
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
NS_IMETHOD GroupPosition(PRInt32 *aGroupLevel, PRInt32 *aSimilarItemsInGroup,
PRInt32 *aPositionInGroup);
@ -104,6 +103,7 @@ public:
// nsAccessible
virtual void ApplyARIAState(PRUint64* aState);
virtual void Description(nsString& aDescription);
virtual void Value(nsString& aValue);
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 State();
virtual PRUint64 NativeState();

View File

@ -124,16 +124,17 @@ nsLinkableAccessible::NativeState()
return states;
}
NS_IMETHODIMP
nsLinkableAccessible::GetValue(nsAString& aValue)
void
nsLinkableAccessible::Value(nsString& aValue)
{
aValue.Truncate();
nsAccessible::GetValue(aValue);
nsAccessible::Value(aValue);
if (!aValue.IsEmpty())
return NS_OK;
return;
return mIsLink ? mActionAcc->GetValue(aValue) : NS_ERROR_NOT_IMPLEMENTED;
if (aValue.IsEmpty() && mIsLink)
mActionAcc->Value(aValue);
}

View File

@ -89,13 +89,13 @@ public:
// nsIAccessible
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 index);
NS_IMETHOD GetValue(nsAString& _retval);
NS_IMETHOD TakeFocus();
// nsAccessNode
virtual void Shutdown();
// nsAccessible
virtual void Value(nsString& aValue);
virtual PRUint64 NativeState();
// ActionAccessible

View File

@ -110,32 +110,29 @@ ProgressMeterAccessible<Max>::IsWidget() const
// nsIAccessibleValue
template<int Max>
NS_IMETHODIMP
ProgressMeterAccessible<Max>::GetValue(nsAString& aValue)
void
ProgressMeterAccessible<Max>::Value(nsString& aValue)
{
nsresult rv = nsFormControlAccessible::GetValue(aValue);
NS_ENSURE_SUCCESS(rv, rv);
nsFormControlAccessible::Value(aValue);
if (!aValue.IsEmpty())
return NS_OK;
return;
double maxValue = 0;
rv = GetMaximumValue(&maxValue);
NS_ENSURE_SUCCESS(rv, rv);
nsresult rv = GetMaximumValue(&maxValue);
NS_ENSURE_SUCCESS(rv, );
if (maxValue == 0)
return;
double curValue = 0;
rv = GetCurrentValue(&curValue);
NS_ENSURE_SUCCESS(rv, rv);
GetCurrentValue(&curValue);
NS_ENSURE_SUCCESS(rv, );
// Treat the current value bigger than maximum as 100%.
double percentValue = (curValue < maxValue) ?
(curValue / maxValue) * 100 : 100;
nsAutoString value;
value.AppendFloat(percentValue); // AppendFloat isn't available on nsAString
value.AppendLiteral("%");
aValue = value;
return NS_OK;
aValue.AppendFloat(percentValue);
aValue.AppendLiteral("%");
}
template<int Max>

View File

@ -58,10 +58,8 @@ public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLEVALUE
// nsIAccessible
NS_IMETHOD GetValue(nsAString &aValue);
// nsAccessible
virtual void Value(nsString& aValue);
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();

View File

@ -283,8 +283,7 @@ nsTextEquivUtils::AppendFromValue(nsAccessible *aAccessible,
nsAutoString text;
if (aAccessible != gInitiatorAcc) {
nsresult rv = aAccessible->GetValue(text);
NS_ENSURE_SUCCESS(rv, rv);
aAccessible->Value(text);
return AppendString(aString, text) ?
NS_OK : NS_OK_NO_NAME_CLAUSE_HANDLED;
@ -304,8 +303,7 @@ nsTextEquivUtils::AppendFromValue(nsAccessible *aAccessible,
siblingContent = siblingContent->GetNextSibling()) {
// .. and subsequent text
if (!siblingContent->TextIsOnlyWhitespace()) {
nsresult rv = aAccessible->GetValue(text);
NS_ENSURE_SUCCESS(rv, rv);
aAccessible->Value(text);
return AppendString(aString, text) ?
NS_OK : NS_OK_NO_NAME_CLAUSE_HANDLED;

View File

@ -406,25 +406,23 @@ nsHTMLTextFieldAccessible::GetNameInternal(nsAString& aName)
return NS_OK;
}
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetValue(nsAString& _retval)
void
nsHTMLTextFieldAccessible::Value(nsString& aValue)
{
if (IsDefunct())
return NS_ERROR_FAILURE;
aValue.Truncate();
if (NativeState() & states::PROTECTED) // Don't return password text!
return NS_ERROR_FAILURE;
return;
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea(do_QueryInterface(mContent));
if (textArea) {
return textArea->GetValue(_retval);
textArea->GetValue(aValue);
return;
}
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(mContent));
if (inputElement) {
return inputElement->GetValue(_retval);
inputElement->GetValue(aValue);
}
return NS_ERROR_FAILURE;
}
void

View File

@ -134,7 +134,6 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessible
NS_IMETHOD GetValue(nsAString& _retval);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 index);
@ -142,6 +141,7 @@ public:
virtual already_AddRefed<nsIEditor> GetEditor() const;
// nsAccessible
virtual void Value(nsString& aValue);
virtual void ApplyARIAState(PRUint64* aState);
virtual nsresult GetNameInternal(nsAString& aName);
virtual mozilla::a11y::role NativeRole();

View File

@ -106,20 +106,18 @@ nsHTMLLinkAccessible::NativeState()
return states;
}
NS_IMETHODIMP
nsHTMLLinkAccessible::GetValue(nsAString& aValue)
void
nsHTMLLinkAccessible::Value(nsString& aValue)
{
aValue.Truncate();
nsresult rv = nsHyperTextAccessible::GetValue(aValue);
NS_ENSURE_SUCCESS(rv, rv);
nsHyperTextAccessible::Value(aValue);
if (!aValue.IsEmpty())
return NS_OK;
return;
nsIPresShell* presShell(mDoc->PresShell());
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
return presShell->GetLinkLocation(DOMNode, aValue);
presShell->GetLinkLocation(DOMNode, aValue);
}
PRUint8

View File

@ -50,12 +50,11 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessible
NS_IMETHOD GetValue(nsAString& aValue);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessible
virtual void Value(nsString& aValue);
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();

View File

@ -587,11 +587,13 @@ nsHTMLComboboxAccessible::Description(nsString& aDescription)
option->Description(aDescription);
}
NS_IMETHODIMP nsHTMLComboboxAccessible::GetValue(nsAString& aValue)
void
nsHTMLComboboxAccessible::Value(nsString& aValue)
{
// Use accessible name of selected option.
nsAccessible* option = SelectedOption();
return option ? option->GetName(aValue) : NS_OK;
if (option)
option->GetName(aValue);
}
PRUint8

View File

@ -187,7 +187,6 @@ public:
virtual ~nsHTMLComboboxAccessible() {}
// nsIAccessible
NS_IMETHOD GetValue(nsAString& _retval);
NS_IMETHOD DoAction(PRUint8 index);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
@ -196,6 +195,7 @@ public:
// nsAccessible
virtual void Description(nsString& aDescription);
virtual void Value(nsString& aValue);
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();
virtual void InvalidateChildren();

View File

@ -116,12 +116,11 @@
- (NSURL*)url
{
if (!mGeckoAccessible)
if (!mGeckoAccessible || mGeckoAccessible->IsDefunct())
return nil;
nsAutoString value;
nsresult rv = mGeckoAccessible->GetValue(value);
NS_ENSURE_SUCCESS(rv, nil);
mGeckoAccessible->Value(value);
NSString* urlString = value.IsEmpty() ? nil : nsCocoaUtils::ToNSString(value);
if (!urlString)

View File

@ -285,9 +285,11 @@ __try {
if (!xpAccessible || xpAccessible->IsDefunct())
return E_FAIL;
if (xpAccessible->NativeRole() == roles::PASSWORD_TEXT)
return E_ACCESSDENIED;
nsAutoString value;
if (NS_FAILED(xpAccessible->GetValue(value)))
return E_FAIL;
xpAccessible->Value(value);
// See bug 438784: need to expose URL on doc's value attribute. For this,
// reverting part of fix for bug 425693 to make this MSAA method behave

View File

@ -145,16 +145,6 @@ nsXFormsAccessible::CacheSelectChildren(nsIDOMNode *aContainerNode)
}
}
// nsIAccessible
NS_IMETHODIMP
nsXFormsAccessible::GetValue(nsAString& aValue)
{
NS_ENSURE_TRUE(sXFormsService, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
return sXFormsService->GetValue(DOMNode, aValue);
}
PRUint64
nsXFormsAccessible::NativeState()
{
@ -213,6 +203,13 @@ nsXFormsAccessible::Description(nsString& aDescription)
GetBoundChildElementValue(NS_LITERAL_STRING("hint"), aDescription);
}
void
nsXFormsAccessible::Value(nsString& aValue)
{
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
sXFormsService->GetValue(DOMNode, aValue);
}
bool
nsXFormsAccessible::CanHaveAnonChildren()
{
@ -545,11 +542,11 @@ nsXFormsSelectableItemAccessible::
{
}
NS_IMETHODIMP
nsXFormsSelectableItemAccessible::GetValue(nsAString& aValue)
void
nsXFormsSelectableItemAccessible::Value(nsString& aValue)
{
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
return sXFormsService->GetValue(DOMNode, aValue);
sXFormsService->GetValue(DOMNode, aValue);
}
PRUint8

View File

@ -72,15 +72,13 @@ class nsXFormsAccessible : public nsHyperTextAccessibleWrap,
public:
nsXFormsAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
// nsIAccessible
// Returns value of instance node that xforms element is bound to.
NS_IMETHOD GetValue(nsAString& aValue);
// nsAccessible
// Returns value of child xforms 'hint' element.
virtual void Description(nsString& aDescription);
// Returns value of instance node that xforms element is bound to.
virtual void Value(nsString& aValue);
// Returns value of child xforms 'label' element.
virtual nsresult GetNameInternal(nsAString& aName);
@ -189,9 +187,11 @@ public:
nsXFormsSelectableItemAccessible(nsIContent* aContent,
nsDocAccessible* aDoc);
NS_IMETHOD GetValue(nsAString& aValue);
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessible
virtual void Value(nsString& aValue);
// ActionAccessible
virtual PRUint8 ActionCount();

View File

@ -109,11 +109,10 @@ nsXFormsTriggerAccessible::NativeRole()
return roles::PUSHBUTTON;
}
NS_IMETHODIMP
nsXFormsTriggerAccessible::GetValue(nsAString& aValue)
void
nsXFormsTriggerAccessible::Value(nsString& aValue)
{
aValue.Truncate();
return NS_OK;
}
PRUint8
@ -295,10 +294,10 @@ nsXFormsSecretAccessible::NativeState()
return nsXFormsInputAccessible::NativeState() | states::PROTECTED;
}
NS_IMETHODIMP
nsXFormsSecretAccessible::GetValue(nsAString& aValue)
void
nsXFormsSecretAccessible::Value(nsString& aValue)
{
return NS_ERROR_FAILURE;
aValue.Truncate();
}
@ -438,11 +437,10 @@ nsXFormsChoicesAccessible::NativeRole()
return roles::GROUPING;
}
NS_IMETHODIMP
nsXFormsChoicesAccessible::GetValue(nsAString& aValue)
void
nsXFormsChoicesAccessible::Value(nsString& aValue)
{
aValue.Truncate();
return NS_OK;
}
void

View File

@ -79,12 +79,11 @@ public:
nsXFormsTriggerAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
// nsIAccessible
NS_IMETHOD GetValue(nsAString& aValue);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessible
virtual void Value(nsString& aValue);
virtual mozilla::a11y::role NativeRole();
// ActionAccessible
@ -156,10 +155,8 @@ class nsXFormsSecretAccessible : public nsXFormsInputAccessible
public:
nsXFormsSecretAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
// nsIAccessible
NS_IMETHOD GetValue(nsAString& aValue);
// nsAccessible
virtual void Value(nsString& aValue);
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();
};
@ -211,9 +208,9 @@ public:
nsXFormsChoicesAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
// nsIAccessible
NS_IMETHOD GetValue(nsAString& aValue);
// nsAccessible
virtual void Value(nsString& aValue);
virtual mozilla::a11y::role NativeRole();
protected:

View File

@ -162,13 +162,6 @@ nsXFormsComboboxPopupWidgetAccessible::NativeState()
return state;
}
NS_IMETHODIMP
nsXFormsComboboxPopupWidgetAccessible::GetValue(nsAString& aValue)
{
aValue.Truncate();
return NS_OK;
}
nsresult
nsXFormsComboboxPopupWidgetAccessible::GetNameInternal(nsAString& aName)
{
@ -183,6 +176,12 @@ nsXFormsComboboxPopupWidgetAccessible::Description(nsString& aDescription)
aDescription.Truncate();
}
void
nsXFormsComboboxPopupWidgetAccessible::Value(nsString& aValue)
{
aValue.Truncate();
}
void
nsXFormsComboboxPopupWidgetAccessible::CacheChildren()
{

View File

@ -91,11 +91,9 @@ public:
nsXFormsComboboxPopupWidgetAccessible(nsIContent* aContent,
nsDocAccessible* aDoc);
// nsIAccessible
NS_IMETHOD GetValue(nsAString& aValue);
// nsAccessible
virtual void Description(nsString& aDescription);
virtual void Value(nsString& aValue);
virtual nsresult GetNameInternal(nsAString& aName);
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();

View File

@ -63,16 +63,12 @@ nsXULColorPickerTileAccessible::
////////////////////////////////////////////////////////////////////////////////
// nsXULColorPickerTileAccessible: nsIAccessible
NS_IMETHODIMP
nsXULColorPickerTileAccessible::GetValue(nsAString& aValue)
void
nsXULColorPickerTileAccessible::Value(nsString& aValue)
{
aValue.Truncate();
if (IsDefunct())
return NS_ERROR_FAILURE;
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::color, aValue);
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -50,10 +50,8 @@ public:
nsXULColorPickerTileAccessible(nsIContent* aContent,
nsDocAccessible* aDoc);
// nsIAccessible
NS_IMETHOD GetValue(nsAString& _retval);
// nsAccessible
virtual void Value(nsString& aValue);
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();

View File

@ -103,22 +103,6 @@ nsXULComboboxAccessible::NativeState()
return states;
}
NS_IMETHODIMP
nsXULComboboxAccessible::GetValue(nsAString& aValue)
{
aValue.Truncate();
if (IsDefunct())
return NS_ERROR_FAILURE;
// The value is the option or text shown entered in the combobox.
nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mContent));
if (menuList)
return menuList->GetLabel(aValue);
return NS_ERROR_FAILURE;
}
void
nsXULComboboxAccessible::Description(nsString& aDescription)
{
@ -139,6 +123,17 @@ nsXULComboboxAccessible::Description(nsString& aDescription)
}
}
void
nsXULComboboxAccessible::Value(nsString& aValue)
{
aValue.Truncate();
// The value is the option or text shown entered in the combobox.
nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mContent));
if (menuList)
menuList->GetLabel(aValue);
}
bool
nsXULComboboxAccessible::CanHaveAnonChildren()
{

View File

@ -53,12 +53,12 @@ public:
nsXULComboboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
// nsIAccessible
NS_IMETHOD GetValue(nsAString& aValue);
NS_IMETHOD DoAction(PRUint8 aIndex);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
// nsAccessible
virtual void Description(nsString& aDescription);
virtual void Value(nsString& aValue);
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();
virtual bool CanHaveAnonChildren();

View File

@ -728,25 +728,22 @@ NS_IMPL_ISUPPORTS_INHERITED3(nsXULTextFieldAccessible, nsAccessible, nsHyperText
////////////////////////////////////////////////////////////////////////////////
// nsXULTextFieldAccessible: nsIAccessible
NS_IMETHODIMP nsXULTextFieldAccessible::GetValue(nsAString& aValue)
void
nsXULTextFieldAccessible::Value(nsString& aValue)
{
if (IsDefunct())
return NS_ERROR_FAILURE;
PRUint64 state = NativeState();
if (state & states::PROTECTED) // Don't return password text!
return NS_ERROR_FAILURE;
aValue.Truncate();
if (NativeRole() == roles::PASSWORD_TEXT) // Don't return password text!
return;
nsCOMPtr<nsIDOMXULTextBoxElement> textBox(do_QueryInterface(mContent));
if (textBox) {
return textBox->GetValue(aValue);
textBox->GetValue(aValue);
return;
}
nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mContent));
if (menuList) {
return menuList->GetLabel(aValue);
}
return NS_ERROR_FAILURE;
if (menuList)
menuList->GetLabel(aValue);
}
void

View File

@ -254,7 +254,6 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessible
NS_IMETHOD GetValue(nsAString& aValue);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 index);
@ -262,6 +261,7 @@ public:
virtual already_AddRefed<nsIEditor> GetEditor() const;
// nsAccessible
virtual void Value(nsString& aValue);
virtual void ApplyARIAState(PRUint64* aState);
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();

View File

@ -210,17 +210,18 @@ nsXULListboxAccessible::NativeState()
/**
* Our value is the label of our ( first ) selected child.
*/
NS_IMETHODIMP nsXULListboxAccessible::GetValue(nsAString& _retval)
void
nsXULListboxAccessible::Value(nsString& aValue)
{
_retval.Truncate();
aValue.Truncate();
nsCOMPtr<nsIDOMXULSelectControlElement> select(do_QueryInterface(mContent));
if (select) {
nsCOMPtr<nsIDOMXULSelectControlItemElement> selectedItem;
select->GetSelectedItem(getter_AddRefs(selectedItem));
if (selectedItem)
return selectedItem->GetLabel(_retval);
selectedItem->GetLabel(aValue);
}
return NS_ERROR_FAILURE;
}
role

View File

@ -104,13 +104,11 @@ public:
// nsIAccessibleTable
NS_DECL_OR_FORWARD_NSIACCESSIBLETABLE_WITH_XPCACCESSIBLETABLE
// nsIAccessible
NS_IMETHOD GetValue(nsAString& aValue);
// nsAccessNode
virtual void Shutdown();
// nsAccessible
virtual void Value(nsString& aValue);
virtual mozilla::a11y::TableAccessible* AsTable() { return this; }
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();

View File

@ -92,10 +92,10 @@ nsXULSliderAccessible::NativeState()
// nsIAccessible
NS_IMETHODIMP
nsXULSliderAccessible::GetValue(nsAString& aValue)
void
nsXULSliderAccessible::Value(nsString& aValue)
{
return GetSliderAttr(nsGkAtoms::curpos, aValue);
GetSliderAttr(nsGkAtoms::curpos, aValue);
}
PRUint8

View File

@ -55,7 +55,6 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessible
NS_IMETHOD GetValue(nsAString& aValue);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 aIndex);
@ -63,6 +62,7 @@ public:
NS_DECL_NSIACCESSIBLEVALUE
// nsAccessible
virtual void Value(nsString& aValue);
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();
virtual bool CanHaveAnonChildren();

View File

@ -187,10 +187,10 @@ nsXULTabsAccessible::ActionCount()
return 0;
}
/** no value */
NS_IMETHODIMP nsXULTabsAccessible::GetValue(nsAString& _retval)
void
nsXULTabsAccessible::Value(nsString& aValue)
{
return NS_OK;
aValue.Truncate();
}
nsresult

View File

@ -76,10 +76,8 @@ class nsXULTabsAccessible : public XULSelectControlAccessible
public:
nsXULTabsAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
// nsIAccessible
NS_IMETHOD GetValue(nsAString& _retval);
// nsAccessible
virtual void Value(nsString& aValue);
virtual nsresult GetNameInternal(nsAString& aName);
virtual mozilla::a11y::role NativeRole();

View File

@ -151,16 +151,12 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsXULLinkAccessible, nsHyperTextAccessibleWrap,
////////////////////////////////////////////////////////////////////////////////
// nsXULLinkAccessible. nsIAccessible
NS_IMETHODIMP
nsXULLinkAccessible::GetValue(nsAString& aValue)
void
nsXULLinkAccessible::Value(nsString& aValue)
{
aValue.Truncate();
if (IsDefunct())
return NS_ERROR_FAILURE;
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::href, aValue);
return NS_OK;
}
nsresult

View File

@ -81,12 +81,11 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessible
NS_IMETHOD GetValue(nsAString& aValue);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessible
virtual void Value(nsString& aValue);
virtual nsresult GetNameInternal(nsAString& aName);
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();

View File

@ -143,20 +143,17 @@ nsXULTreeAccessible::NativeState()
return state;
}
NS_IMETHODIMP
nsXULTreeAccessible::GetValue(nsAString& aValue)
void
nsXULTreeAccessible::Value(nsString& aValue)
{
// Return the value is the first selected child.
aValue.Truncate();
if (IsDefunct() || !mTreeView)
return NS_ERROR_FAILURE;
nsCOMPtr<nsITreeSelection> selection;
mTreeView->GetSelection(getter_AddRefs(selection));
if (!selection)
return NS_ERROR_FAILURE;
return;
PRInt32 currentIndex;
nsCOMPtr<nsIDOMElement> selectItem;
@ -169,10 +166,9 @@ nsXULTreeAccessible::GetValue(nsAString& aValue)
if (cols)
cols->GetKeyColumn(getter_AddRefs(keyCol));
return mTreeView->GetCellText(currentIndex, keyCol, aValue);
mTreeView->GetCellText(currentIndex, keyCol, aValue);
}
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -74,13 +74,11 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXULTreeAccessible,
nsAccessible)
// nsIAccessible
NS_IMETHOD GetValue(nsAString& aValue);
// nsAccessNode
virtual void Shutdown();
// nsAccessible
virtual void Value(nsString& aValue);
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();
virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,

View File

@ -1,15 +1,5 @@
function testValue(aID, aAcc, aValue, aRole)
{
if (aRole == ROLE_PASSWORD_TEXT) {
var value;
try {
value = aAcc.value;
do_throw("We do not want a value on " + aID + "!");
} catch(e) {
is(e.result, Components.results.NS_ERROR_FAILURE,
"Wrong return value for getValue on " + aID + "!");
}
} else
is(aAcc.value, aValue, "Wrong value for " + aID + "!");
}