Bug 988001 - Make the popup click to insert work again, r=bgrin
authorGirish Sharma <scrapmachines@gmail.com>
Sat, 19 Apr 2014 15:43:26 +0530
changeset 179758 ee7632b3d59f6a0433fe93ef3b22a691b7b1e8bd
parent 179757 725b5f3decfe1ccd79decbb758634a6e0ddedd59
child 179759 a5a009436c2d4cbf46f38e49505d7db687c26356
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersbgrin
bugs988001
milestone31.0a1
Bug 988001 - Make the popup click to insert work again, r=bgrin
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
@@ -778,17 +778,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;
@@ -814,16 +814,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
@@ -1993,17 +1993,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.eyedropperOpen);
+      this.ruleEditor.ruleView.colorPicker.eyedropperOpen) ||
+      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");