Ignore:
Timestamp:
2015-02-19T15:22:49+01:00 (9 years ago)
Author:
bastiK
Message:

MapCSS: new @supports rule

Implementation should be mostly compatible with
the CSS Conditional 3 draft [2].

This is similar to @media, which was previously misused
for this purpose and is now deprecated.

refs:
[1] https://wiki.openstreetmap.org/wiki/MapCSS/0.2/Proposal_media_query
[2] http://dev.w3.org/csswg/css-conditional/

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyle.java

    r8085 r8087  
    1414public abstract class ElemStyle implements StyleKeys {
    1515
    16     protected static final String[] ICON_KEYS = {"icon-image", "icon-width", "icon-height", "icon-opacity", "icon-offset-x", "icon-offset-y"};
    17     protected static final String[] REPEAT_IMAGE_KEYS = {"repeat-image", "repeat-image-width", "repeat-image-height", "repeat-image-opacity", null, null};
     16    protected static final int ICON_IMAGE_IDX = 0;
     17    protected static final int ICON_WIDTH_IDX = 1;
     18    protected static final int ICON_HEIGHT_IDX = 2;
     19    protected static final int ICON_OPACITY_IDX = 3;
     20    protected static final int ICON_OFFSET_X_IDX = 4;
     21    protected static final int ICON_OFFSET_Y_IDX = 5;
     22    public static final String[] ICON_KEYS = {ICON_IMAGE, ICON_WIDTH, ICON_HEIGHT, ICON_OPACITY, ICON_OFFSET_X, ICON_OFFSET_Y};
     23    public static final String[] REPEAT_IMAGE_KEYS = {REPEAT_IMAGE, REPEAT_IMAGE_WIDTH, REPEAT_IMAGE_HEIGHT, REPEAT_IMAGE_OPACITY, null, null};
    1824
    1925    public float major_z_index;
     
    3137
    3238    protected ElemStyle(Cascade c, float default_major_z_index) {
    33         major_z_index = c.get("major-z-index", default_major_z_index, Float.class);
     39        major_z_index = c.get(MAJOR_Z_INDEX, default_major_z_index, Float.class);
    3440        z_index = c.get(Z_INDEX, 0f, Float.class);
    3541        object_z_index = c.get(OBJECT_Z_INDEX, 0f, Float.class);
     
    177183
    178184    protected static Font getFont(Cascade c, String s) {
    179         String name = c.get("font-family", getDefaultFontName(), String.class);
    180         float size = c.get("font-size", getDefaultFontSize(), Float.class);
     185        String name = c.get(FONT_FAMILY, getDefaultFontName(), String.class);
     186        float size = c.get(FONT_SIZE, getDefaultFontSize(), Float.class);
    181187        int weight = Font.PLAIN;
    182         if ("bold".equalsIgnoreCase(c.get("font-weight", null, String.class))) {
     188        if ("bold".equalsIgnoreCase(c.get(FONT_WEIGHT, null, String.class))) {
    183189            weight = Font.BOLD;
    184190        }
    185191        int style = Font.PLAIN;
    186         if ("italic".equalsIgnoreCase(c.get("font-style", null, String.class))) {
     192        if ("italic".equalsIgnoreCase(c.get(FONT_STYLE, null, String.class))) {
    187193            style = Font.ITALIC;
    188194        }
Note: See TracChangeset for help on using the changeset viewer.