Bug 1606043 - Make TextControlState::SetValueWithoutTextEditor() notify the text control element of value changed before dispatching eEditorInput event r=smaug
I made `nsContentUtils::DispatchInputEvent()` update validity of event target before dispatching `eEditorInput` event in bug 1584963. However, this is not enough because it updates validity only when the type of `<input>` element is `mail`, but it's required for other types, for example, `<input required>`. This patch reverts the hack added in bug 1584963, instead, makes `TextControlState::SetValueWithoutTextEditor()` notifies `TextControlElement` of value change before dispatching `eEditorInput` event because it may have made damage to the performance if `nsContentUtils::DispatchInputEvent()` updated **all** validity state of the event target. Differential Revision: https://phabricator.services.mozilla.com/D60828
This commit is contained in:
@@ -3036,6 +3036,12 @@ bool TextControlState::SetValueWithoutTextEditor(
|
||||
// event listener?
|
||||
if (aHandlingSetValue.GetSetValueFlags() & eSetValue_BySetUserInput) {
|
||||
MOZ_ASSERT(aHandlingSetValue.GetTextControlElement());
|
||||
|
||||
// Update validity state before dispatching "input" event for its
|
||||
// listeners like `EditorBase::NotifyEditorObservers()`.
|
||||
aHandlingSetValue.GetTextControlElement()->OnValueChanged(
|
||||
true, ValueChangeKind::UserInteraction);
|
||||
|
||||
MOZ_ASSERT(!aHandlingSetValue.GetSettingValue().IsVoid());
|
||||
DebugOnly<nsresult> rvIgnored = nsContentUtils::DispatchInputEvent(
|
||||
MOZ_KnownLive(aHandlingSetValue.GetTextControlElement()),
|
||||
|
||||
Reference in New Issue
Block a user