Bug 1142207 - add "^" to REGEX_CSS_VAR to fix variables in the rule view. r=pbrosset
authorTom Tromey <tromey@mozilla.com>
Mon, 16 Mar 2015 07:55:00 -0700
changeset 233854 83645820fc28239bc99b41051532e953122714b9
parent 233853 1375c8688cc47b69713fea582773fcd0d8421374
child 233855 0743512ea4cc6ba0d14dd4e54ea2a90404d9b663
push id28425
push usercbook@mozilla.com
push dateTue, 17 Mar 2015 10:33:06 +0000
treeherdermozilla-central@a194e8023090 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspbrosset
bugs1142207
milestone39.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 1142207 - add "^" to REGEX_CSS_VAR to fix variables in the rule view. r=pbrosset
browser/devtools/styleinspector/test/browser_styleinspector_output-parser.js
toolkit/devtools/output-parser.js
--- a/browser/devtools/styleinspector/test/browser_styleinspector_output-parser.js
+++ b/browser/devtools/styleinspector/test/browser_styleinspector_output-parser.js
@@ -288,16 +288,30 @@ function test() {
       }
     },
     {
       name: "transition",
       value: "top 3s step-end",
       test: fragment => {
         is(countAll(fragment), 0);
       }
+    },
+    {
+      name: "background",
+      value: "rgb(255, var(--g-value), 192)",
+      test: fragment => {
+	is(fragment.textContent, "rgb(255, var(--g-value), 192)");
+      }
+    },
+    {
+      name: "background",
+      value: "rgb(255, var(--g-value, 0), 192)",
+      test: fragment => {
+	is(fragment.textContent, "rgb(255, var(--g-value, 0), 192)");
+      }
     }
   ];
 
   let parser = new OutputParser();
   for (let i = 0; i < testData.length; i ++) {
     let data = testData[i];
     info("Output-parser test data " + i + ". {" + data.name + " : " + data.value + ";}");
     data.test(parser.parseCssProperty(data.name, data.value, {
--- a/toolkit/devtools/output-parser.js
+++ b/toolkit/devtools/output-parser.js
@@ -15,17 +15,17 @@ const REGEX_QUOTES = /^".*?"|^".*|^'.*?'
 const REGEX_WHITESPACE = /^\s+/;
 const REGEX_FIRST_WORD_OR_CHAR = /^\w+|^./;
 const REGEX_CUBIC_BEZIER = /^linear|^ease-in-out|^ease-in|^ease-out|^ease|^cubic-bezier\(([0-9.\- ]+,){3}[0-9.\- ]+\)/;
 
 // CSS variable names are identifiers which the spec defines as follows:
 //   In CSS, identifiers (including element names, classes, and IDs in
 //   selectors) can contain only the characters [a-zA-Z0-9] and ISO 10646
 //   characters U+00A0 and higher, plus the hyphen (-) and the underscore (_).
-const REGEX_CSS_VAR = /\bvar\(\s*--[-_a-zA-Z0-9\u00A0-\u10FFFF]+\s*\)/;
+const REGEX_CSS_VAR = /^\bvar\(\s*--[-_a-zA-Z0-9\u00A0-\u10FFFF]+\s*\)/;
 
 /**
  * This regex matches:
  *  - #F00
  *  - #FF0000
  *  - hsl()
  *  - hsla()
  *  - rgb()