Bug 1113581 - Artifact when editing a keyword, the keyword is displayed under the text-area. r=jaws
☠☠ backed out by 907d353fc1c3 ☠ ☠
authorFischer.json <fischer.json@gmail.com>
Thu, 21 Jul 2016 17:33:40 +0800
changeset 349330 08a557e99638798e51f239d7226b242c96bded9c
parent 349329 bb565b02a7944724471e6b9443dd102f5784f30c
child 349331 a151859f3a20453f3d46219ed94821d9ace698a3
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1113581
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1113581 - Artifact when editing a keyword, the keyword is displayed under the text-area. r=jaws MozReview-Commit-ID: 6toSvZlJeBz
toolkit/content/widgets/tree.xml
--- a/toolkit/content/widgets/tree.xml
+++ b/toolkit/content/widgets/tree.xml
@@ -356,71 +356,63 @@
 
             // 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.left = cellRect.x;
             input.height = textRect.height + topadj +
                            parseInt(style.borderBottomWidth) +
                            parseInt(style.paddingBottom);
-            input.width = cellRect.width - widthdiff;
+            input.width = cellRect.width;
             input.hidden = false;
 
             input.value = this.view.getCellText(row, column);
             var selectText = function selectText() {
               input.select();
               input.inputField.focus();
             }
             setTimeout(selectText, 0);
 
             this._editingRow = row;
             this._editingColumn = column;
 
+            // Clear the text because we don't want the text appearing underneath the input.
+            this.view.setCellText(this._editingRow, this._editingColumn, "");
+            // Save the original text so we can restore it after stoping editing.
+            input.setAttribute("data-original-text", input.value);
+
             this.setAttribute("editing", "true");
             return true;
           ]]>
         </body>
       </method>
 
       <method name="stopEditing">
         <parameter name="accept"/>
         <body>
           <![CDATA[
             if (!this._editingColumn)
               return;
 
             var input = this.inputField;
             var editingRow = this._editingRow;
             var editingColumn = this._editingColumn;
+            var value = accept ? input.value : input.getAttribute("data-original-text");
             this._editingRow = -1;
             this._editingColumn = null;
-            if (accept) {
-              var value = input.value;
-              this.view.setCellText(editingRow, editingColumn, value);
-            }
+            this.view.setCellText(editingRow, editingColumn, value);
 
             input.hidden = true;
             input.value = "";
             this.removeAttribute("editing");
+            input.removeAttribute("data-original-text");
           ]]>
         </body>
       </method>
 
       <method name="_moveByOffset">
         <parameter name="offset"/>
         <parameter name="edge"/>
         <parameter name="event"/>