diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp
index 68f0106e30bf..8c647c7509e1 100644
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -3010,7 +3010,8 @@ void HTMLInputElement::Select() {
return;
}
- if (DispatchSelectEvent(presContext) && fm) {
+ DispatchSelectEvent(presContext);
+ if (fm) {
fm->SetFocus(this, nsIFocusManager::FLAG_NOSCROLL);
// ensure that the element is actually focused
@@ -3021,22 +3022,16 @@ void HTMLInputElement::Select() {
}
}
-bool HTMLInputElement::DispatchSelectEvent(nsPresContext* aPresContext) {
- nsEventStatus status = nsEventStatus_eIgnore;
-
+void HTMLInputElement::DispatchSelectEvent(nsPresContext* aPresContext) {
// If already handling select event, don't dispatch a second.
if (!mHandlingSelectEvent) {
WidgetEvent event(true, eFormSelect);
mHandlingSelectEvent = true;
EventDispatcher::Dispatch(static_cast(this), aPresContext,
- &event, nullptr, &status);
+ &event);
mHandlingSelectEvent = false;
}
-
- // If the DOM event was not canceled (e.g. by a JS event handler
- // returning false)
- return (status == nsEventStatus_eIgnore);
}
void HTMLInputElement::SelectAll(nsPresContext* aPresContext) {
@@ -3735,9 +3730,8 @@ nsresult HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor) {
nsIFocusManager::FLAG_BYMOVEFOCUS)) {
RefPtr presContext =
GetPresContext(eForComposedDoc);
- if (DispatchSelectEvent(presContext)) {
- SelectAll(presContext);
- }
+ DispatchSelectEvent(presContext);
+ SelectAll(presContext);
}
}
}
diff --git a/dom/html/HTMLInputElement.h b/dom/html/HTMLInputElement.h
index 4131661eb79a..1a967fd215f1 100644
--- a/dom/html/HTMLInputElement.h
+++ b/dom/html/HTMLInputElement.h
@@ -965,9 +965,9 @@ class HTMLInputElement final : public TextControlElement,
virtual void ResultForDialogSubmit(nsAString& aResult) override;
/**
- * Dispatch a select event. Returns true if the event was not cancelled.
+ * Dispatch a select event.
*/
- bool DispatchSelectEvent(nsPresContext* aPresContext);
+ void DispatchSelectEvent(nsPresContext* aPresContext);
void SelectAll(nsPresContext* aPresContext);
bool IsImage() const {
diff --git a/dom/html/HTMLTextAreaElement.cpp b/dom/html/HTMLTextAreaElement.cpp
index 3cbadfacfc67..5a7c9da20f95 100644
--- a/dom/html/HTMLTextAreaElement.cpp
+++ b/dom/html/HTMLTextAreaElement.cpp
@@ -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(this), presContext, &event,
- nullptr, &status);
+ EventDispatcher::Dispatch(static_cast(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);
}
}
}
diff --git a/testing/web-platform/meta/html/semantics/forms/textfieldselection/select-event.html.ini b/testing/web-platform/meta/html/semantics/forms/textfieldselection/select-event.html.ini
index 213880c4395a..46e71478ef67 100644
--- a/testing/web-platform/meta/html/semantics/forms/textfieldselection/select-event.html.ini
+++ b/testing/web-platform/meta/html/semantics/forms/textfieldselection/select-event.html.ini
@@ -1,7 +1,4 @@
[select-event.html]
- [textarea: select()]
- expected: FAIL
-
[textarea: select() a second time (must not fire select)]
expected: FAIL
@@ -20,9 +17,6 @@
[textarea: setRangeText() a second time (must not fire select)]
expected: FAIL
- [input type text: select()]
- expected: FAIL
-
[input type text: select() a second time (must not fire select)]
expected: FAIL
@@ -41,9 +35,6 @@
[input type text: setRangeText() a second time (must not fire select)]
expected: FAIL
- [input type search: select()]
- expected: FAIL
-
[input type search: select() a second time (must not fire select)]
expected: FAIL
@@ -62,9 +53,6 @@
[input type search: setRangeText() a second time (must not fire select)]
expected: FAIL
- [input type tel: select()]
- expected: FAIL
-
[input type tel: select() a second time (must not fire select)]
expected: FAIL
@@ -83,9 +71,6 @@
[input type tel: setRangeText() a second time (must not fire select)]
expected: FAIL
- [input type url: select()]
- expected: FAIL
-
[input type url: select() a second time (must not fire select)]
expected: FAIL
@@ -104,9 +89,6 @@
[input type url: setRangeText() a second time (must not fire select)]
expected: FAIL
- [input type password: select()]
- expected: FAIL
-
[input type password: select() a second time (must not fire select)]
expected: FAIL
diff --git a/widget/BasicEvents.h b/widget/BasicEvents.h
index c5c5c51a8ec6..6295322cea8c 100644
--- a/widget/BasicEvents.h
+++ b/widget/BasicEvents.h
@@ -480,7 +480,8 @@ class WidgetEvent : public WidgetEventTime {
break;
default:
if (mMessage == eResize || mMessage == eMozVisualResize ||
- mMessage == eMozVisualScroll || mMessage == eEditorInput) {
+ mMessage == eMozVisualScroll || mMessage == eEditorInput ||
+ mMessage == eFormSelect) {
mFlags.mCancelable = false;
} else {
mFlags.mCancelable = true;