Bug 1504911 - part 1: Make all "input" event dispatcher in C++ use new utility method r=smaug
Currently, a lot of code dispatch "input" event and some of them dispatch "input" event with wrong interface and/or values. Therefore this patch creates nsContentUtils::DispatchInputEvent() to make all of them dispatch correct event. Unfortunately, due to bug 1506439, we cannot set pointer to refcountable classes of MOZ_CAN_RUN_SCRIPT method to nullptr. Therefore, this patch creates temporary RefPtr<TextEditor> a lot even though it makes damage to the performance if it's in a hot path. This patch makes eEditorInput event dispatched with InternalEditorInputEvent when "input" event should be dispatched with dom::InputEvent. However, this patch uses WidgetEvent whose message is eUnidentifiedEvent and setting WidgetEvent::mSpecifiedEventType to nsGkAtoms::oninput when "input" event should be dispatched with dom::Event because we need to keep that eEditorInput and InternalEditorInputEvent are mapped each other. Differential Revision: https://phabricator.services.mozilla.com/D12244
This commit is contained in:
@@ -459,11 +459,11 @@ nsFileControlFrame::DnDListener::HandleEvent(Event* aEvent)
|
||||
inputElement->SetFiles(fileList, true);
|
||||
}
|
||||
|
||||
nsContentUtils::DispatchTrustedEvent(inputElement->OwnerDoc(),
|
||||
static_cast<nsINode*>(inputElement),
|
||||
NS_LITERAL_STRING("input"),
|
||||
CanBubble::eYes,
|
||||
Cancelable::eNo);
|
||||
RefPtr<TextEditor> textEditor;
|
||||
DebugOnly<nsresult> rvIgnored =
|
||||
nsContentUtils::DispatchInputEvent(inputElement);
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rvIgnored),
|
||||
"Failed to dispatch input event");
|
||||
nsContentUtils::DispatchTrustedEvent(inputElement->OwnerDoc(),
|
||||
static_cast<nsINode*>(inputElement),
|
||||
NS_LITERAL_STRING("change"),
|
||||
|
||||
Reference in New Issue
Block a user