Index: trunk/src/org/openstreetmap/josm/gui/mappaint/Cascade.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/Cascade.java	(revision 3902)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/Cascade.java	(revision 3903)
@@ -75,11 +75,13 @@
             return (T) toBool(o);
 
-        if (klass == float[].class) {
+        if (klass == float[].class)
             return (T) toFloatArray(o);
-        }
 
-        if (klass == Color.class) {
+        if (klass == Color.class)
             return (T) toColor(o);
-        }
+
+        if (klass == String.class)
+            return (T) o.toString();
+
         return null;
     }
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyle.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyle.java	(revision 3902)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyle.java	(revision 3903)
@@ -36,6 +36,4 @@
         Float width = c.get(key, null, Float.class, true);
         if (width != null) {
-            if (width == -1f)
-                return (float) MapPaintSettings.INSTANCE.getDefaultSegmentWidth();
             if (width > 0)
                 return width;
@@ -44,4 +42,6 @@
             if (equal(width_key, "thinnest"))
                 return 0f;
+            else if(equal(width_key, "default"))
+                return (float) MapPaintSettings.INSTANCE.getDefaultSegmentWidth();
             else if (relativeTo != null) {
                 RelativeFloat width_rel = c.get(key, null, RelativeFloat.class, true);
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java	(revision 3902)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java	(revision 3903)
@@ -229,5 +229,5 @@
                 addIfNotNull(sl, LineElemStyle.createCasing(env));
             } else if (osm instanceof Node) {
-                addIfNotNull(sl, NodeElemStyle.create(c));
+                addIfNotNull(sl, NodeElemStyle.create(env));
             } else if (osm instanceof Relation) {
                 if (((Relation)osm).isMultipolygon()) {
@@ -236,5 +236,5 @@
                     addIfNotNull(sl, LineElemStyle.createCasing(env));
                 } else if ("restriction".equals(osm.get("type"))) {
-                    addIfNotNull(sl, NodeElemStyle.create(c));
+                    addIfNotNull(sl, NodeElemStyle.create(env));
                 }
             }
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java	(revision 3902)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java	(revision 3903)
@@ -21,5 +21,5 @@
         MultiCascade mc = new MultiCascade();
         Cascade c = mc.getOrCreateCascade("default");
-        c.put("width", -1f);
+        c.put("width", "default");
         c.put("color", color != null ? color : PaintColors.UNTAGGED.get());
         return createLine(new Environment(null, mc, "default", null));
@@ -95,6 +95,6 @@
 
         Color color = c.get(prefix + "color", null, Color.class);
-        if (color == null) {
-            color = c.get(prefix + "fill-color", null, Color.class);
+        if (!casing && color == null) {
+            color = c.get("fill-color", null, Color.class);
         }
         if (color == null) {
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/NodeElemStyle.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/NodeElemStyle.java	(revision 3902)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/NodeElemStyle.java	(revision 3903)
@@ -124,7 +124,8 @@
     public static final NodeElemStyle SIMPLE_NODE_ELEMSTYLE;
     static {
-        Cascade c = new Cascade();
+        MultiCascade mc = new MultiCascade();
+        Cascade c = mc.getOrCreateCascade("default");
         c.put("text", "auto");
-        SIMPLE_NODE_ELEMSTYLE = create(c, true);
+        SIMPLE_NODE_ELEMSTYLE = create(new Environment(null, mc, "default", null), true);
     }
 
@@ -137,9 +138,11 @@
     }
 
-    public static NodeElemStyle create(Cascade c) {
-        return create(c, false);
-    }
-
-    private static NodeElemStyle create(Cascade c, boolean allowOnlyText) {
+    public static NodeElemStyle create(Environment env) {
+        return create(env, false);
+    }
+
+    private static NodeElemStyle create(Environment env, boolean allowOnlyText) {
+        Cascade c = env.mc.getCascade(env.layer);
+
         IconReference iconRef = c.get("icon-image", null, IconReference.class);
         ImageIcon icon = null;
@@ -158,5 +161,5 @@
             }
         } else {
-            symbol = createSymbol(c);
+            symbol = createSymbol(env);
         }
 
@@ -195,5 +198,8 @@
     }
 
-    private static Symbol createSymbol(Cascade c) {
+    private static Symbol createSymbol(Environment env) {
+        Cascade c = env.mc.getCascade(env.layer);
+        Cascade c_def = env.mc.getCascade("default");
+
         SymbolShape shape;
         String shapeStr = c.get("symbol-shape", null, String.class);
@@ -204,13 +210,21 @@
         } else
             return null;
-
-        float size = c.get("symbol-size", 10f, Float.class);
+        
+        Float sizeOnDefault = c_def.get("symbol-size", null, Float.class);
+        if (sizeOnDefault != null && sizeOnDefault <= 0) {
+            sizeOnDefault = null;
+        }
+        Float size = getWidth(c, "symbol-size", sizeOnDefault);
+
+        if (size == null) {
+            size = 10f;
+        }
+
         if (size <= 0)
             return null;
 
-        Float strokeWidth = c.get("symbol-stroke-width", null, Float.class);
-        if (strokeWidth != null && strokeWidth <= 0) {
-            strokeWidth = null;
-        }
+        Float strokeWidthOnDefault = getWidth(c_def, "symbol-stroke-width", null);
+        Float strokeWidth = getWidth(c, "symbol-stroke-width", strokeWidthOnDefault);
+
         Color strokeColor = c.get("symbol-stroke-color", null, Color.class);
 
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Expression.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Expression.java	(revision 3902)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Expression.java	(revision 3903)
@@ -1,4 +1,6 @@
 // License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.gui.mappaint.mapcss;
+
+import static org.openstreetmap.josm.tools.Utils.equal;
 
 import java.awt.Color;
@@ -113,4 +115,16 @@
                 }
                 return c;
+            }
+
+            public float red(Color c) {
+                return Utils.color_int2float(c.getRed());
+            }
+
+            public float green(Color c) {
+                return Utils.color_int2float(c.getGreen());
+            }
+
+            public float blue(Color c) {
+                return Utils.color_int2float(c.getBlue());
             }
 
@@ -154,28 +168,8 @@
             }
 
-            public Object cond(boolean cond, Object if_, Object else_) {
-                return cond ? if_ : else_; // fixme: do not evaluate the other branch
-            }
-
             public boolean not(boolean b) {
                 return !b;
             }
 
-            public boolean and(boolean... bs) {
-                for (boolean b : bs) {  // fixme: lazy evaluation
-                    if (!b)
-                        return false;
-                }
-                return true;
-            }
-
-            public boolean or(boolean... bs) {
-                for (boolean b : bs) {
-                    if (b)
-                        return true;
-                }
-                return false;
-            }
-
             public boolean greater_equal(float a, float b) {
                 return a >= b;
@@ -192,4 +186,8 @@
             public boolean less(float a, float b) {
                 return a < b;
+            }
+
+            public int length(String s) {
+                return s.length();
             }
 
@@ -201,5 +199,5 @@
                         Float.class, Boolean.class, Color.class, float[].class, String.class }) {
                     Object a2 = Cascade.convertTo(a, klass);
-                    Object b2 = Cascade.convertTo(a, klass);
+                    Object b2 = Cascade.convertTo(b, klass);
                     if (a2 != null && b2 != null && a2.equals(b2))
                         return true;
@@ -231,4 +229,28 @@
         @Override
         public Object evaluate(Environment env) {
+            if (equal(name, "cond")) { // this needs special handling since only one argument should be evaluated
+                if (args.size() != 3)
+                    return null;
+                Boolean b = Cascade.convertTo(args.get(0).evaluate(env), boolean.class);
+                if (b == null)
+                    return null;
+                return args.get(b ? 0 : 1).evaluate(env);
+            }
+            if (equal(name, "and")) {
+                for (Expression arg : args) {
+                    Boolean b = Cascade.convertTo(arg.evaluate(env), boolean.class);
+                    if (b == null || !b)
+                        return false;
+                }
+                return true;
+            }
+            if (equal(name, "or")) {
+                for (Expression arg : args) {
+                    Boolean b = Cascade.convertTo(arg.evaluate(env), boolean.class);
+                    if (b != null && b)
+                        return true;
+                }
+                return false;
+            }
             EvalFunctions fn = new EvalFunctions();
             fn.env = env;
