You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by hi...@apache.org on 2001/03/13 17:28:45 UTC

cvs commit: xml-batik/sources/org/apache/batik/dom/svg DefaultUnitProcessorContext.java

hillion     01/03/13 08:28:45

  Modified:    resources/org/apache/batik/apps/svgbrowser/resources
                        StatusBarMessages.properties
               sources/org/apache/batik/css AbstractViewCSS.java
               sources/org/apache/batik/css/svg DefaultSVGCSSContext.java
                        PaintFactory.java SVGCSSContext.java
                        SVGColorFactory.java SVGValueFactoryMap.java
                        SimpleColorFactory.java StrokeWidthResolver.java
               sources/org/apache/batik/css/value AbstractValueFactory.java
                        ColorFactory.java ColorResolver.java
                        CommonCSSContext.java CommonValueFactoryMap.java
                        CommonViewCSS.java DefaultCommonCSSContext.java
                        FontFamilyResolver.java FontWeightResolver.java
                        ValueConstants.java
               sources/org/apache/batik/dom/svg
                        DefaultUnitProcessorContext.java
  Log:
  Fixed problems with percentages.
  Added support for CSS system colors.
  
  Revision  Changes    Path
  1.2       +2 -2      xml-batik/resources/org/apache/batik/apps/svgbrowser/resources/StatusBarMessages.properties
  
  Index: StatusBarMessages.properties
  ===================================================================
  RCS file: /home/cvs/xml-batik/resources/org/apache/batik/apps/svgbrowser/resources/StatusBarMessages.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StatusBarMessages.properties	2001/03/08 01:21:04	1.1
  +++ StatusBarMessages.properties	2001/03/13 16:28:34	1.2
  @@ -9,10 +9,10 @@
   # The status bar resources.
   #
   # Author: stephane@hillion.org
  -# $Id: StatusBarMessages.properties,v 1.1 2001/03/08 01:21:04 hillion Exp $
  +# $Id: StatusBarMessages.properties,v 1.2 2001/03/13 16:28:34 hillion Exp $
   #
   
  -Panel.default_message = Batik SVG Viewer - xml.apache.org
  +Panel.default_message = Batik SVG Browser - xml.apache.org/batik
   
   Position.width_letters = w:
   Position.height_letters = h:
  
  
  
  1.8       +7 -2      xml-batik/sources/org/apache/batik/css/AbstractViewCSS.java
  
  Index: AbstractViewCSS.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/AbstractViewCSS.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- AbstractViewCSS.java	2001/02/16 15:55:34	1.7
  +++ AbstractViewCSS.java	2001/03/13 16:28:39	1.8
  @@ -41,7 +41,7 @@
    * {@link org.w3c.dom.css.ViewCSS} interface.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: AbstractViewCSS.java,v 1.7 2001/02/16 15:55:34 hillion Exp $
  + * @version $Id: AbstractViewCSS.java,v 1.8 2001/03/13 16:28:39 hillion Exp $
    */
   public abstract class AbstractViewCSS implements ViewCSS {
       /**
  @@ -50,9 +50,14 @@
       protected DocumentView document;
   
       /**
  -     * The computed styles.
  +     * The cached computed styles.
        */
       protected Map styles = new HashMap(11);
  +
  +    /**
  +     * The cached stylesheets.
  +     */
  +    protected StyleSheetList styleSheets;
   
       /**
        * The media to use for cascading.
  
  
  
  1.3       +13 -28    xml-batik/sources/org/apache/batik/css/svg/DefaultSVGCSSContext.java
  
  Index: DefaultSVGCSSContext.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/svg/DefaultSVGCSSContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultSVGCSSContext.java	2000/12/06 21:21:06	1.2
  +++ DefaultSVGCSSContext.java	2001/03/13 16:28:39	1.3
  @@ -10,51 +10,36 @@
   
   import org.apache.batik.css.value.DefaultCommonCSSContext;
   
  +import org.w3c.dom.Element;
  +
   /**
    * This class is the default implementation of the SVGCSSContext.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: DefaultSVGCSSContext.java,v 1.2 2000/12/06 21:21:06 hillion Exp $
  + * @version $Id: DefaultSVGCSSContext.java,v 1.3 2001/03/13 16:28:39 hillion Exp $
    */
   public class DefaultSVGCSSContext
       extends    DefaultCommonCSSContext
       implements SVGCSSContext {
   
       /**
  -     * The viewport width.
  -     */
  -    protected float viewportWidth;
  -
  -    /**
  -     * The viewport height.
  -     */
  -    protected float viewportHeight;
  -
  -    /**
        * Returns the width of the viewport.
  +     * @throws IllegalStateException if the context was not able to compute
  +     *         the value.
        */
  -    public float getViewportWidth() {
  -        return viewportWidth;
  +    public float getViewportWidth(Element e) throws IllegalStateException {
  +        // !!! TODO
  +        throw new IllegalStateException();
       }
   
       /**
  -     * Sets the width of the viewport.
  -     */
  -    public void setViewportWidth(float f) {
  -        viewportWidth = f;
  -    }
  -
  -    /**
        * Returns the height of the viewport.
  +     * @throws IllegalStateException if the context was not able to compute
  +     *         the value.
        */
  -    public float getViewportHeight() {
  -        return viewportHeight;
  +    public float getViewportHeight(Element e) throws IllegalStateException {
  +        // !!! TODO
  +        throw new IllegalStateException();
       }
   
  -    /**
  -     * Sets the height of the viewport.
  -     */
  -    public void setViewportHeight(float f) {
  -        viewportHeight = f;
  -    }
   }
  
  
  
  1.4       +10 -8     xml-batik/sources/org/apache/batik/css/svg/PaintFactory.java
  
  Index: PaintFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/svg/PaintFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PaintFactory.java	2001/02/12 06:18:25	1.3
  +++ PaintFactory.java	2001/03/13 16:28:39	1.4
  @@ -15,6 +15,7 @@
   import org.apache.batik.css.value.ImmutableRGBColor;
   import org.apache.batik.css.value.ImmutableString;
   import org.apache.batik.css.value.ImmutableValue;
  +import org.apache.batik.css.value.SystemColorResolver;
   import org.apache.batik.css.value.ValueFactory;
   
   import org.w3c.css.sac.LexicalUnit;
  @@ -30,22 +31,17 @@
    * This class provides a factory for values of type paint.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: PaintFactory.java,v 1.3 2001/02/12 06:18:25 hillion Exp $
  + * @version $Id: PaintFactory.java,v 1.4 2001/03/13 16:28:39 hillion Exp $
    */
   public class PaintFactory
       extends    SVGColorFactory
       implements SVGValueConstants {
   
  -    static {
  -	values.put(CSS_CURRENTCOLOR_VALUE, CURRENTCOLOR_VALUE);
  -	values.put(CSS_NONE_VALUE,         NONE_VALUE);
  -    }
  -
       /**
        * Creates a new PaintFactory object.
        */
  -    public PaintFactory(Parser p, String prop) {
  -	super(p, prop);
  +    public PaintFactory(Parser p, String prop, SystemColorResolver scr) {
  +	super(p, prop, scr);
       }
   
       /**
  @@ -56,6 +52,12 @@
   	case LexicalUnit.SAC_INHERIT:
   	    return INHERIT;
   	case LexicalUnit.SAC_IDENT:
  +            String s = lu.getStringValue().toLowerCase().intern();
  +            if (s == CSS_CURRENTCOLOR_VALUE) {
  +                return CURRENTCOLOR_VALUE;
  +            } else if (s == CSS_NONE_VALUE) {
  +                return NONE_VALUE;
  +            }
               return super.createValue(lu);
           case LexicalUnit.SAC_RGBCOLOR:
               LexicalUnit l = lu.getParameters();
  
  
  
  1.3       +9 -3      xml-batik/sources/org/apache/batik/css/svg/SVGCSSContext.java
  
  Index: SVGCSSContext.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/svg/SVGCSSContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SVGCSSContext.java	2000/12/06 21:21:08	1.2
  +++ SVGCSSContext.java	2001/03/13 16:28:39	1.3
  @@ -10,24 +10,30 @@
   
   import org.apache.batik.css.value.CommonCSSContext;
   
  +import org.w3c.dom.Element;
  +
   /**
    * This interface represents the context the application must provides
    * to the CSS engine in order to resolve the relative SVG CSS values.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: SVGCSSContext.java,v 1.2 2000/12/06 21:21:08 hillion Exp $
  + * @version $Id: SVGCSSContext.java,v 1.3 2001/03/13 16:28:39 hillion Exp $
    */
   
   public interface SVGCSSContext extends CommonCSSContext {
   
       /**
        * Returns the width of the viewport.
  +     * @throws IllegalStateException if the context was not able to compute
  +     *         the value.
        */
  -    float getViewportWidth();
  +    float getViewportWidth(Element e) throws IllegalStateException;
   
       /**
        * Returns the height of the viewport.
  +     * @throws IllegalStateException if the context was not able to compute
  +     *         the value.
        */
  -    float getViewportHeight();
  +    float getViewportHeight(Element e) throws IllegalStateException;
   
   }
  
  
  
  1.3       +137 -136  xml-batik/sources/org/apache/batik/css/svg/SVGColorFactory.java
  
  Index: SVGColorFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/svg/SVGColorFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SVGColorFactory.java	2001/02/12 06:18:25	1.2
  +++ SVGColorFactory.java	2001/03/13 16:28:40	1.3
  @@ -10,8 +10,9 @@
   
   import org.apache.batik.css.CSSOMValue;
   
  -import org.apache.batik.css.value.ImmutableValue;
   import org.apache.batik.css.value.ColorFactory;
  +import org.apache.batik.css.value.ImmutableValue;
  +import org.apache.batik.css.value.SystemColorResolver;
   
   import org.w3c.css.sac.Parser;
   
  @@ -19,150 +20,150 @@
    * This class provides a factory for values of color type.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: SVGColorFactory.java,v 1.2 2001/02/12 06:18:25 hillion Exp $
  + * @version $Id: SVGColorFactory.java,v 1.3 2001/03/13 16:28:40 hillion Exp $
    */
   public class SVGColorFactory extends ColorFactory {
       {
  -	factories.put("aliceblue",        new RGBColorFactory(240, 248, 255));
  -	factories.put("antiquewhite",     new RGBColorFactory(250, 235, 215));
  -	factories.put("aquamarine",       new RGBColorFactory(127, 255, 212));
  -	factories.put("azure",            new RGBColorFactory(240, 255, 255));
  -	factories.put("beige",            new RGBColorFactory(245, 245, 220));
  -	factories.put("bisque",           new RGBColorFactory(255, 228, 196));
  -	factories.put("blanchedalmond",   new RGBColorFactory(255, 235, 205));
  -	factories.put("blueviolet",       new RGBColorFactory(138,  43, 226));
  -	factories.put("brown",            new RGBColorFactory(165,  42,  42));
  -	factories.put("burlywood",        new RGBColorFactory(222, 184, 135));
  -	factories.put("cadetblue",        new RGBColorFactory( 95, 158, 160));
  -	factories.put("chartreuse",       new RGBColorFactory(127, 255,   0));
  -	factories.put("chocolate",        new RGBColorFactory(210, 105,  30));
  -	factories.put("coral",            new RGBColorFactory(255, 127,  80));
  -	factories.put("cornflowerblue",   new RGBColorFactory(100, 149, 237));
  -	factories.put("cornsilk",         new RGBColorFactory(255, 248, 220));
  -	factories.put("crimson",          new RGBColorFactory(220,  20,  60));
  -	factories.put("cyan",             new RGBColorFactory(  0, 255, 255));
  -	factories.put("darkblue",         new RGBColorFactory(  0,   0, 139));
  -	factories.put("darkcyan",         new RGBColorFactory(  0, 139, 139));
  -	factories.put("darkgoldenrod",    new RGBColorFactory(184, 134,  11));
  -	factories.put("darkgray",         new RGBColorFactory(169, 169, 169));
  -	factories.put("darkgreen",        new RGBColorFactory(  0, 100,   0));
  -	factories.put("darkgrey",         new RGBColorFactory(169, 169, 169));
  -	factories.put("darkkhaki",        new RGBColorFactory(189, 183, 107));
  -	factories.put("darkmagenta",      new RGBColorFactory(139,   0, 139));
  -	factories.put("darkolivegreen",   new RGBColorFactory( 85, 107,  47));
  -	factories.put("darkorange",       new RGBColorFactory(255, 140,   0));
  -	factories.put("darkorchid",       new RGBColorFactory(153,  50, 204));
  -	factories.put("darkred",          new RGBColorFactory(139,   0,   0));
  -	factories.put("darksalmon",       new RGBColorFactory(233, 150, 122));
  -	factories.put("darkseagreen",     new RGBColorFactory(143, 188, 143));
  -	factories.put("darkslateblue",    new RGBColorFactory( 72,  61, 139));
  -	factories.put("darkslategray",    new RGBColorFactory( 47,  79,  79));
  -	factories.put("darkslategrey",    new RGBColorFactory( 47,  79,  79));
  -	factories.put("darkturquoise",    new RGBColorFactory(  0, 206, 209));
  -	factories.put("darkviolet",       new RGBColorFactory(148,   0, 211));
  -	factories.put("deeppink",         new RGBColorFactory(255,  20, 147));
  -	factories.put("deepskyblue",      new RGBColorFactory(  0, 191, 255));
  -	factories.put("dimgray",          new RGBColorFactory(105, 105, 105));
  -	factories.put("dimgrey",          new RGBColorFactory(105, 105, 105));
  -	factories.put("dodgerblue",       new RGBColorFactory( 30, 144, 255));
  -	factories.put("firebrick",        new RGBColorFactory(178,  34,  34));
  -	factories.put("floralwhite",      new RGBColorFactory(255, 250, 240));
  -	factories.put("forestgreen",      new RGBColorFactory( 34, 139,  34));
  -	factories.put("gainsboro",        new RGBColorFactory(220, 200, 200));
  -	factories.put("ghostwhite",       new RGBColorFactory(248, 248, 255));
  -	factories.put("gold",             new RGBColorFactory(255, 215,   0));
  -	factories.put("goldenrod",        new RGBColorFactory(218, 165,  32));
  -	factories.put("grey",             new RGBColorFactory(128, 128, 128));
  -	factories.put("greenyellow",      new RGBColorFactory(173, 255,  47));
  -	factories.put("honeydew",         new RGBColorFactory(240, 255, 240));
  -	factories.put("hotpink",          new RGBColorFactory(255, 105, 180));
  -	factories.put("indianred",        new RGBColorFactory(205,  92,  92));
  -	factories.put("indigo",           new RGBColorFactory( 75,   0, 130));
  -	factories.put("ivory",            new RGBColorFactory(255, 255, 240));
  -	factories.put("khaki",            new RGBColorFactory(240, 230, 140));
  -	factories.put("lavender",         new RGBColorFactory(230, 230, 250));
  -	factories.put("lavenderblush",    new RGBColorFactory(255, 240, 255));
  -	factories.put("lawngreen",        new RGBColorFactory(124, 252,   0));
  -	factories.put("lemonchiffon",     new RGBColorFactory(255, 250, 205));
  -	factories.put("lightblue",        new RGBColorFactory(173, 216, 230));
  -	factories.put("lightcoral",       new RGBColorFactory(240, 128, 128));
  -	factories.put("lightcyan",        new RGBColorFactory(224, 255, 255));
  +	factories.put("aliceblue",        new SimpleRGBColorFactory(240, 248, 255));
  +	factories.put("antiquewhite",     new SimpleRGBColorFactory(250, 235, 215));
  +	factories.put("aquamarine",       new SimpleRGBColorFactory(127, 255, 212));
  +	factories.put("azure",            new SimpleRGBColorFactory(240, 255, 255));
  +	factories.put("beige",            new SimpleRGBColorFactory(245, 245, 220));
  +	factories.put("bisque",           new SimpleRGBColorFactory(255, 228, 196));
  +	factories.put("blanchedalmond",   new SimpleRGBColorFactory(255, 235, 205));
  +	factories.put("blueviolet",       new SimpleRGBColorFactory(138,  43, 226));
  +	factories.put("brown",            new SimpleRGBColorFactory(165,  42,  42));
  +	factories.put("burlywood",        new SimpleRGBColorFactory(222, 184, 135));
  +	factories.put("cadetblue",        new SimpleRGBColorFactory( 95, 158, 160));
  +	factories.put("chartreuse",       new SimpleRGBColorFactory(127, 255,   0));
  +	factories.put("chocolate",        new SimpleRGBColorFactory(210, 105,  30));
  +	factories.put("coral",            new SimpleRGBColorFactory(255, 127,  80));
  +	factories.put("cornflowerblue",   new SimpleRGBColorFactory(100, 149, 237));
  +	factories.put("cornsilk",         new SimpleRGBColorFactory(255, 248, 220));
  +	factories.put("crimson",          new SimpleRGBColorFactory(220,  20,  60));
  +	factories.put("cyan",             new SimpleRGBColorFactory(  0, 255, 255));
  +	factories.put("darkblue",         new SimpleRGBColorFactory(  0,   0, 139));
  +	factories.put("darkcyan",         new SimpleRGBColorFactory(  0, 139, 139));
  +	factories.put("darkgoldenrod",    new SimpleRGBColorFactory(184, 134,  11));
  +	factories.put("darkgray",         new SimpleRGBColorFactory(169, 169, 169));
  +	factories.put("darkgreen",        new SimpleRGBColorFactory(  0, 100,   0));
  +	factories.put("darkgrey",         new SimpleRGBColorFactory(169, 169, 169));
  +	factories.put("darkkhaki",        new SimpleRGBColorFactory(189, 183, 107));
  +	factories.put("darkmagenta",      new SimpleRGBColorFactory(139,   0, 139));
  +	factories.put("darkolivegreen",   new SimpleRGBColorFactory( 85, 107,  47));
  +	factories.put("darkorange",       new SimpleRGBColorFactory(255, 140,   0));
  +	factories.put("darkorchid",       new SimpleRGBColorFactory(153,  50, 204));
  +	factories.put("darkred",          new SimpleRGBColorFactory(139,   0,   0));
  +	factories.put("darksalmon",       new SimpleRGBColorFactory(233, 150, 122));
  +	factories.put("darkseagreen",     new SimpleRGBColorFactory(143, 188, 143));
  +	factories.put("darkslateblue",    new SimpleRGBColorFactory( 72,  61, 139));
  +	factories.put("darkslategray",    new SimpleRGBColorFactory( 47,  79,  79));
  +	factories.put("darkslategrey",    new SimpleRGBColorFactory( 47,  79,  79));
  +	factories.put("darkturquoise",    new SimpleRGBColorFactory(  0, 206, 209));
  +	factories.put("darkviolet",       new SimpleRGBColorFactory(148,   0, 211));
  +	factories.put("deeppink",         new SimpleRGBColorFactory(255,  20, 147));
  +	factories.put("deepskyblue",      new SimpleRGBColorFactory(  0, 191, 255));
  +	factories.put("dimgray",          new SimpleRGBColorFactory(105, 105, 105));
  +	factories.put("dimgrey",          new SimpleRGBColorFactory(105, 105, 105));
  +	factories.put("dodgerblue",       new SimpleRGBColorFactory( 30, 144, 255));
  +	factories.put("firebrick",        new SimpleRGBColorFactory(178,  34,  34));
  +	factories.put("floralwhite",      new SimpleRGBColorFactory(255, 250, 240));
  +	factories.put("forestgreen",      new SimpleRGBColorFactory( 34, 139,  34));
  +	factories.put("gainsboro",        new SimpleRGBColorFactory(220, 200, 200));
  +	factories.put("ghostwhite",       new SimpleRGBColorFactory(248, 248, 255));
  +	factories.put("gold",             new SimpleRGBColorFactory(255, 215,   0));
  +	factories.put("goldenrod",        new SimpleRGBColorFactory(218, 165,  32));
  +	factories.put("grey",             new SimpleRGBColorFactory(128, 128, 128));
  +	factories.put("greenyellow",      new SimpleRGBColorFactory(173, 255,  47));
  +	factories.put("honeydew",         new SimpleRGBColorFactory(240, 255, 240));
  +	factories.put("hotpink",          new SimpleRGBColorFactory(255, 105, 180));
  +	factories.put("indianred",        new SimpleRGBColorFactory(205,  92,  92));
  +	factories.put("indigo",           new SimpleRGBColorFactory( 75,   0, 130));
  +	factories.put("ivory",            new SimpleRGBColorFactory(255, 255, 240));
  +	factories.put("khaki",            new SimpleRGBColorFactory(240, 230, 140));
  +	factories.put("lavender",         new SimpleRGBColorFactory(230, 230, 250));
  +	factories.put("lavenderblush",    new SimpleRGBColorFactory(255, 240, 255));
  +	factories.put("lawngreen",        new SimpleRGBColorFactory(124, 252,   0));
  +	factories.put("lemonchiffon",     new SimpleRGBColorFactory(255, 250, 205));
  +	factories.put("lightblue",        new SimpleRGBColorFactory(173, 216, 230));
  +	factories.put("lightcoral",       new SimpleRGBColorFactory(240, 128, 128));
  +	factories.put("lightcyan",        new SimpleRGBColorFactory(224, 255, 255));
   	factories.put("lightgoldenrodyellow",
  -                      new RGBColorFactory(250, 250, 210));
  -	factories.put("lightgray",        new RGBColorFactory(211, 211, 211));
  -	factories.put("lightgreen",       new RGBColorFactory(144, 238, 144));
  -	factories.put("lightgrey",        new RGBColorFactory(211, 211, 211));
  -	factories.put("lightpink",        new RGBColorFactory(255, 182, 193));
  -	factories.put("lightsalmon",      new RGBColorFactory(255, 160, 122));
  -	factories.put("lightseagreen",    new RGBColorFactory( 32, 178, 170));
  -	factories.put("lightskyblue",     new RGBColorFactory(135, 206, 250));
  -	factories.put("lightslategray",   new RGBColorFactory(119, 136, 153));
  -	factories.put("lightslategrey",   new RGBColorFactory(119, 136, 153));
  -	factories.put("lightsteelblue",   new RGBColorFactory(176, 196, 222));
  -	factories.put("lightyellow",      new RGBColorFactory(255, 255, 224));
  -	factories.put("limegreen",        new RGBColorFactory( 50, 205,  50));
  -	factories.put("linen",            new RGBColorFactory(250, 240, 230));
  -	factories.put("magenta",          new RGBColorFactory(255,   0, 255));
  -	factories.put("mediumaquamarine", new RGBColorFactory(102, 205, 170));
  -	factories.put("mediumblue",       new RGBColorFactory(  0,   0, 205));
  -	factories.put("mediumorchid",     new RGBColorFactory(186,  85, 211));
  -	factories.put("mediumpurple",     new RGBColorFactory(147, 112, 219));
  -	factories.put("mediumseagreen",   new RGBColorFactory( 60, 179, 113));
  -	factories.put("mediumslateblue",  new RGBColorFactory(123, 104, 238));
  -	factories.put("mediumspringgreen",new RGBColorFactory(  0, 250, 154));
  -	factories.put("mediumturquoise",  new RGBColorFactory( 72, 209, 204));
  -	factories.put("mediumvioletred",  new RGBColorFactory(199,  21, 133));
  -	factories.put("midnightblue",     new RGBColorFactory( 25,  25, 112));
  -	factories.put("mintcream",        new RGBColorFactory(245, 255, 250));
  -	factories.put("mistyrose",        new RGBColorFactory(255, 228, 225));
  -	factories.put("moccasin",         new RGBColorFactory(255, 228, 181));
  -	factories.put("navajowhite",      new RGBColorFactory(255, 222, 173));
  -	factories.put("oldlace",          new RGBColorFactory(253, 245, 230));
  -	factories.put("olivedrab",        new RGBColorFactory(107, 142,  35));
  -	factories.put("orange",           new RGBColorFactory(255, 165,   0));
  -	factories.put("orangered",        new RGBColorFactory(255,  69,   0));
  -	factories.put("orchid",           new RGBColorFactory(218, 112, 214));
  -	factories.put("palegoldenrod",    new RGBColorFactory(238, 232, 170));
  -	factories.put("palegreen",        new RGBColorFactory(152, 251, 152));
  -	factories.put("paleturquoise",    new RGBColorFactory(175, 238, 238));
  -	factories.put("palevioletred",    new RGBColorFactory(219, 112, 147));
  -	factories.put("papayawhip",       new RGBColorFactory(255, 239, 213));
  -	factories.put("peachpuff",        new RGBColorFactory(255, 218, 185));
  -	factories.put("peru",             new RGBColorFactory(205, 133,  63));
  -	factories.put("pink",             new RGBColorFactory(255, 192, 203));
  -	factories.put("plum",             new RGBColorFactory(221, 160, 221));
  -	factories.put("powderblue",       new RGBColorFactory(176, 224, 230));
  -	factories.put("purple",           new RGBColorFactory(128,   0, 128));
  -	factories.put("rosybrown",        new RGBColorFactory(188, 143, 143));
  -	factories.put("royalblue",        new RGBColorFactory( 65, 105, 225));
  -	factories.put("saddlebrown",      new RGBColorFactory(139,  69,  19));
  -	factories.put("salmon",           new RGBColorFactory(250,  69, 114));
  -	factories.put("sandybrown",       new RGBColorFactory(244, 164,  96));
  -	factories.put("seagreen",         new RGBColorFactory( 46, 139,  87));
  -	factories.put("seashell",         new RGBColorFactory(255, 245, 238));
  -	factories.put("sienna",           new RGBColorFactory(160,  82,  45));
  -	factories.put("skyblue",          new RGBColorFactory(135, 206, 235));
  -	factories.put("slateblue",        new RGBColorFactory(106,  90, 205));
  -	factories.put("slategray",        new RGBColorFactory(112, 128, 144));
  -	factories.put("slategrey",        new RGBColorFactory(112, 128, 144));
  -	factories.put("snow",             new RGBColorFactory(255, 250, 250));
  -	factories.put("springgreen",      new RGBColorFactory(  0, 255, 127));
  -	factories.put("steelblue",        new RGBColorFactory( 70, 130, 180));
  -	factories.put("tan",              new RGBColorFactory(210, 180, 140));
  -	factories.put("thistle",          new RGBColorFactory(216,  91, 216));
  -	factories.put("tomato",           new RGBColorFactory(255,  99,  71));
  -	factories.put("turquoise",        new RGBColorFactory( 64, 224, 208));
  -	factories.put("violet",           new RGBColorFactory(238, 130, 238));
  -	factories.put("wheat",            new RGBColorFactory(245, 222, 179));
  -	factories.put("whitesmoke",       new RGBColorFactory(245, 245, 245));
  -	factories.put("yellowgreen",      new RGBColorFactory(154, 205,  50));
  +                      new SimpleRGBColorFactory(250, 250, 210));
  +	factories.put("lightgray",        new SimpleRGBColorFactory(211, 211, 211));
  +	factories.put("lightgreen",       new SimpleRGBColorFactory(144, 238, 144));
  +	factories.put("lightgrey",        new SimpleRGBColorFactory(211, 211, 211));
  +	factories.put("lightpink",        new SimpleRGBColorFactory(255, 182, 193));
  +	factories.put("lightsalmon",      new SimpleRGBColorFactory(255, 160, 122));
  +	factories.put("lightseagreen",    new SimpleRGBColorFactory( 32, 178, 170));
  +	factories.put("lightskyblue",     new SimpleRGBColorFactory(135, 206, 250));
  +	factories.put("lightslategray",   new SimpleRGBColorFactory(119, 136, 153));
  +	factories.put("lightslategrey",   new SimpleRGBColorFactory(119, 136, 153));
  +	factories.put("lightsteelblue",   new SimpleRGBColorFactory(176, 196, 222));
  +	factories.put("lightyellow",      new SimpleRGBColorFactory(255, 255, 224));
  +	factories.put("limegreen",        new SimpleRGBColorFactory( 50, 205,  50));
  +	factories.put("linen",            new SimpleRGBColorFactory(250, 240, 230));
  +	factories.put("magenta",          new SimpleRGBColorFactory(255,   0, 255));
  +	factories.put("mediumaquamarine", new SimpleRGBColorFactory(102, 205, 170));
  +	factories.put("mediumblue",       new SimpleRGBColorFactory(  0,   0, 205));
  +	factories.put("mediumorchid",     new SimpleRGBColorFactory(186,  85, 211));
  +	factories.put("mediumpurple",     new SimpleRGBColorFactory(147, 112, 219));
  +	factories.put("mediumseagreen",   new SimpleRGBColorFactory( 60, 179, 113));
  +	factories.put("mediumslateblue",  new SimpleRGBColorFactory(123, 104, 238));
  +	factories.put("mediumspringgreen",new SimpleRGBColorFactory(  0, 250, 154));
  +	factories.put("mediumturquoise",  new SimpleRGBColorFactory( 72, 209, 204));
  +	factories.put("mediumvioletred",  new SimpleRGBColorFactory(199,  21, 133));
  +	factories.put("midnightblue",     new SimpleRGBColorFactory( 25,  25, 112));
  +	factories.put("mintcream",        new SimpleRGBColorFactory(245, 255, 250));
  +	factories.put("mistyrose",        new SimpleRGBColorFactory(255, 228, 225));
  +	factories.put("moccasin",         new SimpleRGBColorFactory(255, 228, 181));
  +	factories.put("navajowhite",      new SimpleRGBColorFactory(255, 222, 173));
  +	factories.put("oldlace",          new SimpleRGBColorFactory(253, 245, 230));
  +	factories.put("olivedrab",        new SimpleRGBColorFactory(107, 142,  35));
  +	factories.put("orange",           new SimpleRGBColorFactory(255, 165,   0));
  +	factories.put("orangered",        new SimpleRGBColorFactory(255,  69,   0));
  +	factories.put("orchid",           new SimpleRGBColorFactory(218, 112, 214));
  +	factories.put("palegoldenrod",    new SimpleRGBColorFactory(238, 232, 170));
  +	factories.put("palegreen",        new SimpleRGBColorFactory(152, 251, 152));
  +	factories.put("paleturquoise",    new SimpleRGBColorFactory(175, 238, 238));
  +	factories.put("palevioletred",    new SimpleRGBColorFactory(219, 112, 147));
  +	factories.put("papayawhip",       new SimpleRGBColorFactory(255, 239, 213));
  +	factories.put("peachpuff",        new SimpleRGBColorFactory(255, 218, 185));
  +	factories.put("peru",             new SimpleRGBColorFactory(205, 133,  63));
  +	factories.put("pink",             new SimpleRGBColorFactory(255, 192, 203));
  +	factories.put("plum",             new SimpleRGBColorFactory(221, 160, 221));
  +	factories.put("powderblue",       new SimpleRGBColorFactory(176, 224, 230));
  +	factories.put("purple",           new SimpleRGBColorFactory(128,   0, 128));
  +	factories.put("rosybrown",        new SimpleRGBColorFactory(188, 143, 143));
  +	factories.put("royalblue",        new SimpleRGBColorFactory( 65, 105, 225));
  +	factories.put("saddlebrown",      new SimpleRGBColorFactory(139,  69,  19));
  +	factories.put("salmon",           new SimpleRGBColorFactory(250,  69, 114));
  +	factories.put("sandybrown",       new SimpleRGBColorFactory(244, 164,  96));
  +	factories.put("seagreen",         new SimpleRGBColorFactory( 46, 139,  87));
  +	factories.put("seashell",         new SimpleRGBColorFactory(255, 245, 238));
  +	factories.put("sienna",           new SimpleRGBColorFactory(160,  82,  45));
  +	factories.put("skyblue",          new SimpleRGBColorFactory(135, 206, 235));
  +	factories.put("slateblue",        new SimpleRGBColorFactory(106,  90, 205));
  +	factories.put("slategray",        new SimpleRGBColorFactory(112, 128, 144));
  +	factories.put("slategrey",        new SimpleRGBColorFactory(112, 128, 144));
  +	factories.put("snow",             new SimpleRGBColorFactory(255, 250, 250));
  +	factories.put("springgreen",      new SimpleRGBColorFactory(  0, 255, 127));
  +	factories.put("steelblue",        new SimpleRGBColorFactory( 70, 130, 180));
  +	factories.put("tan",              new SimpleRGBColorFactory(210, 180, 140));
  +	factories.put("thistle",          new SimpleRGBColorFactory(216,  91, 216));
  +	factories.put("tomato",           new SimpleRGBColorFactory(255,  99,  71));
  +	factories.put("turquoise",        new SimpleRGBColorFactory( 64, 224, 208));
  +	factories.put("violet",           new SimpleRGBColorFactory(238, 130, 238));
  +	factories.put("wheat",            new SimpleRGBColorFactory(245, 222, 179));
  +	factories.put("whitesmoke",       new SimpleRGBColorFactory(245, 245, 245));
  +	factories.put("yellowgreen",      new SimpleRGBColorFactory(154, 205,  50));
       }
   
       /**
        * Creates a new SVGColorFactory object.
        */
  -    public SVGColorFactory(Parser p, String prop) {
  -	super(p, prop);
  +    public SVGColorFactory(Parser p, String prop, SystemColorResolver scr) {
  +	super(p, prop, scr);
       }
   
       /**
  
  
  
  1.7       +19 -8     xml-batik/sources/org/apache/batik/css/svg/SVGValueFactoryMap.java
  
  Index: SVGValueFactoryMap.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/svg/SVGValueFactoryMap.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SVGValueFactoryMap.java	2001/02/15 16:42:00	1.6
  +++ SVGValueFactoryMap.java	2001/03/13 16:28:40	1.7
  @@ -8,7 +8,10 @@
   
   package org.apache.batik.css.svg;
   
  +import org.apache.batik.css.value.DefaultSystemColorResolver;
   import org.apache.batik.css.value.CommonValueFactoryMap;
  +import org.apache.batik.css.value.SystemColorResolver;
  +
   import org.w3c.css.sac.Parser;
   
   /**
  @@ -16,16 +19,24 @@
    * to contains factories for SVG CSS values.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: SVGValueFactoryMap.java,v 1.6 2001/02/15 16:42:00 hillion Exp $
  + * @version $Id: SVGValueFactoryMap.java,v 1.7 2001/03/13 16:28:40 hillion Exp $
    */
   public class SVGValueFactoryMap
       extends    CommonValueFactoryMap
       implements SVGValueConstants {
  +
       /**
        * Creates a new ValueFactoryMap object.
        */
       public SVGValueFactoryMap(Parser p) {
  -	super(p);
  +        this(p, new DefaultSystemColorResolver());
  +    }
  +
  +    /**
  +     * Creates a new ValueFactoryMap object.
  +     */
  +    public SVGValueFactoryMap(Parser p, SystemColorResolver scr) {
  +	super(p, scr);
   
   	put(CSS_ALIGNMENT_BASELINE_PROPERTY,
               new AlignmentBaselineFactory(p));
  @@ -43,7 +54,7 @@
               new ColorProfileFactory(p));
   
   	put(CSS_COLOR_PROPERTY,
  -            new SVGColorFactory(p, CSS_COLOR_PROPERTY));
  +            new SVGColorFactory(p, CSS_COLOR_PROPERTY, scr));
   
   	put(CSS_COLOR_INTERPOLATION_PROPERTY,
               new ColorInterpolationFactory(p));
  @@ -58,7 +69,7 @@
               new EnableBackgroundFactory(p));
   
   	put(CSS_FILL_PROPERTY,
  -            new PaintFactory(p, CSS_FILL_PROPERTY));
  +            new PaintFactory(p, CSS_FILL_PROPERTY, scr));
   
   	put(CSS_FILL_OPACITY_PROPERTY,
               new OpacityFactory(p, CSS_FILL_OPACITY_PROPERTY));
  @@ -70,7 +81,7 @@
               new FilterFactory(p));
   
   	put(CSS_FLOOD_COLOR_PROPERTY,
  -            new SimpleColorFactory(p, CSS_FLOOD_COLOR_PROPERTY));
  +            new SimpleColorFactory(p, CSS_FLOOD_COLOR_PROPERTY, scr));
   
   	put(CSS_FLOOD_OPACITY_PROPERTY,
               new OpacityFactory(p, CSS_FLOOD_OPACITY_PROPERTY));
  @@ -88,7 +99,7 @@
               new ImageRenderingFactory(p));
   
   	put(CSS_LIGHTING_COLOR_PROPERTY,
  -            new SimpleColorFactory(p, CSS_LIGHTING_COLOR_PROPERTY));
  +            new SimpleColorFactory(p, CSS_LIGHTING_COLOR_PROPERTY, scr));
   
   	put(CSS_MARKER_PROPERTY,
               new MarkerShorthandFactory(p));
  @@ -115,13 +126,13 @@
               new ShapeRenderingFactory(p));
   
   	put(CSS_STOP_COLOR_PROPERTY,
  -            new SimpleColorFactory(p, CSS_STOP_COLOR_PROPERTY));
  +            new SimpleColorFactory(p, CSS_STOP_COLOR_PROPERTY, scr));
   
   	put(CSS_STOP_OPACITY_PROPERTY,
               new OpacityFactory(p, CSS_STOP_OPACITY_PROPERTY));
   
   	put(CSS_STROKE_PROPERTY,
  -            new PaintFactory(p, CSS_STROKE_PROPERTY));
  +            new PaintFactory(p, CSS_STROKE_PROPERTY, scr));
   
   	put(CSS_STROKE_DASHARRAY_PROPERTY,
               new StrokeDasharrayFactory(p));
  
  
  
  1.5       +8 -7      xml-batik/sources/org/apache/batik/css/svg/SimpleColorFactory.java
  
  Index: SimpleColorFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/svg/SimpleColorFactory.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SimpleColorFactory.java	2001/02/12 06:18:25	1.4
  +++ SimpleColorFactory.java	2001/03/13 16:28:40	1.5
  @@ -15,6 +15,7 @@
   import org.apache.batik.css.value.ImmutableRGBColor;
   import org.apache.batik.css.value.ImmutableString;
   import org.apache.batik.css.value.ImmutableValue;
  +import org.apache.batik.css.value.SystemColorResolver;
   import org.apache.batik.css.value.ValueFactory;
   
   import org.w3c.css.sac.LexicalUnit;
  @@ -30,21 +31,17 @@
    * This class provides a factory for values of type color.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: SimpleColorFactory.java,v 1.4 2001/02/12 06:18:25 hillion Exp $
  + * @version $Id: SimpleColorFactory.java,v 1.5 2001/03/13 16:28:40 hillion Exp $
    */
   public class SimpleColorFactory
       extends    SVGColorFactory
       implements SVGValueConstants {
   
  -    static {
  -	values.put(CSS_CURRENTCOLOR_VALUE, CURRENTCOLOR_VALUE);
  -    }
  -
       /**
        * Creates a new SimpleColorFactory object.
        */
  -    public SimpleColorFactory(Parser p, String prop) {
  -	super(p, prop);
  +    public SimpleColorFactory(Parser p, String prop, SystemColorResolver scr) {
  +	super(p, prop, scr);
       }
   
       /**
  @@ -55,6 +52,10 @@
   	case LexicalUnit.SAC_INHERIT:
   	    return INHERIT;
   	case LexicalUnit.SAC_IDENT:
  +            String s = lu.getStringValue().toLowerCase().intern();
  +            if (s == CSS_CURRENTCOLOR_VALUE) {
  +                return CURRENTCOLOR_VALUE;
  +            }
               return super.createValue(lu);
           case LexicalUnit.SAC_RGBCOLOR:
               LexicalUnit l = lu.getParameters();
  
  
  
  1.4       +17 -11    xml-batik/sources/org/apache/batik/css/svg/StrokeWidthResolver.java
  
  Index: StrokeWidthResolver.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/svg/StrokeWidthResolver.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StrokeWidthResolver.java	2000/12/06 21:21:16	1.3
  +++ StrokeWidthResolver.java	2001/03/13 16:28:40	1.4
  @@ -10,10 +10,12 @@
   
   import org.apache.batik.css.CSSOMReadOnlyStyleDeclaration;
   import org.apache.batik.css.CSSOMReadOnlyValue;
  +
   import org.apache.batik.css.value.AbstractValueFactory;
   import org.apache.batik.css.value.ImmutableFloat;
   import org.apache.batik.css.value.ImmutableValue;
   import org.apache.batik.css.value.RelativeValueResolver;
  +
   import org.w3c.dom.Element;
   import org.w3c.dom.css.CSSPrimitiveValue;
   import org.w3c.dom.css.ViewCSS;
  @@ -23,7 +25,7 @@
    * stroke-width CSS property.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: StrokeWidthResolver.java,v 1.3 2000/12/06 21:21:16 hillion Exp $
  + * @version $Id: StrokeWidthResolver.java,v 1.4 2001/03/13 16:28:40 hillion Exp $
    */
   public class StrokeWidthResolver implements RelativeValueResolver {
   
  @@ -78,16 +80,20 @@
   			     String priority,
   			     int origin) {
           if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_PERCENTAGE) {
  -            double vpw = context.getViewportWidth();
  -            double vph = context.getViewportHeight();
  -            double vpr = Math.sqrt(vpw * vpw + vph * vph);
  -            double p = value.getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE);
  -            float val = (float)(p * vpr / 100);
  -            ImmutableValue iv = new ImmutableFloat(CSSPrimitiveValue.CSS_NUMBER, val);
  -            styleDeclaration.setPropertyCSSValue(getPropertyName(),
  -                                                 new CSSOMReadOnlyValue(iv),
  -                                                 priority,
  -                                                 origin);
  +            try {
  +                double vpw = context.getViewportWidth(element);
  +                double vph = context.getViewportHeight(element);
  +                double vpr = Math.sqrt(vpw * vpw + vph * vph);
  +                double p = value.getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE);
  +                float val = (float)(p * vpr / 100);
  +                ImmutableValue iv = new ImmutableFloat(CSSPrimitiveValue.CSS_NUMBER, val);
  +                styleDeclaration.setPropertyCSSValue(getPropertyName(),
  +                                                     new CSSOMReadOnlyValue(iv),
  +                                                     priority,
  +                                                     origin);
  +            } catch (IllegalStateException e) {
  +                // Let the value unchanged.
  +            }
           }
       }
   }
  
  
  
  1.4       +1 -16     xml-batik/sources/org/apache/batik/css/value/AbstractValueFactory.java
  
  Index: AbstractValueFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/value/AbstractValueFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractValueFactory.java	2001/02/12 06:18:26	1.3
  +++ AbstractValueFactory.java	2001/03/13 16:28:41	1.4
  @@ -22,26 +22,11 @@
    * This class provides a base implementation for every value factories.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: AbstractValueFactory.java,v 1.3 2001/02/12 06:18:26 hillion Exp $
  + * @version $Id: AbstractValueFactory.java,v 1.4 2001/03/13 16:28:41 hillion Exp $
    */
   public abstract class AbstractValueFactory
       implements ValueFactory,
                  ValueConstants {
  -    /**
  -     * The immutable factory.
  -     */
  -    protected final static ValueFactory IMMUTABLE_FACTORY =
  -	new AbstractValueFactory(null) {
  -	public String getPropertyName() {
  -	    return "";
  -	}
  -	public ImmutableValue createValue(LexicalUnit lu) throws DOMException {
  -	    throw CSSDOMExceptionFactory.createDOMException
  -		(DOMException.NO_MODIFICATION_ALLOWED_ERR,
  -		 "immutable.value",
  -		 new Object[] {});
  -	}
  -    };
   
       /**
        * The CSS parser.
  
  
  
  1.3       +144 -48   xml-batik/sources/org/apache/batik/css/value/ColorFactory.java
  
  Index: ColorFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/value/ColorFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ColorFactory.java	2000/11/27 05:49:14	1.2
  +++ ColorFactory.java	2001/03/13 16:28:42	1.3
  @@ -21,7 +21,7 @@
    * This class provides a factory for the 'color'-like CSS properties.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: ColorFactory.java,v 1.2 2000/11/27 05:49:14 hillion Exp $
  + * @version $Id: ColorFactory.java,v 1.3 2001/03/13 16:28:42 hillion Exp $
    */
   public class ColorFactory
       extends    AbstractRGBColorFactory
  @@ -43,34 +43,6 @@
        */
       protected final static PropertyMap values = new PropertyMap();
       static {
  -	values.put(CSS_ACTIVEBORDER_VALUE,        ACTIVEBORDER_VALUE);
  -	values.put(CSS_ACTIVECAPTION_VALUE,       ACTIVECAPTION_VALUE);
  -	values.put(CSS_APPWORKSPACE_VALUE,        APPWORKSPACE_VALUE);
  -	values.put(CSS_BACKGROUND_VALUE,          BACKGROUND_VALUE);
  -	values.put(CSS_BUTTONFACE_VALUE,          BUTTONFACE_VALUE);
  -	values.put(CSS_BUTTONHIGHLIGHT_VALUE,     BUTTONHIGHLIGHT_VALUE);
  -	values.put(CSS_BUTTONSHADOW_VALUE,        BUTTONSHADOW_VALUE);
  -	values.put(CSS_BUTTONTEXT_VALUE,          BUTTONTEXT_VALUE);
  -	values.put(CSS_CAPTIONTEXT_VALUE,         CAPTIONTEXT_VALUE);
  -	values.put(CSS_GRAYTEXT_VALUE,            GRAYTEXT_VALUE);
  -	values.put(CSS_HIGHLIGHT_VALUE,           HIGHLIGHT_VALUE);
  -	values.put(CSS_HIGHLIGHTTEXT_VALUE,       HIGHLIGHTTEXT_VALUE);
  -	values.put(CSS_INACTIVEBORDER_VALUE,      INACTIVEBORDER_VALUE);
  -	values.put(CSS_INACTIVECAPTION_VALUE,     INACTIVECAPTION_VALUE);
  -	values.put(CSS_INACTIVECAPTIONTEXT_VALUE, INACTIVECAPTIONTEXT_VALUE);
  -	values.put(CSS_INFOBACKGROUND_VALUE,      INFOBACKGROUND_VALUE);
  -	values.put(CSS_INFOTEXT_VALUE,            INFOTEXT_VALUE);
  -	values.put(CSS_MENU_VALUE,                MENU_VALUE);
  -	values.put(CSS_MENUTEXT_VALUE,            MENUTEXT_VALUE);
  -	values.put(CSS_SCROLLBAR_VALUE,           SCROLLBAR_VALUE);
  -	values.put(CSS_THREEDDARKSHADOW_VALUE,    THREEDDARKSHADOW_VALUE);
  -	values.put(CSS_THREEDFACE_VALUE,          THREEDFACE_VALUE);
  -	values.put(CSS_THREEDHIGHLIGHT_VALUE,     THREEDHIGHLIGHT_VALUE);
  -	values.put(CSS_THREEDLIGHTSHADOW_VALUE,   THREEDLIGHTSHADOW_VALUE);
  -	values.put(CSS_THREEDSHADOW_VALUE,        THREEDSHADOW_VALUE);
  -	values.put(CSS_WINDOW_VALUE,              WINDOW_VALUE);
  -	values.put(CSS_WINDOWFRAME_VALUE,         WINDOWFRAME_VALUE);
  -	values.put(CSS_WINDOWTEXT_VALUE,          WINDOWTEXT_VALUE);
       }
   
       /**
  @@ -78,32 +50,117 @@
        */
       protected final PropertyMap factories = new PropertyMap();
       {
  -	factories.put("black",   new RGBColorFactory(  0,   0,   0));
  -	factories.put("silver",  new RGBColorFactory(192, 192, 192));
  -	factories.put("gray",    new RGBColorFactory(128, 128, 128));
  -	factories.put("white",   new RGBColorFactory(255, 255, 255));
  -	factories.put("maroon",  new RGBColorFactory(128,   0,   0));
  -	factories.put("red",     new RGBColorFactory(255,   0,   0));
  -	factories.put("purple",  new RGBColorFactory(128,   0, 128));
  -	factories.put("fuchsia", new RGBColorFactory(255,   0, 255));
  -	factories.put("green",   new RGBColorFactory(  0, 128,   0));
  -	factories.put("lime",    new RGBColorFactory(  0, 255,   0));
  -	factories.put("olive",   new RGBColorFactory(128, 128,   0));
  -	factories.put("yellow",  new RGBColorFactory(255, 255,   0));
  -	factories.put("navy",    new RGBColorFactory(  0,   0, 128));
  -	factories.put("blue",    new RGBColorFactory(  0,   0, 255));
  -	factories.put("teal",    new RGBColorFactory(  0, 128, 128));
  -	factories.put("aqua",    new RGBColorFactory(  0, 255, 255));
  +	factories.put("black",   new SimpleRGBColorFactory(  0,   0,   0));
  +	factories.put("silver",  new SimpleRGBColorFactory(192, 192, 192));
  +	factories.put("gray",    new SimpleRGBColorFactory(128, 128, 128));
  +	factories.put("white",   new SimpleRGBColorFactory(255, 255, 255));
  +	factories.put("maroon",  new SimpleRGBColorFactory(128,   0,   0));
  +	factories.put("red",     new SimpleRGBColorFactory(255,   0,   0));
  +	factories.put("purple",  new SimpleRGBColorFactory(128,   0, 128));
  +	factories.put("fuchsia", new SimpleRGBColorFactory(255,   0, 255));
  +	factories.put("green",   new SimpleRGBColorFactory(  0, 128,   0));
  +	factories.put("lime",    new SimpleRGBColorFactory(  0, 255,   0));
  +	factories.put("olive",   new SimpleRGBColorFactory(128, 128,   0));
  +	factories.put("yellow",  new SimpleRGBColorFactory(255, 255,   0));
  +	factories.put("navy",    new SimpleRGBColorFactory(  0,   0, 128));
  +	factories.put("blue",    new SimpleRGBColorFactory(  0,   0, 255));
  +	factories.put("teal",    new SimpleRGBColorFactory(  0, 128, 128));
  +	factories.put("aqua",    new SimpleRGBColorFactory(  0, 255, 255));
       }
   
       /**
        * Creates a new ColorFactory object.
        * @param p The CSS parser used to parse the CSS texts.
        * @param prop The handled property name.
  +     * @param scr The resolver for system colors.
        */
  -    public ColorFactory(Parser p, String prop) {
  +    public ColorFactory(Parser p, String prop, SystemColorResolver scr) {
   	super(p);
   	property = prop;
  +
  +        factories.put(CSS_ACTIVEBORDER_VALUE,
  +                      new SystemRGBColorFactory(scr.activeBorder()));
  +
  +        factories.put(CSS_ACTIVECAPTION_VALUE,
  +                      new SystemRGBColorFactory(scr.activeCaption()));
  +
  +        factories.put(CSS_APPWORKSPACE_VALUE,
  +                      new SystemRGBColorFactory(scr.appWorkspace()));
  +
  +        factories.put(CSS_BACKGROUND_VALUE,
  +                      new SystemRGBColorFactory(scr.background()));
  +
  +        factories.put(CSS_BUTTONFACE_VALUE,
  +                      new SystemRGBColorFactory(scr.buttonFace()));
  +
  +        factories.put(CSS_BUTTONHIGHLIGHT_VALUE,
  +                      new SystemRGBColorFactory(scr.buttonHighlight()));
  +
  +        factories.put(CSS_BUTTONSHADOW_VALUE,
  +                      new SystemRGBColorFactory(scr.buttonShadow()));
  +
  +        factories.put(CSS_BUTTONTEXT_VALUE,
  +                      new SystemRGBColorFactory(scr.buttonText()));
  +
  +        factories.put(CSS_CAPTIONTEXT_VALUE,
  +                      new SystemRGBColorFactory(scr.captionText()));
  +
  +        factories.put(CSS_GRAYTEXT_VALUE,
  +                      new SystemRGBColorFactory(scr.grayText()));
  +
  +        factories.put(CSS_HIGHLIGHT_VALUE,
  +                      new SystemRGBColorFactory(scr.highlight()));
  +
  +        factories.put(CSS_HIGHLIGHTTEXT_VALUE,
  +                      new SystemRGBColorFactory(scr.highlightText()));
  +
  +        factories.put(CSS_INACTIVEBORDER_VALUE,
  +                      new SystemRGBColorFactory(scr.inactiveBorder()));
  +
  +        factories.put(CSS_INACTIVECAPTION_VALUE,
  +                      new SystemRGBColorFactory(scr.inactiveCaption()));
  +
  +        factories.put(CSS_INACTIVECAPTIONTEXT_VALUE,
  +                      new SystemRGBColorFactory(scr.inactiveCaptionText()));
  +
  +        factories.put(CSS_INFOBACKGROUND_VALUE,
  +                      new SystemRGBColorFactory(scr.infoBackground()));
  +
  +        factories.put(CSS_INFOTEXT_VALUE,
  +                      new SystemRGBColorFactory(scr.infoText()));
  +
  +        factories.put(CSS_MENU_VALUE,
  +                      new SystemRGBColorFactory(scr.menu()));
  +
  +        factories.put(CSS_MENUTEXT_VALUE,
  +                      new SystemRGBColorFactory(scr.menuText()));
  +
  +        factories.put(CSS_SCROLLBAR_VALUE,
  +                      new SystemRGBColorFactory(scr.scrollbar()));
  +
  +        factories.put(CSS_THREEDDARKSHADOW_VALUE,
  +                      new SystemRGBColorFactory(scr.threeDDarkShadow()));
  +
  +        factories.put(CSS_THREEDFACE_VALUE,
  +                      new SystemRGBColorFactory(scr.threeDFace()));
  +
  +        factories.put(CSS_THREEDHIGHLIGHT_VALUE,
  +                      new SystemRGBColorFactory(scr.threeDHighlight()));
  +
  +        factories.put(CSS_THREEDLIGHTSHADOW_VALUE,
  +                      new SystemRGBColorFactory(scr.threeDLightShadow()));
  +
  +        factories.put(CSS_THREEDSHADOW_VALUE,
  +                      new SystemRGBColorFactory(scr.threeDShadow()));
  +
  +        factories.put(CSS_WINDOW_VALUE,
  +                      new SystemRGBColorFactory(scr.window()));
  +
  +        factories.put(CSS_WINDOWFRAME_VALUE,
  +                      new SystemRGBColorFactory(scr.windowFrame()));
  +
  +        factories.put(CSS_WINDOWTEXT_VALUE,
  +                      new SystemRGBColorFactory(scr.windowText()));
       }
   
       /**
  @@ -187,8 +244,20 @@
   
       /**
        * The rgb color factory.
  +     */
  +    protected interface RGBColorFactory {
  +
  +        /**
  +         * Creates the color.
  +         */
  +        ImmutableValue create();
  +    }
  +
  +    /**
  +     * The simple rgb color factory.
        */
  -    protected class RGBColorFactory {
  +    protected class SimpleRGBColorFactory implements RGBColorFactory {
  +
   	/**
   	 * The red component.
   	 */
  @@ -207,7 +276,7 @@
   	/**
   	 * Creates a new factory.
   	 */
  -	public RGBColorFactory(float r, float g, float b) {
  +	public SimpleRGBColorFactory(float r, float g, float b) {
   	    red = r;
   	    green = g;
   	    blue = b;
  @@ -218,6 +287,33 @@
            */
           public ImmutableValue create() {
               return createImmutableRGBColor(red, green, blue);
  +        }
  +    }
  +
  +    /**
  +     * The simple rgb color factory.
  +     */
  +    protected class SystemRGBColorFactory implements RGBColorFactory {
  +
  +        /**
  +         * The system color.
  +         */
  +        protected SystemColorResolver.Color color;
  +
  +	/**
  +	 * Creates a new factory.
  +	 */
  +	public SystemRGBColorFactory(SystemColorResolver.Color c) {
  +            color = c;
  +	}
  +
  +        /**
  +         * Creates the color.
  +         */
  +        public ImmutableValue create() {
  +            return createImmutableRGBColor(color.getRed(),
  +                                           color.getGreen(),
  +                                           color.getBlue());
           }
       }
   }
  
  
  
  1.3       +13 -2     xml-batik/sources/org/apache/batik/css/value/ColorResolver.java
  
  Index: ColorResolver.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/value/ColorResolver.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ColorResolver.java	2000/11/27 05:49:14	1.2
  +++ ColorResolver.java	2001/03/13 16:28:42	1.3
  @@ -10,7 +10,9 @@
   
   import org.apache.batik.css.CSSOMReadOnlyStyleDeclaration;
   import org.apache.batik.css.CSSOMReadOnlyValue;
  +
   import org.w3c.dom.Element;
  +import org.w3c.dom.css.CSSPrimitiveValue;
   import org.w3c.dom.css.ViewCSS;
   
   /**
  @@ -18,9 +20,10 @@
    * property.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: ColorResolver.java,v 1.2 2000/11/27 05:49:14 hillion Exp $
  + * @version $Id: ColorResolver.java,v 1.3 2001/03/13 16:28:42 hillion Exp $
    */
   public class ColorResolver implements RelativeValueResolver {
  +
       /**
        * The application context.
        */
  @@ -52,7 +55,15 @@
        * Returns the default value for the handled property.
        */
       public CSSOMReadOnlyValue getDefaultValue() {
  -	return context.getDefaultColorValue();
  +	CommonCSSContext.Color c = context.getDefaultColorValue();
  +        return new CSSOMReadOnlyValue
  +            (new ImmutableRGBColor
  +                (new CSSOMReadOnlyValue(new ImmutableFloat(CSSPrimitiveValue.CSS_NUMBER,
  +                                                           c.getRed())),
  +                 new CSSOMReadOnlyValue(new ImmutableFloat(CSSPrimitiveValue.CSS_NUMBER,
  +                                                           c.getGreen())),
  +                 new CSSOMReadOnlyValue(new ImmutableFloat(CSSPrimitiveValue.CSS_NUMBER,
  +                                                           c.getBlue()))));
       }
       
       /**
  
  
  
  1.3       +67 -4     xml-batik/sources/org/apache/batik/css/value/CommonCSSContext.java
  
  Index: CommonCSSContext.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/value/CommonCSSContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CommonCSSContext.java	2000/10/23 09:44:31	1.2
  +++ CommonCSSContext.java	2001/03/13 16:28:42	1.3
  @@ -8,6 +8,8 @@
   
   package org.apache.batik.css.value;
   
  +import java.util.List;
  +
   import org.apache.batik.css.CSSOMReadOnlyValue;
   
   /**
  @@ -15,21 +17,82 @@
    * to the CSS engine in order to resolve the relative CSS values.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: CommonCSSContext.java,v 1.2 2000/10/23 09:44:31 hillion Exp $
  + * @version $Id: CommonCSSContext.java,v 1.3 2001/03/13 16:28:42 hillion Exp $
    */
   public interface CommonCSSContext {
       /**
        * The default color.
        */
  -    CSSOMReadOnlyValue getDefaultColorValue();
  +    Color getDefaultColorValue();
   
       /**
  -     * The font-family value.
  +     * The default font-family value.
  +     * @return a list of string.
        */
  -    CSSOMReadOnlyValue getDefaultFontFamilyValue();
  +    List getDefaultFontFamilyValue();
   
       /**
        * The user style sheet URI.
        */
       String getUserStyleSheetURI();
  +
  +    /**
  +     * Returns the font weight 'lighter' than the given weight.
  +     */
  +    float getLighterFontWeight(float f);
  +
  +    /**
  +     * Returns the font weight 'bolder' than the given weight.
  +     */
  +    float getBolderFontWeight(float f);
  +
  +    /**
  +     * To Store a CSS RGB color.
  +     */
  +    public class Color {
  +        /**
  +         * The red component.
  +         */
  +        protected int red;
  +
  +        /**
  +         * The green component.
  +         */
  +        protected int green;
  +
  +        /**
  +         * The blue component.
  +         */
  +        protected int blue;
  +
  +        /**
  +         * Creates a new color.
  +         */
  +        public Color(int red, int green, int blue) {
  +            this.red = red;
  +            this.green = green;
  +            this.blue = blue;
  +        }
  +
  +        /**
  +         * Returns the red component.
  +         */
  +        public int getRed() {
  +            return red;
  +        }
  +
  +        /**
  +         * Returns the green component.
  +         */
  +        public int getGreen() {
  +            return green;
  +        }
  +
  +        /**
  +         * Returns the blue component.
  +         */
  +        public int getBlue() {
  +            return blue;
  +        }
  +    }
   }
  
  
  
  1.3       +9 -2      xml-batik/sources/org/apache/batik/css/value/CommonValueFactoryMap.java
  
  Index: CommonValueFactoryMap.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/value/CommonValueFactoryMap.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CommonValueFactoryMap.java	2000/11/27 05:49:14	1.2
  +++ CommonValueFactoryMap.java	2001/03/13 16:28:42	1.3
  @@ -16,7 +16,7 @@
    * to contains factories for CSS values common to CSS2 and SVG.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: CommonValueFactoryMap.java,v 1.2 2000/11/27 05:49:14 hillion Exp $
  + * @version $Id: CommonValueFactoryMap.java,v 1.3 2001/03/13 16:28:42 hillion Exp $
    */
   public class CommonValueFactoryMap implements ValueFactoryMap, ValueConstants {
       /**
  @@ -28,8 +28,15 @@
        * Creates a new ValueFactoryMap object.
        */
       public CommonValueFactoryMap(Parser p) {
  +        this(p, new DefaultSystemColorResolver());
  +    }
  +
  +    /**
  +     * Creates a new ValueFactoryMap object.
  +     */
  +    public CommonValueFactoryMap(Parser p, SystemColorResolver scr) {
   	put(CSS_CLIP_PROPERTY,               new ClipFactory(p));
  -	put(CSS_COLOR_PROPERTY,              new ColorFactory(p, CSS_COLOR_PROPERTY));
  +	put(CSS_COLOR_PROPERTY,              new ColorFactory(p, CSS_COLOR_PROPERTY, scr));
   	put(CSS_CURSOR_PROPERTY,             new CursorFactory(p));
   	put(CSS_DIRECTION_PROPERTY,          new DirectionFactory(p));
   	put(CSS_DISPLAY_PROPERTY,            new DisplayFactory(p));
  
  
  
  1.4       +2 -2      xml-batik/sources/org/apache/batik/css/value/CommonViewCSS.java
  
  Index: CommonViewCSS.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/value/CommonViewCSS.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CommonViewCSS.java	2000/11/27 05:49:14	1.3
  +++ CommonViewCSS.java	2001/03/13 16:28:42	1.4
  @@ -20,7 +20,7 @@
    * the CSS values common to CSS2 ans SVG.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: CommonViewCSS.java,v 1.3 2000/11/27 05:49:14 hillion Exp $
  + * @version $Id: CommonViewCSS.java,v 1.4 2001/03/13 16:28:42 hillion Exp $
    */
   public abstract class CommonViewCSS extends AbstractViewCSS {
       /**
  @@ -41,7 +41,7 @@
   	addRelativeValueResolver(new FontStretchResolver());
   	addRelativeValueResolver(new FontStyleResolver());
   	addRelativeValueResolver(new FontVariantResolver());
  -	addRelativeValueResolver(new FontWeightResolver());
  +	addRelativeValueResolver(new FontWeightResolver(ctx));
   	addRelativeValueResolver(new SpacingResolver
                                    (ValueConstants.CSS_LETTER_SPACING_PROPERTY));
   	addRelativeValueResolver(new OverflowResolver());
  
  
  
  1.3       +53 -23    xml-batik/sources/org/apache/batik/css/value/DefaultCommonCSSContext.java
  
  Index: DefaultCommonCSSContext.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/value/DefaultCommonCSSContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultCommonCSSContext.java	2000/10/23 09:44:33	1.2
  +++ DefaultCommonCSSContext.java	2001/03/13 16:28:42	1.3
  @@ -8,44 +8,36 @@
   
   package org.apache.batik.css.value;
   
  +import java.util.ArrayList;
  +import java.util.List;
  +
   import org.apache.batik.css.CSSOMReadOnlyValue;
  +import org.apache.batik.util.CSSConstants;
  +
   import org.w3c.dom.css.CSSPrimitiveValue;
   
   /**
    * This class is the default implementation of the CommonCSSContext.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: DefaultCommonCSSContext.java,v 1.2 2000/10/23 09:44:33 hillion Exp $
  + * @version $Id: DefaultCommonCSSContext.java,v 1.3 2001/03/13 16:28:42 hillion Exp $
    */
   public class DefaultCommonCSSContext implements CommonCSSContext {
  -    /**
  -     * 0.
  -     */
  -    protected final static ImmutableValue N_0 =
  -	new ImmutableFloat(CSSPrimitiveValue.CSS_NUMBER, 0);
   
       /**
        * The default color.
        */
  -    public final static CSSOMReadOnlyValue DEFAULT_COLOR_VALUE =
  -	new CSSOMReadOnlyValue
  -        (new ImmutableRGBColor(new CSSOMReadOnlyValue(N_0),
  -                               new CSSOMReadOnlyValue(N_0),
  -                               new CSSOMReadOnlyValue(N_0)));
  +    public final static Color DEFAULT_COLOR = new Color(0, 0, 0);
   
       /**
        * The default font family.
        */
  -    public final static CSSOMReadOnlyValue DEFAULT_FONT_FAMILY;
  +    public final static List DEFAULT_FONT_FAMILY;
       static {
  -	ImmutableValueList l = new ImmutableValueList();
  -	ImmutableValue v;
  -	v = new ImmutableString(CSSPrimitiveValue.CSS_STRING, "Arial");
  -	l.append(new CSSOMReadOnlyValue(v));
  -	v = new ImmutableString(CSSPrimitiveValue.CSS_STRING, "Helvetica");
  -	l.append(new CSSOMReadOnlyValue(v));
  -	l.append(new CSSOMReadOnlyValue(FontFamilyFactory.SANS_SERIF_VALUE));
  -	DEFAULT_FONT_FAMILY = new CSSOMReadOnlyValue(l);
  +        DEFAULT_FONT_FAMILY = new ArrayList(3);
  +        DEFAULT_FONT_FAMILY.add("Arial");
  +        DEFAULT_FONT_FAMILY.add("Helvetica");
  +        DEFAULT_FONT_FAMILY.add(CSSConstants.CSS_SANS_SERIF_VALUE);
       }
   
       /**
  @@ -56,14 +48,14 @@
       /**
        * The default color.
        */
  -    public CSSOMReadOnlyValue getDefaultColorValue() {
  -	return DEFAULT_COLOR_VALUE;
  +    public Color getDefaultColorValue() {
  +	return DEFAULT_COLOR;
       }
   
       /**
        * The font-family value.
        */
  -    public CSSOMReadOnlyValue getDefaultFontFamilyValue() {
  +    public List getDefaultFontFamilyValue() {
   	return DEFAULT_FONT_FAMILY;
       }
   
  @@ -79,5 +71,43 @@
        */
       public void setUserStyleSheetURI(String s) {
           userStyleSheetURI = s;
  +    }
  +
  +    /**
  +     * Returns the font weight 'lighter' than the given weight.
  +     */
  +    public float getLighterFontWeight(float f) {
  +        switch ((int)f) {
  +        case 100: return 100;
  +        case 200: return 100;
  +        case 300: return 200;
  +        case 400: return 300;
  +        case 500: return 400;
  +        case 600: return 400;
  +        case 700: return 400;
  +        case 800: return 400;
  +        case 900: return 400;
  +        default:
  +            throw new IllegalArgumentException("" + f);
  +        }
  +    }
  +
  +    /**
  +     * Returns the font weight 'bolder' than the given weight.
  +     */
  +    public float getBolderFontWeight(float f) {
  +        switch ((int)f) {
  +        case 100: return 600;
  +        case 200: return 600;
  +        case 300: return 600;
  +        case 400: return 600;
  +        case 500: return 600;
  +        case 600: return 700;
  +        case 700: return 800;
  +        case 800: return 900;
  +        case 900: return 900;
  +        default:
  +            throw new IllegalArgumentException("" + f);
  +        }
       }
   }
  
  
  
  1.4       +25 -2     xml-batik/sources/org/apache/batik/css/value/FontFamilyResolver.java
  
  Index: FontFamilyResolver.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/value/FontFamilyResolver.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FontFamilyResolver.java	2000/12/06 21:21:33	1.3
  +++ FontFamilyResolver.java	2001/03/13 16:28:42	1.4
  @@ -8,9 +8,14 @@
   
   package org.apache.batik.css.value;
   
  +import java.util.Iterator;
  +
   import org.apache.batik.css.CSSOMReadOnlyStyleDeclaration;
   import org.apache.batik.css.CSSOMReadOnlyValue;
  +
   import org.w3c.dom.Element;
  +
  +import org.w3c.dom.css.CSSPrimitiveValue;
   import org.w3c.dom.css.ViewCSS;
   
   /**
  @@ -18,7 +23,7 @@
    * property.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: FontFamilyResolver.java,v 1.3 2000/12/06 21:21:33 hillion Exp $
  + * @version $Id: FontFamilyResolver.java,v 1.4 2001/03/13 16:28:42 hillion Exp $
    */
   public class FontFamilyResolver implements RelativeValueResolver {
   
  @@ -53,7 +58,13 @@
        * Returns the default value for the handled property.
        */
       public CSSOMReadOnlyValue getDefaultValue() {
  -	return context.getDefaultFontFamilyValue();
  +        ImmutableValueList l = new ImmutableValueList();
  +        Iterator it = context.getDefaultFontFamilyValue().iterator();
  +        while (it.hasNext()) {
  +            String s = (String)it.next();
  +            l.append(new CSSOMReadOnlyValue(createFontFamilyValue(s)));
  +        }
  +        return new CSSOMReadOnlyValue(l);
       }
       
       /**
  @@ -74,5 +85,17 @@
   			     String priority,
   			     int origin) {
   	// Nothing to do
  +    }
  +
  +    /**
  +     * Creates a font-family value.
  +     */
  +    protected ImmutableValue createFontFamilyValue(String s) {
  +        ImmutableValue res =
  +            (ImmutableValue)FontFamilyFactory.values.get(s.toLowerCase().intern());
  +        if (res != null) {
  +            return res;
  +        }
  +        return new ImmutableString(CSSPrimitiveValue.CSS_STRING, s);
       }
   }
  
  
  
  1.5       +47 -62    xml-batik/sources/org/apache/batik/css/value/FontWeightResolver.java
  
  Index: FontWeightResolver.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/value/FontWeightResolver.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FontWeightResolver.java	2001/02/05 15:20:46	1.4
  +++ FontWeightResolver.java	2001/03/13 16:28:43	1.5
  @@ -11,8 +11,11 @@
   import org.apache.batik.css.CSSOMReadOnlyStyleDeclaration;
   import org.apache.batik.css.CSSOMReadOnlyValue;
   import org.apache.batik.css.HiddenChildElementSupport;
  +
   import org.w3c.dom.Element;
   import org.w3c.dom.Node;
  +
  +import org.w3c.dom.css.CSSPrimitiveValue;
   import org.w3c.dom.css.ViewCSS;
   
   /**
  @@ -20,11 +23,24 @@
    * property.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: FontWeightResolver.java,v 1.4 2001/02/05 15:20:46 billh Exp $
  + * @version $Id: FontWeightResolver.java,v 1.5 2001/03/13 16:28:43 hillion Exp $
    */
   public class FontWeightResolver implements RelativeValueResolver {
   
       /**
  +     * The application context.
  +     */
  +    protected CommonCSSContext context;
  +    
  +    /**
  +     * Creates a new FontWeightResolver object.
  +     * @param ctx The application context.
  +     */
  +    public FontWeightResolver(CommonCSSContext ctx) {
  +	context = ctx;
  +    }
  +
  +    /**
        * Whether the handled property is inherited or not.
        */
       public boolean isInheritedProperty() {
  @@ -63,83 +79,52 @@
                                String priority,
                                int origin) {
           ImmutableValue im = value.getImmutableValue();
  -        /**
  -         * Note:  this implementation should change, since the spec says
  -         * the next lighter/bolder "available" font should be chosen, and
  -         * that if none available then increment/decrement by 100.
  -         * Since at the moment we only have normal and bold fonts,
  -         * the interim solution is a reasonable "fit".  Eventually this
  -         * resolution must be done in the renderer instead of here.
  -         */
  +
           boolean b = im == ValueConstants.BOLDER_VALUE;
           if (b || im == ValueConstants.LIGHTER_VALUE) {
               Element p = HiddenChildElementSupport.getParentElement(element);
               CSSOMReadOnlyValue val;
               if (p == null) {
  -                val = new CSSOMReadOnlyValue((b)
  -                                             ? ValueConstants.NUMBER_600
  -                                             : ValueConstants.NUMBER_300);
  +                val = new CSSOMReadOnlyValue
  +                    ((b)
  +                     ? createFontWeight(context.getBolderFontWeight(400))
  +                     : createFontWeight(context.getLighterFontWeight(400)));
               } else {
                   CSSOMReadOnlyStyleDeclaration sd;
                   sd = (CSSOMReadOnlyStyleDeclaration)view.getComputedStyle
                       (p, null);
                   CSSOMReadOnlyValue prop;
  -                prop = (CSSOMReadOnlyValue)sd.getPropertyCSSValue
  -                    (getPropertyName());
  +                prop = (CSSOMReadOnlyValue)sd.getPropertyCSSValue(getPropertyName());
                   im = prop.getImmutableValue();
  -                if (im == ValueConstants.NUMBER_100) {
  -                    val = new CSSOMReadOnlyValue
  -                        ((b)
  -                         ? ValueConstants.NUMBER_600
  -                         : ValueConstants.NUMBER_100);
  -                } else if (im == ValueConstants.NUMBER_200) {
  -                    val = new CSSOMReadOnlyValue
  -                        ((b)
  -                         ? ValueConstants.NUMBER_600
  -                         : ValueConstants.NUMBER_100);
  -                } else if (im == ValueConstants.NUMBER_300) {
  -                    val = new CSSOMReadOnlyValue
  -                        ((b)
  -                         ? ValueConstants.NUMBER_600
  -                         : ValueConstants.NUMBER_200);
  -                } else if (im == ValueConstants.NUMBER_400 ||
  -                           im == ValueConstants.NORMAL_VALUE) {
  -                    val = new CSSOMReadOnlyValue
  -                        ((b)
  -                         ? ValueConstants.NUMBER_600
  -                         : ValueConstants.NUMBER_300);
  -                } else if (im == ValueConstants.NUMBER_500) {
  -                    val = new CSSOMReadOnlyValue
  -                        ((b)
  -                         ? ValueConstants.NUMBER_600
  -                         : ValueConstants.NUMBER_400);
  -                } else if (im == ValueConstants.NUMBER_600) {
  -                    val = new CSSOMReadOnlyValue
  -                        ((b)
  -                         ? ValueConstants.NUMBER_700
  -                         : ValueConstants.NUMBER_400);
  -                } else if (im == ValueConstants.NUMBER_700 ||
  -                           im == ValueConstants.BOLD_VALUE) {
  -                    val = new CSSOMReadOnlyValue
  -                        ((b)
  -                         ? ValueConstants.NUMBER_800
  -                         : ValueConstants.NUMBER_400);
  -                } else if (im == ValueConstants.NUMBER_800) {
  -                    val = new CSSOMReadOnlyValue
  -                        ((b)
  -                         ? ValueConstants.NUMBER_900
  -                         : ValueConstants.NUMBER_400);
  -                } else {
  -                    val = new CSSOMReadOnlyValue
  -                        ((b)
  -                         ? ValueConstants.NUMBER_900
  -                         : ValueConstants.NUMBER_400);
  -                }
  +                float f = im.getFloatValue(CSSPrimitiveValue.CSS_NUMBER);
  +                val = new CSSOMReadOnlyValue
  +                    ((b)
  +                     ? createFontWeight(context.getBolderFontWeight(f))
  +                     : createFontWeight(context.getLighterFontWeight(f)));
               }
               styleDeclaration.setPropertyCSSValue(getPropertyName(),
                                                    val,
                                                    priority,
                                                    origin);
  +        }
  +    }
  +
  +    /**
  +     * Creates a font weight value.
  +     */
  +    protected ImmutableValue createFontWeight(float f) {
  +        switch ((int)f) {
  +        case 100: return ValueConstants.NUMBER_100;
  +        case 200: return ValueConstants.NUMBER_200;
  +        case 300: return ValueConstants.NUMBER_300;
  +        case 400: return ValueConstants.NUMBER_400;
  +        case 500: return ValueConstants.NUMBER_500;
  +        case 600: return ValueConstants.NUMBER_600;
  +        case 700: return ValueConstants.NUMBER_700;
  +        case 800: return ValueConstants.NUMBER_800;
  +        case 900: return ValueConstants.NUMBER_900;
  +        default:
  +            throw new InternalError();
           }
       }
   }
  
  
  
  1.3       +1 -163    xml-batik/sources/org/apache/batik/css/value/ValueConstants.java
  
  Index: ValueConstants.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/value/ValueConstants.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ValueConstants.java	2000/11/27 05:49:18	1.2
  +++ ValueConstants.java	2001/03/13 16:28:43	1.3
  @@ -16,7 +16,7 @@
    * This interface defines the CSS values constants.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: ValueConstants.java,v 1.2 2000/11/27 05:49:18 hillion Exp $
  + * @version $Id: ValueConstants.java,v 1.3 2001/03/13 16:28:43 hillion Exp $
    */
   public interface ValueConstants extends CSSConstants {
       /**
  @@ -79,27 +79,6 @@
   	new ImmutableFloat(CSSPrimitiveValue.CSS_NUMBER, 900);
   
       /**
  -     * The 'activeborder' identifier value.
  -     */
  -    ImmutableValue ACTIVEBORDER_VALUE =
  -	new ImmutableString(CSSPrimitiveValue.CSS_IDENT,
  -                            CSS_ACTIVEBORDER_VALUE);
  -
  -    /**
  -     * The 'activecaption' identifier value.
  -     */
  -    ImmutableValue ACTIVECAPTION_VALUE =
  -	new ImmutableString(CSSPrimitiveValue.CSS_IDENT,
  -                            CSS_ACTIVECAPTION_VALUE);
  -
  -    /**
  -     * The 'appworkspace' identifier value.
  -     */
  -    ImmutableValue APPWORKSPACE_VALUE =
  -	new ImmutableString(CSSPrimitiveValue.CSS_IDENT,
  -                            CSS_APPWORKSPACE_VALUE);
  -
  -    /**
        * The 'auto' identifier.
        */
       ImmutableValue AUTO_VALUE =
  @@ -149,41 +128,6 @@
                               CSS_BOLDER_VALUE);
   
       /**
  -     * The 'buttonface' identifier value.
  -     */
  -    ImmutableValue BUTTONFACE_VALUE =
  -	new ImmutableString(CSSPrimitiveValue.CSS_IDENT,
  -                            CSS_BUTTONFACE_VALUE);
  -
  -    /**
  -     * The 'buttonhighlight' identifier value.
  -     */
  -    ImmutableValue BUTTONHIGHLIGHT_VALUE =
  -	new ImmutableString(CSSPrimitiveValue.CSS_IDENT,
  -                            CSS_BUTTONHIGHLIGHT_VALUE);
  -
  -    /**
  -     * The 'buttonshadow' identifier value.
  -     */
  -    ImmutableValue BUTTONSHADOW_VALUE =
  -	new ImmutableString(CSSPrimitiveValue.CSS_IDENT,
  -                            CSS_BUTTONSHADOW_VALUE);
  -
  -    /**
  -     * The 'buttontext' identifier value.
  -     */
  -    ImmutableValue BUTTONTEXT_VALUE =
  -	new ImmutableString(CSSPrimitiveValue.CSS_IDENT,
  -                            CSS_BUTTONTEXT_VALUE);
  -
  -    /**
  -     * The 'captiontext' identifier value.
  -     */
  -    ImmutableValue CAPTIONTEXT_VALUE =
  -	new ImmutableString(CSSPrimitiveValue.CSS_IDENT,
  -                            CSS_CAPTIONTEXT_VALUE);
  -
  -    /**
        * The 'collapse' identifier value.
        */
       ImmutableValue COLLAPSE_VALUE =
  @@ -289,55 +233,6 @@
                               CSS_HIDDEN_VALUE);
   
       /**
  -     * The 'highlight' identifier value.
  -     */
  -    ImmutableValue HIGHLIGHT_VALUE =
  -	new ImmutableString(CSSPrimitiveValue.CSS_IDENT,
  -                            CSS_HIGHLIGHT_VALUE);
  -
  -    /**
  -     * The 'highlighttext' identifier value.
  -     */
  -    ImmutableValue HIGHLIGHTTEXT_VALUE =
  -	new ImmutableString(CSSPrimitiveValue.CSS_IDENT,
  -                            CSS_HIGHLIGHTTEXT_VALUE);
  -
  -    /**
  -     * The 'inactiveborder' identifier value.
  -     */
  -    ImmutableValue INACTIVEBORDER_VALUE =
  -	new ImmutableString(CSSPrimitiveValue.CSS_IDENT,
  -                            CSS_INACTIVEBORDER_VALUE);
  -
  -    /**
  -     * The 'inactivecaption' identifier value.
  -     */
  -    ImmutableValue INACTIVECAPTION_VALUE =
  -	new ImmutableString(CSSPrimitiveValue.CSS_IDENT,
  -                            CSS_INACTIVECAPTION_VALUE);
  -
  -    /**
  -     * The 'inactivecaptiontext' identifier value.
  -     */
  -    ImmutableValue INACTIVECAPTIONTEXT_VALUE =
  -	new ImmutableString(CSSPrimitiveValue.CSS_IDENT,
  -                            CSS_INACTIVECAPTIONTEXT_VALUE);
  -
  -    /**
  -     * The 'infobackground' identifier value.
  -     */
  -    ImmutableValue INFOBACKGROUND_VALUE =
  -	new ImmutableString(CSSPrimitiveValue.CSS_IDENT,
  -                            CSS_INFOBACKGROUND_VALUE);
  -
  -    /**
  -     * The 'infotext' identifier value.
  -     */
  -    ImmutableValue INFOTEXT_VALUE =
  -	new ImmutableString(CSSPrimitiveValue.CSS_IDENT,
  -                            CSS_INFOTEXT_VALUE);
  -
  -    /**
        * The 'inline' identifier value.
        */
       ImmutableValue INLINE_VALUE =
  @@ -415,20 +310,6 @@
                               CSS_MEDIUM_VALUE);
   
       /**
  -     * The 'menu' identifier value.
  -     */
  -    ImmutableValue MENU_VALUE =
  -	new ImmutableString(CSSPrimitiveValue.CSS_IDENT,
  -                            CSS_MENU_VALUE);
  -
  -    /**
  -     * The 'menutext' identifier value.
  -     */
  -    ImmutableValue MENUTEXT_VALUE =
  -	new ImmutableString(CSSPrimitiveValue.CSS_IDENT,
  -                            CSS_MENUTEXT_VALUE);
  -
  -    /**
        * The 'monospaced' keyword.
        */
       ImmutableValue MONOSPACED_VALUE =
  @@ -541,13 +422,6 @@
                               CSS_SCROLLBAR_VALUE);
   
       /**
  -     * The 'scrollbar' identifier value.
  -     */
  -    ImmutableValue SCROLLBAR_VALUE =
  -	new ImmutableString(CSSPrimitiveValue.CSS_IDENT,
  -                            CSS_SCROLLBAR_VALUE);
  -
  -    /**
        * The 'se-resize' identifier value.
        */
       ImmutableValue SE_RESIZE_VALUE =
  @@ -672,42 +546,6 @@
       ImmutableValue TEXT_VALUE =
   	new ImmutableString(CSSPrimitiveValue.CSS_IDENT,
                               CSS_TEXT_VALUE);
  -
  -    /**
  -     * The 'threeddarkshadow' identifier value.
  -     */
  -    ImmutableValue THREEDDARKSHADOW_VALUE =
  -	new ImmutableString(CSSPrimitiveValue.CSS_IDENT,
  -                            CSS_THREEDDARKSHADOW_VALUE);
  -
  -    /**
  -     * The 'threedface' identifier value.
  -     */
  -    ImmutableValue THREEDFACE_VALUE =
  -	new ImmutableString(CSSPrimitiveValue.CSS_IDENT,
  -                            CSS_THREEDFACE_VALUE);
  -
  -    
  -    /**
  -     * The 'threedhighlight' identifier value.
  -     */
  -    ImmutableValue THREEDHIGHLIGHT_VALUE =
  -	new ImmutableString(CSSPrimitiveValue.CSS_IDENT,
  -                            CSS_THREEDHIGHLIGHT_VALUE);
  -
  -    /**
  -     * The 'threedlightshadow' identifier value.
  -     */
  -    ImmutableValue THREEDLIGHTSHADOW_VALUE =
  -	new ImmutableString(CSSPrimitiveValue.CSS_IDENT,
  -                            CSS_THREEDLIGHTSHADOW_VALUE);
  -
  -    /**
  -     * The 'threedshadow' identifier value.
  -     */
  -    ImmutableValue THREEDSHADOW_VALUE =
  -	new ImmutableString(CSSPrimitiveValue.CSS_IDENT,
  -                            CSS_THREEDSHADOW_VALUE);
   
       /**
        * The 'ultra-condensed' identifier value.
  
  
  
  1.8       +3 -3      xml-batik/sources/org/apache/batik/dom/svg/DefaultUnitProcessorContext.java
  
  Index: DefaultUnitProcessorContext.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/dom/svg/DefaultUnitProcessorContext.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DefaultUnitProcessorContext.java	2001/02/01 13:45:48	1.7
  +++ DefaultUnitProcessorContext.java	2001/03/13 16:28:44	1.8
  @@ -24,7 +24,7 @@
    * The default unit processor context.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: DefaultUnitProcessorContext.java,v 1.7 2001/02/01 13:45:48 tkormann Exp $
  + * @version $Id: DefaultUnitProcessorContext.java,v 1.8 2001/03/13 16:28:44 hillion Exp $
    */
   public class DefaultUnitProcessorContext
       implements UnitProcessor.Context,
  @@ -73,7 +73,7 @@
       public float getViewportWidth() {
           SVGSVGElement svg = element.getOwnerSVGElement();
           if (svg == null) {
  -            return (float)context.getViewportWidth();
  +            return (float)context.getViewportWidth(element);
           }
           String s = svg.getAttributeNS(null, SVG_WIDTH_ATTRIBUTE);
           LengthParser p = new LengthParser();
  @@ -93,7 +93,7 @@
       public float getViewportHeight() {
           SVGSVGElement svg = element.getOwnerSVGElement();
           if (svg == null) {
  -            return (float)context.getViewportHeight();
  +            return (float)context.getViewportHeight(element);
           }
           String s = svg.getAttributeNS(null, SVG_HEIGHT_ATTRIBUTE);
           LengthParser p = new LengthParser();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org