Bug 1113581 - Artifact when editing a keyword, the keyword is displayed under the text-area draft
authorFischer.json <fischer.json@gmail.com>
Thu, 21 Jul 2016 17:33:40 +0800
changeset 391230 e29bc8174252c831da3bd4c4bc69c236e30b6ef1
parent 390029 d224fc999cb6accb208af0a105f14433375e2e77
child 526171 3cd761f78c0e323838ce84cffce1a60e2d4fff48
push id23852
push userbmo:fliu@mozilla.com
push dateFri, 22 Jul 2016 09:50:10 +0000
bugs1113581
milestone50.0a1
Bug 1113581 - Artifact when editing a keyword, the keyword is displayed under the text-area
toolkit/content/widgets/tree.xml
--- a/toolkit/content/widgets/tree.xml
+++ b/toolkit/content/widgets/tree.xml
@@ -356,33 +356,27 @@
 
             // Get the coordinates of the cell itself.
             var cellRect = box.getCoordsForCellItem(row, column, "cell");
 
             // Calculate the top offset of the textbox.
             var style = window.getComputedStyle(input, "");
             var topadj = parseInt(style.borderTopWidth) + parseInt(style.paddingTop);
             input.top = textRect.y - topadj;
-
-            // The leftside of the textbox is aligned to the left side of the text
-            // in LTR mode, and left side of the cell in RTL mode.
-            var left, widthdiff;
-            if (style.direction == "rtl") {
-              left = cellRect.x;
-              widthdiff = cellRect.x - textRect.x;
-            } else {
-              left = textRect.x;
-              widthdiff = textRect.x - cellRect.x;
-            }
-
-            input.left = left;
             input.height = textRect.height + topadj +
                            parseInt(style.borderBottomWidth) +
                            parseInt(style.paddingBottom);
-            input.width = cellRect.width - widthdiff;
+
+            // Consider the case that the keyword area is full of text,
+            // displaying like "kkkkkkkkkkkkkkkk...".
+            // So we have to make some compensation for the input.left and input.width
+            // to cover the whole text including the trailing "...".
+            input.left = cellRect.x - 1;
+            input.width = cellRect.width + textRect.x - cellRect.x + 4;
+
             input.hidden = false;
 
             input.value = this.view.getCellText(row, column);
             var selectText = function selectText() {
               input.select();
               input.inputField.focus();
             }
             setTimeout(selectText, 0);