[Pkg-mozext-commits] [firebug] 17/59: Issue 7605 (Show @counter-style rules inside CSS panel) https://code.google.com/p/fbug/issues/detail?id=7605

David Prévot taffit at moszumanska.debian.org
Thu Aug 14 14:52:54 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository firebug.

commit 303b25dee26bcddb78bb7994fec20ab17a42deab
Author: Sebastian Zartner <sebastianzartner at gmail.com>
Date:   Thu Jul 24 12:12:39 2014 +0200

    Issue 7605 (Show @counter-style rules inside CSS panel)
    https://code.google.com/p/fbug/issues/detail?id=7605
---
 extension/content/firebug/css/cssEditor.js | 18 +++++++++++++
 extension/content/firebug/css/cssPanel.js  | 43 +++++++++++++++++++++++++-----
 extension/content/firebug/css/cssReps.js   | 38 +++++++++++++++++++++++---
 3 files changed, 88 insertions(+), 11 deletions(-)

diff --git a/extension/content/firebug/css/cssEditor.js b/extension/content/firebug/css/cssEditor.js
index 668e178..204b5b9 100644
--- a/extension/content/firebug/css/cssEditor.js
+++ b/extension/content/firebug/css/cssEditor.js
@@ -257,6 +257,24 @@ CSSEditor.prototype = domplate(InlineEditor.prototype,
 
             rule.encoding = value;
         }
+        else if (rule instanceof window.CSSCounterStyleRule)
+        {
+            var prop = Dom.getAncestorByClass(target, "cssProp");
+            var propName = "";
+
+            if (prop)
+            {
+                propName = Dom.getChildByClass(prop, "cssPropName").textContent;
+                target.textContent = value;
+            }
+
+            if (FBTrace.DBG_CSS)
+                FBTrace.sysout("CSSEditor.saveEdit: @counter-style: " + previousValue + "->" + value);
+
+            rule[propName] = value;
+            var saveSuccess = rule[propName] === value;
+            this.box.setAttribute("saveSuccess", saveSuccess);
+        }
 
         Firebug.Inspector.repaint();
 
diff --git a/extension/content/firebug/css/cssPanel.js b/extension/content/firebug/css/cssPanel.js
index 3f7a704..b6e9023 100644
--- a/extension/content/firebug/css/cssPanel.js
+++ b/extension/content/firebug/css/cssPanel.js
@@ -551,6 +551,17 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Panel,
                         isSystemSheet: isSystemSheet
                     });
                 }
+                else if (rule instanceof window.CSSCounterStyleRule)
+                {
+                    props = this.parseCSSProps(rule);
+                    this.sortProperties(props);
+                    rules.push({
+                        tag: CSSReps.CSSCounterStyleRuleTag.tag,
+                        rule: rule,
+                        props: props,
+                        isSystemSheet: isSystemSheet
+                    });
+                }
                 // Workaround for https://bugzil.la/754772
                 // All types of CSS rules are currently recognized as CSSNameSpaceRules,
                 // so we explicitly need to check whether the rule's type is NAMESPACE_RULE
@@ -1850,11 +1861,22 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Panel,
 
     getCSSText: function(styleRule, propName)
     {
-        var value = (Options.get("colorDisplay") === "authored" &&
-                styleRule.style.getAuthoredPropertyValue) ?
-            styleRule.style.getAuthoredPropertyValue(propName) : styleRule.style.getPropertyValue(propName);
-        var priority = styleRule.style.getPropertyPriority(propName);
-        var text = value + (priority ? " !" + priority : "");
+        var value = "";
+        var priority = "";
+        var text = "";
+        if (styleRule.style)
+        {
+            value = (Options.get("colorDisplay") === "authored" &&
+                    styleRule.style.getAuthoredPropertyValue) ?
+                styleRule.style.getAuthoredPropertyValue(propName) : styleRule.style.getPropertyValue(propName);
+            priority = styleRule.style.getPropertyPriority(propName);
+            text = value + (priority ? " !" + priority : "");
+        }
+        else
+        {
+            value = styleRule[propName];
+            text = value;
+        }
 
         if (text != "")
             return formatColor(text);
@@ -1898,8 +1920,15 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Panel,
 
 function getPropertyValue(style, propName)
 {
-    return (Options.get("colorDisplay") === "authored" && style.getAuthoredPropertyValue) ?
-        style.getAuthoredPropertyValue(propName) : style.getPropertyValue(propName);
+    if (style instanceof window.CSSRule)
+    {
+        return style[propName];
+    }
+    else
+    {
+        return (Options.get("colorDisplay") === "authored" && style.getAuthoredPropertyValue) ?
+            style.getAuthoredPropertyValue(propName) : style.getPropertyValue(propName);
+    }
 }
 
 function formatColor(color)
diff --git a/extension/content/firebug/css/cssReps.js b/extension/content/firebug/css/cssReps.js
index e7f02f1..7569cc1 100644
--- a/extension/content/firebug/css/cssReps.js
+++ b/extension/content/firebug/css/cssReps.js
@@ -283,7 +283,8 @@ var CSSMediaRuleTag = domplate(CSSDomplateBase,
             ),
             DIV({$editable: "$rule|isEditable", $insertBefore:"$rule|isEditable",
                 role:"presentation"},
-                "}")
+                "}"
+            )
         )
 });
 
@@ -305,7 +306,8 @@ var CSSSupportsRuleTag = domplate(CSSDomplateBase,
             ),
             DIV({$editable: "$rule|isEditable", $insertBefore:"$rule|isEditable",
                 role:"presentation"},
-            "}")
+                "}"
+            )
         )
 });
 
@@ -326,7 +328,8 @@ var CSSKeyframesRuleTag = domplate(CSSDomplateBase,
                 )
             ),
             DIV({role:"presentation"},
-                "}")
+                "}"
+            )
         )
 });
 
@@ -376,6 +379,31 @@ var CSSNamespaceRuleTag = domplate(CSSDomplateBase,
     }
 });
 
+var CSSCounterStyleRuleTag = domplate(CSSDomplateBase,
+    {
+        tag:
+            DIV({"class": "cssRule focusRow cssCounterStyleRule", _repObject: "$rule.rule"},
+                DIV({"class": "cssHead focusRow", role : "listitem"},
+                    SPAN({"class": "cssRuleName"}, "@counter-style"),
+                    SPAN({"class": "separator"}, " "),
+                    SPAN({"class": "cssCounterStyleRuleName", $editable: "$rule|isEditable"},
+                    "$rule.rule.name"),
+                    SPAN(" {")
+                ),
+                DIV({role: "group"},
+                    DIV({"class": "cssPropertyListBox", _rule: "$rule", role: "listbox"},
+                        FOR("prop", "$rule.props",
+                            TAG(CSSPropTag.tag, {rule: "$rule", prop: "$prop"})
+                        )
+                    )
+                ),
+                DIV({$editable: "$rule|isEditable", $insertBefore:"$rule|isEditable",
+                    role:"presentation"},
+                    "}"
+                )
+            )
+    });
+
 var CSSFontFaceRuleTag = domplate(CSSDomplateBase,
 {
     tag:
@@ -451,7 +479,8 @@ var CSSDocumentRuleTag = domplate(CSSDomplateBase,
             ),
             DIV({$editable: "$rule|isEditable", $insertBefore:"$rule|isEditable",
                 role:"presentation"},
-            "}")
+                "}"
+            )
         )
 });
 
@@ -528,6 +557,7 @@ return {
     CSSKeyframesRuleTag: CSSKeyframesRuleTag,
     CSSKeyframeRuleTag: CSSKeyframeRuleTag,
     CSSNamespaceRuleTag: CSSNamespaceRuleTag,
+    CSSCounterStyleRuleTag: CSSCounterStyleRuleTag,
     CSSFontFaceRuleTag: CSSFontFaceRuleTag,
     CSSPageRuleTag: CSSPageRuleTag,
     CSSDocumentRuleTag: CSSDocumentRuleTag,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firebug.git



More information about the Pkg-mozext-commits mailing list