From 2909e5b1c5405acc7c3fc2dfd67f996208178025 Mon Sep 17 00:00:00 2001 From: "ginn.chen%sun.com" Date: Tue, 13 Mar 2007 03:22:44 +0000 Subject: [PATCH] Back out bug 372367 due to a regression --- accessible/public/nsIAccessible.idl | 8 ++- accessible/src/base/nsAccessible.cpp | 6 ++ .../src/base/nsBaseWidgetAccessible.cpp | 11 ++-- .../src/html/nsHTMLFormControlAccessible.cpp | 63 ++++++++++--------- .../src/xul/nsXULFormControlAccessible.cpp | 10 ++- 5 files changed, 58 insertions(+), 40 deletions(-) diff --git a/accessible/public/nsIAccessible.idl b/accessible/public/nsIAccessible.idl index 781c8d83de6f..9a154f8d0b1c 100644 --- a/accessible/public/nsIAccessible.idl +++ b/accessible/public/nsIAccessible.idl @@ -57,7 +57,7 @@ interface nsIDOMDOMStringList; * * @status UNDER_REVIEW */ -[scriptable, uuid(b3674866-49a9-4cf2-bfea-c00be2d4a695)] +[scriptable, uuid(58305abc-1b04-4e1e-a7f2-4c52ffa8936b)] interface nsIAccessible : nsISupports { /** @@ -163,6 +163,12 @@ interface nsIAccessible : nsISupports */ readonly attribute unsigned long extState; + /** + * True if this element is live in an editor. + * False if the content is being displayed but not edited. + */ + readonly attribute boolean isEditable; + /** * Help text associated with node */ diff --git a/accessible/src/base/nsAccessible.cpp b/accessible/src/base/nsAccessible.cpp index 2d5d531e43f3..b7e16177e500 100644 --- a/accessible/src/base/nsAccessible.cpp +++ b/accessible/src/base/nsAccessible.cpp @@ -2588,6 +2588,12 @@ NS_IMETHODIMP nsAccessible::GetExtState(PRUint32 *aExtState) return NS_OK; } +NS_IMETHODIMP nsAccessible::GetIsEditable(PRBool *aIsEditable) +{ + *aIsEditable = PR_FALSE; + return NS_OK; +} + /* [noscript] void getNativeInterface(out voidPtr aOutAccessible); */ NS_IMETHODIMP nsAccessible::GetNativeInterface(void **aOutAccessible) { diff --git a/accessible/src/base/nsBaseWidgetAccessible.cpp b/accessible/src/base/nsBaseWidgetAccessible.cpp index 6373871e3e82..29d34f7e834a 100644 --- a/accessible/src/base/nsBaseWidgetAccessible.cpp +++ b/accessible/src/base/nsBaseWidgetAccessible.cpp @@ -146,14 +146,13 @@ NS_IMETHODIMP nsLinkableAccessible::GetState(PRUint32 *aState) // XXX What if we're in a contenteditable container? // We may need to go up the parent chain unless a better API is found - nsCOMPtr docAccessible = + nsCOMPtr docAccessible = do_QueryInterface(nsCOMPtr(GetDocAccessible())); if (docAccessible) { - PRUint32 aExtState = 0; - nsresult rv = GetExtState(&aExtState); - if (NS_SUCCEEDED(rv) && (aExtState & EXT_STATE_EDITABLE)) { - // Links not focusable in editor - *aState &= ~(STATE_FOCUSED | STATE_FOCUSABLE); + PRBool isEditable; + docAccessible->GetIsEditable(&isEditable); + if (isEditable) { + *aState &= ~(STATE_FOCUSED | STATE_FOCUSABLE); // Links not focusable in editor } } return NS_OK; diff --git a/accessible/src/html/nsHTMLFormControlAccessible.cpp b/accessible/src/html/nsHTMLFormControlAccessible.cpp index 590163b18470..14ebdd7d592b 100644 --- a/accessible/src/html/nsHTMLFormControlAccessible.cpp +++ b/accessible/src/html/nsHTMLFormControlAccessible.cpp @@ -286,8 +286,7 @@ nsHyperTextAccessible(aNode, aShell) { } -NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLTextFieldAccessible, nsHyperTextAccessible, - nsIAccessibleText) +NS_IMPL_ISUPPORTS_INHERITED2(nsHTMLTextFieldAccessible, nsAccessible, nsIAccessibleText, nsIAccessibleEditableText) NS_IMETHODIMP nsHTMLTextFieldAccessible::Init() { @@ -369,44 +368,46 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible::GetState(PRUint32 *aState) NS_IMETHODIMP nsHTMLTextFieldAccessible::GetExtState(PRUint32 *aExtState) { nsresult rv = nsHyperTextAccessible::GetExtState(aExtState); - NS_ENSURE_SUCCESS(rv, rv); + if (NS_FAILED(rv)) { + return rv; + } nsCOMPtr htmlInput(do_QueryInterface(mDOMNode, &rv)); // Is it an or a