Bug 1848409 - Tweak the UpdateDefaultPreventedOnContent call to only special case the HTMLEditorEventListener case r=masayuki,dom-core

Calling `UpdateDefaultPreventedOnContent` separately from
`PreventDefault()` is error-prone. This patch should make it
safer.

Differential Revision: https://phabricator.services.mozilla.com/D186052
This commit is contained in:
Sean Feng
2023-08-15 13:46:42 +00:00
parent 37f42b0c3e
commit 036a480b6a
7 changed files with 43 additions and 40 deletions

View File

@@ -924,10 +924,6 @@ nsDocShellTreeOwner::HandleEvent(Event* aEvent) {
handler->CanDropLink(dragEvent, false, &canDropLink);
if (canDropLink) {
aEvent->PreventDefault();
WidgetDragEvent* asWidgetDropEvent =
dragEvent->WidgetEventPtr()->AsDragEvent();
asWidgetDropEvent->UpdateDefaultPreventedOnContent(
asWidgetDropEvent->mCurrentTarget);
}
} else if (eventType.EqualsLiteral("drop")) {
nsCOMPtr<nsIWebNavigation> webnav =
@@ -979,10 +975,6 @@ nsDocShellTreeOwner::HandleEvent(Event* aEvent) {
} else {
aEvent->StopPropagation();
aEvent->PreventDefault();
WidgetDragEvent* asWidgetDropEvent =
dragEvent->WidgetEventPtr()->AsDragEvent();
asWidgetDropEvent->UpdateDefaultPreventedOnContent(
asWidgetDropEvent->mCurrentTarget);
}
}