diff --git a/extension/content/firebug/css/cssPanel.js b/extension/content/firebug/css/cssPanel.js index ff6138064c..cfa5aeb6e3 100644 --- a/extension/content/firebug/css/cssPanel.js +++ b/extension/content/firebug/css/cssPanel.js @@ -78,7 +78,7 @@ var CSSPropTag = domplate(CSSDomplateBase, // Use a space here, so that "copy to clipboard" has it (issue 3266). SPAN({"class": "cssColon"}, ": "), SPAN({"class": "cssPropValue", $editable: "$rule|isEditable", - _repObject: "$prop.value"},"$prop|getPropertyValue$prop.important" + _repObject: "$prop.value$prop.important"},"$prop|getPropertyValue$prop.important" ), SPAN({"class": "cssSemi"}, ";" ) @@ -1300,7 +1300,7 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Firebug.Panel, var propName = propNameNode.textContent.toLowerCase(); var priority = styleRule.style.getPropertyPriority(propName); var text = styleRule.style.getPropertyValue(propName) + - (priority ? "!" + priority : ""); + (priority ? " !" + priority : ""); if (text != "") { @@ -1320,12 +1320,11 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Firebug.Panel, if (disabledProps[i].name == propName) { priority = disabledProps[i].important; - text = disabledProps[i].value + (priority ? " "+priority : ""); + text = disabledProps[i].value + (priority ? " !" + priority : ""); break; } } } - FBTrace.sysout("disabledProps", {disabledProps:disabledProps, propName: propName, text: text}); } var cssValue; @@ -1742,6 +1741,7 @@ CSSEditor.prototype = domplate(Firebug.InlineEditor.prototype, CSSModule.setProperty(rule, value, parsedValue.value, parsedValue.priority); + propName = value; } Events.dispatch(CSSModule.fbListeners, "onCSSPropertyNameChanged", [rule, value, @@ -1773,7 +1773,7 @@ CSSEditor.prototype = domplate(Firebug.InlineEditor.prototype, parsedValue = parsePriority(value); CSSModule.setProperty(rule, propName, parsedValue.value, parsedValue.priority); - // save in rep object. + // Save in rep object. Dom.getAncestorByClass(target, "cssPropValue").repObject = value; } else if (previousValue && previousValue != "null") @@ -1884,11 +1884,6 @@ CSSEditor.prototype = domplate(Firebug.InlineEditor.prototype, { var row = Dom.getAncestorByClass(target, "cssProp"); value = Firebug.getRepObject(propValue); - - if (Options.get("colorDisplay") == "hex") - value = Css.rgbToHex(value); - else if (Options.get("colorDisplay") == "hsl") - value = Css.rgbToHSL(value); } return value; }, @@ -2293,13 +2288,13 @@ CSSRuleEditor.prototype = domplate(Firebug.InlineEditor.prototype, "'", target); target.innerHTML = Str.escapeForCss(value); - if (value === previousValue) return; var row = Dom.getAncestorByClass(target, "cssRule"); var rule = Firebug.getRepObject(target); + var searchRule = rule || Firebug.getRepObject(row.nextSibling); var oldRule, ruleIndex; @@ -2348,12 +2343,6 @@ CSSRuleEditor.prototype = domplate(Firebug.InlineEditor.prototype, ruleIndex = cssRules.length; } - // Delete in all cases except for new add - // We want to do this before the insert to ease change tracking - if (oldRule) - { - CSSModule.deleteRule(styleSheet, ruleIndex); - } // Firefox does not follow the spec for the update selector text case. // When attempting to update the value, firefox will silently fail. @@ -2367,6 +2356,7 @@ CSSRuleEditor.prototype = domplate(Firebug.InlineEditor.prototype, var props = row.getElementsByClassName("cssProp"); for (var i = 0; i < props.length; i++) { + var propEl = props[i]; if (!Css.hasClass(propEl, "disabledStyle")) { @@ -2374,18 +2364,27 @@ CSSRuleEditor.prototype = domplate(Firebug.InlineEditor.prototype, cssText.push(propName); cssText.push(":"); cssText.push(rule.style.getPropertyValue(propName) + - rule.style.getPropertyPriority(propName) ? "!important" : ""); + (rule.style.getPropertyPriority(propName) ? " !important" : "")); cssText.push(";"); } } cssText.push("}"); cssText = cssText.join(""); + + // Delete in all cases except for new add + // We want to do this before the insert to ease change tracking + if (oldRule) + { + CSSModule.deleteRule(styleSheet, ruleIndex); + } try { var insertLoc = CSSModule.insertRule(styleSheet, cssText, ruleIndex); + rule = cssRules[insertLoc]; + ruleIndex++; var saveSuccess = (this.panel.name != "css"); @@ -2416,6 +2415,10 @@ CSSRuleEditor.prototype = domplate(Firebug.InlineEditor.prototype, } else { + if (oldRule) + { + CSSModule.deleteRule(styleSheet, ruleIndex); + } rule = undefined; } @@ -2427,6 +2430,7 @@ CSSRuleEditor.prototype = domplate(Firebug.InlineEditor.prototype, this.panel.markChange(this.panel.name == "stylesheet"); }, + getAutoCompleteRange: function(value, offset) { if (!Css.hasClass(this.target, "cssSelector"))