diff --git a/accessible/public/nsIAccessible.idl b/accessible/public/nsIAccessible.idl index ff5c98eda775..c34006ce510f 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(3494b81a-1d90-491a-be34-7893f8e27117)] interface nsIAccessible : nsISupports { /** @@ -165,6 +165,12 @@ interface nsIAccessible : nsISupports */ void getFinalState(out unsigned long aState, out unsigned long aExtraState); + /** + * 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/nsAccessibilityAtomList.h b/accessible/src/base/nsAccessibilityAtomList.h index 774ca6d71db8..3ad7ef6ae778 100755 --- a/accessible/src/base/nsAccessibilityAtomList.h +++ b/accessible/src/base/nsAccessibilityAtomList.h @@ -145,7 +145,6 @@ ACCESSIBILITY_ATOM(acceltext, "acceltext") ACCESSIBILITY_ATOM(accesskey, "accesskey") ACCESSIBILITY_ATOM(alt, "alt") ACCESSIBILITY_ATOM(anonid, "anonid") // Used for ID's in XBL -ACCESSIBILITY_ATOM(autocomplete, "autocomplete") // Used as attribute value too ACCESSIBILITY_ATOM(control, "control") ACCESSIBILITY_ATOM(data, "data") ACCESSIBILITY_ATOM(disabled, "disabled") diff --git a/accessible/src/base/nsAccessible.cpp b/accessible/src/base/nsAccessible.cpp index dfb676ac9397..e48f03890284 100644 --- a/accessible/src/base/nsAccessible.cpp +++ b/accessible/src/base/nsAccessible.cpp @@ -2720,6 +2720,12 @@ NS_IMETHODIMP nsAccessible::ExtendSelection() return NS_ERROR_NOT_IMPLEMENTED; } +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 cabfb6001d7c..c259ca94554d 100644 --- a/accessible/src/base/nsBaseWidgetAccessible.cpp +++ b/accessible/src/base/nsBaseWidgetAccessible.cpp @@ -149,22 +149,21 @@ nsLinkableAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState) // 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 docState = 0, docExtraState = 0; - rv = docAccessible->GetFinalState(&docState, &docExtraState); - if (NS_SUCCEEDED(rv) && - (docExtraState & nsIAccessibleStates::EXT_STATE_EDITABLE)) { + PRBool isEditable; + docAccessible->GetIsEditable(&isEditable); + if (isEditable) { // Links not focusable in editor *aState &= ~(nsIAccessibleStates::STATE_FOCUSED | nsIAccessibleStates::STATE_FOCUSABLE); } } - return NS_OK; } + NS_IMETHODIMP nsLinkableAccessible::GetValue(nsAString& _retval) { if (mIsLink) { diff --git a/accessible/src/html/nsHTMLFormControlAccessible.cpp b/accessible/src/html/nsHTMLFormControlAccessible.cpp index 22363bc17c81..3e640aff9ece 100644 --- a/accessible/src/html/nsHTMLFormControlAccessible.cpp +++ b/accessible/src/html/nsHTMLFormControlAccessible.cpp @@ -358,8 +358,7 @@ nsHyperTextAccessible(aNode, aShell) { } -NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLTextFieldAccessible, nsHyperTextAccessible, - nsIAccessibleText) +NS_IMPL_ISUPPORTS_INHERITED2(nsHTMLTextFieldAccessible, nsAccessible, nsIAccessibleText, nsIAccessibleEditableText) NS_IMETHODIMP nsHTMLTextFieldAccessible::Init() { @@ -434,46 +433,44 @@ nsHTMLTextFieldAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState) *aState |= nsIAccessibleStates::STATE_READONLY; } - if (!aExtraState || !(*aExtraState & nsIAccessibleStates::EXT_STATE_EDITABLE)) + if (!aExtraState) return NS_OK; - nsCOMPtr htmlInput(do_QueryInterface(mDOMNode)); + nsCOMPtr htmlInput(do_QueryInterface(mDOMNode, &rv)); // Is it an or a