Commit d8c5f9eb authored by Ms2ger's avatar Ms2ger
Browse files

Bug 780165 - Part c: Use nsPIDOMWindow::GetDoc() in drag&drop; r=smaug

parent b23a9d3d
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@
class NS_STACK_CLASS DragDataProducer
{
public:
  DragDataProducer(nsIDOMWindow* aWindow,
  DragDataProducer(nsPIDOMWindow* aWindow,
                   nsIContent* aTarget,
                   nsIContent* aSelectionTargetNode,
                   bool aIsAltKeyPressed);
@@ -84,7 +84,7 @@ private:
  static void GetSelectedLink(nsISelection* inSelection,
                              nsIContent **outLinkNode);

  nsCOMPtr<nsIDOMWindow> mWindow;
  nsCOMPtr<nsPIDOMWindow> mWindow;
  nsCOMPtr<nsIContent> mTarget;
  nsCOMPtr<nsIContent> mSelectionTargetNode;
  bool mIsAltKeyPressed;
@@ -104,7 +104,7 @@ private:


nsresult
nsContentAreaDragDrop::GetDragData(nsIDOMWindow* aWindow,
nsContentAreaDragDrop::GetDragData(nsPIDOMWindow* aWindow,
                                   nsIContent* aTarget,
                                   nsIContent* aSelectionTargetNode,
                                   bool aIsAltKeyPressed,
@@ -238,7 +238,7 @@ nsContentAreaDragDropDataProvider::GetFlavorData(nsITransferable *aTransferable,
  return rv;
}

DragDataProducer::DragDataProducer(nsIDOMWindow* aWindow,
DragDataProducer::DragDataProducer(nsPIDOMWindow* aWindow,
                                   nsIContent* aTarget,
                                   nsIContent* aSelectionTargetNode,
                                   bool aIsAltKeyPressed)
@@ -648,9 +648,7 @@ DragDataProducer::Produce(nsDOMDataTransfer* aDataTransfer,
    mInfoString.Truncate();
    mTitleString.Truncate();

    nsCOMPtr<nsIDOMDocument> domDoc;
    mWindow->GetDocument(getter_AddRefs(domDoc));
    nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
    nsCOMPtr<nsIDocument> doc = mWindow->GetDoc();
    NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);

    // if we have selected text, use it in preference to the node
+2 −2
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
#include "nsITransferable.h"

class nsIDOMNode;
class nsIDOMWindow;
class nsPIDOMWindow;
class nsIDOMDragEvent;
class nsISelection;
class nsITransferable;
@@ -49,7 +49,7 @@ public:
   * aDragNode - [out] the link, image or area being dragged, or null if the
   *             drag occurred on another element.
   */
  static nsresult GetDragData(nsIDOMWindow* aWindow,
  static nsresult GetDragData(nsPIDOMWindow* aWindow,
                              nsIContent* aTarget,
                              nsIContent* aSelectionTargetNode,
                              bool aIsAltKeyPressed,
+1 −1
Original line number Diff line number Diff line
@@ -2292,7 +2292,7 @@ nsEventStateManager::DetermineDragTarget(nsPresContext* aPresContext,
  *aTargetNode = nullptr;

  nsCOMPtr<nsISupports> container = aPresContext->GetContainer();
  nsCOMPtr<nsIDOMWindow> window = do_GetInterface(container);
  nsCOMPtr<nsPIDOMWindow> window = do_GetInterface(container);
  if (!window)
    return;