hillion     2002/08/14 07:12:22

  Modified:    sources/org/apache/batik/apps/svgbrowser
                        JSVGViewerFrame.java
               sources/org/apache/batik/css/engine CSSEngine.java
               sources/org/apache/batik/css/engine/value/css2
                        FontSizeManager.java
               sources/org/apache/batik/css/engine/value/svg
                        SVGColorManager.java SVGPaintManager.java
                        StrokeDasharrayManager.java
               sources/org/apache/batik/dom AbstractAttr.java
                        AbstractDocument.java AbstractDocumentFragment.java
                        AbstractElement.java AbstractEntity.java
                        AbstractEntityReference.java AbstractNode.java
                        AbstractParentNode.java
               sources/org/apache/batik/dom/svg SVGOMSVGElement.java
               test-resources/org/apache/batik/css/dom unitTesting.xml
  Added:       test-resources/org/apache/batik/css/dom bug11670.svg
  Log:
  - fixed bugs #11670, #11497and #9965
  
  Revision  Changes    Path
  1.85      +2 -2      
xml-batik/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
  
  Index: JSVGViewerFrame.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java,v
  retrieving revision 1.84
  retrieving revision 1.85
  diff -u -r1.84 -r1.85
  --- JSVGViewerFrame.java      22 Jul 2002 08:28:29 -0000      1.84
  +++ JSVGViewerFrame.java      14 Aug 2002 14:12:21 -0000      1.85
  @@ -2242,7 +2242,7 @@
            * Returns the  medium font size. 
            */
           public float getMediumFontSize() {
  -            // <!> FIXME: Should that 72 be 96?
  +            // 9pt (72pt == 1in)
               return 9f * 25.4f / (72f * getPixelUnitToMillimeter());
           }
   
  
  
  
  1.17      +17 -4     xml-batik/sources/org/apache/batik/css/engine/CSSEngine.java
  
  Index: CSSEngine.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/engine/CSSEngine.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- CSSEngine.java    13 Jun 2002 11:19:38 -0000      1.16
  +++ CSSEngine.java    14 Aug 2002 14:12:21 -0000      1.17
  @@ -1052,7 +1052,6 @@
               ImportRule ir = (ImportRule)r;
               parseStyleSheet(ir, ir.getURI());
           }
  -        
       }
   
       /**
  @@ -1068,7 +1067,21 @@
           short   dorg = dest.getOrigin(idx);
           boolean dimp = dest.isImportant(idx);
   
  -        if (dval == null || dorg != StyleMap.USER_ORIGIN || !dimp) {
  +        boolean cond = dval == null;
  +        if (!cond) {
  +            switch (dorg) {
  +            case StyleMap.USER_ORIGIN:
  +                cond = !dimp;
  +                break;
  +            case StyleMap.AUTHOR_ORIGIN:
  +                cond = !dimp || imp;
  +                break;
  +            default:
  +                cond = true;
  +            }
  +        }
  +
  +        if (cond) {
               dest.putValue(idx, sval);
               dest.putImportant(idx, imp);
               dest.putOrigin(idx, origin);
  @@ -1704,7 +1717,7 @@
                       for (int i = getNumberOfProperties() - 1; i >= 0; --i) {
                           if (updated[i]) {
                               props[count++] = i;
  -                    }
  +                        }
                       }
                       firePropertiesChangedEvent(elt, props);
                       
  
  
  
  1.3       +1 -2      
xml-batik/sources/org/apache/batik/css/engine/value/css2/FontSizeManager.java
  
  Index: FontSizeManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/value/css2/FontSizeManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FontSizeManager.java      5 Jun 2002 21:14:47 -0000       1.2
  +++ FontSizeManager.java      14 Aug 2002 14:12:21 -0000      1.3
  @@ -155,7 +155,6 @@
           case CSSPrimitiveValue.CSS_PT:
               ctx = engine.getCSSContext();
               v = value.getFloatValue();
  -            // <!> FIXME should that 72 be 96?
               return new FloatValue(CSSPrimitiveValue.CSS_NUMBER,
                                     v * 25.4f /
                                     (72f * ctx.getPixelUnitToMillimeter()));
  
  
  
  1.2       +2 -3      
xml-batik/sources/org/apache/batik/css/engine/value/svg/SVGColorManager.java
  
  Index: SVGColorManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/value/svg/SVGColorManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SVGColorManager.java      18 Mar 2002 10:28:23 -0000      1.1
  +++ SVGColorManager.java      14 Aug 2002 14:12:21 -0000      1.2
  @@ -123,8 +123,7 @@
               }
               lu = lu.getNextLexicalUnit();
               if (lu == null) {
  -                throw createInvalidLexicalUnitDOMException
  -                    (lu.getLexicalUnitType());
  +                throw createInvalidLexicalUnitDOMException((short)-1);
               }
               icc.append(getColorValue(lu));
               lu = lu.getNextLexicalUnit();
  
  
  
  1.2       +3 -2      
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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SVGPaintManager.java      18 Mar 2002 10:28:23 -0000      1.1
  +++ SVGPaintManager.java      14 Aug 2002 14:12:22 -0000      1.2
  @@ -94,8 +94,9 @@
               for (int i = 0; i < lv.getLength(); i++) {
                   result.append(lv.item(i));
               }
  +        } else {
  +            result.append(v);
           }
  -        result.append(v);
           return result;
       }
   
  
  
  
  1.2       +40 -22    
xml-batik/sources/org/apache/batik/css/engine/value/svg/StrokeDasharrayManager.java
  
  Index: StrokeDasharrayManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/value/svg/StrokeDasharrayManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StrokeDasharrayManager.java       18 Mar 2002 10:28:23 -0000      1.1
  +++ StrokeDasharrayManager.java       14 Aug 2002 14:12:22 -0000      1.2
  @@ -10,10 +10,13 @@
   
   import org.apache.batik.util.CSSConstants;
   
  +import org.apache.batik.css.engine.CSSContext;
   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.FloatValue;
  +import org.apache.batik.css.engine.value.LengthManager;
   import org.apache.batik.css.engine.value.ListValue;
   import org.apache.batik.css.engine.value.Value;
   import org.apache.batik.css.engine.value.ValueManager;
  @@ -22,6 +25,7 @@
   
   import org.w3c.dom.DOMException;
   import org.w3c.dom.css.CSSPrimitiveValue;
  +import org.w3c.dom.css.CSSValue;
   
   /**
    * This class provides a factory for the 'stroke-dasharray' property values.
  @@ -29,7 +33,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephane Hillion</a>
    * @version $Id$
    */
  -public class StrokeDasharrayManager extends AbstractValueManager {
  +public class StrokeDasharrayManager extends LengthManager {
       
       /**
        * Implements {@link ValueManager#isInheritedProperty()}.
  @@ -57,8 +61,6 @@
        */
       public Value createValue(LexicalUnit lu, CSSEngine engine)
           throws DOMException {
  -        // !!! TODO: support lengths.
  -
           switch (lu.getLexicalUnitType()) {
           case LexicalUnit.SAC_INHERIT:
               return SVGValueConstants.INHERIT_VALUE;
  @@ -73,23 +75,7 @@
        default:
               ListValue lv = new ListValue(' ');
               do {
  -                Value v;
  -                switch (lu.getLexicalUnitType()) {
  -                case LexicalUnit.SAC_INTEGER:
  -                    v = new FloatValue(CSSPrimitiveValue.CSS_NUMBER,
  -                                       lu.getIntegerValue());
  -                    break;
  -
  -                case LexicalUnit.SAC_REAL:
  -                    v = new FloatValue(CSSPrimitiveValue.CSS_NUMBER,
  -                                       lu.getFloatValue());
  -                    break;
  -
  -                default:
  -                    throw createInvalidLexicalUnitDOMException
  -                        (lu.getLexicalUnitType());
  -                }
  -
  +                Value v = super.createValue(lu, engine);
                   lv.append(v);
                   lu = lu.getNextLexicalUnit();
                   if (lu != null &&
  @@ -115,5 +101,37 @@
               return SVGValueConstants.NONE_VALUE;
           }
           throw createInvalidIdentifierDOMException(value);
  +    }
  +
  +    /**
  +     * Implements {@link
  +     * 
ValueManager#computeValue(CSSStylableElement,String,CSSEngine,int,StyleMap,Value)}.
  +     */
  +    public Value computeValue(CSSStylableElement elt,
  +                              String pseudo,
  +                              CSSEngine engine,
  +                              int idx,
  +                              StyleMap sm,
  +                              Value value) {
  +        switch (value.getCssValueType()) {
  +        case CSSValue.CSS_PRIMITIVE_VALUE:
  +            return value;
  +        }
  +        
  +        ListValue lv = (ListValue)value;
  +        ListValue result = new ListValue(' ');
  +        for (int i = 0; i < lv.getLength(); i++) {
  +            result.append(super.computeValue(elt, pseudo, engine, idx, sm,
  +                                             lv.item(i)));
  +        }
  +        return result;
  +    }
  +
  +    /**
  +     * Indicates the orientation of the property associated with
  +     * this manager.
  +     */
  +    protected int getOrientation() {
  +        return BOTH_ORIENTATION;
       }
   }
  
  
  
  1.9       +2 -2      xml-batik/sources/org/apache/batik/dom/AbstractAttr.java
  
  Index: AbstractAttr.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/dom/AbstractAttr.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AbstractAttr.java 19 Nov 2001 13:39:55 -0000      1.8
  +++ AbstractAttr.java 14 Aug 2002 14:12:22 -0000      1.9
  @@ -254,7 +254,7 @@
       /**
        * Checks the validity of a node to be inserted.
        */
  -    protected void checkChildType(Node n) {
  +    protected void checkChildType(Node n, boolean replace) {
        switch (n.getNodeType()) {
        case TEXT_NODE:
        case ENTITY_REFERENCE_NODE:
  
  
  
  1.15      +4 -3      xml-batik/sources/org/apache/batik/dom/AbstractDocument.java
  
  Index: AbstractDocument.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/dom/AbstractDocument.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- AbstractDocument.java     19 Mar 2002 09:25:40 -0000      1.14
  +++ AbstractDocument.java     14 Aug 2002 14:12:22 -0000      1.15
  @@ -487,7 +487,7 @@
       /**
        * Checks the validity of a node to be inserted.
        */
  -    protected void checkChildType(Node n) {
  +    protected void checkChildType(Node n, boolean replace) {
        short t = n.getNodeType();
        switch (t) {
        case ELEMENT_NODE:
  @@ -504,7 +504,8 @@
                                                    new Integer(t),
                                                    n.getNodeName() });
        }
  -     if ((t == ELEMENT_NODE && getDocumentElement() != null) ||
  +     if (!replace &&
  +            (t == ELEMENT_NODE && getDocumentElement() != null) ||
            (t == DOCUMENT_TYPE_NODE && getDoctype() != null)) {
            throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR,
                                     "child.type",
  
  
  
  1.2       +2 -2      
xml-batik/sources/org/apache/batik/dom/AbstractDocumentFragment.java
  
  Index: AbstractDocumentFragment.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/dom/AbstractDocumentFragment.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractDocumentFragment.java     10 Oct 2000 18:38:48 -0000      1.1
  +++ AbstractDocumentFragment.java     14 Aug 2002 14:12:22 -0000      1.2
  @@ -41,7 +41,7 @@
       /**
        * Checks the validity of a node to be inserted.
        */
  -    protected void checkChildType(Node n) {
  +    protected void checkChildType(Node n, boolean replace) {
        switch (n.getNodeType()) {
        case ELEMENT_NODE:
        case PROCESSING_INSTRUCTION_NODE:
  
  
  
  1.19      +2 -2      xml-batik/sources/org/apache/batik/dom/AbstractElement.java
  
  Index: AbstractElement.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/dom/AbstractElement.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- AbstractElement.java      30 May 2002 16:42:34 -0000      1.18
  +++ AbstractElement.java      14 Aug 2002 14:12:22 -0000      1.19
  @@ -446,7 +446,7 @@
        * Checks the validity of a node to be inserted.
        * @param n The node to be inserted.
        */
  -    protected void checkChildType(Node n) {
  +    protected void checkChildType(Node n, boolean replace) {
        switch (n.getNodeType()) {
        case ELEMENT_NODE:
        case PROCESSING_INSTRUCTION_NODE:
  
  
  
  1.2       +2 -2      xml-batik/sources/org/apache/batik/dom/AbstractEntity.java
  
  Index: AbstractEntity.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/dom/AbstractEntity.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractEntity.java       10 Oct 2000 18:38:52 -0000      1.1
  +++ AbstractEntity.java       14 Aug 2002 14:12:22 -0000      1.2
  @@ -157,7 +157,7 @@
       /**
        * Checks the validity of a node to be inserted.
        */
  -    protected void checkChildType(Node n) {
  +    protected void checkChildType(Node n, boolean replace) {
        switch (n.getNodeType()) {
        case ELEMENT_NODE:
        case PROCESSING_INSTRUCTION_NODE:
  
  
  
  1.3       +2 -2      
xml-batik/sources/org/apache/batik/dom/AbstractEntityReference.java
  
  Index: AbstractEntityReference.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/dom/AbstractEntityReference.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractEntityReference.java      17 May 2001 16:36:36 -0000      1.2
  +++ AbstractEntityReference.java      14 Aug 2002 14:12:22 -0000      1.3
  @@ -121,7 +121,7 @@
       /**
        * Checks the validity of a node to be inserted.
        */
  -    protected void checkChildType(Node n) {
  +    protected void checkChildType(Node n, boolean replace) {
        switch (n.getNodeType()) {
        case ELEMENT_NODE:
        case PROCESSING_INSTRUCTION_NODE:
  
  
  
  1.12      +2 -2      xml-batik/sources/org/apache/batik/dom/AbstractNode.java
  
  Index: AbstractNode.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/dom/AbstractNode.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- AbstractNode.java 19 Apr 2002 16:04:05 -0000      1.11
  +++ AbstractNode.java 14 Aug 2002 14:12:22 -0000      1.12
  @@ -542,7 +542,7 @@
       /**
        * Checks the validity of a node to be inserted.
        */
  -    protected void checkChildType(Node n) {
  +    protected void checkChildType(Node n, boolean replace) {
           throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR,
                                    "children.not.allowed",
                                    new Object[] { new Integer(getNodeType()),
  
  
  
  1.17      +6 -6      xml-batik/sources/org/apache/batik/dom/AbstractParentNode.java
  
  Index: AbstractParentNode.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/dom/AbstractParentNode.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- AbstractParentNode.java   16 May 2002 11:23:34 -0000      1.16
  +++ AbstractParentNode.java   14 Aug 2002 14:12:22 -0000      1.17
  @@ -73,7 +73,7 @@
                 new Object[] { new Integer(refChild.getNodeType()),
                                refChild.getNodeName() });
        }
  -     checkAndRemove(newChild);
  +     checkAndRemove(newChild, false);
   
        if (newChild.getNodeType() == DOCUMENT_FRAGMENT_NODE) {
            Node n = newChild.getFirstChild();
  @@ -114,7 +114,7 @@
                 new Object[] { new Integer(oldChild.getNodeType()),
                                oldChild.getNodeName() });
        }
  -     checkAndRemove(newChild);
  +     checkAndRemove(newChild, true);
   
        if (newChild.getNodeType() == DOCUMENT_FRAGMENT_NODE) {
            Node n  = newChild.getLastChild();
  @@ -187,7 +187,7 @@
        * <b>DOM</b>: Implements {@link org.w3c.dom.Node#appendChild(Node)}.
        */
       public Node appendChild(Node newChild) throws DOMException {
  -     checkAndRemove(newChild);
  +     checkAndRemove(newChild, false);
   
        if (newChild.getNodeType() == DOCUMENT_FRAGMENT_NODE) {
            Node n = newChild.getFirstChild();
  @@ -415,8 +415,8 @@
        * Checks the validity of a node to be inserted, and removes it from
        * the document if needed.
        */
  -    protected void checkAndRemove(Node n) {
  -     checkChildType(n);
  +    protected void checkAndRemove(Node n, boolean replace) {
  +     checkChildType(n, replace);
        if (isReadonly()) {
            throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
  
  
  
  1.19      +7 -2      xml-batik/sources/org/apache/batik/dom/svg/SVGOMSVGElement.java
  
  Index: SVGOMSVGElement.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/dom/svg/SVGOMSVGElement.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- SVGOMSVGElement.java      21 Jun 2002 15:52:00 -0000      1.18
  +++ SVGOMSVGElement.java      14 Aug 2002 14:12:22 -0000      1.19
  @@ -9,6 +9,7 @@
   package org.apache.batik.dom.svg;
   
   import org.apache.batik.dom.AbstractDocument;
  +import org.apache.batik.dom.util.XLinkSupport;
   import org.apache.batik.dom.util.XMLSupport;
   
   import org.w3c.dom.DOMException;
  @@ -56,11 +57,15 @@
        */
       protected final static AttributeInitializer attributeInitializer;
       static {
  -        attributeInitializer = new AttributeInitializer(6);
  +        attributeInitializer = new AttributeInitializer(7);
           attributeInitializer.addAttribute(XMLSupport.XMLNS_NAMESPACE_URI,
                                             null,
                                             "xmlns",
                                             SVG_NAMESPACE_URI);
  +        attributeInitializer.addAttribute(XMLSupport.XMLNS_NAMESPACE_URI,
  +                                          "xmlns",
  +                                          "xlink",
  +                                          XLinkSupport.XLINK_NAMESPACE_URI);
           attributeInitializer.addAttribute(null,
                                             null,
                                             SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE,
  
  
  
  1.5       +7 -6      
xml-batik/test-resources/org/apache/batik/css/dom/unitTesting.xml
  
  Index: unitTesting.xml
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/test-resources/org/apache/batik/css/dom/unitTesting.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- unitTesting.xml   12 Jun 2002 11:04:24 -0000      1.4
  +++ unitTesting.xml   14 Aug 2002 14:12:22 -0000      1.5
  @@ -14,10 +14,11 @@
       class="org.apache.batik.css.dom.EcmaScriptCSSDOMTest">
   
       <testGroup id="basic" name="Basic CSS DOM Testing">
  -        <test id="rgbTest" />
  -        <test id="rgbUpdateTest" />
  -        <test id="rgbPresentationTest" />
  -        <test id="bug9740" />
  -        <test id="bug9779" />
  +        <test id="rgbTest"/>
  +        <test id="rgbUpdateTest"/>
  +        <test id="rgbPresentationTest"/>
  +        <test id="bug9740"/>
  +        <test id="bug9779"/>
  +        <test id="bug11670"/>
       </testGroup>
   </testSuite>
  
  
  
  1.1                  xml-batik/test-resources/org/apache/batik/css/dom/bug11670.svg
  
  Index: bug11670.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";>
  
  <!-- ========================================================================= -->
  <!-- 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.                                                         -->
  <!-- ========================================================================= -->
  
  <!-- ========================================================================= -->
  <!--                                                                           -->
  <!-- @author [EMAIL PROTECTED]                                                  -->
  <!-- @version $Id: bug11670.svg,v 1.1 2002/08/14 14:12:22 hillion Exp $ -->
  <!-- ========================================================================= -->
  
  <svg xmlns="http://www.w3.org/2000/svg"; 
       xmlns:xlink="http://www.w3.org/1999/xlink"; 
       xmlns:test="http://xml.apache.org/batik/test";
       width="450" height="500" viewBox="0 0 450 500"
       onload="runTest(evt)" class="c">
  
    <style type="text/css"><![CDATA[
        .c rect { fill: #010203 ! important }
        .c g rect { fill: #020304 ! important }
    ]]></style>
  
    <test:testResult id="testResult" />
  
    <script type="text/ecmascript"><![CDATA[
     var testNS = "http://xml.apache.org/batik/test";;
  
     function runTest() {
       var result = document.getElementById("testResult");
  
       var rect = document.getElementById("rect1");
  
       if (rect == null){
          result.setAttributeNS(null, "errorCode", "cannot.find.test.element");
          var entry = document.createElementNS(testNS, "errorDescriptionEntry");
          entry.setAttributeNS(null, "id", "missing.element.id");
          entry.setAttributeNS(null, "value", "targetElement");
          result.appendChild(entry);
          return;
       }
  
       var style = document.documentElement.getComputedStyle(rect, null);
  
       if (style == null){
          result.setAttributeNS(null, "errorCode", "getComputedStyle() returned null");
          return;
       }
  
       var val = style.getPropertyCSSValue("fill");
  
       if ( val == null ){
          result.setAttributeNS(null, "errorCode",
             "CSSStyleDeclaration.getPropertyCSSValue returned null");
          return;
       }
  
       val = val.getRGBColor()
       
       if (val.red.getFloatValue(1) != 2 ||
           val.green.getFloatValue(1) != 3 ||
           val.blue.getFloatValue(1) != 4) {
          result.setAttributeNS(null, "errorCode", "invalid color components");
          return;
       }
  
       result.setAttributeNS(null, "result", "passed");
     }
    ]]></script>
  
    <g>
    <rect id="rect1" x="10%" y="10%" width="80%" height="80%" style="fill: #030405"/>
    </g>
  
  </svg>
  
  
  

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

Reply via email to