/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/** * Starts a modal drag session with an array of transaferables. * * @param aPrincipal - the triggering principal of the drag, or null if * it's from browser chrome or OS * @param aCsp - The csp of the triggering Document * @param aTransferables - an array of transferables to be dragged * @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)
*/
MOZ_CAN_RUN_SCRIPT virtual nsresult InvokeDragSession(
nsIWidget* aWidget, nsINode* aDOMNode, nsIPrincipal* aPrincipal,
nsIContentSecurityPolicy* aCsp, nsICookieJarSettings* aCookieJarSettings,
nsIArray* aTransferableArray, uint32_t aActionType,
nsContentPolicyType aContentPolicyType = nsIContentPolicy::TYPE_OTHER);
/** * Called to create a drag session with a Gecko source. Like all drag * sessions, the resulting session needs to be eventually ended with a call * to nsIDragSession::EndDragSession.
*/
MOZ_CAN_RUN_SCRIPT virtual nsresult InvokeDragSessionImpl(
nsIWidget* aWidget, nsIArray* aTransferableArray, const mozilla::Maybe<mozilla::CSSIntRegion>& aRegion,
uint32_t aActionType) = 0;
/** * Draw the drag image, if any, to a surface and return it. The drag image * is constructed from mImage if specified, or aDOMNode if mImage is null. * * aRegion may be used to draw only a subset of the element. This region * should be supplied using x and y coordinates measured in css pixels * that are relative to the upper-left corner of the window. * * aScreenPosition should be the screen coordinates of the mouse click * for the drag. These are in CSS pixels. * * On return, aScreenDragRect will contain the screen coordinates of the * area being dragged. This is used by the platform-specific part of the * drag service to determine the drag feedback. This rect will be in the * 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(nsINode* aDOMNode, const mozilla::Maybe<mozilla::CSSIntRegion>& aRegion,
mozilla::CSSIntPoint aScreenPosition,
mozilla::LayoutDeviceIntRect* aScreenDragRect,
RefPtr<mozilla::gfx::SourceSurface>* aSurface,
nsPresContext** aPresContext);
/** * Draw a drag image for an image node specified by aImageLoader or aCanvas. * This is called by DrawDrag.
*/
nsresult DrawDragForImage(nsPresContext* aPresContext,
nsIImageLoadingContent* aImageLoader,
mozilla::dom::HTMLCanvasElement* aCanvas,
mozilla::LayoutDeviceIntRect* aScreenDragRect,
RefPtr<mozilla::gfx::SourceSurface>* aSurface);
// Returns true if a drag event was dispatched to a child process after // the previous TakeDragEventDispatchedToChildProcess() call. bool TakeDragEventDispatchedToChildProcess() { bool retval = mDragEventDispatchedToChildProcess;
mDragEventDispatchedToChildProcess = false; return retval;
}
// Takes the list of PBrowsers that are engaged in the current drag session // from the drag service and stores them here. void TakeSessionBrowserListFromService();
/** * Free resources contained in DataTransferItems that aren't needed by JS.
*/ void DiscardInternalTransferData();
/** * If the drag image is a popup, open the popup when the drag begins.
*/ void OpenDragPopup();
// Data from a prior call to EndDragSession. struct EndDragSessionData { bool mDoneDrag = false;
uint32_t mKeyModifiers = 0;
};
// When we delay a drop event in a content process, if we subsequently need to // also delay an EndDragSession call, this records the parameters to that // call.
mozilla::Maybe<EndDragSessionData> mEndDragSessionData; // When we delay a drop event in a content process, this is the dom::Element // that the drop was targetted to.
nsWeakPtr mDelayedDropTarget; // When we delay a drop event in a content process, this is the nsIFrame that // would handle the drop.
WeakFrame mDelayedDropFrame;
// Parent process PBrowser with a the remote drag session that corresponds to // this one and is currently delayed.
RefPtr<mozilla::dom::BrowserParent> mDelayedDropBrowserParent;
RefPtr<mozilla::dom::WindowContext> mSourceWindowContext;
RefPtr<mozilla::dom::WindowContext> mSourceTopWindowContext;
nsCOMPtr<nsINode> mSourceNode; // the document at the drag source. will be null if it came from outside the // app.
RefPtr<mozilla::dom::Document> mSourceDocument; // set if a selection is being dragged
RefPtr<mozilla::dom::Selection> mSelection;
// used to determine the image to appear on the cursor while dragging
nsCOMPtr<nsINode> mImage; // offset of cursor within the image
mozilla::CSSIntPoint mImageOffset; // 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.
nsCOMPtr<mozilla::dom::Element> mDragPopup;
// Weak references to PBrowsers that are currently engaged in drags
nsTArray<nsWeakPtr> mBrowsers; // remote drag data
RefPtr<mozilla::dom::RemoteDragStartData> mDragStartData;
// Sub-region for tree-selections.
mozilla::Maybe<mozilla::CSSIntRegion> mRegion;
// the screen position where drag gesture occurred, used for positioning the // drag image.
mozilla::CSSIntPoint mScreenPosition;
// The position relative to the top level widget where the drag ended.
mozilla::LayoutDeviceIntPoint mEndDragPoint;
// the contentpolicy type passed to the channel when initiating the drag // session
nsContentPolicyType mContentPolicyType = nsIContentPolicy::TYPE_OTHER;
// mEffectAllowedForTests stores allowed effects at invoking the drag // for tests.
uint32_t mEffectAllowedForTests =
nsIDragService::DRAGDROP_ACTION_UNINITIALIZED;
// The input source of the drag event. Possible values are from MouseEvent.
uint16_t mInputSource = mozilla::dom::MouseEvent_Binding::MOZ_SOURCE_MOUSE;
// false after EndDragSession has run bool mDoingDrag = true;
// The drag session representing the user's current actions, if any. // This value is only valid in the parent process. For child // process drag sessions, see BrowserChild and PuppetWidget.
RefPtr<nsIDragSession> mCurrentParentDragSession;
// Sub-region for tree-selections.
mozilla::Maybe<mozilla::CSSIntRegion> mRegion;
// Weak references to PBrowsers that are currently engaged in drags. // Once an nsIDragSession is created for the remote drag, these browsers // will be moved to that object.
nsTArray<nsWeakPtr> mBrowsers;
uint32_t mSuppressLevel = 0;
// If this is set, mSessionIsSynthesizedForTests should not become true. // This hack is used to bypass the "old" drag-drop test behavior. // See nsIDragService.idl for details. bool mNeverAllowSessionIsSynthesizedForTests = false;
};
#endif// nsBaseDragService_h__
¤ Dauer der Verarbeitung: 0.16 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.