зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1444991 - Part 5: Make some XPCOM methods more strongly typed, r=bz
This patch goes through and changes a bunch of places in our tree which mention this bug to use the new feature, making the methods more strongly typed. There are probably more places in tree which could be changed, but I didn't try to find them.
This commit is contained in:
Родитель
e5f31c03d8
Коммит
5e2e5fc993
|
@ -1670,7 +1670,7 @@ nsDOMWindowUtils::GetScrollbarSize(bool aFlushLayout, int32_t* aWidth,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::GetBoundsWithoutFlushing(nsIDOMElement *aElement,
|
||||
nsISupports** aResult)
|
||||
DOMRect** aResult)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_STATE(window);
|
||||
|
@ -1739,7 +1739,7 @@ nsDOMWindowUtils::FlushLayoutWithoutThrottledAnimations()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::GetRootBounds(nsISupports** aResult)
|
||||
nsDOMWindowUtils::GetRootBounds(DOMRect** aResult)
|
||||
{
|
||||
nsIDocument* doc = GetDocument();
|
||||
NS_ENSURE_STATE(doc);
|
||||
|
|
|
@ -2522,9 +2522,8 @@ GetContentParent(Element* aBrowser)
|
|||
return ReturnTuple(nullptr, nullptr);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports> otherLoaderAsSupports;
|
||||
browser->GetSameProcessAsFrameLoader(getter_AddRefs(otherLoaderAsSupports));
|
||||
RefPtr<nsFrameLoader> otherLoader = do_QueryObject(otherLoaderAsSupports);
|
||||
RefPtr<nsFrameLoader> otherLoader;
|
||||
browser->GetSameProcessAsFrameLoader(getter_AddRefs(otherLoader));
|
||||
if (!otherLoader) {
|
||||
return ReturnTuple(nullptr, nullptr);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
|
||||
interface nsIDOMEvent;
|
||||
|
||||
webidl DragEvent;
|
||||
webidl DataTransfer;
|
||||
|
||||
[scriptable, uuid(69E14F91-2E09-4CA6-A511-A715C99A2804)]
|
||||
interface nsIDroppedLinkItem : nsISupports
|
||||
{
|
||||
|
@ -37,10 +40,8 @@ interface nsIDroppedLinkHandler : nsISupports
|
|||
* of the source of the drag is different from the destination. This check
|
||||
* includes any parent, sibling and child frames in the same content tree.
|
||||
* If true, the source is not checked.
|
||||
*
|
||||
* aEvent should be a DragEvent. See bug 1444991.
|
||||
*/
|
||||
boolean canDropLink(in nsIDOMEvent aEvent, in boolean aAllowSameDocument);
|
||||
boolean canDropLink(in DragEvent aEvent, in boolean aAllowSameDocument);
|
||||
|
||||
/**
|
||||
* Given a drop event aEvent, determines the link being dragged and returns
|
||||
|
@ -58,10 +59,8 @@ interface nsIDroppedLinkHandler : nsISupports
|
|||
*
|
||||
* aName is filled in with the link title if it exists, or an empty string
|
||||
* otherwise.
|
||||
*
|
||||
* aEvent should be a DragEvent. See bug 1444991.
|
||||
*/
|
||||
AString dropLink(in nsIDOMEvent aEvent, out AString aName,
|
||||
AString dropLink(in DragEvent aEvent, out AString aName,
|
||||
[optional] in boolean aDisallowInherit);
|
||||
|
||||
/**
|
||||
|
@ -77,10 +76,8 @@ interface nsIDroppedLinkHandler : nsISupports
|
|||
* the user into a dragging a chrome url, for example.
|
||||
* - aDisallowInherit is true, and the URI being dropped would inherit the
|
||||
* current document's security context (URI_INHERITS_SECURITY_CONTEXT).
|
||||
*
|
||||
* aEvent should be a DragEvent. See bug 1444991.
|
||||
*/
|
||||
void dropLinks(in nsIDOMEvent aEvent,
|
||||
void dropLinks(in DragEvent aEvent,
|
||||
[optional] in boolean aDisallowInherit,
|
||||
[optional] out unsigned long aCount,
|
||||
[retval, array, size_is(aCount)] out nsIDroppedLinkItem aLinks);
|
||||
|
@ -89,10 +86,8 @@ interface nsIDroppedLinkHandler : nsISupports
|
|||
* Given a drop event aEvent, validate the extra URIs for the event,
|
||||
* this is used when the caller extracts yet another URIs from the dropped
|
||||
* text, like home button that splits the text with "|".
|
||||
*
|
||||
* aEvent should be a DragEvent. See bug 1444991.
|
||||
*/
|
||||
void validateURIsForDrop(in nsIDOMEvent aEvent,
|
||||
void validateURIsForDrop(in DragEvent aEvent,
|
||||
in unsigned long aURIsCount,
|
||||
[array, size_is(aURIsCount)] in wstring aURIs,
|
||||
[optional] in boolean aDisallowInherit);
|
||||
|
@ -102,18 +97,14 @@ interface nsIDroppedLinkHandler : nsISupports
|
|||
* dragged. Since drag/drop performs a roundtrip of parent, child, parent,
|
||||
* it allows the parent to verify that the child did not modify links
|
||||
* being dropped.
|
||||
*
|
||||
* @param dataTransfer is a DataTransfer. See bug 1444991.
|
||||
*/
|
||||
void queryLinks(in nsISupports aDataTransfer,
|
||||
void queryLinks(in DataTransfer aDataTransfer,
|
||||
[optional] out unsigned long aCount,
|
||||
[retval, array, size_is(aCount)] out nsIDroppedLinkItem aLinks);
|
||||
|
||||
/**
|
||||
* Given a drop event aEvent, determines the triggering principal for the
|
||||
* event and returns it.
|
||||
*
|
||||
* aEvent should be a DragEvent. See bug 1444991.
|
||||
*/
|
||||
nsIPrincipal getTriggeringPrincipal(in nsIDOMEvent aEvent);
|
||||
nsIPrincipal getTriggeringPrincipal(in DragEvent aEvent);
|
||||
};
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
interface nsIDOMDOMRequest;
|
||||
|
||||
webidl FrameLoader;
|
||||
|
||||
[scriptable, function, uuid(00d0e19d-bd67-491f-8e85-b9905224d3bb)]
|
||||
interface nsIBrowserElementNextPaintListener : nsISupports
|
||||
{
|
||||
|
@ -39,8 +41,7 @@ interface nsIBrowserElementAPI : nsISupports
|
|||
*/
|
||||
void destroyFrameScripts();
|
||||
|
||||
// The argument should be a FrameLoader. Fix that when bug 1444991 is fixed.
|
||||
void setFrameLoader(in nsISupports frameLoader);
|
||||
void setFrameLoader(in FrameLoader frameLoader);
|
||||
|
||||
void sendMouseEvent(in DOMString type,
|
||||
in uint32_t x,
|
||||
|
|
|
@ -979,7 +979,7 @@ HTMLFormElement::NotifySubmitObservers(nsIURI* aActionURL,
|
|||
nsCOMPtr<nsIFormSubmitObserver> formSubmitObserver(
|
||||
do_QueryInterface(inst));
|
||||
if (formSubmitObserver) {
|
||||
rv = formSubmitObserver->Notify(static_cast<nsIContent*>(this),
|
||||
rv = formSubmitObserver->Notify(this,
|
||||
window ? window->GetCurrentInnerWindow() : nullptr,
|
||||
aActionURL,
|
||||
aCancelSubmit);
|
||||
|
@ -1977,7 +1977,7 @@ HTMLFormElement::CheckValidFormSubmission()
|
|||
observer = do_QueryInterface(inst);
|
||||
|
||||
if (observer) {
|
||||
observer->NotifyInvalidSubmit(static_cast<nsIContent*>(this),
|
||||
observer->NotifyInvalidSubmit(this,
|
||||
static_cast<nsIArray*>(invalidElements));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ nsBrowserElement::InitBrowserElementAPI()
|
|||
return;
|
||||
}
|
||||
}
|
||||
mBrowserElementAPI->SetFrameLoader(ToSupports(frameLoader));
|
||||
mBrowserElementAPI->SetFrameLoader(frameLoader);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -10,14 +10,14 @@ interface mozIDOMWindow;
|
|||
interface nsIURI;
|
||||
interface nsIArray;
|
||||
|
||||
webidl HTMLFormElement;
|
||||
|
||||
[scriptable, uuid(867cb7e7-835d-408b-9788-d2834d284e03)]
|
||||
interface nsIFormSubmitObserver: nsISupports
|
||||
{
|
||||
// formNode must be a HTMLFormElement (bug 1444991 can clean it up)
|
||||
void notify(in nsISupports formNode, in mozIDOMWindow window, in nsIURI actionURL, out boolean cancelSubmit);
|
||||
void notify(in HTMLFormElement formNode, in mozIDOMWindow window, in nsIURI actionURL, out boolean cancelSubmit);
|
||||
|
||||
// formNode must be a HTMLFormElement (bug 1444991 can clean it up)
|
||||
void notifyInvalidSubmit(in nsISupports formNode,
|
||||
void notifyInvalidSubmit(in HTMLFormElement formNode,
|
||||
in nsIArray invalidElements);
|
||||
};
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
interface nsIPrincipal;
|
||||
|
||||
webidl FrameLoader;
|
||||
|
||||
[scriptable, uuid(14e5a0cb-e223-4202-95e8-fe53275193ea)]
|
||||
interface nsIBrowser : nsISupports
|
||||
{
|
||||
|
@ -14,11 +16,8 @@ interface nsIBrowser : nsISupports
|
|||
* this frame loader for any new tab parents. For example, view source
|
||||
* browsers set this to the frame loader for the original content to ensure
|
||||
* they are loaded in the same process as the content.
|
||||
*
|
||||
* This returns a FrameLoader, but we have no good way to represent
|
||||
* one in xpidl. Fix this when bug 1444991 is fixed.
|
||||
*/
|
||||
readonly attribute nsISupports sameProcessAsFrameLoader;
|
||||
readonly attribute FrameLoader sameProcessAsFrameLoader;
|
||||
|
||||
/*
|
||||
* Called by the child to inform the parent that links are dropped into
|
||||
|
|
|
@ -49,6 +49,8 @@ interface nsIContentPermissionRequest;
|
|||
interface nsIObserver;
|
||||
interface nsIDOMStorage;
|
||||
|
||||
webidl DOMRect;
|
||||
|
||||
[scriptable, uuid(4d6732ca-9da7-4176-b8a1-8dde15cd0bf9)]
|
||||
interface nsIDOMWindowUtils : nsISupports {
|
||||
|
||||
|
@ -842,9 +844,8 @@ interface nsIDOMWindowUtils : nsISupports {
|
|||
|
||||
/**
|
||||
* Returns the given element's bounds without flushing pending layout changes.
|
||||
* The returned object is a DOMRect (bug 1444991 may remove this walkaround).
|
||||
*/
|
||||
nsISupports getBoundsWithoutFlushing(in nsIDOMElement aElement);
|
||||
DOMRect getBoundsWithoutFlushing(in nsIDOMElement aElement);
|
||||
|
||||
const long FLUSH_NONE = -1;
|
||||
const long FLUSH_STYLE = 0;
|
||||
|
@ -866,9 +867,8 @@ interface nsIDOMWindowUtils : nsISupports {
|
|||
* Returns the bounds of the window's currently loaded document. This will
|
||||
* generally be (0, 0, pageWidth, pageHeight) but in some cases (e.g. RTL
|
||||
* documents) may have a negative left value.
|
||||
* The returned object is a DOMRect (bug 1444991 may remove this walkaround).
|
||||
*/
|
||||
nsISupports getRootBounds();
|
||||
DOMRect getRootBounds();
|
||||
|
||||
/**
|
||||
* Get IME open state. TRUE means 'Open', otherwise, 'Close'.
|
||||
|
|
|
@ -184,7 +184,7 @@ public:
|
|||
NS_IMETHOD TerminatePlugin() override;
|
||||
NS_IMETHOD UserCanceled() override;
|
||||
|
||||
NS_IMETHOD IsReportForBrowser(nsISupports* aFrameLoader, bool* aResult) override;
|
||||
NS_IMETHOD IsReportForBrowser(nsFrameLoader* aFrameLoader, bool* aResult) override;
|
||||
|
||||
// Called when a content process shuts down.
|
||||
void Clear() {
|
||||
|
@ -1124,7 +1124,7 @@ HangMonitoredProcess::TerminatePlugin()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HangMonitoredProcess::IsReportForBrowser(nsISupports* aFrameLoader, bool* aResult)
|
||||
HangMonitoredProcess::IsReportForBrowser(nsFrameLoader* aFrameLoader, bool* aResult)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(NS_IsMainThread());
|
||||
|
||||
|
@ -1133,10 +1133,9 @@ HangMonitoredProcess::IsReportForBrowser(nsISupports* aFrameLoader, bool* aResul
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
RefPtr<nsFrameLoader> frameLoader = do_QueryObject(aFrameLoader);
|
||||
NS_ENSURE_STATE(frameLoader);
|
||||
NS_ENSURE_STATE(aFrameLoader);
|
||||
|
||||
TabParent* tp = TabParent::GetFrom(frameLoader);
|
||||
TabParent* tp = TabParent::GetFrom(aFrameLoader);
|
||||
if (!tp) {
|
||||
*aResult = false;
|
||||
return NS_OK;
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
interface nsIDOMElement;
|
||||
|
||||
webidl FrameLoader;
|
||||
|
||||
/**
|
||||
* When a content process hangs, Gecko notifies "process-hang-report" observers
|
||||
* and passes an nsIHangReport for the subject parameter. There is at most one
|
||||
|
@ -65,6 +67,6 @@ interface nsIHangReport : nsISupports
|
|||
void endStartingDebugger();
|
||||
|
||||
// Inquire whether the report is for a content process loaded by the given
|
||||
// frameloader. Make this take a FrameLoader once bug 1444991 is fixed.
|
||||
bool isReportForBrowser(in nsISupports aFrameLoader);
|
||||
// frameloader.
|
||||
bool isReportForBrowser(in FrameLoader aFrameLoader);
|
||||
};
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
interface nsISelection;
|
||||
|
||||
webidl CharacterData;
|
||||
|
||||
/*
|
||||
Editor Action Listener interface to outside world
|
||||
|
@ -79,37 +80,37 @@ interface nsIEditActionListener : nsISupports
|
|||
|
||||
/**
|
||||
* Called after the editor inserts text.
|
||||
* @param aTextNode This node getting inserted text. Should be a CharacterData after bug 1444991.
|
||||
* @param aTextNode This node getting inserted text.
|
||||
* @param aOffset The offset in aTextNode to insert at.
|
||||
* @param aString The string that gets inserted.
|
||||
* @param aResult The result of the insert text operation.
|
||||
*/
|
||||
void DidInsertText(in nsISupports aTextNode,
|
||||
void DidInsertText(in CharacterData aTextNode,
|
||||
in long aOffset,
|
||||
in DOMString aString,
|
||||
in nsresult aResult);
|
||||
|
||||
/**
|
||||
* Called before the editor deletes text.
|
||||
* @param aTextNode This node getting text deleted. Should be a CharacterData after bug 1444991.
|
||||
* @param aTextNode This node getting text deleted.
|
||||
* @param aOffset The offset in aTextNode to delete at.
|
||||
* @param aLength The amount of text to delete.
|
||||
*/
|
||||
void WillDeleteText(in nsISupports aTextNode,
|
||||
void WillDeleteText(in CharacterData aTextNode,
|
||||
in long aOffset,
|
||||
in long aLength);
|
||||
|
||||
/**
|
||||
* Called before the editor deletes text.
|
||||
* @param aTextNode This node getting text deleted. Should be a CharacterData after bug 1444991.
|
||||
* @param aTextNode This node getting text deleted.
|
||||
* @param aOffset The offset in aTextNode to delete at.
|
||||
* @param aLength The amount of text to delete.
|
||||
* @param aResult The result of the delete text operation.
|
||||
*/
|
||||
void DidDeleteText(in nsISupports aTextNode,
|
||||
void DidDeleteText(in CharacterData aTextNode,
|
||||
in long aOffset,
|
||||
in long aLength,
|
||||
in nsresult aResult);
|
||||
in nsresult aResult);
|
||||
|
||||
/**
|
||||
* Called before the editor deletes the selection.
|
||||
|
|
|
@ -3220,7 +3220,7 @@ TextServicesDocument::DidCreateNode(const nsAString& aTag,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TextServicesDocument::DidInsertText(nsISupports* aTextNode,
|
||||
TextServicesDocument::DidInsertText(CharacterData* aTextNode,
|
||||
int32_t aOffset,
|
||||
const nsAString& aString,
|
||||
nsresult aResult)
|
||||
|
@ -3229,7 +3229,7 @@ TextServicesDocument::DidInsertText(nsISupports* aTextNode,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TextServicesDocument::WillDeleteText(nsISupports* aTextNode,
|
||||
TextServicesDocument::WillDeleteText(CharacterData* aTextNode,
|
||||
int32_t aOffset,
|
||||
int32_t aLength)
|
||||
{
|
||||
|
@ -3237,7 +3237,7 @@ TextServicesDocument::WillDeleteText(nsISupports* aTextNode,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TextServicesDocument::DidDeleteText(nsISupports* aTextNode,
|
||||
TextServicesDocument::DidDeleteText(CharacterData* aTextNode,
|
||||
int32_t aOffset,
|
||||
int32_t aLength,
|
||||
nsresult aResult)
|
||||
|
|
|
@ -9,6 +9,8 @@ interface nsITreeBoxObject;
|
|||
interface nsITreeSelection;
|
||||
interface nsITreeColumn;
|
||||
|
||||
webidl DataTransfer;
|
||||
|
||||
[scriptable, uuid(091116f0-0bdc-4b32-b9c8-c8d5a37cb088)]
|
||||
interface nsITreeView : nsISupports
|
||||
{
|
||||
|
@ -75,18 +77,14 @@ interface nsITreeView : nsISupports
|
|||
* the current location. To get the behavior where drops are only allowed on
|
||||
* items, such as the mailNews folder pane, always return false when
|
||||
* the orientation is not DROP_ON.
|
||||
*
|
||||
* @param dataTransfer should be a DataTransfer once bug 1444991 is fixed.
|
||||
*/
|
||||
boolean canDrop(in long index, in long orientation, in nsISupports dataTransfer);
|
||||
boolean canDrop(in long index, in long orientation, in DataTransfer dataTransfer);
|
||||
|
||||
/**
|
||||
* Called when the user drops something on this view. The |orientation| param
|
||||
* specifies before/on/after the given |row|.
|
||||
*
|
||||
* @param dataTransfer should be a DataTransfer once bug 1444991 is fixed.
|
||||
*/
|
||||
void drop(in long row, in long orientation, in nsISupports dataTransfer);
|
||||
void drop(in long row, in long orientation, in DataTransfer dataTransfer);
|
||||
|
||||
/**
|
||||
* Methods used by the tree to draw thread lines in the tree.
|
||||
|
|
|
@ -368,7 +368,7 @@ nsTreeContentView::CanDrop(int32_t aRow, int32_t aOrientation,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsTreeContentView::CanDrop(int32_t aIndex, int32_t aOrientation,
|
||||
nsISupports* aDataTransfer, bool *_retval)
|
||||
DataTransfer* aDataTransfer, bool *_retval)
|
||||
{
|
||||
ErrorResult rv;
|
||||
*_retval = CanDrop(aIndex, aOrientation, rv);
|
||||
|
@ -392,7 +392,7 @@ nsTreeContentView::Drop(int32_t aRow, int32_t aOrientation,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsTreeContentView::Drop(int32_t aRow, int32_t aOrientation,
|
||||
nsISupports* aDataTransfer)
|
||||
DataTransfer* aDataTransfer)
|
||||
{
|
||||
ErrorResult rv;
|
||||
Drop(aRow, aOrientation, rv);
|
||||
|
|
|
@ -398,7 +398,7 @@ nsNSSASN1Tree::PerformActionOnCell(const char16_t*, int32_t, nsITreeColumn*)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNSSASN1Tree::CanDrop(int32_t, int32_t, nsISupports*, bool* _retval)
|
||||
nsNSSASN1Tree::CanDrop(int32_t, int32_t, mozilla::dom::DataTransfer*, bool* _retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
*_retval = false;
|
||||
|
@ -406,7 +406,7 @@ nsNSSASN1Tree::CanDrop(int32_t, int32_t, nsISupports*, bool* _retval)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNSSASN1Tree::Drop(int32_t, int32_t, nsISupports*)
|
||||
nsNSSASN1Tree::Drop(int32_t, int32_t, mozilla::dom::DataTransfer*)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -1224,7 +1224,8 @@ nsCertTree::dumpMap()
|
|||
// CanDrop
|
||||
//
|
||||
NS_IMETHODIMP nsCertTree::CanDrop(int32_t index, int32_t orientation,
|
||||
nsISupports* aDataTransfer, bool *_retval)
|
||||
mozilla::dom::DataTransfer* aDataTransfer,
|
||||
bool *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
*_retval = false;
|
||||
|
@ -1237,7 +1238,7 @@ NS_IMETHODIMP nsCertTree::CanDrop(int32_t index, int32_t orientation,
|
|||
// Drop
|
||||
//
|
||||
NS_IMETHODIMP nsCertTree::Drop(int32_t row, int32_t orient,
|
||||
nsISupports* aDataTransfer)
|
||||
mozilla::dom::DataTransfer* aDataTransfer)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -240,16 +240,14 @@ public:
|
|||
|
||||
// take a screenshot, as wide as possible, proportional to the destination size
|
||||
nsCOMPtr<nsIDOMWindowUtils> utils = do_GetInterface(window);
|
||||
nsCOMPtr<nsISupports> rectSupports;
|
||||
RefPtr<DOMRect> rect;
|
||||
if (!utils ||
|
||||
NS_FAILED(utils->GetRootBounds(getter_AddRefs(rectSupports))) ||
|
||||
!rectSupports) {
|
||||
NS_FAILED(utils->GetRootBounds(getter_AddRefs(rect))) ||
|
||||
!rect) {
|
||||
java::ThumbnailHelper::NotifyThumbnail(
|
||||
aData, aTab, /* success */ false, /* store */ false);
|
||||
return;
|
||||
}
|
||||
// this is safe, as GetRootBounds returns a DOMRect instance.
|
||||
DOMRect* rect = DOMRect::FromSupports(rectSupports);
|
||||
float pageLeft = rect->Left();
|
||||
float pageTop = rect->Top();
|
||||
float pageWidth = rect->Width();
|
||||
|
|
|
@ -204,7 +204,7 @@ nsBaseDragService::IsDataFlavorSupported(const char *aDataFlavor,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBaseDragService::GetDataTransferXPCOM(nsISupports** aDataTransfer)
|
||||
nsBaseDragService::GetDataTransferXPCOM(DataTransfer** aDataTransfer)
|
||||
{
|
||||
*aDataTransfer = mDataTransfer;
|
||||
NS_IF_ADDREF(*aDataTransfer);
|
||||
|
@ -212,11 +212,10 @@ nsBaseDragService::GetDataTransferXPCOM(nsISupports** aDataTransfer)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBaseDragService::SetDataTransferXPCOM(nsISupports* aDataTransfer)
|
||||
nsBaseDragService::SetDataTransferXPCOM(DataTransfer* aDataTransfer)
|
||||
{
|
||||
RefPtr<DataTransfer> dataTransfer = do_QueryObject(aDataTransfer);
|
||||
NS_ENSURE_STATE(dataTransfer);
|
||||
mDataTransfer = dataTransfer.forget();
|
||||
NS_ENSURE_STATE(aDataTransfer);
|
||||
mDataTransfer = aDataTransfer;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -281,7 +280,7 @@ nsBaseDragService::InvokeDragSessionWithImage(nsIDOMNode* aDOMNode,
|
|||
uint32_t aActionType,
|
||||
nsIDOMNode* aImage,
|
||||
int32_t aImageX, int32_t aImageY,
|
||||
nsIDOMEvent* aDragEvent,
|
||||
DragEvent* aDragEvent,
|
||||
DataTransfer* aDataTransfer)
|
||||
{
|
||||
NS_ENSURE_TRUE(aDragEvent, NS_ERROR_NULL_POINTER);
|
||||
|
@ -295,14 +294,9 @@ nsBaseDragService::InvokeDragSessionWithImage(nsIDOMNode* aDOMNode,
|
|||
mImage = aImage;
|
||||
mImageOffset = CSSIntPoint(aImageX, aImageY);
|
||||
|
||||
DragEvent* dragEvent = aDragEvent->InternalDOMEvent()->AsDragEvent();
|
||||
if (NS_WARN_IF(!dragEvent)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
mScreenPosition.x = dragEvent->ScreenX(CallerType::System);
|
||||
mScreenPosition.y = dragEvent->ScreenY(CallerType::System);
|
||||
mInputSource = dragEvent->MozInputSource();
|
||||
mScreenPosition.x = aDragEvent->ScreenX(CallerType::System);
|
||||
mScreenPosition.y = aDragEvent->ScreenY(CallerType::System);
|
||||
mInputSource = aDragEvent->MozInputSource();
|
||||
|
||||
nsresult rv = InvokeDragSession(aDOMNode, aPrincipalURISpec,
|
||||
aTransferableArray,
|
||||
|
@ -323,7 +317,7 @@ nsBaseDragService::InvokeDragSessionWithSelection(nsISelection* aSelection,
|
|||
const nsACString& aPrincipalURISpec,
|
||||
nsIArray* aTransferableArray,
|
||||
uint32_t aActionType,
|
||||
nsIDOMEvent* aDragEvent,
|
||||
DragEvent* aDragEvent,
|
||||
DataTransfer* aDataTransfer)
|
||||
{
|
||||
NS_ENSURE_TRUE(aSelection, NS_ERROR_NULL_POINTER);
|
||||
|
@ -337,14 +331,9 @@ nsBaseDragService::InvokeDragSessionWithSelection(nsISelection* aSelection,
|
|||
mImage = nullptr;
|
||||
mImageOffset = CSSIntPoint();
|
||||
|
||||
DragEvent* dragEvent = aDragEvent->InternalDOMEvent()->AsDragEvent();
|
||||
if (NS_WARN_IF(!dragEvent)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
mScreenPosition.x = dragEvent->ScreenX(CallerType::System);
|
||||
mScreenPosition.y = dragEvent->ScreenY(CallerType::System);
|
||||
mInputSource = dragEvent->MozInputSource();
|
||||
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
|
||||
|
|
|
@ -14,6 +14,8 @@ interface nsIDOMNode;
|
|||
interface nsIDOMEvent;
|
||||
interface nsISelection;
|
||||
|
||||
webidl DragEvent;
|
||||
|
||||
%{C++
|
||||
#include "mozilla/EventForwards.h"
|
||||
|
||||
|
@ -86,8 +88,6 @@ interface nsIDragService : nsISupports
|
|||
*
|
||||
* The aDragEvent must be supplied as the current screen coordinates of the
|
||||
* event are needed to calculate the image location.
|
||||
*
|
||||
* aDragEvent should be a DragEvent. See bug 1444991.
|
||||
*/
|
||||
[noscript]
|
||||
void invokeDragSessionWithImage(in nsIDOMNode aDOMNode,
|
||||
|
@ -98,7 +98,7 @@ interface nsIDragService : nsISupports
|
|||
in nsIDOMNode aImage,
|
||||
in long aImageX,
|
||||
in long aImageY,
|
||||
in nsIDOMEvent aDragEvent,
|
||||
in DragEvent aDragEvent,
|
||||
in DataTransferPtr aDataTransfer);
|
||||
|
||||
/**
|
||||
|
@ -107,14 +107,12 @@ interface nsIDragService : nsISupports
|
|||
* event are needed to calculate the image location.
|
||||
*
|
||||
* Note: This method is deprecated for non-native code.
|
||||
*
|
||||
* aDragEvent should be a DragEvent. See bug 1444991.
|
||||
*/
|
||||
void invokeDragSessionWithSelection(in nsISelection aSelection,
|
||||
in AUTF8String aPrincipalURISpec,
|
||||
in nsIArray aTransferableArray,
|
||||
in unsigned long aActionType,
|
||||
in nsIDOMEvent aDragEvent,
|
||||
in DragEvent aDragEvent,
|
||||
in DataTransferPtr aDataTransfer);
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,20 +10,15 @@
|
|||
|
||||
%{ C++
|
||||
#include "nsSize.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class DataTransfer;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
%}
|
||||
|
||||
native nsSize (nsSize);
|
||||
[ptr] native DataTransferPtr(mozilla::dom::DataTransfer);
|
||||
|
||||
interface nsIDOMDocument;
|
||||
interface nsIDOMNode;
|
||||
|
||||
webidl DataTransfer;
|
||||
|
||||
[scriptable, builtinclass, uuid(25bce737-73f0-43c7-bc20-c71044a73c5a)]
|
||||
interface nsIDragSession : nsISupports
|
||||
{
|
||||
|
@ -75,13 +70,12 @@ interface nsIDragSession : nsISupports
|
|||
attribute AUTF8String triggeringPrincipalURISpec;
|
||||
|
||||
/**
|
||||
* The data transfer object for the current drag. Should become a
|
||||
* DataTransfer once bug 1444991 is fixed.
|
||||
* The data transfer object for the current drag.
|
||||
*/
|
||||
[binaryname(DataTransferXPCOM)]
|
||||
attribute nsISupports dataTransfer;
|
||||
[notxpcom, nostdcall] DataTransferPtr getDataTransfer();
|
||||
[notxpcom, nostdcall] void setDataTransfer(in DataTransferPtr aDataTransfer);
|
||||
attribute DataTransfer dataTransfer;
|
||||
[notxpcom, nostdcall] DataTransfer getDataTransfer();
|
||||
[notxpcom, nostdcall] void setDataTransfer(in DataTransfer aDataTransfer);
|
||||
|
||||
/**
|
||||
* Get data from a Drag&Drop. Can be called while the drag is in process
|
||||
|
|
Загрузка…
Ссылка в новой задаче