Bug 1283915 - Preserve input selection properties after type change. r=smaug

MozReview-Commit-ID: 7xJKc3vIpTY
This commit is contained in:
Decky Coss
2016-07-27 11:04:53 -04:00
parent af36ab2fce
commit 0eb80cd61e
5 changed files with 95 additions and 0 deletions

View File

@@ -4826,12 +4826,22 @@ HTMLInputElement::HandleTypeChange(uint8_t aNewType)
GetValue(aOldValue);
}
nsTextEditorState::SelectionProperties sp;
if (GetEditorState()) {
sp = mInputData.mState->GetSelectionProperties();
}
// We already have a copy of the value, lets free it and changes the type.
FreeData();
mType = aNewType;
if (IsSingleLineTextControl()) {
mInputData.mState = new nsTextEditorState(this);
if (!sp.IsDefault()) {
mInputData.mState->SetSelectionProperties(sp);
}
}
/**