Bug 1677254 - Make select event from select() uncancelable r=masayuki

Differential Revision: https://phabricator.services.mozilla.com/D97068
This commit is contained in:
Kagami Sascha Rosylight
2020-11-15 02:32:22 +00:00
parent 6082baa482
commit 326140995d
5 changed files with 18 additions and 46 deletions

View File

@@ -149,23 +149,18 @@ void HTMLTextAreaElement::Select() {
return;
}
nsEventStatus status = nsEventStatus_eIgnore;
WidgetGUIEvent event(true, eFormSelect, nullptr);
// XXXbz HTMLInputElement guards against this reentering; shouldn't we?
EventDispatcher::Dispatch(static_cast<nsIContent*>(this), presContext, &event,
nullptr, &status);
EventDispatcher::Dispatch(static_cast<nsIContent*>(this), presContext,
&event);
// If the DOM event was not canceled (e.g. by a JS event handler
// returning false)
if (status == nsEventStatus_eIgnore) {
if (fm) {
fm->SetFocus(this, nsIFocusManager::FLAG_NOSCROLL);
if (fm) {
fm->SetFocus(this, nsIFocusManager::FLAG_NOSCROLL);
// ensure that the element is actually focused
if (this == fm->GetFocusedElement()) {
// Now Select all the text!
SelectAll(presContext);
}
// ensure that the element is actually focused
if (this == fm->GetFocusedElement()) {
// Now Select all the text!
SelectAll(presContext);
}
}
}