Bug 1679474 - Removed DispatchSelectEvent from HTMLInputElement::PostHandleEvent. r=masayuki

Differential Revision: https://phabricator.services.mozilla.com/D154776
This commit is contained in:
Jan-Niklas Jaeschke
2022-08-24 09:23:39 +00:00
parent 2b5a041bc7
commit 88991698bc
3 changed files with 35 additions and 23 deletions

View File

@@ -3013,22 +3013,6 @@ void HTMLInputElement::Select() {
TextControlState::ScrollAfterSelection::No);
}
void HTMLInputElement::DispatchSelectEvent(nsPresContext* aPresContext) {
// If already handling select event, don't dispatch a second.
if (!mHandlingSelectEvent) {
// FYI: If you want to skip dispatching eFormSelect event and if there are
// no event listeners, you can refer
// nsPIDOMWindow::HasFormSelectEventListeners(), but be careful about
// some C++ event handlers, e.g., EventTarget::PostHandleEvent().
WidgetEvent event(true, eFormSelect);
mHandlingSelectEvent = true;
EventDispatcher::Dispatch(static_cast<nsIContent*>(this), aPresContext,
&event);
mHandlingSelectEvent = false;
}
}
void HTMLInputElement::SelectAll(nsPresContext* aPresContext) {
nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
@@ -3747,7 +3731,6 @@ nsresult HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor) {
if (shouldSelectAllOnFocus) {
RefPtr<nsPresContext> presContext =
GetPresContext(eForComposedDoc);
DispatchSelectEvent(presContext);
SelectAll(presContext);
}
}