Bug 737889 - Make sure that clearing the readonly attribute does not disable spell checking; r=roc

This commit is contained in:
Ehsan Akhgari 2012-03-23 11:35:40 -04:00
parent 1c087a36bd
commit 833302e22f
5 changed files with 31 additions and 0 deletions

View File

@ -855,6 +855,10 @@ nsHTMLInputElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
}
UpdateEditableState(aNotify);
nsTextEditorState *state = GetEditorState();
if (state) {
state->UpdateEditableState(aNotify);
}
UpdateState(aNotify);
}

View File

@ -1293,6 +1293,7 @@ nsHTMLTextAreaElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
if (aName == nsGkAtoms::readonly) {
UpdateEditableState(aNotify);
mState->UpdateEditableState(aNotify);
}
UpdateState(aNotify);
}

View File

@ -44,6 +44,7 @@
#include "nsITextControlElement.h"
#include "nsITextControlFrame.h"
#include "nsCycleCollectionParticipant.h"
#include "nsIContent.h"
class nsTextInputListener;
class nsTextControlFrame;
@ -238,6 +239,12 @@ public:
void WillInitEagerly() { mSelectionRestoreEagerInit = true; }
bool HasNeverInitializedBefore() const { return !mEverInited; }
void UpdateEditableState(bool aNotify) {
if (mRootNode) {
mRootNode->UpdateEditableState(aNotify);
}
}
private:
friend class RestoreSelectionState;

View File

@ -44,6 +44,7 @@ fails-if(Android) != spellcheck-input-property-dynamic-override-inherit.html spe
fails-if(Android) != spellcheck-textarea-attr.html spellcheck-textarea-ref.html
needs-focus == spellcheck-textarea-focused.html spellcheck-textarea-ref.html
needs-focus == spellcheck-textarea-focused-reframe.html spellcheck-textarea-ref.html
needs-focus == spellcheck-textarea-focused-notreadonly.html spellcheck-textarea-ref.html
fails-if(Android) != spellcheck-textarea-nofocus.html spellcheck-textarea-ref.html
fails-if(Android) != spellcheck-textarea-disabled.html spellcheck-textarea-ref.html
fails-if(Android) != spellcheck-textarea-attr-inherit.html spellcheck-textarea-ref.html

View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<body>
<textarea id="testBox" readonly></textarea>
<script type="text/javascript">
//Adding focus to the textbox should trigger a spellcheck
var textbox = document.getElementById("testBox");
addEventListener("load", function() {
textbox.readOnly = false;
textbox.focus();
textbox.value = "blahblahblah";
textbox.selectionStart = textbox.selectionEnd = 0;
}, false);
</script>
</body>
</html>