Back out bug 372367 due to a regression

This commit is contained in:
ginn.chen%sun.com 2007-03-13 03:22:44 +00:00
Родитель ac5a543cca
Коммит 2909e5b1c5
5 изменённых файлов: 58 добавлений и 40 удалений

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

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

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

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

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

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

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

@ -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<nsIDOMHTMLInputElement> htmlInput(do_QueryInterface(mDOMNode, &rv));
// Is it an <input> or a <textarea> ?
*aExtState |= htmlInput ? EXT_STATE_SINGLE_LINE : EXT_STATE_MULTI_LINE;
if (!(*aExtState & EXT_STATE_EDITABLE))
return NS_OK;
PRUint32 state;
rv = GetState(&state);
NS_ENSURE_SUCCESS(rv, rv);
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)) {
*aExtState |= EXT_STATE_SUPPORTS_AUTOCOMPLETION;
}
} else if (gIsFormFillEnabled && htmlInput && !(state & 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")) {
GetState(&state);
const PRUint32 kNonEditableStates = STATE_READONLY | STATE_UNAVAILABLE;
if (0 == (state & kNonEditableStates)) {
*aExtState |= 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)) {
*aExtState |= EXT_STATE_SUPPORTS_AUTOCOMPLETION;
}
}
else if (gIsFormFillEnabled && htmlInput && !(state & 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")) {
*aExtState |= EXT_STATE_SUPPORTS_AUTOCOMPLETION;
}
}
}
}
return NS_OK;

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

@ -635,8 +635,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()
{
@ -683,6 +682,13 @@ NS_IMETHODIMP nsXULTextFieldAccessible::GetExtState(PRUint32 *aExtState)
PRBool isMultiLine = content->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::multiline);
*aExtState |= (isMultiLine ? EXT_STATE_MULTI_LINE : EXT_STATE_SINGLE_LINE);
PRUint32 state;
GetState(&state);
const PRUint32 kNonEditableStates = STATE_READONLY | STATE_UNAVAILABLE;
if (0 == (state & kNonEditableStates)) {
*aExtState |= EXT_STATE_EDITABLE;
}
return NS_OK;
}