Bug 1113581 - Artifact when editing a keyword, the keyword is displayed under the text-area. r?jaws draft
authorFischer.json <fischer.json@gmail.com>
Mon, 01 Aug 2016 11:32:24 +0800
changeset 404821 dc8229ea19cdb8d3ce7d90faaa894c61a5527285
parent 404131 24763f58772d45279a935790f732d80851924b46
child 529280 02d124862a68ca968b757cbcb3f85e619e17e1af
push id27311
push userbmo:fliu@mozilla.com
push dateWed, 24 Aug 2016 07:02:50 +0000
reviewersjaws
bugs1113581
milestone51.0a1
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
@@ -378,45 +378,48 @@
 
             input.value = this.view.getCellText(row, column);
             var selectText = function selectText() {
               input.select();
               input.inputField.focus();
             }
             setTimeout(selectText, 0);
 
+            // Clear the text because we don't want the text appearing underneath the input.
+            this.view.setCellText(row, column, "");
+            // Save the original text so we can restore it after stoping editing.
+            input.setAttribute("data-original-text", input.value);
+
             this._editingRow = row;
             this._editingColumn = column;
-
             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"/>