Bug 1843484 - Use EventTarget* instead of nsISupports* for the event target parameter of the nsContentUtils::Dispatch methods. r=smaug
This saves a few queryInterface calls on the hot path. Differential Revision: https://phabricator.services.mozilla.com/D186976
This commit is contained in:
@@ -248,9 +248,9 @@ class DispatchChangeEventCallback final : public GetFilesCallback {
|
||||
nsresult rv = nsContentUtils::DispatchInputEvent(inputElement);
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "Failed to dispatch input event");
|
||||
|
||||
rv = nsContentUtils::DispatchTrustedEvent(
|
||||
mInputElement->OwnerDoc(), static_cast<Element*>(mInputElement.get()),
|
||||
u"change"_ns, CanBubble::eYes, Cancelable::eNo);
|
||||
rv = nsContentUtils::DispatchTrustedEvent(mInputElement->OwnerDoc(),
|
||||
mInputElement, u"change"_ns,
|
||||
CanBubble::eYes, Cancelable::eNo);
|
||||
|
||||
return rv;
|
||||
}
|
||||
@@ -451,8 +451,8 @@ HTMLInputElement::nsFilePickerShownCallback::Done(
|
||||
if (aResult == nsIFilePicker::returnCancel) {
|
||||
RefPtr<HTMLInputElement> inputElement(mInput);
|
||||
return nsContentUtils::DispatchTrustedEvent(
|
||||
inputElement->OwnerDoc(), static_cast<Element*>(inputElement.get()),
|
||||
u"cancel"_ns, CanBubble::eYes, Cancelable::eNo);
|
||||
inputElement->OwnerDoc(), inputElement, u"cancel"_ns, CanBubble::eYes,
|
||||
Cancelable::eNo);
|
||||
}
|
||||
|
||||
mInput->OwnerDoc()->NotifyUserGestureActivation();
|
||||
@@ -6851,8 +6851,8 @@ void HTMLInputElement::SetRevealPassword(bool aValue) {
|
||||
// revealing the saved passwords.
|
||||
bool defaultAction = true;
|
||||
nsContentUtils::DispatchEventOnlyToChrome(
|
||||
doc, ToSupports(this), u"MozWillToggleReveal"_ns, CanBubble::eYes,
|
||||
Cancelable::eYes, &defaultAction);
|
||||
doc, this, u"MozWillToggleReveal"_ns, CanBubble::eYes, Cancelable::eYes,
|
||||
&defaultAction);
|
||||
if (NS_WARN_IF(!defaultAction)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user