Bug 1531230 - Stop using the TextPropertyEditor value in the TextProperty model. r=rcaliman
authorGabriel Luong <gabriel.luong@gmail.com>
Wed, 27 Feb 2019 23:39:03 -0500
changeset 519626 18bf7cf021184952bcb7b614734a8c59832ebd15
parent 519625 584d1d57db0b1474ec36244b5024c1a24876d089
child 519627 70b353cfbbf301b0175d6b36a957fd49479a5b2d
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrcaliman
bugs1531230
milestone67.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 1531230 - Stop using the TextPropertyEditor value in the TextProperty model. r=rcaliman Differential Revision: https://phabricator.services.mozilla.com/D21480
devtools/client/inspector/rules/models/text-property.js
--- a/devtools/client/inspector/rules/models/text-property.js
+++ b/devtools/client/inspector/rules/models/text-property.js
@@ -136,17 +136,17 @@ class TextProperty {
     if (changed) {
       this.updateEditor();
     }
   }
 
   setValue(value, priority, force = false) {
     const store = this.rule.elementStyle.store;
 
-    if (this.editor && value !== this.editor.committed.value || force) {
+    if (value !== this.value || force) {
       store.userProperties.setProperty(this.rule.domRule, this.name, value);
     }
 
     return this.rule.setPropertyValue(this, value, priority)
       .then(() => this.updateEditor());
   }
 
   /**
@@ -159,20 +159,19 @@ class TextProperty {
   updateValue(value) {
     if (value !== this.value) {
       this.value = value;
       this.updateEditor();
     }
   }
 
   async setName(name) {
-    if (name !== this.name && this.editor) {
+    if (name !== this.name) {
       const store = this.rule.elementStyle.store;
-      store.userProperties.setProperty(this.rule.domRule, name,
-                                       this.editor.committed.value);
+      store.userProperties.setProperty(this.rule.domRule, name, this.value);
     }
 
     await this.rule.setPropertyName(this, name);
     this.updateEditor();
   }
 
   setEnabled(value) {
     this.rule.setPropertyEnabled(this, value);
@@ -183,18 +182,23 @@ class TextProperty {
     this.rule.removeProperty(this);
   }
 
   /**
    * Return a string representation of the rule property.
    */
   stringifyProperty() {
     // Get the displayed property value
-    let declaration = this.name + ": " + this.editor.valueSpan.textContent +
-      ";";
+    let declaration = this.name + ": " + this.value;
+
+    if (this.priority) {
+      declaration += " !" + this.priority;
+    }
+
+    declaration += ";";
 
     // Comment out property declarations that are not enabled
     if (!this.enabled) {
       declaration = "/* " + escapeCSSComment(declaration) + " */";
     }
 
     return declaration;
   }