Bug 988001 - Make the popup click to insert work again. r=bgrins, a=bkerensa
authorGirish Sharma <scrapmachines@gmail.com>
Sat, 19 Apr 2014 15:43:26 +0530
changeset 185848 581e9cd493c185d1a457e15497cca19900f854de
parent 185847 4f4f58855f42debe08d901d10a435a36a53e881c
child 185849 a85092fe252880917d31d7f0d0651504bb82d40b
push id5793
push userryanvm@gmail.com
push dateWed, 23 Apr 2014 14:50:21 +0000
treeherdermozilla-aurora@d3a9542a040e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgrins, bkerensa
bugs988001
milestone30.0a2
Bug 988001 - Make the popup click to insert work again. r=bgrins, a=bkerensa
browser/devtools/shared/inplace-editor.js
browser/devtools/styleinspector/rule-view.js
--- a/browser/devtools/shared/inplace-editor.js
+++ b/browser/devtools/shared/inplace-editor.js
@@ -773,17 +773,17 @@ InplaceEditor.prototype = {
   },
 
   /**
    * Handle loss of focus by calling done if it hasn't been called yet.
    */
   _onBlur: function InplaceEditor_onBlur(aEvent, aDoNotClear)
   {
     if (aEvent && this.popup && this.popup.isOpen &&
-        this.contentType == CONTENT_TYPES.CSS_MIXED) {
+        this.popup.selectedIndex >= 0) {
       let label, preLabel;
       if (this._selectedIndex === undefined) {
         ({label, preLabel}) = this.popup.getItemAtIndex(this.popup.selectedIndex);
       }
       else {
         ({label, preLabel}) = this.popup.getItemAtIndex(this._selectedIndex);
       }
       let input = this.input;
@@ -809,16 +809,21 @@ InplaceEditor.prototype = {
         this.popup._panel.removeEventListener("popuphidden", onPopupHidden);
         this.doc.defaultView.setTimeout(()=> {
           input.focus();
           this.emit("after-suggest");
         }, 0);
       };
       this.popup._panel.addEventListener("popuphidden", onPopupHidden);
       this.popup.hidePopup();
+      // Content type other than CSS_MIXED is used in rule-view where the values
+      // are live previewed. So we apply the value before returning.
+      if (this.contentType != CONTENT_TYPES.CSS_MIXED) {
+        this._apply();
+      }
       return;
     }
     this._apply();
     if (!aDoNotClear) {
       this._clear();
     }
   },
 
--- a/browser/devtools/styleinspector/rule-view.js
+++ b/browser/devtools/styleinspector/rule-view.js
@@ -1992,17 +1992,18 @@ function TextPropertyEditor(aRuleEditor,
 }
 
 TextPropertyEditor.prototype = {
   /**
    * Boolean indicating if the name or value is being currently edited.
    */
   get editing() {
     return !!(this.nameSpan.inplaceEditor || this.valueSpan.inplaceEditor ||
-      this.ruleEditor.ruleView.colorPicker.tooltip.isShown());
+      this.ruleEditor.ruleView.colorPicker.tooltip.isShown()) ||
+      this.popup.isOpen;
   },
 
   /**
    * Create the property editor's DOM.
    */
   _create: function() {
     this.element = this.doc.createElementNS(HTML_NS, "li");
     this.element.classList.add("ruleview-property");