From 954f6c04671f9a25d9f492691bd471d8ef5b8497 Mon Sep 17 00:00:00 2001 From: "louie.zhao%sun.com" Date: Tue, 1 Jun 2004 05:25:00 +0000 Subject: [PATCH] bug241055 nsHTMLTextFieldAccessible need "ATK_STATE_EDITABLE" state and "Activate" action. r = pkw sr= henry --- accessible/src/base/accessible.properties | 11 ------- .../src/html/nsHTMLFormControlAccessible.cpp | 29 +++++++++++++++++++ .../src/html/nsHTMLFormControlAccessible.h | 3 ++ 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/accessible/src/base/accessible.properties b/accessible/src/base/accessible.properties index d93ff023b38..e69de29bb2d 100644 --- a/accessible/src/base/accessible.properties +++ b/accessible/src/base/accessible.properties @@ -1,11 +0,0 @@ -jump = Jump -press = Press -check = Check -uncheck = Uncheck -select = Select -open = Open -close = Close -switch = Switch -click = Click -collapse= Collapse -expand = Expand diff --git a/accessible/src/html/nsHTMLFormControlAccessible.cpp b/accessible/src/html/nsHTMLFormControlAccessible.cpp index 3fe90a9f2cd..ca6f20abe48 100644 --- a/accessible/src/html/nsHTMLFormControlAccessible.cpp +++ b/accessible/src/html/nsHTMLFormControlAccessible.cpp @@ -415,6 +415,35 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible::GetState(PRUint32 *_retval) return NS_OK; } +NS_IMETHODIMP nsHTMLTextFieldAccessible::GetNumActions(PRUint8 *_retval) +{ + *_retval = eSingle_Action; + return NS_OK;; +} + +NS_IMETHODIMP nsHTMLTextFieldAccessible::GetActionName(PRUint8 index, nsAString& _retval) +{ + if (index == eAction_Click) { + nsAccessible::GetTranslatedString(NS_LITERAL_STRING("activate"), _retval); + return NS_OK; + } + return NS_ERROR_INVALID_ARG; +} + +NS_IMETHODIMP nsHTMLTextFieldAccessible::DoAction(PRUint8 index) +{ + if (index == 0) { + nsCOMPtr element(do_QueryInterface(mDOMNode)); + if ( element ) + { + element->Focus(); + return NS_OK; + } + return NS_ERROR_FAILURE; + } + return NS_ERROR_INVALID_ARG; +} + // --- groupbox ----- /* diff --git a/accessible/src/html/nsHTMLFormControlAccessible.h b/accessible/src/html/nsHTMLFormControlAccessible.h index 00862ee1943..54f6c5741ed 100644 --- a/accessible/src/html/nsHTMLFormControlAccessible.h +++ b/accessible/src/html/nsHTMLFormControlAccessible.h @@ -99,6 +99,9 @@ public: NS_IMETHOD GetRole(PRUint32 *_retval); NS_IMETHOD GetValue(nsAString& _retval); NS_IMETHOD GetState(PRUint32 *_retval); + NS_IMETHOD GetNumActions(PRUint8 *_retval); + NS_IMETHOD GetActionName(PRUint8 index, nsAString& _retval); + NS_IMETHOD DoAction(PRUint8 index); }; class nsHTMLGroupboxAccessible : public nsAccessibleWrap