Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Issue 5862 (Crop long CSS values in Style side panel)

  • Loading branch information...
commit cbc142e81dc4fb6b807c77cbca64c78b034dcd98 1 parent 90cb487
Sebastian Zartner authored September 06, 2012

Showing 1 changed file with 36 additions and 4 deletions. Show diff stats Hide diff stats

  1. 40  extension/content/firebug/css/cssPanel.js
40  extension/content/firebug/css/cssPanel.js
@@ -50,6 +50,14 @@ var CSSDomplateBase =
50 50
     isSelectorEditable: function(rule)
51 51
     {
52 52
         return rule.isSelectorEditable && this.isEditable(rule);
  53
+    },
  54
+
  55
+    getPropertyValue: function(prop)
  56
+    {
  57
+        var limit = Options.get("stringCropLength");
  58
+        if (limit > 0)
  59
+            return Str.cropString(prop.value, limit);
  60
+        return prop.value;
53 61
     }
54 62
 };
55 63
 
@@ -70,7 +78,7 @@ var CSSPropTag = domplate(CSSDomplateBase,
70 78
             // Use a space here, so that "copy to clipboard" has it (issue 3266).
71 79
             SPAN({"class": "cssColon"}, ": "),
72 80
             SPAN({"class": "cssPropValue", $editable: "$rule|isEditable"},
73  
-                "$prop.value$prop.important"
  81
+                "$prop|getPropertyValue$prop.important"
74 82
             ),
75 83
             SPAN({"class": "cssSemi"}, ";"
76 84
         )
@@ -1286,10 +1294,11 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Firebug.Panel,
1286 1294
         var propValue = Dom.getAncestorByClass(target, "cssPropValue");
1287 1295
         if (propValue)
1288 1296
         {
1289  
-            var text = propValue.textContent;
  1297
+            var styleRule = Firebug.getRepObject(propValue);
1290 1298
             var prop = Dom.getAncestorByClass(target, "cssProp");
1291 1299
             var propNameNode = prop.getElementsByClassName("cssPropName").item(0);
1292 1300
             var propName = propNameNode.textContent.toLowerCase();
  1301
+            var text = styleRule.style.getPropertyValue(propName);
1293 1302
             var cssValue;
1294 1303
 
1295 1304
             if (propName == "font" || propName == "font-family")
@@ -1672,12 +1681,11 @@ CSSEditor.prototype = domplate(Firebug.InlineEditor.prototype,
1672 1681
             this.panel.removeDisabledProperty(rule, propName);
1673 1682
         }
1674 1683
 
1675  
-        target.textContent = value;
1676  
-
1677 1684
         if (rule instanceof window.CSSStyleRule || rule instanceof window.Element)
1678 1685
         {
1679 1686
             if (Css.hasClass(target, "cssPropName"))
1680 1687
             {
  1688
+                target.textContent = value;
1681 1689
   
1682 1690
                 if (value && previousValue != value)  // name of property has changed.
1683 1691
                 {
@@ -1716,6 +1724,9 @@ CSSEditor.prototype = domplate(Firebug.InlineEditor.prototype,
1716 1724
             }
1717 1725
             else if (Dom.getAncestorByClass(target, "cssPropValue"))
1718 1726
             {
  1727
+                var limit = Options.get("stringCropLength");
  1728
+                target.textContent = limit > 0 ? Str.cropString(value, limit) : value;
  1729
+
1719 1730
                 propName = Dom.getChildByClass(row, "cssPropName").textContent;
1720 1731
                 propValue = Dom.getChildByClass(row, "cssPropValue").textContent;
1721 1732
   
@@ -1761,6 +1772,8 @@ CSSEditor.prototype = domplate(Firebug.InlineEditor.prototype,
1761 1772
         }
1762 1773
         else if (rule instanceof window.CSSImportRule && Css.hasClass(target, "cssMediaQuery"))
1763 1774
         {
  1775
+            target.textContent = value;
  1776
+
1764 1777
             if (FBTrace.DBG_CSS)
1765 1778
             {
1766 1779
                 FBTrace.sysout("CSSEditor.saveEdit: @import media query: " +
@@ -1779,6 +1792,8 @@ CSSEditor.prototype = domplate(Firebug.InlineEditor.prototype,
1779 1792
         }
1780 1793
         else if (rule instanceof window.CSSCharsetRule)
1781 1794
         {
  1795
+            target.textContent = value;
  1796
+            
1782 1797
             if (FBTrace.DBG_CSS)
1783 1798
                 FBTrace.sysout("CSSEditor.saveEdit: @charset: " + previousValue + "->" + value);
1784 1799
 
@@ -1826,6 +1841,23 @@ CSSEditor.prototype = domplate(Firebug.InlineEditor.prototype,
1826 1841
         }
1827 1842
     },
1828 1843
 
  1844
+    getInitialValue: function(target, value)
  1845
+    {
  1846
+        if (value == "")
  1847
+            return value;
  1848
+
  1849
+        var propValue = Dom.getAncestorByClass(target, "cssPropValue");
  1850
+        if (propValue)
  1851
+        {
  1852
+            var styleRule = Firebug.getRepObject(propValue);
  1853
+            var prop = Dom.getAncestorByClass(target, "cssProp");
  1854
+            var propNameNode = prop.getElementsByClassName("cssPropName").item(0);
  1855
+            var propName = propNameNode.textContent.toLowerCase();
  1856
+            value = styleRule.style.getPropertyValue(propName);
  1857
+        }
  1858
+        return value;
  1859
+    },
  1860
+
1829 1861
     // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1830 1862
 
1831 1863
     getAutoCompleteRange: function(value, offset)

0 notes on commit cbc142e

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