Bug 673958 - rework accessible focus handling, r=enndeaking, marcoz, tbsaunde, matspal, f=marcoz
This commit is contained in:
@@ -463,40 +463,29 @@ nsHTMLTextFieldAccessible::NativeState()
|
||||
nsGkAtoms::password, eIgnoreCase)) {
|
||||
state |= states::PROTECTED;
|
||||
}
|
||||
else {
|
||||
nsAccessible* parent = Parent();
|
||||
if (parent && parent->Role() == nsIAccessibleRole::ROLE_AUTOCOMPLETE)
|
||||
state |= states::HASPOPUP;
|
||||
}
|
||||
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::readonly)) {
|
||||
state |= states::READONLY;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> htmlInput(do_QueryInterface(mContent));
|
||||
// Is it an <input> or a <textarea> ?
|
||||
if (htmlInput) {
|
||||
state |= states::SINGLE_LINE;
|
||||
}
|
||||
else {
|
||||
state |= states::MULTI_LINE;
|
||||
}
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> htmlInput(do_QueryInterface(mContent));
|
||||
state |= htmlInput ? states::SINGLE_LINE : states::MULTI_LINE;
|
||||
|
||||
if (!(state & states::EDITABLE))
|
||||
if (!(state & states::EDITABLE) ||
|
||||
(state & (states::PROTECTED | states::MULTI_LINE)))
|
||||
return state;
|
||||
|
||||
nsCOMPtr<nsIContent> bindingContent = mContent->GetBindingParent();
|
||||
if (bindingContent &&
|
||||
bindingContent->NodeInfo()->Equals(nsGkAtoms::textbox,
|
||||
kNameSpaceID_XUL)) {
|
||||
if (bindingContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::autocomplete,
|
||||
eIgnoreCase)) {
|
||||
// If parent is XUL textbox and value of @type attribute is "autocomplete",
|
||||
// then this accessible supports autocompletion.
|
||||
state |= states::SUPPORTS_AUTOCOMPLETION;
|
||||
}
|
||||
} else if (gIsFormFillEnabled && htmlInput && !(state & states::PROTECTED)) {
|
||||
// Expose autocomplete states if this input is part of autocomplete widget.
|
||||
nsAccessible* widget = ContainerWidget();
|
||||
if (widget && widget-IsAutoComplete()) {
|
||||
state |= states::HASPOPUP | states::SUPPORTS_AUTOCOMPLETION;
|
||||
return state;
|
||||
}
|
||||
|
||||
// No parent can mean a fake widget created for XUL textbox. If accessible
|
||||
// is unattached from tree then we don't care.
|
||||
if (mParent && gIsFormFillEnabled) {
|
||||
// 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
|
||||
@@ -575,6 +564,23 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAssociatedEditor(nsIEditor **aEditor
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLTextFieldAccessible: Widgets
|
||||
|
||||
bool
|
||||
nsHTMLTextFieldAccessible::IsWidget() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
nsAccessible*
|
||||
nsHTMLTextFieldAccessible::ContainerWidget() const
|
||||
{
|
||||
return mParent && mParent->Role() == nsIAccessibleRole::ROLE_AUTOCOMPLETE ?
|
||||
mParent : nsnull;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLGroupboxAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user