Bug 1455676 part 3. Remove nsIDOMNode usage from widget/. r=qdot
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 29 May 2018 22:58:48 -0400
changeset 420385 7161cb18122e3f51c30a014d688a4c5fbcacaa74
parent 420384 1ccf1348f689b06996d1cbdb1f47eee2b85cd208
child 420386 5d81f28df4d2adcbe839d82adb509ffcf721cca7
push id34071
push userncsoregi@mozilla.com
push dateWed, 30 May 2018 09:25:30 +0000
treeherdermozilla-central@5866d6685849 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersqdot
bugs1455676
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1455676 part 3. Remove nsIDOMNode usage from widget/. r=qdot
dom/events/DataTransfer.cpp
dom/events/DataTransfer.h
dom/events/EventStateManager.cpp
layout/base/PresShell.cpp
layout/base/PresShell.h
layout/base/nsIPresShell.h
widget/GfxInfoBase.cpp
widget/cocoa/nsChildView.mm
widget/cocoa/nsDragService.h
widget/cocoa/nsDragService.mm
widget/gtk/nsDragService.cpp
widget/gtk/nsDragService.h
widget/gtk/nsWindow.cpp
widget/nsBaseDragService.cpp
widget/nsBaseDragService.h
widget/nsDragServiceProxy.cpp
widget/nsIDragService.idl
widget/nsIDragSession.idl
widget/nsTransferable.cpp
widget/windows/nsDragService.cpp
widget/windows/nsDragService.h
widget/windows/nsNativeDragTarget.cpp
--- a/dom/events/DataTransfer.cpp
+++ b/dom/events/DataTransfer.cpp
@@ -426,25 +426,24 @@ DataTransfer::SetMozCursor(const nsAStri
 already_AddRefed<nsINode>
 DataTransfer::GetMozSourceNode()
 {
   nsCOMPtr<nsIDragSession> dragSession = nsContentUtils::GetDragSession();
   if (!dragSession) {
     return nullptr;
   }
 
-  nsCOMPtr<nsIDOMNode> sourceNode;
+  nsCOMPtr<nsINode> sourceNode;
   dragSession->GetSourceNode(getter_AddRefs(sourceNode));
-  nsCOMPtr<nsINode> node = do_QueryInterface(sourceNode);
-  if (node && !nsContentUtils::LegacyIsCallerNativeCode()
-      && !nsContentUtils::CanCallerAccess(node)) {
+  if (sourceNode && !nsContentUtils::LegacyIsCallerNativeCode()
+      && !nsContentUtils::CanCallerAccess(sourceNode)) {
     return nullptr;
   }
 
-  return node.forget();
+  return sourceNode.forget();
 }
 
 already_AddRefed<DOMStringList>
 DataTransfer::MozTypesAt(uint32_t aIndex, CallerType aCallerType,
                          ErrorResult& aRv) const
 {
   // Only the first item is valid for clipboard events
   if (aIndex > 0 &&
@@ -739,17 +738,17 @@ void
 DataTransfer::UpdateDragImage(Element& aImage, int32_t aX, int32_t aY)
 {
   if (mEventMessage < eDragDropEventFirst || mEventMessage > eDragDropEventLast) {
     return;
   }
 
   nsCOMPtr<nsIDragSession> dragSession = nsContentUtils::GetDragSession();
   if (dragSession) {
-    dragSession->UpdateDragImage(aImage.AsDOMNode(), aX, aY);
+    dragSession->UpdateDragImage(&aImage, aX, aY);
   }
 }
 
 already_AddRefed<Promise>
 DataTransfer::GetFilesAndDirectories(nsIPrincipal& aSubjectPrincipal,
                                      ErrorResult& aRv)
 {
   nsCOMPtr<nsINode> parentNode = do_QueryInterface(mParent);
--- a/dom/events/DataTransfer.h
+++ b/dom/events/DataTransfer.h
@@ -16,16 +16,17 @@
 
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/EventForwards.h"
 #include "mozilla/dom/BindingDeclarations.h"
 #include "mozilla/dom/File.h"
 
+class nsIDOMNode;
 class nsINode;
 class nsITransferable;
 class nsILoadContext;
 
 namespace mozilla {
 
 class EventStateManager;
 
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -2152,21 +2152,20 @@ EventStateManager::DoDefaultDragStart(ns
           do_QueryFrame(dragTarget->GetPrimaryFrame());
         if (treeBody) {
           treeBody->GetSelectionRegion(getter_AddRefs(region));
         }
       }
     }
 #endif
 
-    dragService->InvokeDragSessionWithImage(dragTarget->AsDOMNode(),
+    dragService->InvokeDragSessionWithImage(dragTarget,
                                             aPrincipalURISpec, transArray,
                                             region, action,
-                                            dragImage ? dragImage->AsDOMNode() :
-                                                        nullptr,
+                                            dragImage,
                                             imageX, imageY, event,
                                             dataTransfer);
   }
 
   return true;
 }
 
 nsresult
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -5098,35 +5098,34 @@ PresShell::PaintRangePaintInfo(const nsT
 
   // restore the old selection display state
   frameSelection->SetDisplaySelection(oldDisplaySelection);
 
   return dt->Snapshot();
 }
 
 already_AddRefed<SourceSurface>
-PresShell::RenderNode(nsIDOMNode* aNode,
+PresShell::RenderNode(nsINode* aNode,
                       nsIntRegion* aRegion,
                       const LayoutDeviceIntPoint aPoint,
                       LayoutDeviceIntRect* aScreenRect,
                       uint32_t aFlags)
 {
   // area will hold the size of the surface needed to draw the node, measured
   // from the root frame.
   nsRect area;
   nsTArray<UniquePtr<RangePaintInfo>> rangeItems;
 
   // nothing to draw if the node isn't in a document
-  nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
-  if (!node->IsInUncomposedDoc())
+  if (!aNode->IsInUncomposedDoc())
     return nullptr;
 
-  RefPtr<nsRange> range = new nsRange(node);
+  RefPtr<nsRange> range = new nsRange(aNode);
   IgnoredErrorResult rv;
-  range->SelectNode(*node, rv);
+  range->SelectNode(*aNode, rv);
   if (rv.Failed()) {
     return nullptr;
   }
 
   UniquePtr<RangePaintInfo> info = CreateRangePaintInfo(range, area, false);
   if (info && !rangeItems.AppendElement(Move(info))) {
     return nullptr;
   }
--- a/layout/base/PresShell.h
+++ b/layout/base/PresShell.h
@@ -185,17 +185,17 @@ public:
   void FireOrClearDelayedEvents(bool aFireEvents) override;
 
   nsresult RenderDocument(const nsRect& aRect,
                           uint32_t aFlags,
                           nscolor aBackgroundColor,
                           gfxContext* aThebesContext) override;
 
   already_AddRefed<SourceSurface>
-  RenderNode(nsIDOMNode* aNode,
+  RenderNode(nsINode* aNode,
              nsIntRegion* aRegion,
              const LayoutDeviceIntPoint aPoint,
              LayoutDeviceIntRect* aScreenRect,
              uint32_t aFlags) override;
 
   already_AddRefed<SourceSurface>
   RenderSelection(dom::Selection* aSelection,
                   const LayoutDeviceIntPoint aPoint,
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -1155,17 +1155,17 @@ public:
 
   /**
    * Renders a node aNode to a surface and returns it. The aRegion may be used
    * to clip the rendering. This region is measured in CSS pixels from the
    * edge of the presshell area. The aPoint, aScreenRect and aFlags arguments
    * function in a similar manner as RenderSelection.
    */
   virtual already_AddRefed<mozilla::gfx::SourceSurface>
-  RenderNode(nsIDOMNode* aNode,
+  RenderNode(nsINode* aNode,
              nsIntRegion* aRegion,
              const mozilla::LayoutDeviceIntPoint aPoint,
              mozilla::LayoutDeviceIntRect* aScreenRect,
              uint32_t aFlags) = 0;
 
   /**
    * Renders a selection to a surface and returns it. This method is primarily
    * intended to create the drag feedback when dragging a selection.
--- a/widget/GfxInfoBase.cpp
+++ b/widget/GfxInfoBase.cpp
@@ -14,17 +14,16 @@
 #include "nsCOMArray.h"
 #include "nsString.h"
 #include "nsUnicharUtils.h"
 #include "nsVersionComparator.h"
 #include "mozilla/Services.h"
 #include "mozilla/Observer.h"
 #include "nsIObserver.h"
 #include "nsIObserverService.h"
-#include "nsIDOMNode.h"
 #include "nsTArray.h"
 #include "nsXULAppAPI.h"
 #include "nsIXULAppInfo.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/gfx/GPUProcessManager.h"
 #include "mozilla/gfx/Logging.h"
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -6148,17 +6148,17 @@ GetIntegerDeltaForEvent(NSEvent* aEvent)
       dragSession->SetCanDrop(false);
     } else if (aMessage == eDrop) {
       // We make the assumption that the dragOver handlers have correctly set
       // the |canDrop| property of the Drag Session.
       bool canDrop = false;
       if (!NS_SUCCEEDED(dragSession->GetCanDrop(&canDrop)) || !canDrop) {
         [self doDragAction:eDragExit sender:aSender];
 
-        nsCOMPtr<nsIDOMNode> sourceNode;
+        nsCOMPtr<nsINode> sourceNode;
         dragSession->GetSourceNode(getter_AddRefs(sourceNode));
         if (!sourceNode) {
           mDragService->EndDragSession(
             false, nsCocoaUtils::ModifiersForEvent([NSApp currentEvent]));
         }
         return NSDragOperationNone;
       }
     }
@@ -6206,17 +6206,17 @@ GetIntegerDeltaForEvent(NSEvent* aEvent)
         if (childDragAction != nsIDragService::DRAGDROP_ACTION_UNINITIALIZED) {
           dragAction = childDragAction;
         }
 
         return [self dragOperationFromDragAction:dragAction];
       }
       case eDragExit:
       case eDrop: {
-        nsCOMPtr<nsIDOMNode> sourceNode;
+        nsCOMPtr<nsINode> sourceNode;
         dragSession->GetSourceNode(getter_AddRefs(sourceNode));
         if (!sourceNode) {
           // We're leaving a window while doing a drag that was
           // initiated in a different app. End the drag session,
           // since we're done with it for now (until the user
           // drags back into mozilla).
           mDragService->EndDragSession(
             false, nsCocoaUtils::ModifiersForEvent([NSApp currentEvent]));
--- a/widget/cocoa/nsDragService.h
+++ b/widget/cocoa/nsDragService.h
@@ -24,40 +24,40 @@ public:
   nsDragService();
 
   // nsBaseDragService
   virtual nsresult InvokeDragSessionImpl(nsIArray* anArrayTransferables,
                                          nsIScriptableRegion* aRegion,
                                          uint32_t aActionType) override;
   // nsIDragService
   NS_IMETHOD EndDragSession(bool aDoneDrag, uint32_t aKeyModifiers) override;
-  NS_IMETHOD UpdateDragImage(nsIDOMNode* aImage, int32_t aImageX, int32_t aImageY) override;
+  NS_IMETHOD UpdateDragImage(nsINode* aImage, int32_t aImageX, int32_t aImageY) override;
 
   // nsIDragSession
   NS_IMETHOD GetData(nsITransferable * aTransferable, uint32_t aItemIndex) override;
   NS_IMETHOD IsDataFlavorSupported(const char *aDataFlavor, bool *_retval) override;
   NS_IMETHOD GetNumDropItems(uint32_t * aNumItems) override;
 
   void DragMovedWithView(NSDraggingSession* aSession, NSPoint aPoint);
 
 protected:
   virtual ~nsDragService();
 
 private:
 
   // Creates and returns the drag image for a drag. aImagePoint will be set to
   // the origin of the drag relative to mNativeDragView.
-  NSImage* ConstructDragImage(nsIDOMNode* aDOMNode,
+  NSImage* ConstructDragImage(nsINode* aDOMNode,
                               nsIScriptableRegion* aRegion,
                               NSPoint* aImagePoint);
 
   // Creates and returns the drag image for a drag. aPoint should be the origin
   // of the drag, for example the mouse coordinate of the mousedown event.
   // aDragRect will be set the area of the drag relative to this.
-  NSImage* ConstructDragImage(nsIDOMNode* aDOMNode,
+  NSImage* ConstructDragImage(nsINode* aDOMNode,
                               nsIScriptableRegion* aRegion,
                               mozilla::CSSIntPoint aPoint,
                               mozilla::LayoutDeviceIntRect* aDragRect);
 
   bool IsValidType(NSString* availableType, bool allowFileURL);
   NSString* GetStringForType(NSPasteboardItem* item, const NSString* type,
                              bool allowFileURL = false);
   NSString* GetTitleForURL(NSPasteboardItem* item);
--- a/widget/cocoa/nsDragService.mm
+++ b/widget/cocoa/nsDragService.mm
@@ -14,17 +14,17 @@
 #include "nsString.h"
 #include "nsClipboard.h"
 #include "nsXPCOM.h"
 #include "nsISupportsPrimitives.h"
 #include "nsCOMPtr.h"
 #include "nsPrimitiveHelpers.h"
 #include "nsLinebreakConverter.h"
 #include "nsIMacUtils.h"
-#include "nsIDOMNode.h"
+#include "nsINode.h"
 #include "nsRect.h"
 #include "nsPoint.h"
 #include "nsIIOService.h"
 #include "nsIDocument.h"
 #include "nsIContent.h"
 #include "nsView.h"
 #include "nsCocoaUtils.h"
 #include "mozilla/gfx/2D.h"
@@ -60,17 +60,17 @@ nsDragService::nsDragService()
   EnsureLogInitialized();
 }
 
 nsDragService::~nsDragService()
 {
 }
 
 NSImage*
-nsDragService::ConstructDragImage(nsIDOMNode* aDOMNode,
+nsDragService::ConstructDragImage(nsINode* aDOMNode,
                                   nsIScriptableRegion* aRegion,
                                   NSPoint* aDragPoint)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   CGFloat scaleFactor = nsCocoaUtils::GetBackingScaleFactor(mNativeDragView);
 
   LayoutDeviceIntRect dragRect(0, 0, 20, 20);
@@ -102,17 +102,17 @@ nsDragService::ConstructDragImage(nsIDOM
   *aDragPoint = [mNativeDragView convertPoint:point fromView:nil];
 
   return image;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
 NSImage*
-nsDragService::ConstructDragImage(nsIDOMNode* aDOMNode,
+nsDragService::ConstructDragImage(nsINode* aDOMNode,
                                   nsIScriptableRegion* aRegion,
                                   CSSIntPoint aPoint,
                                   LayoutDeviceIntRect* aDragRect)
  {
    NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   CGFloat scaleFactor = nsCocoaUtils::GetBackingScaleFactor(mNativeDragView);
 
@@ -660,17 +660,17 @@ nsDragService::GetNumDropItems(uint32_t*
   }
 
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 NS_IMETHODIMP
-nsDragService::UpdateDragImage(nsIDOMNode* aImage, int32_t aImageX, int32_t aImageY)
+nsDragService::UpdateDragImage(nsINode* aImage, int32_t aImageX, int32_t aImageY)
 {
   nsBaseDragService::UpdateDragImage(aImage, aImageX, aImageY);
   mDragImageChanged = true;
   return NS_OK;
 }
 
 void
 nsDragService::DragMovedWithView(NSDraggingSession* aSession, NSPoint aPoint)
--- a/widget/gtk/nsDragService.cpp
+++ b/widget/gtk/nsDragService.cpp
@@ -304,17 +304,17 @@ GetGtkWindow(nsIDocument *aDocument)
         return nullptr;
 
     return GTK_WINDOW(toplevel);
 }
 
 // nsIDragService
 
 NS_IMETHODIMP
-nsDragService::InvokeDragSession(nsIDOMNode *aDOMNode,
+nsDragService::InvokeDragSession(nsINode *aDOMNode,
                                  const nsACString& aPrincipalURISpec,
                                  nsIArray * aArrayTransferables,
                                  nsIScriptableRegion * aRegion,
                                  uint32_t aActionType,
                                  nsContentPolicyType aContentPolicyType =
                                    nsIContentPolicy::TYPE_OTHER)
 {
     MOZ_LOG(sDragLm, LogLevel::Debug, ("nsDragService::InvokeDragSession"));
--- a/widget/gtk/nsDragService.h
+++ b/widget/gtk/nsDragService.h
@@ -59,17 +59,17 @@ public:
 
     NS_DECL_NSIOBSERVER
 
     // nsBaseDragService
     virtual nsresult InvokeDragSessionImpl(nsIArray* anArrayTransferables,
                                            nsIScriptableRegion* aRegion,
                                            uint32_t aActionType) override;
     // nsIDragService
-    NS_IMETHOD InvokeDragSession (nsIDOMNode *aDOMNode,
+    NS_IMETHOD InvokeDragSession (nsINode *aDOMNode,
                                   const nsACString& aPrincipalURISpec,
                                   nsIArray * anArrayTransferables,
                                   nsIScriptableRegion * aRegion,
                                   uint32_t aActionType,
                                   nsContentPolicyType aContentPolicyType) override;
     NS_IMETHOD StartDragSession() override;
     NS_IMETHOD EndDragSession(bool aDoneDrag, uint32_t aKeyModifiers) override;
 
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -21,17 +21,17 @@
 #include "mozilla/dom/WheelEventBinding.h"
 #include <algorithm>
 
 #include "GeckoProfiler.h"
 
 #include "prlink.h"
 #include "nsGTKToolkit.h"
 #include "nsIRollupListener.h"
-#include "nsIDOMNode.h"
+#include "nsINode.h"
 
 #include "nsWidgetsCID.h"
 #include "nsDragService.h"
 #include "nsIWidgetListener.h"
 #include "nsIScreenManager.h"
 #include "SystemTimeConverter.h"
 
 #include "nsGtkKeyUtils.h"
@@ -2893,17 +2893,17 @@ nsWindow::OnContainerFocusOutEvent(GdkEv
         dragService->GetCurrentSession(getter_AddRefs(dragSession));
 
         // Rollup popups when a window is focused out unless a drag is occurring.
         // This check is because drags grab the keyboard and cause a focus out on
         // versions of GTK before 2.18.
         bool shouldRollup = !dragSession;
         if (!shouldRollup) {
             // we also roll up when a drag is from a different application
-            nsCOMPtr<nsIDOMNode> sourceNode;
+            nsCOMPtr<nsINode> sourceNode;
             dragSession->GetSourceNode(getter_AddRefs(sourceNode));
             shouldRollup = (sourceNode == nullptr);
         }
 
         if (shouldRollup) {
             CheckForRollup(0, 0, false, true);
         }
     }
--- a/widget/nsBaseDragService.cpp
+++ b/widget/nsBaseDragService.cpp
@@ -13,17 +13,17 @@
 #include "nsISupportsPrimitives.h"
 #include "nsCOMPtr.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIFrame.h"
 #include "nsIDocument.h"
 #include "nsIContent.h"
 #include "nsIPresShell.h"
 #include "nsViewManager.h"
-#include "nsIDOMNode.h"
+#include "nsINode.h"
 #include "nsPresContext.h"
 #include "nsIImageLoadingContent.h"
 #include "imgIContainer.h"
 #include "imgIRequest.h"
 #include "ImageRegion.h"
 #include "nsQueryObject.h"
 #include "nsRegion.h"
 #include "nsXULPopupManager.h"
@@ -158,21 +158,19 @@ nsBaseDragService::GetSourceDocument(nsI
 
 //
 // GetSourceNode
 //
 // Returns the DOM node where the drag was initiated. This will be
 // nullptr if the drag began outside of our application.
 //
 NS_IMETHODIMP
-nsBaseDragService::GetSourceNode(nsIDOMNode** aSourceNode)
+nsBaseDragService::GetSourceNode(nsINode** aSourceNode)
 {
-  *aSourceNode = mSourceNode.get();
-  NS_IF_ADDREF(*aSourceNode);
-
+  *aSourceNode = do_AddRef(mSourceNode).take();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsBaseDragService::GetTriggeringPrincipalURISpec(nsACString& aPrincipalURISpec)
 {
   aPrincipalURISpec = mTriggeringPrincipalURISpec;
   return NS_OK;
@@ -227,32 +225,31 @@ nsBaseDragService::GetDataTransfer()
 void
 nsBaseDragService::SetDataTransfer(DataTransfer* aDataTransfer)
 {
   mDataTransfer = aDataTransfer;
 }
 
 //-------------------------------------------------------------------------
 NS_IMETHODIMP
-nsBaseDragService::InvokeDragSession(nsIDOMNode *aDOMNode,
+nsBaseDragService::InvokeDragSession(nsINode *aDOMNode,
                                      const nsACString& aPrincipalURISpec,
                                      nsIArray* aTransferableArray,
                                      nsIScriptableRegion* aDragRgn,
                                      uint32_t aActionType,
                                      nsContentPolicyType aContentPolicyType =
                                        nsIContentPolicy::TYPE_OTHER)
 {
   AUTO_PROFILER_LABEL("nsBaseDragService::InvokeDragSession", OTHER);
 
   NS_ENSURE_TRUE(aDOMNode, NS_ERROR_INVALID_ARG);
   NS_ENSURE_TRUE(mSuppressLevel == 0, NS_ERROR_FAILURE);
 
   // stash the document of the dom node
-  nsCOMPtr<nsINode> node = do_QueryInterface(aDOMNode);
-  mSourceDocument = node->OwnerDoc();
+  mSourceDocument = aDOMNode->OwnerDoc();
   mTriggeringPrincipalURISpec.Assign(aPrincipalURISpec);
   mSourceNode = aDOMNode;
   mContentPolicyType = aContentPolicyType;
   mEndDragPoint = LayoutDeviceIntPoint(0, 0);
 
   // When the mouse goes down, the selection code starts a mouse
   // capture. However, this gets in the way of determining drag
   // feedback for things like trees because the event coordinates
@@ -267,22 +264,22 @@ nsBaseDragService::InvokeDragSession(nsI
     mTriggeringPrincipalURISpec.Truncate(0);
     mSourceDocument = nullptr;
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
-nsBaseDragService::InvokeDragSessionWithImage(nsIDOMNode* aDOMNode,
+nsBaseDragService::InvokeDragSessionWithImage(nsINode* aDOMNode,
                                               const nsACString& aPrincipalURISpec,
                                               nsIArray* aTransferableArray,
                                               nsIScriptableRegion* aRegion,
                                               uint32_t aActionType,
-                                              nsIDOMNode* aImage,
+                                              nsINode* aImage,
                                               int32_t aImageX, int32_t aImageY,
                                               DragEvent* aDragEvent,
                                               DataTransfer* aDataTransfer)
 {
   NS_ENSURE_TRUE(aDragEvent, NS_ERROR_NULL_POINTER);
   NS_ENSURE_TRUE(aDataTransfer, NS_ERROR_NULL_POINTER);
   NS_ENSURE_TRUE(mSuppressLevel == 0, NS_ERROR_FAILURE);
 
@@ -332,18 +329,17 @@ nsBaseDragService::InvokeDragSessionWith
 
   mScreenPosition.x = aDragEvent->ScreenX(CallerType::System);
   mScreenPosition.y = aDragEvent->ScreenY(CallerType::System);
   mInputSource = aDragEvent->MozInputSource();
 
   // just get the focused node from the selection
   // XXXndeakin this should actually be the deepest node that contains both
   // endpoints of the selection
-  nsCOMPtr<nsIDOMNode> node = aSelection->GetFocusNode() ?
-    aSelection->GetFocusNode()->AsDOMNode() : nullptr;
+  nsCOMPtr<nsINode> node = aSelection->GetFocusNode();
 
   nsresult rv = InvokeDragSession(node, aPrincipalURISpec,
                                   aTransferableArray,
                                   nullptr, aActionType,
                                   nsIContentPolicy::TYPE_OTHER);
 
   if (NS_FAILED(rv)) {
     mHasImage = false;
@@ -544,50 +540,50 @@ nsBaseDragService::DragMoved(int32_t aX,
       (static_cast<nsMenuPopupFrame *>(frame))->MoveTo(cssPos, true);
     }
   }
 
   return NS_OK;
 }
 
 static nsIPresShell*
-GetPresShellForContent(nsIDOMNode* aDOMNode)
+GetPresShellForContent(nsINode* aDOMNode)
 {
   nsCOMPtr<nsIContent> content = do_QueryInterface(aDOMNode);
   if (!content)
     return nullptr;
 
   nsCOMPtr<nsIDocument> document = content->GetUncomposedDoc();
   if (document) {
     document->FlushPendingNotifications(FlushType::Display);
 
     return document->GetShell();
   }
 
   return nullptr;
 }
 
 nsresult
-nsBaseDragService::DrawDrag(nsIDOMNode* aDOMNode,
+nsBaseDragService::DrawDrag(nsINode* aDOMNode,
                             nsIScriptableRegion* aRegion,
                             CSSIntPoint aScreenPosition,
                             LayoutDeviceIntRect* aScreenDragRect,
                             RefPtr<SourceSurface>* aSurface,
                             nsPresContext** aPresContext)
 {
   *aSurface = nullptr;
   *aPresContext = nullptr;
 
   // use a default size, in case of an error.
   aScreenDragRect->SetRect(aScreenPosition.x - mImageOffset.x,
                            aScreenPosition.y - mImageOffset.y,
                            1, 1);
 
   // if a drag image was specified, use that, otherwise, use the source node
-  nsCOMPtr<nsIDOMNode> dragNode = mImage ? mImage.get() : aDOMNode;
+  nsCOMPtr<nsINode> dragNode = mImage ? mImage.get() : aDOMNode;
 
   // get the presshell for the node being dragged. If the drag image is not in
   // a document or has no frame, get the presshell from the source drag node
   nsIPresShell* presShell = GetPresShellForContent(dragNode);
   if (!presShell && mImage)
     presShell = GetPresShellForContent(aDOMNode);
   if (!presShell)
     return NS_ERROR_FAILURE;
@@ -836,17 +832,17 @@ nsBaseDragService::UserCancelled()
 NS_IMETHODIMP
 nsBaseDragService::UpdateDragEffect()
 {
   mDragActionFromChildProcess = mDragAction;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsBaseDragService::UpdateDragImage(nsIDOMNode* aImage, int32_t aImageX, int32_t aImageY)
+nsBaseDragService::UpdateDragImage(nsINode* aImage, int32_t aImageX, int32_t aImageY)
 {
   // Don't change the image if this is a drag from another source or if there
   // is a drag popup.
   if (!mSourceNode || mDragPopup)
     return NS_OK;
 
   mImage = aImage;
   mImageOffset = CSSIntPoint(aImageX, aImageY);
--- a/widget/nsBaseDragService.h
+++ b/widget/nsBaseDragService.h
@@ -18,18 +18,18 @@
 #include "mozilla/dom/HTMLCanvasElement.h"
 #include "nsTArray.h"
 #include "Units.h"
 
 // translucency level for drag images
 #define DRAG_TRANSLUCENCY 0.65
 
 class nsIContent;
-class nsIDOMNode;
 class nsIDocument;
+class nsINode;
 class nsPresContext;
 class nsIImageLoadingContent;
 
 namespace mozilla {
 namespace gfx {
 class SourceSurface;
 } // namespace gfx
 
@@ -101,17 +101,17 @@ protected:
    * device pixels of the presContext.
    *
    * If there is no drag image, the returned surface will be null, but
    * aScreenDragRect will still be set to the drag area.
    *
    * aPresContext will be set to the nsPresContext used determined from
    * whichever of mImage or aDOMNode is used.
    */
-  nsresult DrawDrag(nsIDOMNode* aDOMNode,
+  nsresult DrawDrag(nsINode* aDOMNode,
                     nsIScriptableRegion* aRegion,
                     mozilla::CSSIntPoint aScreenPosition,
                     mozilla::LayoutDeviceIntRect* aScreenDragRect,
                     RefPtr<SourceSurface>* aSurface,
                     nsPresContext **aPresContext);
 
   /**
    * Draw a drag image for an image node specified by aImageLoader or aCanvas.
@@ -158,26 +158,26 @@ protected:
   bool mUserCancelled;
 
   bool mDragEventDispatchedToChildProcess;
 
   uint32_t mDragAction;
   uint32_t mDragActionFromChildProcess;
 
   nsSize mTargetSize;
-  nsCOMPtr<nsIDOMNode> mSourceNode;
+  nsCOMPtr<nsINode> mSourceNode;
   nsCString mTriggeringPrincipalURISpec;
   nsCOMPtr<nsIDocument> mSourceDocument;          // the document at the drag source. will be null
                                                   //  if it came from outside the app.
   nsContentPolicyType mContentPolicyType;         // the contentpolicy type passed to the channel
                                                   // when initiating the drag session
   RefPtr<mozilla::dom::DataTransfer> mDataTransfer;
 
   // used to determine the image to appear on the cursor while dragging
-  nsCOMPtr<nsIDOMNode> mImage;
+  nsCOMPtr<nsINode> mImage;
   // offset of cursor within the image
   mozilla::CSSIntPoint mImageOffset;
 
   // set if a selection is being dragged
   RefPtr<mozilla::dom::Selection> mSelection;
 
   // set if the image in mImage is a popup. If this case, the popup will be opened
   // and moved instead of using a drag image.
--- a/widget/nsDragServiceProxy.cpp
+++ b/widget/nsDragServiceProxy.cpp
@@ -23,25 +23,24 @@ nsDragServiceProxy::nsDragServiceProxy()
 {
 }
 
 nsDragServiceProxy::~nsDragServiceProxy()
 {
 }
 
 static void
-GetPrincipalURIFromNode(nsCOMPtr<nsIDOMNode>& sourceNode,
+GetPrincipalURIFromNode(nsCOMPtr<nsINode>& sourceNode,
                         nsCString& aPrincipalURISpec)
 {
-  nsCOMPtr<nsINode> node = do_QueryInterface(sourceNode);
-  if (!node) {
+  if (!sourceNode) {
     return;
   }
 
-  nsCOMPtr<nsIPrincipal> principal = node->NodePrincipal();
+  nsCOMPtr<nsIPrincipal> principal = sourceNode->NodePrincipal();
   nsCOMPtr<nsIURI> principalURI;
   nsresult rv = principal->GetURI(getter_AddRefs(principalURI));
   if (NS_FAILED(rv) || !principalURI) {
     return;
   }
 
   principalURI->GetSpec(aPrincipalURISpec);
 }
--- a/widget/nsIDragService.idl
+++ b/widget/nsIDragService.idl
@@ -5,19 +5,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsIArray.idl"
 #include "nsISupports.idl"
 #include "nsIDragSession.idl"
 #include "nsIScriptableRegion.idl"
 #include "nsIContentPolicy.idl"
 
-interface nsIDOMNode;
-
 webidl DragEvent;
+webidl Node;
 webidl Selection;
 
 %{C++
 #include "mozilla/EventForwards.h"
 
 namespace mozilla {
 namespace dom {
 class ContentParent;
@@ -49,17 +48,17 @@ interface nsIDragService : nsISupports
     * @param  aTransferables - an array of transferables to be dragged
     * @param  aRegion - a region containing rectangles for cursor feedback, 
     *            in window coordinates.
     * @param  aActionType - specified which of copy/move/link are allowed
     * @param  aContentPolicyType - the contentPolicyType that will be
     *           passed to the loadInfo when creating a new channel
     *           (defaults to TYPE_OTHER)
     */
-  void invokeDragSession (in nsIDOMNode aDOMNode,
+  void invokeDragSession (in Node aDOMNode,
                           in AUTF8String aPrincipalURISpec,
                           in nsIArray aTransferables, 
                           in nsIScriptableRegion aRegion,
                           in unsigned long aActionType,
                           [optional] in nsContentPolicyType aContentPolicyType);
 
   /**
    * Starts a modal drag session using an image. The first four arguments are
@@ -84,22 +83,22 @@ interface nsIDragService : nsISupports
    * rendered at its real size. For other types of elements, the element is
    * rendered into an offscreen buffer in the same manner as it is currently
    * displayed. The document selection is hidden while drawing.
    *
    * The aDragEvent must be supplied as the current screen coordinates of the
    * event are needed to calculate the image location.
    */
   [noscript]
-  void invokeDragSessionWithImage(in nsIDOMNode aDOMNode,
+  void invokeDragSessionWithImage(in Node aDOMNode,
                                   in AUTF8String aPrincipalURISpec,
                                   in nsIArray aTransferableArray,
                                   in nsIScriptableRegion aRegion,
                                   in unsigned long aActionType,
-                                  in nsIDOMNode aImage,
+                                  in Node aImage,
                                   in long aImageX,
                                   in long aImageY,
                                   in DragEvent aDragEvent,
                                   in DataTransferPtr aDataTransfer);
 
   /**
    * Start a modal drag session using the selection as the drag image.
    * The aDragEvent must be supplied as the current screen coordinates of the
--- a/widget/nsIDragSession.idl
+++ b/widget/nsIDragSession.idl
@@ -9,20 +9,19 @@
 
 
 %{ C++
 #include "nsSize.h"
 %}
 
 native nsSize (nsSize);
 
-interface nsIDOMNode;
-
 webidl DataTransfer;
 webidl Document;
+webidl Node;
 
 [scriptable, builtinclass, uuid(25bce737-73f0-43c7-bc20-c71044a73c5a)]
 interface nsIDragSession : nsISupports
 {
   /**
     * Set the current state of the drag, whether it can be dropped or not.
     * usually the target "frame" sets this so the native system can render the correct feedback
     */
@@ -55,17 +54,17 @@ interface nsIDragSession : nsISupports
     * originated in the same document.
     */
   readonly attribute Document sourceDocument;
 
   /**
     * The dom node that was originally dragged to start the session, which will be null if the
     * drag originated outside the application.
     */
-  readonly attribute nsIDOMNode sourceNode;
+  readonly attribute Node sourceNode;
 
   /**
    * The URI spec of the triggering principal.  This may be different than
    * sourceNode's principal when sourceNode is xul:browser and the drag is
    * triggered in a browsing context inside it.
    */
   attribute AUTF8String triggeringPrincipalURISpec;
 
@@ -97,15 +96,15 @@ interface nsIDragSession : nsISupports
 
   // Called when nsIDragSession implementation should update the UI for the
   // drag-and-drop based on the data got from the child process in response to
   // NS_DRAGDROP_OVER sent from parent process to child process.
   void updateDragEffect();
 
   // Change the drag image, using similar arguments as
   // nsIDragService::InvokeDragSessionWithImage.
-  void updateDragImage(in nsIDOMNode aImage, in long aImageX, in long aImageY);
+  void updateDragImage(in Node aImage, in long aImageX, in long aImageY);
 };
 
 
 %{ C++
 
 %}
--- a/widget/nsTransferable.cpp
+++ b/widget/nsTransferable.cpp
@@ -27,17 +27,16 @@ Notes to self:
 #include "nsXPCOM.h"
 #include "nsISupportsPrimitives.h"
 #include "nsMemory.h"
 #include "nsPrimitiveHelpers.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsDirectoryService.h"
 #include "nsCRT.h"
 #include "nsNetUtil.h"
-#include "nsIDOMNode.h"
 #include "nsIOutputStream.h"
 #include "nsIInputStream.h"
 #include "nsIWeakReferenceUtils.h"
 #include "nsILoadContext.h"
 #include "mozilla/UniquePtr.h"
 
 NS_IMPL_ISUPPORTS(nsTransferable, nsITransferable)
 
--- a/widget/windows/nsDragService.cpp
+++ b/widget/windows/nsDragService.cpp
@@ -63,17 +63,17 @@ nsDragService::nsDragService()
 //
 //-------------------------------------------------------------------------
 nsDragService::~nsDragService()
 {
   NS_IF_RELEASE(mDataObject);
 }
 
 bool
-nsDragService::CreateDragImage(nsIDOMNode *aDOMNode,
+nsDragService::CreateDragImage(nsINode *aDOMNode,
                                nsIScriptableRegion *aRegion,
                                SHDRAGIMAGE *psdi)
 {
   if (!psdi)
     return false;
 
   memset(psdi, 0, sizeof(SHDRAGIMAGE));
   if (!aDOMNode)
@@ -195,18 +195,17 @@ nsDragService::InvokeDragSessionImpl(nsI
     if (!dataObjCollection)
       return NS_ERROR_OUT_OF_MEMORY;
     itemToDrag = dataObjCollection;
     for (uint32_t i=0; i<numItemsToDrag; ++i) {
       nsCOMPtr<nsITransferable> trans =
           do_QueryElementAt(anArrayTransferables, i);
       if (trans) {
         // set the requestingPrincipal on the transferable
-        nsCOMPtr<nsINode> node = do_QueryInterface(mSourceNode);
-        trans->SetRequestingPrincipal(node->NodePrincipal());
+        trans->SetRequestingPrincipal(mSourceNode->NodePrincipal());
         trans->SetContentPolicyType(mContentPolicyType);
         RefPtr<IDataObject> dataObj;
         rv = nsClipboard::CreateNativeDataObject(trans,
                                                  getter_AddRefs(dataObj), uri);
         NS_ENSURE_SUCCESS(rv, rv);
         // Add the flavors to the collection object too
         rv = nsClipboard::SetupNativeDataObject(trans, dataObjCollection);
         NS_ENSURE_SUCCESS(rv, rv);
@@ -215,18 +214,17 @@ nsDragService::InvokeDragSessionImpl(nsI
       }
     }
   } // if dragging multiple items
   else {
     nsCOMPtr<nsITransferable> trans =
         do_QueryElementAt(anArrayTransferables, 0);
     if (trans) {
       // set the requestingPrincipal on the transferable
-      nsCOMPtr<nsINode> node = do_QueryInterface(mSourceNode);
-      trans->SetRequestingPrincipal(node->NodePrincipal());
+      trans->SetRequestingPrincipal(mSourceNode->NodePrincipal());
       trans->SetContentPolicyType(mContentPolicyType);
       rv = nsClipboard::CreateNativeDataObject(trans,
                                                getter_AddRefs(itemToDrag),
                                                uri);
       NS_ENSURE_SUCCESS(rv, rv);
     }
   } // else dragging a single object
 
@@ -639,17 +637,17 @@ nsDragService::EndDragSession(bool aDone
 
   nsBaseDragService::EndDragSession(aDoneDrag, aKeyModifiers);
   NS_IF_RELEASE(mDataObject);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDragService::UpdateDragImage(nsIDOMNode* aImage, int32_t aImageX, int32_t aImageY)
+nsDragService::UpdateDragImage(nsINode* aImage, int32_t aImageX, int32_t aImageY)
 {
   if (!mDataObject) {
     return NS_OK;
   }
 
   nsBaseDragService::UpdateDragImage(aImage, aImageX, aImageY);
 
   IDragSourceHelper *pdsh;
--- a/widget/windows/nsDragService.h
+++ b/widget/windows/nsDragService.h
@@ -28,17 +28,17 @@ public:
                                          nsIScriptableRegion* aRegion,
                                          uint32_t aActionType);
 
   // nsIDragSession
   NS_IMETHOD GetData(nsITransferable * aTransferable, uint32_t anItem) override;
   NS_IMETHOD GetNumDropItems(uint32_t * aNumItems) override;
   NS_IMETHOD IsDataFlavorSupported(const char *aDataFlavor, bool *_retval) override;
   NS_IMETHOD EndDragSession(bool aDoneDrag, uint32_t aKeyModifiers) override;
-  NS_IMETHOD UpdateDragImage(nsIDOMNode* aImage, int32_t aImageX, int32_t aImageY) override;
+  NS_IMETHOD UpdateDragImage(nsINode* aImage, int32_t aImageX, int32_t aImageY) override;
 
   // native impl.
   NS_IMETHOD SetIDataObject(IDataObject * aDataObj);
   NS_IMETHOD StartInvokingDragSession(IDataObject * aDataObj,
                                       uint32_t aActionType);
 
   // A drop occurred within the application vs. outside of it.
   void SetDroppedLocal();
@@ -48,17 +48,17 @@ public:
 protected:
   nsDataObjCollection* GetDataObjCollection(IDataObject * aDataObj);
 
   // determine if we have a single data object or one of our private
   // collections
   bool IsCollectionObject(IDataObject* inDataObj);
 
   // Create a bitmap for drag operations
-  bool CreateDragImage(nsIDOMNode *aDOMNode,
-                         nsIScriptableRegion *aRegion,
-                         SHDRAGIMAGE *psdi);
+  bool CreateDragImage(nsINode *aDOMNode,
+                       nsIScriptableRegion *aRegion,
+                       SHDRAGIMAGE *psdi);
 
   IDataObject * mDataObject;
   bool mSentLocalDropEvent;
 };
 
 #endif // nsDragService_h__
--- a/widget/windows/nsNativeDragTarget.cpp
+++ b/widget/windows/nsNativeDragTarget.cpp
@@ -4,17 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <stdio.h>
 #include "nsIDragService.h"
 #include "nsWidgetsCID.h"
 #include "nsNativeDragTarget.h"
 #include "nsDragService.h"
 #include "nsIServiceManager.h"
-#include "nsIDOMNode.h"
+#include "nsINode.h"
 #include "nsCOMPtr.h"
 
 #include "nsIWidget.h"
 #include "nsWindow.h"
 #include "nsClipboard.h"
 #include "KeyboardLayout.h"
 
 #include "mozilla/MouseEvents.h"
@@ -375,17 +375,17 @@ nsNativeDragTarget::DragLeave()
 
   // dispatch the event into Gecko
   DispatchDragDropEvent(eDragExit, gDragLastPoint);
 
   nsCOMPtr<nsIDragSession> currentDragSession;
   mDragService->GetCurrentSession(getter_AddRefs(currentDragSession));
 
   if (currentDragSession) {
-    nsCOMPtr<nsIDOMNode> sourceNode;
+    nsCOMPtr<nsINode> sourceNode;
     currentDragSession->GetSourceNode(getter_AddRefs(sourceNode));
 
     if (!sourceNode) {
       // We're leaving a window while doing a drag that was
       // initiated in a different app. End the drag session, since
       // we're done with it for now (until the user drags back into
       // mozilla).
       ModifierKeyState modifierKeyState;