Bug 1366218 - Use fast path to check empty value. r=smaug

HTMLInputElement::IsValueEmpty uses DocumentEncoder when input element has focus.  DocumentEncoder is slow, so we should use fast path (nsTextEditorState::HasNonEmptyValue) to check whether value is empty.

MozReview-Commit-ID: 1JxAeZ6z5A4

--HG--
extra : rebase_source : 8cf89721bf59f0bde09e217428bb593ad6d328de
This commit is contained in:
Makoto Kato 2017-05-23 12:27:23 +09:00
Родитель 88991ce560
Коммит 54382f83cb
1 изменённых файлов: 4 добавлений и 0 удалений

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

@ -1788,6 +1788,10 @@ HTMLInputElement::GetNonFileValueInternal(nsAString& aValue) const
bool
HTMLInputElement::IsValueEmpty() const
{
if (GetValueMode() == VALUE_MODE_VALUE && IsSingleLineTextControl(false)) {
return !mInputData.mState->HasNonEmptyValue();
}
nsAutoString value;
GetNonFileValueInternal(value);