Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Allow temporary invalid values in selector editing

Broken by issue 5862 (Crop long CSS values in Style side panel).
  • Loading branch information...
commit e006bec727b1147bd3433721ed8fbd736a8616c6 1 parent 3c90164
Simon Lindholm authored October 03, 2012

Showing 1 changed file with 16 additions and 24 deletions. Show diff stats Hide diff stats

  1. 40  extension/content/firebug/css/cssPanel.js
40  extension/content/firebug/css/cssPanel.js
@@ -1754,8 +1754,7 @@ CSSEditor.prototype = domplate(Firebug.InlineEditor.prototype,
1754 1754
             }
1755 1755
             else if (Dom.getAncestorByClass(target, "cssPropValue"))
1756 1756
             {
1757  
-                var limit = Options.get("stringCropLength");
1758  
-                target.textContent = limit > 0 ? Str.cropString(value, limit) : value;
  1757
+                target.textContent = CSSDomplateBase.getPropertyValue({value: value});
1759 1758
 
1760 1759
                 propName = Dom.getChildByClass(row, "cssPropName").textContent;
1761 1760
                 propValue = Dom.getChildByClass(row, "cssPropValue").textContent;
@@ -2291,7 +2290,6 @@ CSSRuleEditor.prototype = domplate(Firebug.InlineEditor.prototype,
2291 2290
             return;
2292 2291
 
2293 2292
         var row = Dom.getAncestorByClass(target, "cssRule");
2294  
-
2295 2293
         var rule = Firebug.getRepObject(target);
2296 2294
 
2297 2295
         var searchRule = rule || Firebug.getRepObject(row.nextSibling);
@@ -2342,6 +2340,14 @@ CSSRuleEditor.prototype = domplate(Firebug.InlineEditor.prototype,
2342 2340
             ruleIndex = cssRules.length;
2343 2341
         }
2344 2342
 
  2343
+        // Delete in all cases except for new add
  2344
+        // We want to do this before the insert to ease change tracking
  2345
+        if (oldRule)
  2346
+        {
  2347
+            CSSModule.deleteRule(styleSheet, ruleIndex);
  2348
+        }
  2349
+
  2350
+        var doMarkChange = true;
2345 2351
 
2346 2352
         // Firefox does not follow the spec for the update selector text case.
2347 2353
         // When attempting to update the value, firefox will silently fail.
@@ -2360,24 +2366,14 @@ CSSRuleEditor.prototype = domplate(Firebug.InlineEditor.prototype,
2360 2366
                 if (!Css.hasClass(propEl, "disabledStyle"))
2361 2367
                 {
2362 2368
                     var propName = Dom.getChildByClass(propEl, "cssPropName").textContent;
2363  
-                    cssText.push(propName);
2364  
-                    cssText.push(":");
2365  
-                    cssText.push(rule.style.getPropertyValue(propName) +
2366  
-                        (rule.style.getPropertyPriority(propName) ? " !important" : ""));
2367  
-                    cssText.push(";");
  2369
+                    var propValue = Dom.getChildByClass(propEl, "cssPropValue").repObject;
  2370
+                    cssText.push(propName + ":" + propValue + ";");
2368 2371
                 }
2369 2372
             }
2370 2373
 
2371 2374
             cssText.push("}");
2372 2375
             cssText = cssText.join("");
2373 2376
             
2374  
-            // Delete in all cases except for new add
2375  
-            // We want to do this before the insert to ease change tracking
2376  
-            if (oldRule)
2377  
-            {
2378  
-                CSSModule.deleteRule(styleSheet, ruleIndex);
2379  
-            }
2380  
-
2381 2377
             try
2382 2378
             {
2383 2379
                 var insertLoc = CSSModule.insertRule(styleSheet, cssText, ruleIndex);
@@ -2408,28 +2404,24 @@ CSSRuleEditor.prototype = domplate(Firebug.InlineEditor.prototype,
2408 2404
 
2409 2405
                 this.box.setAttribute('saveSuccess', false);
2410 2406
 
2411  
-                row.repObject = rule;
2412  
-                return;
  2407
+                doMarkChange = false;
2413 2408
             }
2414 2409
         }
2415 2410
         else
2416 2411
         {
2417  
-            if (oldRule)
2418  
-            {
2419  
-                CSSModule.deleteRule(styleSheet, ruleIndex);
2420  
-            }
  2412
+            // XXX There is currently no way to re-add the rule after this happens.
2421 2413
             rule = undefined;
2422 2414
         }
2423 2415
 
2424 2416
         // Update the rep object
2425 2417
         row.repObject = rule;
2426  
-        if (oldRule)
  2418
+        if (oldRule && rule)
2427 2419
             this.panel.remapRule(context, oldRule, rule);
2428 2420
 
2429  
-        this.panel.markChange(this.panel.name == "stylesheet");
  2421
+        if (doMarkChange)
  2422
+            this.panel.markChange(this.panel.name == "stylesheet");
2430 2423
     },
2431 2424
 
2432  
-
2433 2425
     getAutoCompleteRange: function(value, offset)
2434 2426
     {
2435 2427
         if (!Css.hasClass(this.target, "cssSelector"))

0 notes on commit e006bec

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