Bug 427245 IME is enabled on non text editable input element (re-landing, the previous test failure is not related this patch.) r=peterv, sr=roc, a1.9=beltzner

git-svn-id: svn://10.0.0.236/trunk@250054 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
masayuki%d-toybox.com 2008-04-11 11:31:13 +00:00
parent 4820a0fff2
commit 6a86e61a8a
2 changed files with 21 additions and 10 deletions

View File

@ -1916,17 +1916,24 @@ nsGenericHTMLFormElement::UpdateEditableFormControlState()
}
nsIContent *parent = GetParent();
PRBool editable = parent && parent->HasFlag(NODE_IS_EDITABLE);
if (!editable) {
// If not contentEditable we still need to check the readonly attribute.
PRBool roState;
GetBoolAttr(nsGkAtoms::readonly, &roState);
editable = !roState;
if (parent && parent->HasFlag(NODE_IS_EDITABLE)) {
SetEditableFlag(PR_TRUE);
return;
}
SetEditableFlag(editable);
PRInt32 formType = GetType();
if (formType != NS_FORM_INPUT_PASSWORD && formType != NS_FORM_INPUT_TEXT &&
formType != NS_FORM_TEXTAREA) {
SetEditableFlag(PR_FALSE);
return;
}
// If not contentEditable we still need to check the readonly attribute.
PRBool roState;
GetBoolAttr(nsGkAtoms::readonly, &roState);
SetEditableFlag(!roState);
}

View File

@ -563,7 +563,9 @@ nsHTMLInputElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
// now.
nsIDocument* document = GetCurrentDoc();
MOZ_AUTO_DOC_UPDATE(document, UPDATE_CONTENT_STATE, aNotify);
UpdateEditableState();
if (!aValue) {
// We're now a text input. Note that we have to handle this manually,
// since removing an attribute (which is what happened, since aValue is
@ -613,7 +615,9 @@ nsHTMLInputElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
NS_EVENT_STATE_BROKEN |
NS_EVENT_STATE_USERDISABLED |
NS_EVENT_STATE_SUPPRESSED |
NS_EVENT_STATE_LOADING);
NS_EVENT_STATE_LOADING |
NS_EVENT_STATE_MOZ_READONLY |
NS_EVENT_STATE_MOZ_READWRITE);
}
}