Places:Drag & Drop
Jump to navigation
Jump to search
Tree Drop Handling
The Places Tree View (tree.xml) implements nsINavHistoryResultViewObserver
, which provides a method onDrop
which is called by the view when a drop occurs. When this happens, the following steps occur:
- Check whether or not the drop is valid by calling the
canDrop
method, returning silently if it is not. - Determine how many new items will be inserted into open folders in the tree view after the drop completes.
- If the drag and drop operation occured within the same view, adjust the insertion index to account for the fact that items may have been removed before it.
- Call the controller's onDrop helper.
Controller Drop Handling Helper
The PlacesControllerDragHelper provides an onDrop
method that performs view-agnostic drop handling. This method performs the following actions:
- Determine what mime types of objects are being dragged (from the dragged transferable), and compares this list of types supported as droppable by the target view (
peerDropTypes, childDropTypes
). - For each dropped item, unwrap the data, generate insertion or copy transactions, and execute the transactions on the transaction manager.