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 2002/04/10 11:29:07 UTC

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

hillion     02/04/10 02:29:07

  Modified:    sources/org/apache/batik/css/dom
                        CSSOMSVGStyleDeclaration.java
                        CSSOMStyleDeclaration.java
               sources/org/apache/batik/css/engine StyleDeclaration.java
               sources/org/apache/batik/dom/svg SVGStylableElement.java
  Log:
  Fixed a CSS DOM bug.
  
  Revision  Changes    Path
  1.2       +7 -11     xml-batik/sources/org/apache/batik/css/dom/CSSOMSVGStyleDeclaration.java
  
  Index: CSSOMSVGStyleDeclaration.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/dom/CSSOMSVGStyleDeclaration.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CSSOMSVGStyleDeclaration.java	9 Apr 2002 16:27:18 -0000	1.1
  +++ CSSOMSVGStyleDeclaration.java	10 Apr 2002 09:29:07 -0000	1.2
  @@ -24,7 +24,7 @@
    * This class represents a SVG style declaration.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: CSSOMSVGStyleDeclaration.java,v 1.1 2002/04/09 16:27:18 hillion Exp $
  + * @version $Id: CSSOMSVGStyleDeclaration.java,v 1.2 2002/04/10 09:29:07 hillion Exp $
    */
   public class CSSOMSVGStyleDeclaration extends CSSOMStyleDeclaration {
       
  @@ -59,12 +59,12 @@
               switch (idx) {
               case SVGCSSEngine.FILL_INDEX:
               case SVGCSSEngine.STROKE_INDEX:
  -                return new StyleDeclarationColorValue(name);
  +                return new StyleDeclarationPaintValue(name);
   
               case SVGCSSEngine.FLOOD_COLOR_INDEX:
               case SVGCSSEngine.LIGHTING_COLOR_INDEX:
               case SVGCSSEngine.STOP_COLOR_INDEX:
  -                return new StyleDeclarationPaintValue(name);
  +                return new StyleDeclarationColorValue(name);
               }
           }
           return super.createCSSValue(name);
  @@ -73,7 +73,7 @@
       /**
        * This class represents a CSS value returned by this declaration.
        */
  -    protected class StyleDeclarationColorValue
  +    public class StyleDeclarationColorValue
           extends CSSOMSVGColor
           implements CSSOMSVGColor.ValueProvider {
           
  @@ -93,9 +93,7 @@
                           return StyleDeclarationColorValue.this.getValue();
                       }
                       public void textChanged(String text) throws DOMException {
  -                        if (values == null ||
  -                            values.get(this) == null ||
  -                            handler == null) {
  +                        if (handler == null) {
                               throw new DOMException
                                   (DOMException.NO_MODIFICATION_ALLOWED_ERR, "");
                           }
  @@ -123,7 +121,7 @@
       /**
        * This class represents a CSS value returned by this declaration.
        */
  -    protected class StyleDeclarationPaintValue
  +    public class StyleDeclarationPaintValue
           extends CSSOMSVGPaint
           implements CSSOMSVGPaint.ValueProvider {
           
  @@ -143,9 +141,7 @@
                           return StyleDeclarationPaintValue.this.getValue();
                       }
                       public void textChanged(String text) throws DOMException {
  -                        if (values == null ||
  -                            values.get(this) == null ||
  -                            handler == null) {
  +                        if (handler == null) {
                               throw new DOMException
                                   (DOMException.NO_MODIFICATION_ALLOWED_ERR, "");
                           }
  
  
  
  1.3       +8 -2      xml-batik/sources/org/apache/batik/css/dom/CSSOMStyleDeclaration.java
  
  Index: CSSOMStyleDeclaration.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/dom/CSSOMStyleDeclaration.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CSSOMStyleDeclaration.java	10 Apr 2002 08:08:30 -0000	1.2
  +++ CSSOMStyleDeclaration.java	10 Apr 2002 09:29:07 -0000	1.3
  @@ -24,7 +24,7 @@
    * This class represents a style declaration.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: CSSOMStyleDeclaration.java,v 1.2 2002/04/10 08:08:30 hillion Exp $
  + * @version $Id: CSSOMStyleDeclaration.java,v 1.3 2002/04/10 09:29:07 hillion Exp $
    */
   public class CSSOMStyleDeclaration implements CSSStyleDeclaration {
   
  @@ -179,9 +179,15 @@
        * Gets the CSS value associated with the given property.
        */
       protected CSSValue getCSSValue(String name) {
  -        CSSValue result = (CSSValue)values.get(name);
  +        CSSValue result = null;
  +        if (values != null) {
  +            result = (CSSValue)values.get(name);
  +        }
           if (result == null) {
               result = createCSSValue(name);
  +            if (values == null) {
  +                values = new HashMap(11);
  +            }
               values.put(name, result);
           }
           return result;
  
  
  
  1.3       +3 -3      xml-batik/sources/org/apache/batik/css/engine/StyleDeclaration.java
  
  Index: StyleDeclaration.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/engine/StyleDeclaration.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StyleDeclaration.java	9 Apr 2002 16:27:18 -0000	1.2
  +++ StyleDeclaration.java	10 Apr 2002 09:29:07 -0000	1.3
  @@ -16,7 +16,7 @@
    * This class represents a collection of CSS property values.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: StyleDeclaration.java,v 1.2 2002/04/09 16:27:18 hillion Exp $
  + * @version $Id: StyleDeclaration.java,v 1.3 2002/04/10 09:29:07 hillion Exp $
    */
   public class StyleDeclaration {
   
  @@ -85,9 +85,9 @@
       /**
        * Sets a value within the declaration.
        */
  -    public void put(Value v, int idx, boolean prio) {
  +    public void put(int idx, Value v, int i, boolean prio) {
           values[idx]     = v;
  -        indexes[idx]    = idx;
  +        indexes[idx]    = i;
           priorities[idx] = prio;
       }
   
  
  
  
  1.5       +2 -2      xml-batik/sources/org/apache/batik/dom/svg/SVGStylableElement.java
  
  Index: SVGStylableElement.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/dom/svg/SVGStylableElement.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SVGStylableElement.java	9 Apr 2002 16:27:18 -0000	1.4
  +++ SVGStylableElement.java	10 Apr 2002 09:29:07 -0000	1.5
  @@ -44,7 +44,7 @@
    * SVGStylable.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: SVGStylableElement.java,v 1.4 2002/04/09 16:27:18 hillion Exp $
  + * @version $Id: SVGStylableElement.java,v 1.5 2002/04/10 09:29:07 hillion Exp $
    */
   public abstract class SVGStylableElement
       extends SVGOMElement
  @@ -637,7 +637,7 @@
               for (int i = 0; i < declaration.size(); i++) {
                   if (idx == declaration.getIndex(i)) {
                       Value v = cssEngine.parsePropertyValue(name, value);
  -                    declaration.put(v, i, prio.length() > 0);
  +                    declaration.put(i, v, idx, prio.length() > 0);
                       mutate = true;
                       setAttributeNS(null, SVG_STYLE_ATTRIBUTE,
                                      declaration.toString(cssEngine));
  
  
  

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