Bug 940006 - Get the 'readonly' attribute working for <input type=number>. r=smaug
This commit is contained in:
@@ -153,7 +153,8 @@ nsNumberControlFrame::AttributeChanged(int32_t aNameSpaceID,
|
||||
int32_t aModType)
|
||||
{
|
||||
if (aNameSpaceID == kNameSpaceID_None) {
|
||||
if (aAttribute == nsGkAtoms::placeholder) {
|
||||
if (aAttribute == nsGkAtoms::placeholder ||
|
||||
aAttribute == nsGkAtoms::readonly) {
|
||||
if (aModType == nsIDOMMutationEvent::REMOVAL) {
|
||||
mTextField->UnsetAttr(aNameSpaceID, aAttribute, true);
|
||||
} else {
|
||||
@@ -252,6 +253,12 @@ nsNumberControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
||||
HTMLInputElement::FromContent(mContent)->GetValue(value);
|
||||
mTextField->SetAttr(kNameSpaceID_None, nsGkAtoms::value, value, false);
|
||||
|
||||
// If we're readonly, make sure our anonymous text control is too:
|
||||
nsAutoString readonly;
|
||||
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::readonly, readonly)) {
|
||||
mTextField->SetAttr(kNameSpaceID_None, nsGkAtoms::readonly, readonly, false);
|
||||
}
|
||||
|
||||
// Initialize the text field's placeholder, if ours is set:
|
||||
nsAutoString placeholder;
|
||||
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::placeholder, placeholder)) {
|
||||
|
||||
Reference in New Issue
Block a user