Reversing backout of fix for bug 372367 as it is not the cause of startup crashes when a screen reader is running. Original patch by surkov, r=ginn.chen

This commit is contained in:
aaronleventhal@moonset.net 2007-04-05 15:14:08 -07:00
parent 7a52426d7b
commit 18e3f7f649
6 changed files with 45 additions and 56 deletions

View File

@ -57,7 +57,7 @@ interface nsIDOMDOMStringList;
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(3494b81a-1d90-491a-be34-7893f8e27117)]
[scriptable, uuid(b3674866-49a9-4cf2-bfea-c00be2d4a695)]
interface nsIAccessible : nsISupports
{
/**
@ -165,12 +165,6 @@ 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
*/

View File

@ -145,6 +145,7 @@ 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")

View File

@ -2720,12 +2720,6 @@ 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)
{

View File

@ -152,18 +152,19 @@ nsLinkableAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
nsCOMPtr<nsIAccessible> docAccessible =
do_QueryInterface(nsCOMPtr<nsIAccessibleDocument>(GetDocAccessible()));
if (docAccessible) {
PRBool isEditable;
docAccessible->GetIsEditable(&isEditable);
if (isEditable) {
PRUint32 docState = 0, docExtraState = 0;
rv = docAccessible->GetFinalState(&docState, &docExtraState);
if (NS_SUCCEEDED(rv) &&
(docExtraState & nsIAccessibleStates::EXT_STATE_EDITABLE)) {
// Links not focusable in editor
*aState &= ~(nsIAccessibleStates::STATE_FOCUSED |
nsIAccessibleStates::STATE_FOCUSABLE);
}
}
return NS_OK;
}
NS_IMETHODIMP nsLinkableAccessible::GetValue(nsAString& _retval)
{
if (mIsLink) {

View File

@ -358,7 +358,8 @@ nsHyperTextAccessible(aNode, aShell)
{
}
NS_IMPL_ISUPPORTS_INHERITED2(nsHTMLTextFieldAccessible, nsAccessible, nsIAccessibleText, nsIAccessibleEditableText)
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLTextFieldAccessible, nsHyperTextAccessible,
nsIAccessibleText)
NS_IMETHODIMP nsHTMLTextFieldAccessible::Init()
{
@ -433,46 +434,48 @@ nsHTMLTextFieldAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
*aState |= nsIAccessibleStates::STATE_READONLY;
}
if (!aExtraState)
if (!aExtraState || !(*aExtraState & nsIAccessibleStates::EXT_STATE_EDITABLE))
return NS_OK;
nsCOMPtr<nsIDOMHTMLInputElement> htmlInput(do_QueryInterface(mDOMNode, &rv));
nsCOMPtr<nsIDOMHTMLInputElement> htmlInput(do_QueryInterface(mDOMNode));
// Is it an <input> or a <textarea> ?
*aExtraState |= htmlInput ? nsIAccessibleStates::EXT_STATE_SINGLE_LINE :
nsIAccessibleStates::EXT_STATE_MULTI_LINE;
const PRUint32 kNonEditableStates = nsIAccessibleStates::STATE_READONLY |
nsIAccessibleStates::STATE_UNAVAILABLE;
if (0 == (*aState & kNonEditableStates)) {
*aExtraState |= nsIAccessibleStates::EXT_STATE_EDITABLE;
nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
if (content && (content = content->GetBindingParent()) != nsnull &&
content->NodeInfo()->Equals(nsAccessibilityAtoms::textbox, kNameSpaceID_XUL)) {
// If parent is XUL textbox, then it supports autocompletion if type="autocomplete"
if (content->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
NS_LITERAL_STRING("autocomplete"), eIgnoreCase)) {
nsCOMPtr<nsIContent> bindingContent = content->GetBindingParent();
if (bindingContent &&
bindingContent->NodeInfo()->Equals(nsAccessibilityAtoms::textbox,
kNameSpaceID_XUL) &&
bindingContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
nsAccessibilityAtoms::autocomplete,
eIgnoreCase)) {
// If parent is XUL textbox and value of @type attribute is "autocomplete",
// then this accessible supports autocompletion.
*aExtraState |= nsIAccessibleStates::EXT_STATE_SUPPORTS_AUTOCOMPLETION;
}
} else if (gIsFormFillEnabled && htmlInput &&
!(*aState & nsIAccessibleStates::STATE_PROTECTED)) {
// Check to see if autocompletion is allowed on this input
// We don't expose it for password fields even though the entire password can
// be remembered for a page if the user asks it to be.
// However, the kind of autocomplete we're talking here is based on what
// the user types, where a popup of possible choices comes up.
// Check to see if autocompletion is allowed on this input. We don't expose
// it for password fields even though the entire password can be remembered
// for a page if the user asks it to be. However, the kind of autocomplete
// we're talking here is based on what the user types, where a popup of
// possible choices comes up.
nsAutoString autocomplete;
htmlInput->GetAttribute(NS_LITERAL_STRING("autocomplete"), autocomplete);
content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::autocomplete,
autocomplete);
if (!autocomplete.LowerCaseEqualsLiteral("off")) {
nsCOMPtr<nsIDOMHTMLFormElement> form;
htmlInput->GetForm(getter_AddRefs(form));
if (form)
form->GetAttribute(NS_LITERAL_STRING("autocomplete"), autocomplete);
if (!form || !autocomplete.LowerCaseEqualsLiteral("off")) {
nsCOMPtr<nsIContent> formContent(do_QueryInterface(form));
if (formContent) {
formContent->GetAttr(kNameSpaceID_None,
nsAccessibilityAtoms::autocomplete, autocomplete);
}
if (!formContent || !autocomplete.LowerCaseEqualsLiteral("off"))
*aExtraState |= nsIAccessibleStates::EXT_STATE_SUPPORTS_AUTOCOMPLETION;
}
}
}
}
return NS_OK;
}

View File

@ -675,7 +675,8 @@ nsXULTextFieldAccessible::nsXULTextFieldAccessible(nsIDOMNode* aNode, nsIWeakRef
{
}
NS_IMPL_ISUPPORTS_INHERITED2(nsXULTextFieldAccessible, nsAccessible, nsIAccessibleText, nsIAccessibleEditableText)
NS_IMPL_ISUPPORTS_INHERITED1(nsXULTextFieldAccessible, nsHyperTextAccessible,
nsIAccessibleText)
NS_IMETHODIMP nsXULTextFieldAccessible::Init()
{
@ -780,11 +781,6 @@ nsXULTextFieldAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
*aExtraState |= (isMultiLine ? nsIAccessibleStates::EXT_STATE_MULTI_LINE :
nsIAccessibleStates::EXT_STATE_SINGLE_LINE);
const PRUint32 kNonEditableStates = nsIAccessibleStates::STATE_READONLY |
nsIAccessibleStates::STATE_UNAVAILABLE;
if (0 == (*aState & kNonEditableStates))
*aExtraState |= nsIAccessibleStates::EXT_STATE_EDITABLE;
return NS_OK;
}