Bug 549674 part.1 Commit composition string at setting value of <input> or <textarea> r=smaug

This commit is contained in:
Masayuki Nakano
2015-06-18 23:56:20 +09:00
parent ad6d6410fe
commit 9845694589
7 changed files with 489 additions and 60 deletions

View File

@@ -297,13 +297,14 @@ HTMLTextAreaElement::GetPlaceholderVisibility()
nsresult
HTMLTextAreaElement::SetValueInternal(const nsAString& aValue,
bool aUserInput)
uint32_t aFlags)
{
// Need to set the value changed flag here, so that
// nsTextControlFrame::UpdateValueDisplay retrieves the correct value
// if needed.
SetValueChanged(true);
if (!mState.SetValue(aValue, aUserInput, true)) {
aFlags |= nsTextEditorState::eSetValue_Notify;
if (!mState.SetValue(aValue, aFlags)) {
return NS_ERROR_OUT_OF_MEMORY;
}
@@ -323,7 +324,8 @@ HTMLTextAreaElement::SetValue(const nsAString& aValue)
nsAutoString currentValue;
GetValueInternal(currentValue, true);
nsresult rv = SetValueInternal(aValue, false);
nsresult rv =
SetValueInternal(aValue, nsTextEditorState::eSetValue_ByContent);
NS_ENSURE_SUCCESS(rv, rv);
if (mFocusedValue.Equals(currentValue)) {
@@ -339,7 +341,7 @@ HTMLTextAreaElement::SetUserInput(const nsAString& aValue)
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
return SetValueInternal(aValue, true);
return SetValueInternal(aValue, nsTextEditorState::eSetValue_BySetUserInput);
}
NS_IMETHODIMP
@@ -968,7 +970,8 @@ HTMLTextAreaElement::SetRangeText(const nsAString& aReplacement,
if (aStart <= aEnd) {
value.Replace(aStart, aEnd - aStart, aReplacement);
nsresult rv = SetValueInternal(value, false);
nsresult rv =
SetValueInternal(value, nsTextEditorState::eSetValue_ByContent);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return;