Bug 1445417 part 3. Stop using ndIDOMDragEvent in docshell and dom code. r=mystor

MozReview-Commit-ID: 21JCx8OeaR5
This commit is contained in:
Boris Zbarsky 2018-03-16 22:25:25 -04:00
parent ec11fcb519
commit c5b088227c
2 changed files with 9 additions and 8 deletions

View File

@ -54,10 +54,10 @@
#include "nsPresContext.h"
#include "nsViewManager.h"
#include "nsView.h"
#include "nsIDOMDragEvent.h"
#include "nsIConstraintValidation.h"
#include "mozilla/Attributes.h"
#include "mozilla/EventListenerManager.h"
#include "mozilla/dom/DragEvent.h"
#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
#include "mozilla/dom/File.h" // for input type=file
#include "mozilla/dom/FileList.h" // for input type=file
@ -928,12 +928,13 @@ nsDocShellTreeOwner::RemoveChromeListeners()
NS_IMETHODIMP
nsDocShellTreeOwner::HandleEvent(nsIDOMEvent* aEvent)
{
nsCOMPtr<nsIDOMDragEvent> dragEvent = do_QueryInterface(aEvent);
NS_ENSURE_TRUE(dragEvent, NS_ERROR_INVALID_ARG);
DragEvent* dragEvent =
aEvent ? aEvent->InternalDOMEvent()->AsDragEvent() : nullptr;
if (NS_WARN_IF(!dragEvent)) {
return NS_ERROR_INVALID_ARG;
}
bool defaultPrevented;
aEvent->GetDefaultPrevented(&defaultPrevented);
if (defaultPrevented) {
if (dragEvent->DefaultPrevented()) {
return NS_OK;
}

View File

@ -41,7 +41,6 @@ using mozilla::DefaultXDisplay;
#include "nsAttrName.h"
#include "nsIFocusManager.h"
#include "nsFocusManager.h"
#include "nsIDOMDragEvent.h"
#include "nsIScriptSecurityManager.h"
#include "nsIScrollableFrame.h"
#include "nsIDocShell.h"
@ -52,6 +51,7 @@ using mozilla::DefaultXDisplay;
#include "mozilla/MiscEvents.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/TextEvents.h"
#include "mozilla/dom/DragEvent.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/HTMLObjectElementBinding.h"
#include "mozilla/dom/TabChild.h"
@ -1762,7 +1762,7 @@ nsPluginInstanceOwner::HandleEvent(nsIDOMEvent* aEvent)
return DispatchCompositionToPlugin(aEvent);
}
nsCOMPtr<nsIDOMDragEvent> dragEvent(do_QueryInterface(aEvent));
DragEvent* dragEvent = aEvent->InternalDOMEvent()->AsDragEvent();
if (dragEvent && mInstance) {
WidgetEvent* ievent = aEvent->WidgetEventPtr();
if (ievent && ievent->IsTrusted() &&