deweese     2003/09/26 18:48:15

  Modified:    sources/org/apache/batik/css/dom CSSOMComputedStyle.java
               sources/org/apache/batik/css/engine/value
                        AbstractColorManager.java AbstractValueManager.java
               sources/org/apache/batik/css/engine/value/css2
                        CursorManager.java SrcManager.java
               sources/org/apache/batik/css/engine/value/svg
                        ClipPathManager.java ColorManager.java
                        ColorProfileManager.java FilterManager.java
                        MarkerManager.java MaskManager.java
                        SVGPaintManager.java
               sources/org/apache/batik/dom/svg SVGStylableElement.java
               test-resources/org/apache/batik/test samplesRendering.xml
  Added:       samples/tests/spec/scripting relativeURI.svg
               sources/org/apache/batik/css/engine/value URIValue.java
               test-references/samples/tests/spec/scripting relativeURI.png
  Log:
  1) 'getCssText()' on style that have URI's does not return the
     absolute version of the URI it returns the original css Text.
     It does return the absolute version for getStringValue().
     For computed values it always returns the absolute version of
     the URI.
  2) Added test for #1 that checks all property types that accept
     URI's in SVG.
  
  Revision  Changes    Path
  1.1                  xml-batik/samples/tests/spec/scripting/relativeURI.svg
  
  Index: relativeURI.svg
  ===================================================================
  <?xml version="1.0" standalone="no"?>
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
  "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd";>
  
  <!--
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Batik" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      [EMAIL PROTECTED]
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  -->
  
  <!-- ====================================================================== -->
  <!-- Test of getting/setting current Scale and Translate.                   -->
  <!--                                                                        -->
  <!-- @author [EMAIL PROTECTED]                                             -->
  <!-- @version $Id: relativeURI.svg,v 1.1 2003/09/27 01:48:14 deweese Exp $ -->
  <!-- ====================================================================== -->
  
  <?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>  
  
  <svg id="body" width="450" height="500" viewBox="0 0 450 500"
       onload="init()"
       xmlns="http://www.w3.org/2000/svg"; 
       xmlns:xlink="http://www.w3.org/1999/xlink";>
  
      <title>Test of CSS with relative URIs</title>
      <text class="title" x="50%" y="50">Test of CSS with relative URIs</text>
  
  
  <script type="text/ecmascript"><![CDATA[
  var root = document.getRootElement();
  
  var t0 = document.getElementById('t0');
  var t1 = document.getElementById('t1');
  var t2 = document.getElementById('t2');
  var t3 = document.getElementById('t3');
  var t4 = document.getElementById('t4');
  var t5 = document.getElementById('t5');
  var t6 = document.getElementById('t6');
  var t7 = document.getElementById('t7');
  var t8 = document.getElementById('t8');
  var t9 = document.getElementById('t9');
  var t10 = document.getElementById('t10');
  var t11 = document.getElementById('t11');
  var t12 = document.getElementById('t12');
  var t13 = document.getElementById('t13');
  var t14 = document.getElementById('t14');
  
  var docURL = document.getURL();
  
  function unifyURL(str) {
    var start = str.indexOf(docURL);
    if (start == -1) return str;
    var before = str.substring(0, start);
    var after  = str.substring(start+docURL.length);
    return before + "<doc>" + after;
  }
  
  function init() {
    var view = document.getDefaultView();
  
    var elem = document.getElementById('xxx');
    var cssStyle = elem.getStyle();
    var computedStyle = view.getComputedStyle(elem, "");
    
    cssStyle.setProperty("fill", "url(#grad)","");
    var localStr = cssStyle.getPropertyValue("fill");
    var absStr = computedStyle.getPropertyValue("fill");
    t1.firstChild.nodeValue = unifyURL(localStr);
    t2.firstChild.nodeValue = unifyURL(absStr);
  
    cssStyle.setProperty("cursor", "url(#cur),crosshair","");
    localStr = cssStyle.getPropertyValue("cursor");
    absStr = computedStyle.getPropertyCSSValue("cursor");
    absStr = absStr.item(0).getCssText();
    t3.firstChild.nodeValue = unifyURL(localStr);
    t4.firstChild.nodeValue = unifyURL(absStr);
  
    cssStyle.setProperty("clip-path", "url(#clip)","");
    localStr = cssStyle.getPropertyValue("clip-path");
    absStr = computedStyle.getPropertyValue("clip-path");
    t5.firstChild.nodeValue = unifyURL(localStr);
    t6.firstChild.nodeValue = unifyURL(absStr);
  
    cssStyle.setProperty("color-profile", "url(#prof)","");
    localStr = cssStyle.getPropertyValue("color-profile");
    absStr = computedStyle.getPropertyValue("color-profile");
    t7.firstChild.nodeValue = unifyURL(localStr);
    t8.firstChild.nodeValue = unifyURL(absStr);
  
    cssStyle.setProperty("filter", "url(#filt)","");
    localStr = cssStyle.getPropertyValue("filter");
    absStr = computedStyle.getPropertyValue("filter");
    t9.firstChild.nodeValue  = unifyURL(localStr);
    t10.firstChild.nodeValue = unifyURL(absStr);
  
    elem = document.getElementById('yyy');
    var cssStyle = elem.getStyle();
    computedStyle = view.getComputedStyle(elem, "");
  
    cssStyle.setProperty("marker-start", "url(#mark)","");
    localStr = cssStyle.getPropertyValue("marker-start");
    absStr = computedStyle.getPropertyValue("marker-start");
    t11.firstChild.nodeValue = unifyURL(localStr);
    t12.firstChild.nodeValue = unifyURL(absStr);
  
    cssStyle.setProperty("mask", "url(#mask)","");
    localStr = cssStyle.getPropertyValue("mask");
    absStr = computedStyle.getPropertyValue("mask");
    t13.firstChild.nodeValue = unifyURL(localStr);
    t14.firstChild.nodeValue = unifyURL(absStr);
  }
  
  function regardStart() {
    inRegard = true;
  }
  ]]></script>
  
  <!-- cursor, src, clip-path, color-profile, filter, marker, mask -->
  
    <radialGradient id="grad">
      <stop offset="0" stop-color="gold" />
      <stop offset="1" stop-color="crimson" />
    </radialGradient>
    
    <cursor id="cur" x="16" y="16" 
      xlink:href="../../resources/images/hotSpotCenter.png"/>
  
    <clipPath id="clip" clipPathUnits="objectBoundingBox">
      <circle cx=".25"  cy=".5" r=".4"/>
      <circle cx=".75"  cy=".5" r=".4"/>
    </clipPath>
  
    <color-profile id="prof" name="changeColorAuto" 
      rendering-intent="auto"
      xlink:href="../../resources/icc/changeColor.icm"/>
  
    <filter id="filt" primitiveUnits="objectBoundingBox"
      filterUnits="objectBoundingBox"
      x="0" y="0" width="200%" height="200%">
      <feOffset x="0%" y="0%" width="50%" height="50%"/>
      <feTile /> 
    </filter>
  
    <marker id="mark" markerWidth="48" markerHeight="32" 
      viewBox="-10 -3 13 6" orient="auto" refX="0" refY="0"
      markerUnits="strokeWidth">
      <g stroke="none" fill="gold">
        <circle r="3" />
        <rect x="-1" y="0" width="2" height="7" />
        <path d="M -3 6 l 6 0 l -3 3 z" />
      </g>
    </marker>
  
    <mask id="mask">
      <g transform="translate(275, 400)">
        <circle cx="-25" cy="-10" r="25" fill="#ff0000" />
        <circle cx="25" cy="-10" r="25" fill="#00ff00" />
        <circle cx="-25" cy="10" r="25" fill="#0000ff" />
        <circle cx="25" cy="10" r="25" fill="#ffffff" />
      </g>
    </mask>
  
    <g transform="translate(30, 75)">
      <g stroke="black" >
        <rect x="120" y="15" width="210" height="30" fill="white"/>
        <rect x="20" y="45" width="310" height="30" fill="lightgrey"/>
        <rect x="20" y="75" width="310" height="30" fill="white"/>
        <rect x="20" y="105" width="310" height="30" fill="lightgrey"/>
        <rect x="20" y="135" width="310" height="30" fill="white"/>
        <rect x="20" y="165" width="310" height="30" fill="lightgrey"/>
        <rect x="20" y="195" width="310" height="30" fill="white"/>
        <rect x="20" y="225" width="310" height="30" fill="lightgrey"/>
        <line x1="225" y1="15" x2="225" y2="255"/>
        <line x1="120" y1="15" x2="120" y2="255"/>
      </g>
      <g text-anchor="middle">
        <text x="175" y="35">Style</text>
        <text x="275" y="35">Computed</text>
  
        <text x="75" y="65">fill</text>
        <text id="t1" x="175" y="65"> </text>
        <text id="t2" x="275" y="65"> </text>
  
        <text x="75" y="95">cursor</text>
        <text id="t3" x="175" y="95"> </text>
        <text id="t4" x="275" y="95"> </text>
  
        <text x="75" y="125">clip-path</text>
        <text id="t5" x="175" y="125"> </text>
        <text id="t6" x="275" y="126"> </text>
  
        <text x="75" y="155">color-profile</text>
        <text id="t7" x="175" y="155"> </text>
        <text id="t8" x="275" y="155"> </text>
  
        <text x="75" y="185">filter</text>
        <text id="t9" x="175" y="185"> </text>
        <text id="t10" x="275" y="185"> </text>
  
        <text x="75" y="215">marker</text>
        <text id="t11" x="175" y="215"> </text>
        <text id="t12" x="275" y="215"> </text>
  
        <text x="75" y="245">mask</text>
        <text id="t13" x="175" y="245"> </text>
        <text id="t14" x="275" y="245"> </text>
      </g>
    </g>
    <rect id="xxx" x="75" y="375" width="100" height="50"
      style="fill:blue"/>
  
    <path id="yyy" d="M225 375 h 100 v 50 h -100 z"
      marker-end="url(#mark)"
      style="fill:crimson" stroke="black" stroke-width="1"/>
  
  </svg>
  
  
  1.5       +2 -2      
xml-batik/sources/org/apache/batik/css/dom/CSSOMComputedStyle.java
  
  Index: CSSOMComputedStyle.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/dom/CSSOMComputedStyle.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- CSSOMComputedStyle.java   8 Aug 2003 11:38:54 -0000       1.4
  +++ CSSOMComputedStyle.java   27 Sep 2003 01:48:14 -0000      1.5
  @@ -217,7 +217,7 @@
       /**
        * To manage a computed CSSValue.
        */
  -    protected class ComputedCSSValue
  +    public class ComputedCSSValue
           extends CSSOMValue
           implements CSSOMValue.ValueProvider {
           
  
  
  
  1.4       +3 -2      
xml-batik/sources/org/apache/batik/css/engine/value/AbstractColorManager.java
  
  Index: AbstractColorManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/value/AbstractColorManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractColorManager.java 8 Aug 2003 11:38:55 -0000       1.3
  +++ AbstractColorManager.java 27 Sep 2003 01:48:14 -0000      1.4
  @@ -242,7 +242,7 @@
               }
               return engine.getCSSContext().getSystemColor(ident);
           }
  -        return value;
  +        return super.computeValue(elt, pseudo, engine, idx, sm, value);
       }
   
       /**
  @@ -287,4 +287,5 @@
           String s = Messages.formatMessage("invalid.rgb.component.unit", p);
           return new DOMException(DOMException.NOT_SUPPORTED_ERR, s);
       }
  +
   }
  
  
  
  1.4       +10 -1     
xml-batik/sources/org/apache/batik/css/engine/value/AbstractValueManager.java
  
  Index: AbstractValueManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/value/AbstractValueManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractValueManager.java 8 Aug 2003 11:38:55 -0000       1.3
  +++ AbstractValueManager.java 27 Sep 2003 01:48:14 -0000      1.4
  @@ -53,6 +53,8 @@
   import org.apache.batik.css.engine.CSSEngine;
   import org.apache.batik.css.engine.CSSStylableElement;
   import org.apache.batik.css.engine.StyleMap;
  +import org.w3c.dom.css.CSSPrimitiveValue;
  +import org.w3c.dom.css.CSSValue;
   import org.w3c.dom.DOMException;
   
   /**
  @@ -93,6 +95,13 @@
                                 int idx,
                                 StyleMap sm,
                                 Value value) {
  +        
  +        if ((value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) &&
  +            (value.getPrimitiveType() == CSSPrimitiveValue.CSS_URI)) {
  +            // Reveal the absolute value as the cssText now.
  +            return new URIValue(value.getStringValue(),
  +                                value.getStringValue());
  +        }
           return value;
       }
   }
  
  
  
  1.1                  
xml-batik/sources/org/apache/batik/css/engine/value/URIValue.java
  
  Index: URIValue.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Batik" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      [EMAIL PROTECTED]
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.batik.css.engine.value;
  
  import org.w3c.dom.DOMException;
  import org.w3c.dom.css.CSSPrimitiveValue;
  
  /**
   * This class represents uri values.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a>
   * @version $Id: URIValue.java,v 1.1 2003/09/27 01:48:14 deweese Exp $
   */
  public class URIValue extends StringValue {
  
      String cssText;
  
      /**
       * Creates a new StringValue.
       */
      public URIValue(String cssText, String uri) {
          super(CSSPrimitiveValue.CSS_URI, uri);
          this.cssText = cssText;
      }
  
      /**
       * A string representation of the current value. 
       */
      public String getCssText() {
          return "url(" + cssText + ")";
      }
  }
  
  
  
  1.4       +38 -6     
xml-batik/sources/org/apache/batik/css/engine/value/css2/CursorManager.java
  
  Index: CursorManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/value/css2/CursorManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CursorManager.java        8 Aug 2003 11:38:56 -0000       1.3
  +++ CursorManager.java        27 Sep 2003 01:48:14 -0000      1.4
  @@ -51,16 +51,19 @@
   package org.apache.batik.css.engine.value.css2;
   
   import org.apache.batik.css.engine.CSSEngine;
  +import org.apache.batik.css.engine.CSSStylableElement;
  +import org.apache.batik.css.engine.StyleMap;
   import org.apache.batik.css.engine.value.AbstractValueManager;
   import org.apache.batik.css.engine.value.ListValue;
   import org.apache.batik.css.engine.value.StringMap;
  -import org.apache.batik.css.engine.value.StringValue;
  +import org.apache.batik.css.engine.value.URIValue;
   import org.apache.batik.css.engine.value.Value;
   import org.apache.batik.css.engine.value.ValueConstants;
   import org.apache.batik.util.CSSConstants;
   import org.w3c.css.sac.LexicalUnit;
   import org.w3c.dom.DOMException;
   import org.w3c.dom.css.CSSPrimitiveValue;
  +import org.w3c.dom.css.CSSValue;
   
   /**
    * This class provides a manager for the 'cursor' property values.
  @@ -142,10 +145,9 @@
   
           case LexicalUnit.SAC_URI:
               do {
  -                result.append
  -                    (new StringValue(CSSPrimitiveValue.CSS_URI,
  -                                     resolveURI(engine.getCSSBaseURI(),
  -                                                lu.getStringValue())));
  +                result.append(new URIValue(lu.getStringValue(),
  +                                           resolveURI(engine.getCSSBaseURI(),
  +                                                      lu.getStringValue())));
                   lu = lu.getNextLexicalUnit();
                   if (lu == null) {
                       throw createMalformedLexicalUnitDOMException();
  @@ -181,4 +183,34 @@
           }
           return result;
       }
  +
  +    /**
  +     * Implements [EMAIL PROTECTED]
  +     * 
ValueManager#computeValue(CSSStylableElement,String,CSSEngine,int,StyleMap,Value)}.
  +     */
  +    public Value computeValue(CSSStylableElement elt,
  +                              String pseudo,
  +                              CSSEngine engine,
  +                              int idx,
  +                              StyleMap sm,
  +                              Value value) {
  +        if (value.getCssValueType() == CSSValue.CSS_VALUE_LIST) {
  +            ListValue lv = (ListValue)value;
  +            int len = lv.getLength();
  +            ListValue result = new ListValue(' ');
  +            for (int i=0; i<len; i++) {
  +                Value v = lv.item(0);
  +                if (v.getPrimitiveType() == CSSPrimitiveValue.CSS_URI) {
  +                    // Reveal the absolute value as the cssText now.
  +                    result.append(new URIValue(v.getStringValue(),
  +                                               v.getStringValue()));
  +                } else {
  +                    result.append(v);
  +                }
  +            }
  +            return result;
  +        }
  +        return super.computeValue(elt, pseudo, engine, idx, sm, value);
  +    }
  +
   }
  
  
  
  1.5       +3 -2      
xml-batik/sources/org/apache/batik/css/engine/value/css2/SrcManager.java
  
  Index: SrcManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/value/css2/SrcManager.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SrcManager.java   14 Aug 2003 00:53:51 -0000      1.4
  +++ SrcManager.java   27 Sep 2003 01:48:14 -0000      1.5
  @@ -55,6 +55,7 @@
   import org.apache.batik.css.engine.value.ListValue;
   import org.apache.batik.css.engine.value.StringMap;
   import org.apache.batik.css.engine.value.StringValue;
  +import org.apache.batik.css.engine.value.URIValue;
   import org.apache.batik.css.engine.value.Value;
   import org.apache.batik.css.engine.value.ValueConstants;
   import org.apache.batik.util.CSSConstants;
  @@ -142,7 +143,7 @@
                   String uri = resolveURI(engine.getCSSBaseURI(), 
                                           lu.getStringValue());
                   
  -                result.append(new StringValue(CSSPrimitiveValue.CSS_URI, uri));
  +                result.append(new URIValue(lu.getStringValue(), uri));
                   lu = lu.getNextLexicalUnit();
                   if ((lu != null) && 
                       (lu.getLexicalUnitType() == LexicalUnit.SAC_FUNCTION)) {
  
  
  
  1.4       +7 -7      
xml-batik/sources/org/apache/batik/css/engine/value/svg/ClipPathManager.java
  
  Index: ClipPathManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/value/svg/ClipPathManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ClipPathManager.java      8 Aug 2003 11:38:56 -0000       1.3
  +++ ClipPathManager.java      27 Sep 2003 01:48:14 -0000      1.4
  @@ -52,7 +52,7 @@
   
   import org.apache.batik.css.engine.CSSEngine;
   import org.apache.batik.css.engine.value.AbstractValueManager;
  -import org.apache.batik.css.engine.value.StringValue;
  +import org.apache.batik.css.engine.value.URIValue;
   import org.apache.batik.css.engine.value.Value;
   import org.apache.batik.css.engine.value.ValueConstants;
   import org.apache.batik.util.CSSConstants;
  @@ -99,9 +99,9 @@
            return ValueConstants.INHERIT_VALUE;
   
        case LexicalUnit.SAC_URI:
  -            return new StringValue(CSSPrimitiveValue.CSS_URI,
  -                                   resolveURI(engine.getCSSBaseURI(),
  -                                              lu.getStringValue()));
  +            return new URIValue(lu.getStringValue(),
  +                                resolveURI(engine.getCSSBaseURI(),
  +                                           lu.getStringValue()));
   
        case LexicalUnit.SAC_IDENT:
            if (lu.getStringValue().equalsIgnoreCase
  @@ -126,8 +126,8 @@
               break;
   
           case CSSPrimitiveValue.CSS_URI:
  -            return new StringValue(CSSPrimitiveValue.CSS_URI,
  -                                   resolveURI(engine.getCSSBaseURI(), value));
  +            return new URIValue(value, 
  +                                resolveURI(engine.getCSSBaseURI(), value));
        }
           throw createInvalidStringTypeDOMException(type);
       }
  
  
  
  1.4       +3 -1      
xml-batik/sources/org/apache/batik/css/engine/value/svg/ColorManager.java
  
  Index: ColorManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/value/svg/ColorManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ColorManager.java 8 Aug 2003 11:38:56 -0000       1.3
  +++ ColorManager.java 27 Sep 2003 01:48:14 -0000      1.4
  @@ -665,4 +665,6 @@
       public Value getDefaultValue() {
           return DEFAULT_VALUE;
       }
  +
  +
   }
  
  
  
  1.4       +7 -6      
xml-batik/sources/org/apache/batik/css/engine/value/svg/ColorProfileManager.java
  
  Index: ColorProfileManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/value/svg/ColorProfileManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ColorProfileManager.java  8 Aug 2003 11:38:56 -0000       1.3
  +++ ColorProfileManager.java  27 Sep 2003 01:48:14 -0000      1.4
  @@ -53,6 +53,7 @@
   import org.apache.batik.css.engine.CSSEngine;
   import org.apache.batik.css.engine.value.AbstractValueManager;
   import org.apache.batik.css.engine.value.StringValue;
  +import org.apache.batik.css.engine.value.URIValue;
   import org.apache.batik.css.engine.value.Value;
   import org.apache.batik.util.CSSConstants;
   import org.w3c.css.sac.LexicalUnit;
  @@ -108,9 +109,9 @@
               return new StringValue(CSSPrimitiveValue.CSS_IDENT, s);
               
           case LexicalUnit.SAC_URI:
  -            return new StringValue(CSSPrimitiveValue.CSS_URI,
  -                                   resolveURI(engine.getCSSBaseURI(),
  -                                              lu.getStringValue()));
  +            return new URIValue(lu.getStringValue(),
  +                                resolveURI(engine.getCSSBaseURI(),
  +                                           lu.getStringValue()));
           }
           throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());
       }
  @@ -133,8 +134,8 @@
               return new StringValue(CSSPrimitiveValue.CSS_IDENT, s);
   
           case CSSPrimitiveValue.CSS_URI:
  -            return new StringValue(CSSPrimitiveValue.CSS_URI,
  -                                   resolveURI(engine.getCSSBaseURI(), value));
  +            return new URIValue(value,
  +                                resolveURI(engine.getCSSBaseURI(), value));
           }
           throw createInvalidStringTypeDOMException(type);
       }
  
  
  
  1.4       +7 -7      
xml-batik/sources/org/apache/batik/css/engine/value/svg/FilterManager.java
  
  Index: FilterManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/value/svg/FilterManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FilterManager.java        8 Aug 2003 11:38:56 -0000       1.3
  +++ FilterManager.java        27 Sep 2003 01:48:14 -0000      1.4
  @@ -52,7 +52,7 @@
   
   import org.apache.batik.css.engine.CSSEngine;
   import org.apache.batik.css.engine.value.AbstractValueManager;
  -import org.apache.batik.css.engine.value.StringValue;
  +import org.apache.batik.css.engine.value.URIValue;
   import org.apache.batik.css.engine.value.Value;
   import org.apache.batik.util.CSSConstants;
   import org.w3c.css.sac.LexicalUnit;
  @@ -99,9 +99,9 @@
            return SVGValueConstants.INHERIT_VALUE;
   
           case LexicalUnit.SAC_URI:
  -            return new StringValue(CSSPrimitiveValue.CSS_URI,
  -                                   resolveURI(engine.getCSSBaseURI(),
  -                                              lu.getStringValue()));
  +            return new URIValue(lu.getStringValue(),
  +                                resolveURI(engine.getCSSBaseURI(),
  +                                           lu.getStringValue()));
   
           case LexicalUnit.SAC_IDENT:
            if (lu.getStringValue().equalsIgnoreCase
  @@ -126,8 +126,8 @@
               throw createInvalidIdentifierDOMException(value);
        }
        if (type == CSSPrimitiveValue.CSS_URI) {
  -         return new StringValue(type, resolveURI(engine.getCSSBaseURI(),
  -                                                    value));
  +         return new URIValue(value, 
  +                                resolveURI(engine.getCSSBaseURI(), value));
        }
           throw createInvalidStringTypeDOMException(type);
       }
  
  
  
  1.4       +7 -7      
xml-batik/sources/org/apache/batik/css/engine/value/svg/MarkerManager.java
  
  Index: MarkerManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/value/svg/MarkerManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MarkerManager.java        8 Aug 2003 11:38:56 -0000       1.3
  +++ MarkerManager.java        27 Sep 2003 01:48:14 -0000      1.4
  @@ -52,7 +52,7 @@
   
   import org.apache.batik.css.engine.CSSEngine;
   import org.apache.batik.css.engine.value.AbstractValueManager;
  -import org.apache.batik.css.engine.value.StringValue;
  +import org.apache.batik.css.engine.value.URIValue;
   import org.apache.batik.css.engine.value.Value;
   import org.apache.batik.css.engine.value.ValueConstants;
   import org.apache.batik.util.CSSConstants;
  @@ -111,9 +111,9 @@
            return ValueConstants.INHERIT_VALUE;
   
        case LexicalUnit.SAC_URI:
  -            return new StringValue(CSSPrimitiveValue.CSS_URI,
  -                                   resolveURI(engine.getCSSBaseURI(),
  -                                              lu.getStringValue()));
  +            return new URIValue(lu.getStringValue(),
  +                                resolveURI(engine.getCSSBaseURI(),
  +                                           lu.getStringValue()));
   
        case LexicalUnit.SAC_IDENT:
            if (lu.getStringValue().equalsIgnoreCase
  @@ -138,8 +138,8 @@
               break;
   
           case CSSPrimitiveValue.CSS_URI:
  -            return new StringValue(CSSPrimitiveValue.CSS_URI,
  -                                   resolveURI(engine.getCSSBaseURI(), value));
  +            return new URIValue(value,
  +                                resolveURI(engine.getCSSBaseURI(), value));
        }
           throw createInvalidStringTypeDOMException(type);
       }
  
  
  
  1.4       +7 -7      
xml-batik/sources/org/apache/batik/css/engine/value/svg/MaskManager.java
  
  Index: MaskManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/value/svg/MaskManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MaskManager.java  8 Aug 2003 11:38:56 -0000       1.3
  +++ MaskManager.java  27 Sep 2003 01:48:14 -0000      1.4
  @@ -52,7 +52,7 @@
   
   import org.apache.batik.css.engine.CSSEngine;
   import org.apache.batik.css.engine.value.AbstractValueManager;
  -import org.apache.batik.css.engine.value.StringValue;
  +import org.apache.batik.css.engine.value.URIValue;
   import org.apache.batik.css.engine.value.Value;
   import org.apache.batik.css.engine.value.ValueConstants;
   import org.apache.batik.util.CSSConstants;
  @@ -99,9 +99,9 @@
            return ValueConstants.INHERIT_VALUE;
   
        case LexicalUnit.SAC_URI:
  -            return new StringValue(CSSPrimitiveValue.CSS_URI,
  -                                   resolveURI(engine.getCSSBaseURI(),
  -                                              lu.getStringValue()));
  +            return new URIValue(lu.getStringValue(),
  +                                resolveURI(engine.getCSSBaseURI(),
  +                                           lu.getStringValue()));
   
        case LexicalUnit.SAC_IDENT:
            if (lu.getStringValue().equalsIgnoreCase
  @@ -126,8 +126,8 @@
               break;
   
           case CSSPrimitiveValue.CSS_URI:
  -            return new StringValue(CSSPrimitiveValue.CSS_URI,
  -                                   resolveURI(engine.getCSSBaseURI(), value));
  +            return new URIValue(value,
  +                                resolveURI(engine.getCSSBaseURI(), value));
        }
           throw createInvalidStringTypeDOMException(type);
       }
  
  
  
  1.5       +8 -6      
xml-batik/sources/org/apache/batik/css/engine/value/svg/SVGPaintManager.java
  
  Index: SVGPaintManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/value/svg/SVGPaintManager.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SVGPaintManager.java      8 Aug 2003 11:38:56 -0000       1.4
  +++ SVGPaintManager.java      27 Sep 2003 01:48:14 -0000      1.5
  @@ -54,13 +54,13 @@
   import org.apache.batik.css.engine.CSSStylableElement;
   import org.apache.batik.css.engine.StyleMap;
   import org.apache.batik.css.engine.value.ListValue;
  -import org.apache.batik.css.engine.value.StringValue;
  +import org.apache.batik.css.engine.value.URIValue;
   import org.apache.batik.css.engine.value.Value;
   import org.apache.batik.util.CSSConstants;
   import org.w3c.css.sac.LexicalUnit;
  -import org.w3c.dom.DOMException;
   import org.w3c.dom.css.CSSPrimitiveValue;
   import org.w3c.dom.css.CSSValue;
  +import org.w3c.dom.DOMException;
   
   /**
    * This class provides a manager for the SVGPaint property values.
  @@ -104,18 +104,20 @@
                   (CSSConstants.CSS_NONE_VALUE)) {
                   return SVGValueConstants.NONE_VALUE;
               }
  +            // Fall through
           default:
               return super.createValue(lu, engine);
           case LexicalUnit.SAC_URI:
           }
  -        String uri = resolveURI(engine.getCSSBaseURI(), lu.getStringValue());
  +        String value = lu.getStringValue();
  +        String uri = resolveURI(engine.getCSSBaseURI(), value);
           lu = lu.getNextLexicalUnit();
           if (lu == null) {
  -            return new StringValue(CSSPrimitiveValue.CSS_URI, uri);
  +            return new URIValue(value, uri);
           }
   
           ListValue result = new ListValue(' ');
  -        result.append(new StringValue(CSSPrimitiveValue.CSS_URI, uri));
  +        result.append(new URIValue(value, uri));
   
        if (lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT) {
               if (lu.getStringValue().equalsIgnoreCase
  
  
  
  1.11      +9 -1      
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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- SVGStylableElement.java   10 Aug 2003 18:03:16 -0000      1.10
  +++ SVGStylableElement.java   27 Sep 2003 01:48:15 -0000      1.11
  @@ -687,6 +687,14 @@
   
               int i = 0;
               int idx = cssEngine.getPropertyIndex(name);
  +            if (i == -1) {
  +                i = cssEngine.getShorthandIndex(name);
  +                if (i == -1) {
  +                    return; // Unknown property
  +                }
  +                // TODO: Really need to set the short property properties.
  +                return;
  +            }
               for (; i < declaration.size(); i++) {
                   if (idx == declaration.getIndex(i))
                       break;
  
  
  
  1.1                  
xml-batik/test-references/samples/tests/spec/scripting/relativeURI.png
  
        <<Binary file>>
  
  
  1.113     +2 -1      
xml-batik/test-resources/org/apache/batik/test/samplesRendering.xml
  
  Index: samplesRendering.xml
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/test-resources/org/apache/batik/test/samplesRendering.xml,v
  retrieving revision 1.112
  retrieving revision 1.113
  diff -u -r1.112 -r1.113
  --- samplesRendering.xml      31 Aug 2003 17:27:13 -0000      1.112
  +++ samplesRendering.xml      27 Sep 2003 01:48:15 -0000      1.113
  @@ -371,6 +371,7 @@
           <test id="samples/tests/spec/scripting/polyline_points1.svg" />
           <test id="samples/tests/spec/scripting/polyline_points2.svg" />
           <test id="samples/tests/spec/scripting/rect.svg" />
  +        <test id="samples/tests/spec/scripting/relativeURI.svg" />
           <test id="samples/tests/spec/scripting/remove.svg" />
           <test id="samples/tests/spec/scripting/removeOnclick.svg" />
           <test id="samples/tests/spec/scripting/text.svg" />
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to