mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 15:25:52 +00:00
Bug 1248616 - move simulated places nodes after a successful drag 'n drop operation, which applies to Recently Bookmarked items. r=mak
This commit is contained in:
parent
2ed19fb31d
commit
da651f3cb1
@ -1550,19 +1550,27 @@ var PlacesControllerDragHelper = {
|
||||
*
|
||||
* @param aNode
|
||||
* A nsINavHistoryResultNode node.
|
||||
* @param [optional] aDOMNode
|
||||
* A XUL DOM node.
|
||||
* @return True if the node can be moved, false otherwise.
|
||||
*/
|
||||
canMoveNode:
|
||||
function PCDH_canMoveNode(aNode) {
|
||||
canMoveNode(aNode, aDOMNode) {
|
||||
// Only bookmark items are movable.
|
||||
if (aNode.itemId == -1)
|
||||
return false;
|
||||
|
||||
let parentNode = aNode.parent;
|
||||
if (!parentNode) {
|
||||
// Normally parentless places nodes can not be moved,
|
||||
// but simulated bookmarked URI nodes are special.
|
||||
return !!aDOMNode &&
|
||||
aDOMNode.hasAttribute("simulated-places-node") &&
|
||||
PlacesUtils.nodeIsBookmark(aNode);
|
||||
}
|
||||
|
||||
// Once tags and bookmarked are divorced, the tag-query check should be
|
||||
// removed.
|
||||
let parentNode = aNode.parent;
|
||||
return parentNode != null &&
|
||||
!(PlacesUtils.nodeIsFolder(parentNode) &&
|
||||
return !(PlacesUtils.nodeIsFolder(parentNode) &&
|
||||
PlacesUIUtils.isContentsReadOnly(parentNode)) &&
|
||||
!PlacesUtils.nodeIsTagQuery(parentNode);
|
||||
},
|
||||
|
@ -346,14 +346,15 @@
|
||||
]]></handler>
|
||||
|
||||
<handler event="dragstart"><![CDATA[
|
||||
if (!event.target._placesNode)
|
||||
let elt = event.target;
|
||||
if (!elt._placesNode)
|
||||
return;
|
||||
|
||||
let draggedElt = event.target._placesNode;
|
||||
let draggedElt = elt._placesNode;
|
||||
|
||||
// Force a copy action if parent node is a query or we are dragging a
|
||||
// not-removable node.
|
||||
if (!PlacesControllerDragHelper.canMoveNode(draggedElt))
|
||||
if (!PlacesControllerDragHelper.canMoveNode(draggedElt, elt))
|
||||
event.dataTransfer.effectAllowed = "copyLink";
|
||||
|
||||
// Activate the view and cache the dragged element.
|
||||
|
Loading…
Reference in New Issue
Block a user