Backing out fix for bug 372367 as it causes startup crashes when a screen reader is running

This commit is contained in:
aaronleventhal@moonset.net 2007-04-05 14:52:03 -07:00
Родитель fd6ea22734
Коммит 59aac6785e
6 изменённых файлов: 56 добавлений и 45 удалений

Просмотреть файл

@ -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
*/

Просмотреть файл

@ -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")

Просмотреть файл

@ -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)
{

Просмотреть файл

@ -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<nsIAccessible> docAccessible =
nsCOMPtr<nsIAccessible> docAccessible =
do_QueryInterface(nsCOMPtr<nsIAccessibleDocument>(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) {

Просмотреть файл

@ -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<nsIDOMHTMLInputElement> htmlInput(do_QueryInterface(mDOMNode));
nsCOMPtr<nsIDOMHTMLInputElement> htmlInput(do_QueryInterface(mDOMNode, &rv));
// Is it an <input> or a <textarea> ?
*aExtraState |= htmlInput ? nsIAccessibleStates::EXT_STATE_SINGLE_LINE :
nsIAccessibleStates::EXT_STATE_MULTI_LINE;
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.
nsAutoString autocomplete;
content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::autocomplete,
autocomplete);
if (!autocomplete.LowerCaseEqualsLiteral("off")) {
nsCOMPtr<nsIDOMHTMLFormElement> form;
htmlInput->GetForm(getter_AddRefs(form));
nsCOMPtr<nsIContent> formContent(do_QueryInterface(form));
if (formContent) {
formContent->GetAttr(kNameSpaceID_None,
nsAccessibilityAtoms::autocomplete, autocomplete);
}
if (!formContent || !autocomplete.LowerCaseEqualsLiteral("off"))
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)) {
*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.
nsAutoString autocomplete;
htmlInput->GetAttribute(NS_LITERAL_STRING("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")) {
*aExtraState |= nsIAccessibleStates::EXT_STATE_SUPPORTS_AUTOCOMPLETION;
}
}
}
}

Просмотреть файл

@ -675,8 +675,7 @@ nsXULTextFieldAccessible::nsXULTextFieldAccessible(nsIDOMNode* aNode, nsIWeakRef
{
}
NS_IMPL_ISUPPORTS_INHERITED1(nsXULTextFieldAccessible, nsHyperTextAccessible,
nsIAccessibleText)
NS_IMPL_ISUPPORTS_INHERITED2(nsXULTextFieldAccessible, nsAccessible, nsIAccessibleText, nsIAccessibleEditableText)
NS_IMETHODIMP nsXULTextFieldAccessible::Init()
{
@ -781,6 +780,11 @@ 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;
}