Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

!important must be recognized correctly for fonts (related to issue

2495)
  • Loading branch information...
commit cb3ac1846e6442dca8958f742dad44ca31c7ed0a 1 parent e7e2865
Sebastian Zartner authored April 30, 2012
39  extension/content/firebug/css/cssElementPanel.js
@@ -80,7 +80,7 @@ CSSElementPanel.prototype = Obj.extend(CSSStyleSheetPanel.prototype,
80 80
         CSSFontPropValueTag:
81 81
             SPAN({"class": "cssFontPropValue"},
82 82
                 FOR("part", "$propValueParts",
83  
-                    SPAN({"class": "$part.class"}, "$part.value"),
  83
+                    SPAN({"class": "$part.type|getClass"}, "$part.value"),
84 84
                     SPAN({"class": "cssFontPropSeparator"}, "$part|getSeparator")
85 85
                 )
86 86
             ),
@@ -90,10 +90,25 @@ CSSElementPanel.prototype = Obj.extend(CSSStyleSheetPanel.prototype,
90 90
             if (part.type == "otherProps")
91 91
                 return " ";
92 92
 
93  
-            if (part.last)
  93
+            if (part.lastFont || part.type == "important")
94 94
                 return "";
95 95
 
96 96
             return ",";
  97
+        },
  98
+
  99
+        getClass: function(type)
  100
+        {
  101
+            switch (type)
  102
+            {
  103
+                case "used":
  104
+                    return "cssPropValueUsed";
  105
+
  106
+                case "unused":
  107
+                    return "cssPropValueUnused";
  108
+
  109
+                default:
  110
+                    return "";
  111
+            }
97 112
         }
98 113
     }),
99 114
 
@@ -685,8 +700,8 @@ function getFontPropValueParts(element, value)
685 700
         "fantasy": 1,
686 701
         "monospace": 1,
687 702
     };
688  
-    const reFontFamilies = new RegExp("^(.*(\\d+(\\.\\d+)?(em|ex|ch|rem|cm|mm|in|pt|pc|px|%)|"+
689  
-        "x{0,2}-(small|large)|medium|larger|smaller)) (.*)$|.*");
  703
+    const reFontFamilies = new RegExp("(^(.*(\\d+(\\.\\d+)?(em|ex|ch|rem|cm|mm|in|pt|pc|px|%)|"+
  704
+        "x{0,2}-(small|large)|medium|larger|smaller)) (.*?)|.*?)( !important)?$");
690 705
     var matches = reFontFamilies.exec(value);
691 706
     var parts = [];
692 707
     var i = 0;
@@ -695,14 +710,14 @@ function getFontPropValueParts(element, value)
695 710
         return;
696 711
 
697 712
     var fonts;
698  
-    if (matches[6])
  713
+    if (matches[7])
699 714
     {
700  
-        parts.push({type: "otherProps", value: matches[1]});
701  
-        fonts = matches[6].split(",");
  715
+        parts.push({type: "otherProps", value: matches[2]});
  716
+        fonts = matches[7].split(",");
702 717
     }
703 718
     else
704 719
     {
705  
-        fonts = matches[0].split(",");
  720
+        fonts = matches[1].split(",");
706 721
     }
707 722
 
708 723
     var usedFonts = Fonts.getFonts(element);
@@ -727,13 +742,15 @@ function getFontPropValueParts(element, value)
727 742
         }
728 743
 
729 744
         if (!isUsedFont)
730  
-            parts.push({type: "unused", class: "cssPropValueUnused", value: fonts[i]});
731  
-
  745
+            parts.push({type: "unused", value: fonts[i]});
732 746
     }
733 747
 
734 748
     // xxxsz: Domplate doesn't allow to check for the last element in an array yet,
735 749
     // so use this as hack
736  
-    parts[parts.length-1].last = true;
  750
+    parts[parts.length-1].lastFont = true;
  751
+
  752
+    if (matches[8])
  753
+        parts.push({type: "important", value: " !important"});
737 754
 
738 755
     return parts;
739 756
 }

0 notes on commit cb3ac18

Please sign in to comment.
Something went wrong with that request. Please try again.