Bug 1345606. setRangeText should mark the text control as dirty. r=ehsan

MozReview-Commit-ID: 9le2PoelGei
This commit is contained in:
Boris Zbarsky 2017-03-09 14:44:36 -05:00
Родитель ef2cceb1d9
Коммит 0bf4f56f8c
3 изменённых файлов: 22 добавлений и 2 удалений

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

@ -6320,7 +6320,9 @@ HTMLInputElement::GetValueFromSetRangeText(nsAString& aValue)
nsresult
HTMLInputElement::SetValueFromSetRangeText(const nsAString& aValue)
{
return SetValueInternal(aValue, nsTextEditorState::eSetValue_ByContent);
return SetValueInternal(aValue,
nsTextEditorState::eSetValue_ByContent |
nsTextEditorState::eSetValue_Notify);
}
Nullable<uint32_t>

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

@ -784,7 +784,9 @@ HTMLTextAreaElement::GetValueFromSetRangeText(nsAString& aValue)
nsresult
HTMLTextAreaElement::SetValueFromSetRangeText(const nsAString& aValue)
{
return SetValueInternal(aValue, nsTextEditorState::eSetValue_ByContent);
return SetValueInternal(aValue,
nsTextEditorState::eSetValue_ByContent |
nsTextEditorState::eSetValue_Notify);
}
nsresult

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

@ -200,4 +200,20 @@ for (var data of elemData) {
}, `selection location after defaultValue set to shorter than selectionStart of ${data.desc}`);
}
for (var data of elemData) {
test(function() {
var el = data.factory();
this.add_cleanup(() => el.remove());
el.defaultValue = sometext;
assert_true(sometext.length > 8,
"sometext too short, test won't work right");
el.selectionStart = 4;
el.selectionEnd = 6;
el.setRangeText("xyz");
el.defaultValue = "set range text";
assert_equals(el.value, sometext.slice(0, 4) + "xyz" + sometext.slice(6),
"Calling setRangeText should set the value dirty flag");
}, `value dirty flag behavior after setRangeText on ${data.desc}`);
}
</script>