Bug 1444686 part 2. Get rid of nsIDOMDataTransfer::GetMozItemCount. r=mystor

MozReview-Commit-ID: 1eo6czER8Qw
This commit is contained in:
Boris Zbarsky 2018-03-13 16:23:59 -04:00
Родитель 4968b166a6
Коммит 6139d9be8f
5 изменённых файлов: 13 добавлений и 26 удалений

Просмотреть файл

@ -919,7 +919,7 @@ nsCopySupport::FireClipboardEvent(EventMessage aEventMessage,
}
} else if (clipboardData) {
// check to see if any data was put on the data transfer.
clipboardData->GetMozItemCount(&count);
count = clipboardData->MozItemCount();
if (count) {
nsCOMPtr<nsIClipboard> clipboard(do_GetService("@mozilla.org/widget/clipboard;1"));
NS_ENSURE_TRUE(clipboard, false);

Просмотреть файл

@ -483,13 +483,6 @@ DataTransfer::ClearData(const Optional<nsAString>& aFormat,
}
}
NS_IMETHODIMP
DataTransfer::GetMozItemCount(uint32_t* aCount)
{
*aCount = MozItemCount();
return NS_OK;
}
NS_IMETHODIMP
DataTransfer::GetMozCursor(nsAString& aCursorState)
{

Просмотреть файл

@ -2059,10 +2059,12 @@ EventStateManager::DoDefaultDragStart(nsPresContext* aPresContext,
// No drag session is currently active, so check if a handler added
// any items to be dragged. If not, there isn't anything to drag.
uint32_t count = 0;
if (aDataTransfer)
aDataTransfer->GetMozItemCount(&count);
if (!count)
if (aDataTransfer) {
count = aDataTransfer->MozItemCount();
}
if (!count) {
return false;
}
// Get the target being dragged, which may not be the same as the
// target of the mouse event. If one wasn't set in the

Просмотреть файл

@ -68,11 +68,6 @@ interface nsIDOMDataTransfer : nsISupports
*/
void addElement(in nsIDOMElement element);
/**
* The number of items being dragged.
*/
readonly attribute unsigned long mozItemCount;
/**
* Sets the drag cursor state. Primarily used to control the cursor during
* tab drags, but could be expanded to other uses. XXX Currently implemented

Просмотреть файл

@ -9,6 +9,8 @@
#include "mozilla/EditorUtils.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/SelectionState.h"
#include "mozilla/dom/DataTransfer.h"
#include "mozilla/dom/DragEvent.h"
#include "mozilla/dom/Selection.h"
#include "nsAString.h"
#include "nsCOMPtr.h"
@ -18,9 +20,7 @@
#include "nsError.h"
#include "nsIClipboard.h"
#include "nsIContent.h"
#include "nsIDOMDataTransfer.h"
#include "nsIDOMDocument.h"
#include "nsIDOMDragEvent.h"
#include "nsIDOMEvent.h"
#include "nsIDOMNode.h"
#include "nsIDOMUIEvent.h"
@ -165,12 +165,11 @@ TextEditor::InsertFromDrop(nsIDOMEvent* aDropEvent)
{
CommitComposition();
nsCOMPtr<nsIDOMDragEvent> dragEvent(do_QueryInterface(aDropEvent));
Event* dropEvent = aDropEvent->InternalDOMEvent();
DragEvent* dragEvent = dropEvent->AsDragEvent();
NS_ENSURE_TRUE(dragEvent, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMDataTransfer> domDataTransfer;
dragEvent->GetDataTransfer(getter_AddRefs(domDataTransfer));
nsCOMPtr<DataTransfer> dataTransfer = do_QueryInterface(domDataTransfer);
RefPtr<DataTransfer> dataTransfer = dragEvent->GetDataTransfer();
NS_ENSURE_TRUE(dataTransfer, NS_ERROR_FAILURE);
nsCOMPtr<nsIDragSession> dragSession = nsContentUtils::GetDragSession();
@ -196,9 +195,7 @@ TextEditor::InsertFromDrop(nsIDOMEvent* aDropEvent)
nsCOMPtr<nsIDOMDocument> destdomdoc = GetDOMDocument();
NS_ENSURE_TRUE(destdomdoc, NS_ERROR_NOT_INITIALIZED);
uint32_t numItems = 0;
nsresult rv = dataTransfer->GetMozItemCount(&numItems);
NS_ENSURE_SUCCESS(rv, rv);
uint32_t numItems = dataTransfer->MozItemCount();
if (numItems < 1) {
return NS_ERROR_FAILURE; // Nothing to drop?
}
@ -214,7 +211,7 @@ TextEditor::InsertFromDrop(nsIDOMEvent* aDropEvent)
NS_ENSURE_TRUE(uiEvent, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMNode> newSelectionParent;
rv = uiEvent->GetRangeParent(getter_AddRefs(newSelectionParent));
nsresult rv = uiEvent->GetRangeParent(getter_AddRefs(newSelectionParent));
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(newSelectionParent, NS_ERROR_FAILURE);