diff --git a/mozilla/browser/components/places/content/toolbar.xml b/mozilla/browser/components/places/content/toolbar.xml index 4df2eff0a12..7713caecf4a 100755 --- a/mozilla/browser/components/places/content/toolbar.xml +++ b/mozilla/browser/components/places/content/toolbar.xml @@ -762,6 +762,10 @@ if (!PlacesUtils.nodeIsFolder(result.root)) return null; + var isRTL = document.defaultView + .getComputedStyle(this._self.parentNode, "") + .direction == "rtl"; + var dropPoint = { ip: null, beforeIndex: null, folderNode: null }; // Loop through all the nodes to see which one this should // get dropped in/next to @@ -770,9 +774,11 @@ if (PlacesUtils.nodeIsFolder(xulNode.node) && !PlacesUtils.nodeIsReadOnly(xulNode.node)) { // This is a folder. If the mouse is in the left 25% of the - // node, drop to the left of the folder. If it's in the middle - // 50%, drop into the folder. If it's past that, drop to the right. - if (event.clientX < xulNode.boxObject.x + (xulNode.boxObject.width * 0.25)) { + // node (or 25% of the right, in RTL UI), drop before the folder. + // If it's in the middle 50%, drop into the folder. If it's past + // that, drop after. + if ((isRTL && event.clientX > xulNode.boxObject.x + (xulNode.boxObject.width * 0.75)) || + (!isRTL && event.clientX < xulNode.boxObject.x + (xulNode.boxObject.width * 0.25))) { // Drop to the left of this folder. dropPoint.ip = new InsertionPoint(PlacesUtils.getConcreteItemId(result.root), @@ -780,7 +786,8 @@ dropPoint.beforeIndex = i; return dropPoint; } - else if (event.clientX < xulNode.boxObject.x + (xulNode.boxObject.width * 0.75)) { + else if ((isRTL && event.clientX > xulNode.boxObject.x + (xulNode.boxObject.width * 0.25)) || + (!isRTL && event.clientX < xulNode.boxObject.x + (xulNode.boxObject.width * 0.75))) { // Drop inside this folder. dropPoint.ip = new InsertionPoint(PlacesUtils.getConcreteItemId(xulNode.node), @@ -791,10 +798,12 @@ } } else { - // This is a non-folder node. If the mouse is left of the middle, - // drop to the left of the folder. If it's right, drop to the right. - if (event.clientX < xulNode.boxObject.x + (xulNode.boxObject.width / 2)) { - // Drop to the left of this bookmark. + // This is a non-folder node. If the mouse is left (or right, in + // RTL UI) of the middle, drop before the folder. Otehrwise, + // we'll drop after + if ((isRTL && event.clientX > xulNode.boxObject.x + (xulNode.boxObject.width / 2)) || + (!isRTL && event.clientX < xulNode.boxObject.x + (xulNode.boxObject.width / 2))) { + // Drop before this bookmark. dropPoint.ip = new InsertionPoint(PlacesUtils.getConcreteItemId(result.root), i, -1); @@ -803,7 +812,7 @@ } } } - // Should drop to the right of the last node. + // Should drop after the last node. dropPoint.ip = new InsertionPoint(PlacesUtils.getConcreteItemId(result.root), -1, 1); @@ -893,12 +902,19 @@ } else { halfInd = Math.floor(halfInd); - if (dropPoint.beforeIndex == -1 || !this._self.childNodes.length) - ind.style.marginRight = '0px'; - else - ind.style.marginRight = (this._self.childNodes[this._self.childNodes.length - 1].boxObject.x + - this._self.childNodes[this._self.childNodes.length - 1].boxObject.width) - - (this._self.childNodes[dropPoint.beforeIndex].boxObject.x) - halfInd + 'px'; + if (this._self.childNodes.length == 0) + ind.style.marginRight = this._self.boxObject.width + 'px'; + else if (dropPoint.beforeIndex == -1) { + ind.style.marginRight = this._self.boxObject.width - + (this._self.childNodes[this._self.childNodes.length - 1].boxObject.x + + halfInd) +'px'; + } + else { + ind.style.marginRight = this._self.boxObject.width - + (this._self.childNodes[dropPoint.beforeIndex].boxObject.x + + this._self.childNodes[dropPoint.beforeIndex].boxObject.width - + this._self.boxObject.x + halfInd) + 'px'; + } } // Clear out old folder information this._clearOverFolder();