Bug 1360162 - Don't call UpdateOverlayTextVisibility twice by input.value setter when input element has focus. r=masayuki

When editor has focus, input.value setter will call UpdateOverlayTextVisibility via nsTextInputListener::EditAction -> nsTextControlFrame::SetValueChanged at first.  But SetValue will call UpdateOverlayTextVisibility again via ValueWasChanged.

So it is unnecessary to call UpdateOverlayTextVisibility on nsTextEditorState::SetValue when we have the editor.

MozReview-Commit-ID: Hw3Bh64Euo6
This commit is contained in:
Makoto Kato
2017-06-21 13:10:58 +09:00
parent 2bf9335dea
commit 52e77ceefe

View File

@@ -2695,6 +2695,11 @@ nsTextEditorState::SetValue(const nsAString& aValue, const nsAString* aOldValue,
mTextListener->SetValueChanged(true);
mTextListener->SettingValue(false);
if (!notifyValueChanged) {
// Listener doesn't update frame, but it is required for placeholder
ValueWasChanged(true);
}
}
if (!weakFrame.IsAlive()) {
@@ -2757,11 +2762,11 @@ nsTextEditorState::SetValue(const nsAString& aValue, const nsAString* aOldValue,
props.SetIsDirty();
}
}
}
// If we've reached the point where the root node has been created, we
// can assume that it's safe to notify.
ValueWasChanged(!!mRootNode);
// If we've reached the point where the root node has been created, we
// can assume that it's safe to notify.
ValueWasChanged(!!mRootNode);
}
mTextCtrlElement->OnValueChanged(/* aNotify = */ !!mRootNode,
/* aWasInteractiveUserChange = */ false);