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/02/15 17:42:04 UTC

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

hillion     01/02/15 08:42:04

  Modified:    sources/org/apache/batik/css/svg MarkerResolver.java
                        SVGValueFactoryMap.java SVGViewCSS.java
               sources/org/apache/batik/dom/svg
                        ElementNonCSSPresentationalHintsSupport.java
  Added:       sources/org/apache/batik/css/svg ColorProfileFactory.java
                        ColorProfileResolver.java
  Log:
  Added 'color-profile' property support to the CSS engine.
  
  Revision  Changes    Path
  1.3       +2 -7      xml-batik/sources/org/apache/batik/css/svg/MarkerResolver.java
  
  Index: MarkerResolver.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/svg/MarkerResolver.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MarkerResolver.java	2000/11/27 05:49:02	1.2
  +++ MarkerResolver.java	2001/02/15 16:42:00	1.3
  @@ -23,14 +23,9 @@
    * property.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: MarkerResolver.java,v 1.2 2000/11/27 05:49:02 hillion Exp $
  + * @version $Id: MarkerResolver.java,v 1.3 2001/02/15 16:42:00 hillion Exp $
    */
   public class MarkerResolver implements RelativeValueResolver {
  -    /**
  -     * The none CSS value.
  -     */
  -    public final static CSSOMReadOnlyValue NONE =
  -        new CSSOMReadOnlyValue(MarkerFactory.NONE_VALUE);
   
       /**
        * The handled property name.
  @@ -63,7 +58,7 @@
        * Returns the default value for the handled property.
        */
       public CSSOMReadOnlyValue getDefaultValue() {
  -	return NONE;
  +	return new CSSOMReadOnlyValue(MarkerFactory.NONE_VALUE);
       }
       
       /**
  
  
  
  1.6       +4 -1      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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SVGValueFactoryMap.java	2001/02/05 09:55:31	1.5
  +++ SVGValueFactoryMap.java	2001/02/15 16:42:00	1.6
  @@ -16,7 +16,7 @@
    * to contains factories for SVG CSS values.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: SVGValueFactoryMap.java,v 1.5 2001/02/05 09:55:31 hillion Exp $
  + * @version $Id: SVGValueFactoryMap.java,v 1.6 2001/02/15 16:42:00 hillion Exp $
    */
   public class SVGValueFactoryMap
       extends    CommonValueFactoryMap
  @@ -38,6 +38,9 @@
   
   	put(CSS_CLIP_RULE_PROPERTY,
               new ClipRuleFactory(p));
  +
  +	put(CSS_COLOR_PROFILE_PROPERTY,
  +            new ColorProfileFactory(p));
   
   	put(CSS_COLOR_PROPERTY,
               new SVGColorFactory(p, CSS_COLOR_PROPERTY));
  
  
  
  1.7       +2 -1      xml-batik/sources/org/apache/batik/css/svg/SVGViewCSS.java
  
  Index: SVGViewCSS.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/svg/SVGViewCSS.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SVGViewCSS.java	2001/02/05 09:55:31	1.6
  +++ SVGViewCSS.java	2001/02/15 16:42:01	1.7
  @@ -16,7 +16,7 @@
    * the SVG CSS.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: SVGViewCSS.java,v 1.6 2001/02/05 09:55:31 hillion Exp $
  + * @version $Id: SVGViewCSS.java,v 1.7 2001/02/15 16:42:01 hillion Exp $
    */
   
   public class SVGViewCSS
  @@ -34,6 +34,7 @@
   	addRelativeValueResolver(new ClipPathResolver());
   	addRelativeValueResolver(new ClipRuleResolver());
   	addRelativeValueResolver(new ColorInterpolationResolver());
  +	addRelativeValueResolver(new ColorProfileResolver());
   	addRelativeValueResolver(new ColorRenderingResolver());
   	addRelativeValueResolver(new DominantBaselineResolver());
   	addRelativeValueResolver(new EnableBackgroundResolver());
  
  
  
  1.1                  xml-batik/sources/org/apache/batik/css/svg/ColorProfileFactory.java
  
  Index: ColorProfileFactory.java
  ===================================================================
  /*****************************************************************************
   * Copyright (C) The Apache Software Foundation. All rights reserved.        *
   * ------------------------------------------------------------------------- *
   * This software is published under the terms of the Apache Software License *
   * version 1.1, a copy of which has been included with this distribution in  *
   * the LICENSE file.                                                         *
   *****************************************************************************/
  
  package org.apache.batik.css.svg;
  
  import org.apache.batik.css.PropertyMap;
  import org.apache.batik.css.value.AbstractIdentifierFactory;
  import org.apache.batik.css.value.ImmutableString;
  import org.apache.batik.css.value.ImmutableValue;
  import org.w3c.css.sac.LexicalUnit;
  import org.w3c.css.sac.Parser;
  import org.w3c.dom.DOMException;
  import org.w3c.dom.css.CSSPrimitiveValue;
  
  /**
   * This class provides a factory for the color-profile property values.
   *
   * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
   * @version $Id: ColorProfileFactory.java,v 1.1 2001/02/15 16:41:59 hillion Exp $
   */
  public class ColorProfileFactory
      extends    AbstractIdentifierFactory
      implements SVGValueConstants {
  
      /**
       * The identifier values.
       */
      protected final static PropertyMap values = new PropertyMap();
      static {
  	values.put(CSS_AUTO_VALUE,  START_VALUE);
  	values.put(CSS_SRGB_VALUE,  SRGB_VALUE);
      }
  
      /**
       * Creates a new ColorProfileFactory.
       */
      public ColorProfileFactory(Parser p) {
          super(p);
      }
  
      /**
       * Returns the name of the property handled.
       */
      public String getPropertyName() {
  	return CSS_TEXT_ANCHOR_PROPERTY;
      }
      
      /**
       * Creates a value from a lexical unit.
       */
      public ImmutableValue createValue(LexicalUnit lu) throws DOMException {
  	if (lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT) {
  	    if (lu.getStringValue().equalsIgnoreCase(CSS_AUTO_VALUE)) {
  		return AUTO_VALUE;
  	    }
  	}
          return super.createValue(lu);
      }
  
      /**
       * Creates and returns a new string value.
       * @param type   A string code as defined in CSSPrimitiveValue. The string
       *               code can only be a string unit type.
       * @param value  The new string value. 
       */
      public ImmutableValue createStringValue(short type, String value)
  	throws DOMException {
  	if (type == CSSPrimitiveValue.CSS_IDENT &&
              value.equalsIgnoreCase(CSS_AUTO_VALUE)) {
              return AUTO_VALUE;
          }
          return super.createStringValue(type, value);
      }
  
      /**
       * Returns the property map that contains the possible values.
       */
      protected PropertyMap getIdentifiers() {
  	return values;
      }
  }
  
  
  
  1.1                  xml-batik/sources/org/apache/batik/css/svg/ColorProfileResolver.java
  
  Index: ColorProfileResolver.java
  ===================================================================
  /*****************************************************************************
   * Copyright (C) The Apache Software Foundation. All rights reserved.        *
   * ------------------------------------------------------------------------- *
   * This software is published under the terms of the Apache Software License *
   * version 1.1, a copy of which has been included with this distribution in  *
   * the LICENSE file.                                                         *
   *****************************************************************************/
  
  package org.apache.batik.css.svg;
  
  import org.apache.batik.css.CSSOMReadOnlyStyleDeclaration;
  import org.apache.batik.css.CSSOMReadOnlyValue;
  import org.apache.batik.css.value.RelativeValueResolver;
  
  import org.w3c.dom.Element;
  import org.w3c.dom.css.ViewCSS;
  
  /**
   * This class provides a relative value resolver for the color-profile
   * property.
   *
   * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
   * @version $Id: ColorProfileResolver.java,v 1.1 2001/02/15 16:41:59 hillion Exp $
   */
  public class ColorProfileResolver implements RelativeValueResolver {
      
      /**
       * Whether the handled property is inherited or not.
       */
      public boolean isInheritedProperty() {
  	return true;
      }
  
      /**
       * Returns the name of the handled property.
       */
      public String getPropertyName() {
  	return ColorProfileFactory.CSS_COLOR_PROFILE_PROPERTY;
      }
  
      /**
       * Returns the default value for the handled property.
       */
      public CSSOMReadOnlyValue getDefaultValue() {
  	return new CSSOMReadOnlyValue(ColorProfileFactory.AUTO_VALUE);
      }
      
      /**
       * Resolves the given value if relative, and puts it in the given table.
       * @param element The element to which this value applies.
       * @param pseudoElement The pseudo element if one.
       * @param view The view CSS of the current document.
       * @param styleDeclaration The computed style declaration.
       * @param value The cascaded value.
       * @param priority The priority of the cascaded value.
       * @param origin The origin of the cascaded value.
       */
      public void resolveValue(Element element,
  			     String pseudoElement,
  			     ViewCSS view,
  			     CSSOMReadOnlyStyleDeclaration styleDeclaration,
  			     CSSOMReadOnlyValue value,
  			     String priority,
  			     int origin) {
          // Nothing to do.
      }
  }
  
  
  
  1.5       +2 -1      xml-batik/sources/org/apache/batik/dom/svg/ElementNonCSSPresentationalHintsSupport.java
  
  Index: ElementNonCSSPresentationalHintsSupport.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/dom/svg/ElementNonCSSPresentationalHintsSupport.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ElementNonCSSPresentationalHintsSupport.java	2001/02/01 16:41:55	1.4
  +++ ElementNonCSSPresentationalHintsSupport.java	2001/02/15 16:42:03	1.5
  @@ -23,7 +23,7 @@
    * processing in SVG.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: ElementNonCSSPresentationalHintsSupport.java,v 1.4 2001/02/01 16:41:55 vhardy Exp $
  + * @version $Id: ElementNonCSSPresentationalHintsSupport.java,v 1.5 2001/02/15 16:42:03 hillion Exp $
    */
   public class ElementNonCSSPresentationalHintsSupport
       implements CSSConstants {
  @@ -39,6 +39,7 @@
           PRESENTATION_ATTRIBUTES.add(CSS_CLIP_RULE_PROPERTY);
           PRESENTATION_ATTRIBUTES.add(CSS_COLOR_PROPERTY);
           PRESENTATION_ATTRIBUTES.add(CSS_COLOR_INTERPOLATION_PROPERTY);
  +        PRESENTATION_ATTRIBUTES.add(CSS_COLOR_PROFILE_PROPERTY);
           PRESENTATION_ATTRIBUTES.add(CSS_COLOR_RENDERING_PROPERTY);
           PRESENTATION_ATTRIBUTES.add(CSS_CURSOR_PROPERTY);
           PRESENTATION_ATTRIBUTES.add(CSS_DIRECTION_PROPERTY);