Fix for bug 120579. Dragging a bookmark draws frame of entire window.

r=pinkerton, sr=blake
This commit is contained in:
varga%utcru.sk 2002-01-31 04:31:22 +00:00
Родитель 0f552b9979
Коммит 91e5e599b5
1 изменённых файлов: 33 добавлений и 1 удалений

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

@ -107,6 +107,38 @@ var nsDragAndDrop = {
var transArray = Components.classes["@mozilla.org/supports-array;1"]
.createInstance(Components.interfaces.nsISupportsArray);
var region = null;
if (aEvent.target.localName == "outliner") {
// let's build the drag region
var outliner = aEvent.target;
try {
region = Components.classes["@mozilla.org/gfx/region;1"].createInstance(Components.interfaces.nsIScriptableRegion);
region.init();
var obo = outliner.outlinerBoxObject;
var bo = obo.outlinerBody.boxObject;
var obosel= obo.selection;
var rowX = bo.x;
var rowY = bo.y;
var rowHeight = obo.rowHeight;
var rowWidth = bo.width;
//add a rectangle for each visible selected row
for (var i = obo.getFirstVisibleRow(); i <= obo.getLastVisibleRow(); i ++)
{
if (obosel.isSelected(i))
region.unionRect(rowX, rowY, rowWidth, rowHeight);
rowY = rowY + rowHeight;
}
//and finally, clip the result to be sure we don't spill over...
region.intersectRect(bo.x, bo.y, bo.width, bo.height);
} catch(ex) {
dump("Error while building selection region: " + ex + "\n");
region = null;
}
}
var count = 0;
do
{
@ -118,7 +150,7 @@ var nsDragAndDrop = {
while (transferData._XferID == "TransferDataSet" &&
count < transferData.dataList.length);
this.mDragService.invokeDragSession(aEvent.target, transArray, null, dragAction.action);
this.mDragService.invokeDragSession(aEvent.target, transArray, region, dragAction.action);
aEvent.preventBubble();
},