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
This commit is contained in:
Makoto Kato
2017-05-23 12:27:23 +09:00
parent 6aac8cf7e1
commit 3c935193e9

View File

@@ -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);