Index: /trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java	(revision 7056)
+++ /trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java	(revision 7057)
@@ -123,5 +123,5 @@
             final TagCheck check = new TagCheck(rule);
             boolean containsSetClassExpression = false;
-            for (Instruction i : rule.declaration.instructions) {
+            for (Instruction i : rule.declaration) {
                 if (i instanceof Instruction.AssignmentInstruction) {
                     final Instruction.AssignmentInstruction ai = (Instruction.AssignmentInstruction) i;
@@ -161,7 +161,7 @@
             }
             if (check.errors.isEmpty() && !containsSetClassExpression) {
-                throw new RuntimeException("No throwError/throwWarning/throwOther given! You should specify a validation error message for " + rule.selector);
+                throw new RuntimeException("No throwError/throwWarning/throwOther given! You should specify a validation error message for " + rule.selectors);
             } else if (check.errors.size() > 1) {
-                throw new RuntimeException("More than one throwError/throwWarning/throwOther given! You should specify a single validation error message for " + rule.selector);
+                throw new RuntimeException("More than one throwError/throwWarning/throwOther given! You should specify a single validation error message for " + rule.selectors);
             }
             return check;
@@ -191,8 +191,11 @@
             for (Iterator<MapCSSRule> it = source.rules.iterator(); it.hasNext(); ) {
                 MapCSSRule x = it.next();
-                if (x.selector instanceof GeneralSelector) {
-                    GeneralSelector gs = (GeneralSelector) x.selector;
-                    if ("meta".equals(gs.base) && gs.getConditions().isEmpty()) {
-                        it.remove();
+                if (x.selectors.size() == 1) {
+                    Selector sel = x.selectors.get(0);
+                    if (sel instanceof GeneralSelector) {
+                        GeneralSelector gs = (GeneralSelector) sel;
+                        if ("meta".equals(gs.base) && gs.getConditions().isEmpty()) {
+                            it.remove();
+                        }
                     }
                 }
@@ -211,7 +214,9 @@
 
         Selector whichSelectorMatchesEnvironment(Environment env) {
-            env.clearSelectorMatchingInformation();
-            if (rule.selector.matches(env)) {
-                return rule.selector;
+            for (Selector i : rule.selectors) {
+                env.clearSelectorMatchingInformation();
+                if (i.matches(env)) {
+                    return i;
+                }
             }
             return null;
Index: /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj	(revision 7056)
+++ /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj	(revision 7057)
@@ -18,5 +18,4 @@
 import org.openstreetmap.josm.gui.mappaint.mapcss.Instruction;
 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSRule;
-import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSRule.Declaration;
 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource;
 import org.openstreetmap.josm.gui.mappaint.mapcss.Selector;
@@ -470,4 +469,5 @@
 void sheet(MapCSSStyleSource sheet):
 {
+    MapCSSRule r;
 }
 {
@@ -476,5 +476,5 @@
     (
         try {
-            rule() w()
+            r=rule() { if (r != null) { sheet.rules.add(r); } } w()
         } catch (MapCSSException mex) {
             error_skipto(RBRACE, mex);
@@ -488,9 +488,9 @@
 }
 
-void rule():
+MapCSSRule rule():
 {
     List<Selector> selectors = new ArrayList<Selector>();
     Selector sel;
-    Declaration decl;
+    List<Instruction> decl;
 }
 {
@@ -501,9 +501,5 @@
     )*
     decl=declaration()
-    { 
-        for (Selector s : selectors) {
-            sheet.rules.add(new MapCSSRule(s, decl));
-        }
-    }
+    { return new MapCSSRule(selectors, decl); }
 }
 
@@ -711,5 +707,5 @@
 }
 
-Declaration declaration() :
+List<Instruction> declaration() :
 {
     List<Instruction> ins = new ArrayList<Instruction>();
@@ -727,5 +723,5 @@
             ( <EQUAL> val=expression() )?
             { ins.add(new Instruction.AssignmentInstruction(key.image, val == null ? true : val, true)); }
-            ( <RBRACE> { return new Declaration(ins); } | <SEMICOLON> w() )
+            ( <RBRACE> { return ins; } | <SEMICOLON> w() )
         )
     |
@@ -736,10 +732,10 @@
                 { ins.add(new Instruction.AssignmentInstruction(key.image, val, false)); }
                 w()
-                ( <RBRACE> { return new Declaration(ins); } | <SEMICOLON> w() )
+                ( <RBRACE> { return ins; } | <SEMICOLON> w() )
             |
             LOOKAHEAD( expression() ( <SEMICOLON> | <RBRACE> ) )
                 val=expression()
                 { ins.add(new Instruction.AssignmentInstruction(key.image, val, false)); }
-                ( <RBRACE> { return new Declaration(ins); } | <SEMICOLON> w() )
+                ( <RBRACE> { return ins; } | <SEMICOLON> w() )
             |
                 val=readRaw() w() { ins.add(new Instruction.AssignmentInstruction(key.image, val, false)); }
@@ -747,5 +743,5 @@
     )*
     <RBRACE>
-    { return new Declaration(ins); }
+    { return ins; }
 }
 
Index: /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSRule.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSRule.java	(revision 7056)
+++ /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSRule.java	(revision 7057)
@@ -9,23 +9,9 @@
 public class MapCSSRule {
 
-    public Selector selector;
-    public Declaration declaration;
+    public List<Selector> selectors;
+    public List<Instruction> declaration;
 
-    public static class Declaration {
-        public List<Instruction> instructions;
-        // usedId is an optimized way to make sure that
-        // each declaration is only applied once for each primitive,
-        // even if multiple of the comma separated selectors in the
-        // rule match.
-        public int usedId;
-
-        public Declaration(List<Instruction> instructions) {
-            this.instructions = instructions;
-            usedId = 0;
-        }
-    }
-    
-    public MapCSSRule(Selector selector, Declaration declaration) {
-        this.selector = selector;
+    public MapCSSRule(List<Selector> selectors, List<Instruction> declaration) {
+        this.selectors = selectors;
         this.declaration = declaration;
     }
@@ -37,5 +23,5 @@
      */
     public void execute(Environment env) {
-        for (Instruction i : declaration.instructions) {
+        for (Instruction i : declaration) {
             i.execute(env);
         }
@@ -44,5 +30,5 @@
     @Override
     public String toString() {
-        return selector + " {\n  " + Utils.join("\n  ", declaration.instructions) + "\n}";
+        return Utils.join(",", selectors) + " {\n  " + Utils.join("\n  ", declaration) + "\n}";
     }
 }
Index: /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java	(revision 7056)
+++ /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java	(revision 7057)
@@ -58,6 +58,4 @@
     private ZipFile zipFile;
 
-    private static int usedId = 1;
-    
     public MapCSSStyleSource(String url, String name, String shortdescription) {
         super(url, name, shortdescription);
@@ -120,32 +118,42 @@
         // optimization: filter rules for different primitive types
         for (MapCSSRule r: rules) {
-            // find the rightmost selector, this must be a GeneralSelector
-            Selector selRightmost = r.selector;
-            while (selRightmost instanceof ChildOrParentSelector) {
-                selRightmost = ((ChildOrParentSelector) selRightmost).right;
-            }
-            MapCSSRule optRule = new MapCSSRule(r.selector.optimizedBaseCheck(), r.declaration);
-            switch (((GeneralSelector) selRightmost).getBase()) {
-                case "node":
-                    nodeRules.add(optRule);
-                    break;
-                case "way":
-                    wayRules.add(optRule);
-                    break;
-                case "area":
-                    wayRules.add(optRule);
-                    multipolygonRules.add(optRule);
-                    break;
-                case "relation":
-                    relationRules.add(optRule);
-                    multipolygonRules.add(optRule);
-                    break;
-                case "*":
-                    nodeRules.add(optRule);
-                    wayRules.add(optRule);
-                    relationRules.add(optRule);
-                    multipolygonRules.add(optRule);
-                    break;
-            }
+            List<Selector> nodeSel = new ArrayList<>();
+            List<Selector> waySel = new ArrayList<>();
+            List<Selector> relationSel = new ArrayList<>();
+            List<Selector> multipolygonSel = new ArrayList<>();
+            for (Selector sel : r.selectors) {
+                // find the rightmost selector, this must be a GeneralSelector
+                Selector selRightmost = sel;
+                while (selRightmost instanceof ChildOrParentSelector) {
+                    selRightmost = ((ChildOrParentSelector) selRightmost).right;
+                }
+                Selector optimizedSel = sel.optimizedBaseCheck();
+                switch (((GeneralSelector) selRightmost).getBase()) {
+                    case "node":
+                        nodeSel.add(optimizedSel);
+                        break;
+                    case "way":
+                        waySel.add(optimizedSel);
+                        break;
+                    case "area":
+                        waySel.add(optimizedSel);
+                        multipolygonSel.add(optimizedSel);
+                        break;
+                    case "relation":
+                        relationSel.add(optimizedSel);
+                        multipolygonSel.add(optimizedSel);
+                        break;
+                    case "*":
+                        nodeSel.add(optimizedSel);
+                        waySel.add(optimizedSel);
+                        relationSel.add(optimizedSel);
+                        multipolygonSel.add(optimizedSel);
+                        break;
+                }
+            }
+            nodeRules.add(new MapCSSRule(nodeSel, r.declaration));
+            wayRules.add(new MapCSSRule(waySel, r.declaration));
+            relationRules.add(new MapCSSRule(relationSel, r.declaration));
+            multipolygonRules.add(new MapCSSRule(multipolygonSel, r.declaration));
         }
         rules.clear();
@@ -211,11 +219,13 @@
         NEXT_RULE:
         for (MapCSSRule r : rules) {
-            if ((r.selector instanceof GeneralSelector)) {
-                GeneralSelector gs = (GeneralSelector) r.selector;
-                if (gs.getBase().equals(type)) {
-                    if (!gs.matchesConditions(env)) {
-                        continue NEXT_RULE;
+            for (Selector s : r.selectors) {
+                if ((s instanceof GeneralSelector)) {
+                    GeneralSelector gs = (GeneralSelector) s;
+                    if (gs.getBase().equals(type)) {
+                        if (!gs.matchesConditions(env)) {
+                            continue NEXT_RULE;
+                        }
+                        r.execute(env);
                     }
-                    r.execute(env);
                 }
             }
@@ -244,34 +254,32 @@
             }
         }
-        usedId++;
         RULE: for (MapCSSRule r : matchingRules) {
-            env.clearSelectorMatchingInformation();
-            if (r.selector.matches(env)) { // as side effect env.parent will be set (if s is a child selector)
-                Selector s = r.selector;
-                if (s.getRange().contains(scale)) {
-                    mc.range = Range.cut(mc.range, s.getRange());
-                } else {
-                    mc.range = mc.range.reduceAround(scale, s.getRange());
-                    continue;
+            for (Selector s : r.selectors) {
+                env.clearSelectorMatchingInformation();
+                if (s.matches(env)) { // as side effect env.parent will be set (if s is a child selector)
+                    if (s.getRange().contains(scale)) {
+                        mc.range = Range.cut(mc.range, s.getRange());
+                    } else {
+                        mc.range = mc.range.reduceAround(scale, s.getRange());
+                        continue;
+                    }
+
+                    String sub = s.getSubpart();
+                    if (sub == null) {
+                        sub = "default";
+                    }
+                    else if ("*".equals(sub)) {
+                        for (Entry<String, Cascade> entry : mc.getLayers()) {
+                            env.layer = entry.getKey();
+                            if (Utils.equal(env.layer, "*")) {
+                                continue;
+                            }
+                            r.execute(env);
+                        }
+                    }
+                    env.layer = sub;
+                    r.execute(env);
+                    continue RULE;
                 }
-
-                if (r.declaration.usedId == usedId) continue; // don't apply a declaration block more than once
-                r.declaration.usedId = usedId;
-                String sub = s.getSubpart();
-                if (sub == null) {
-                    sub = "default";
-                }
-                else if ("*".equals(sub)) {
-                    for (Entry<String, Cascade> entry : mc.getLayers()) {
-                        env.layer = entry.getKey();
-                        if (Utils.equal(env.layer, "*")) {
-                            continue;
-                        }
-                        r.execute(env);
-                    }
-                }
-                env.layer = sub;
-                r.execute(env);
-                continue RULE;
             }
         }
