[prev in list] [next in list] [prev in thread] [next in thread] 

List:       batik-dev
Subject:    cvs commit: xml-batik/test-resources/org/apache/batik/test samplesRendering.xml
From:       deweese () apache ! org
Date:       2003-07-20 22:32:31
[Download RAW message or body]

deweese     2003/07/20 15:32:31

  Modified:    sources/org/apache/batik/css/engine CSSEngine.java
               sources/org/apache/batik/gvt UpdateTracker.java
               sources/org/apache/batik/script/rhino WindowWrapper.java
               test-resources/org/apache/batik/test samplesRendering.xml
  Added:       samples/tests/spec/scripting styling.svg
               samples/tests/spec/styling styleElement.svg
  Log:
  1) Fixed an NPE with some updates.
  2) When an element is removed or CSS properties change all
     next sibling elements are not repainted (unless a rendering property
     truely changes as a result (think css '+' rules)).
  3) Changes to the 'class' attribute now update the rendering
     tree appropriately.
  4) New test for this (samples/tests/scripting/styling.svg) and
     for comments in style elements (samples/tests/styling/styleElement.svg).
  
  Revision  Changes    Path
  1.1                  xml-batik/samples/tests/spec/scripting/styling.svg
  
  Index: styling.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.                                      -->
  <!-- ====================================================================== -->
  
  <?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>  
  
  <svg xmlns="http://www.w3.org/2000/svg" 
       xmlns:xlink="http://www.w3.org/1999/xlink"
       xmlns:cb="http://www.example.org/gui/checkbox"
       id="body" width="450" height="500" viewBox="0 0 450 500">
  
    <title>Dynamic test of CSS selectors</title>
    <text x="50%" y="45" class="title">Dynamic test of CSS selectors</text>
  
    <style type="text/css"><![CDATA[
      text.button {
      fill: #00F;
      }
  
      text + text.button {
      fill: #888;
      }
  
      text + g > text {
        fill: #F00;
      }
  
      g > text {
        fill: #0F0;
      }
  
      g.xxx > text { fill: #F0F; }
  
      [id=test4] > text { fill: #80F; }
  
      g + [id=foo] > text { fill: #808; }
  
      .checkbox > path { fill: none; stroke: black; stroke-width: 2; }
      .checkbox > rect { fill: white; stroke: black; stroke-width: 1; }
      .checkbox[selected=true] > path { visibility: visible;}
      .checkbox[selected=false] > path { visibility: hidden; }
      ]]></style>
  
    <script type="text/ecmascript"><![CDATA[
      var svgns = "http://www.w3.org/2000/svg";
  
      function insertTextEvt(evt, x, y) {
         insertText(evt.currentTarget, x, y);
      }
  
      function removeTargetEvt(evt) {
         removeTarget(evt.currentTarget);
      }
  
      function setAttributeEvt(evt, attr, val) {
        evt.currentTarget.setAttribute(attr, val);
      }
  
      function removeTarget(e) {
         e.parentNode.removeChild(e);
      }
  
      function insertText(e, x, y) {
         var t = document.createElementNS(svgns, "text");
         t.setAttribute("x", x);
         t.setAttribute("y", y);
         t.appendChild(document.createTextNode("Inserted"));
         e.parentNode.insertBefore(t, e);
      }
  
      function toggleSelectedEvt(evt) {
        toggleSelected(evt.currentTarget);
      }
      function toggleSelected(e) {
         var sel = e.getAttribute("selected");
         if (sel == "true") {
           e.setAttribute("selected", "false");
         } else {
           e.setAttribute("selected", "true");
         }
      }
  
      function regardStart() {
        var e;
        removeTarget(document.getElementById("rm1"))
        insertText(document.getElementById("in1"), '10', '75');
  
        removeTarget(document.getElementById("rm2"))
        insertText(document.getElementById("in2"), '10', '125');
  
        document.getElementById("test3").setAttribute("class", "xxx");
        document.getElementById("test4").setAttribute("class", "");
        document.getElementById("test5").setAttribute("id", "foo");
        regardTestInstance.scriptDone();
        toggleSelected(document.getElementById("cb"));
      }
    ]]></script>
  
    <g/>
    <text id="rm1" x="10" y="100" onclick="removeTargetEvt(evt)">Click me</text>
    <text x="100" y="100" class="button">Do I change?</text>
  
    <g/>
    <text id="in1" x="100" y="125" class="button" 
          onclick="insertTextEvt(evt, '10', '125')">Click Me!</text>
  
    <g/>
    <text id="rm2" x="10" y="150" onclick="removeTargetEvt(evt)">Click me</text>
    <g id="test1">
      <text id="ct" x="100" y="150">Child Text</text>
    </g>
  
    <g/>
    <g id="in2" onclick="insertTextEvt(evt, '10', '175')">
      <text id="ct2" x="100" y="175">Click me</text>
    </g>
  
    <g id="test3" onclick="setAttributeEvt(evt, 'class', 'xxx')">
      <text id="ct3" x="10" y="200">Click me</text>
    </g>
  
    <g id="test4" class="xxx" onclick="setAttributeEvt(evt, 'class', '')">
      <text id="ct4" x="100" y="200">Click me</text>
    </g>
  
    <g id="test5" class="xxx" onclick="setAttributeEvt(evt, 'id', 'foo')">
      <text id="ct5" x="200" y="200">Click me</text>
    </g>
  
    <g id="cb" class="checkbox" selected="true" transform="translate(10, 225)"
       onclick="toggleSelected(evt)">
      <rect width="15" height="15" fill="white" stroke="black"/>
      <path d="M3,3 L12,12 M12,3 L3,12"/>
    </g>
  
  </svg>
  
  
  
  1.1                  xml-batik/samples/tests/spec/styling/styleElement.svg
  
  Index: styleElement.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.                                      -->
  <!-- ====================================================================== -->
  
  <!-- ====================================================================== -->
  <!-- Modification of a circle attributes                                    -->
  <!--                                                                        -->
  <!-- @author tkormann@ilog.fr                                               -->
  <!-- @version $Id: styleElement.svg,v 1.1 2003/07/20 22:32:30 deweese Exp $ -->
  <!-- ====================================================================== -->
  
  <?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>  
  
  <svg id="body" width="450" height="500" viewBox="0 0 450 500"
       xmlns="http://www.w3.org/2000/svg" 
       xmlns:xlink="http://www.w3.org/1999/xlink">
  
    <style type="text/css">
      rect { stroke="black" }
    </style>
  
  <!-- The '.blue' will be applied as the comment characters will be ignored.
       the '.green' rule will not be as the parser will abort on the invalid
       'TEST' content because the CDATA block hides the XML comments from
       the XML parser. --> 
  
    <style type="text/css"><![CDATA[
      <!-- .blue { fill: blue } -->
      <!-- TEST -->
      .green { fill: green }
      /*end of css */
    ]]></style>
  
  <!-- Only .yellow will be applied .purple will be stripped by the
       XML parser (Note no CDATA block). --> 
  
    <style type="text/css">
      <!-- .purple { fill: purple } -->
      <!-- TEST -->
      .yellow { fill: yellow }
      /* end of css */
    </style>
  
    <title>Test of XML comments in &lt;style&gt; elements</title>
    <text x="50%" y="50" class="title"
      >Test of XML comments in &lt;style&gt; elements</text>
    <g id="test-content" >
      <rect class="blue" x="10" y="100" width="100" height="50"/>
      <text x="150" y="125">class="blue"</text>
  
      <rect class="green" x="10" y="175" width="100" height="50"/>
      <text x="150" y="200">class="green"</text>
  
      <rect class="purple" x="10" y="250" width="100" height="50"/>
      <text x="150" y="275">class="purple"</text>
  
      <rect class="yellow" x="10" y="325" width="100" height="50"/>
      <text x="150" y="350">class="yellow"</text>
    </g>
  </svg>
  
  
  
  
  1.24      +121 -182  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.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- CSSEngine.java	16 Jul 2003 00:46:50 -0000	1.23
  +++ CSSEngine.java	20 Jul 2003 22:32:30 -0000	1.24
  @@ -1693,20 +1693,7 @@
               }
   
               if (removed) {
  -                // Invalidate all the values.
  -                elt.setComputedStyleMap(null, null);
  -
  -                firePropertiesChangedEvent(elt, ALL_PROPERTIES);
  -                    
  -                Node c = getImportedChild(elt);
  -                if (c != null) {
  -                    propagateChanges(c, ALL_PROPERTIES);
  -                }
  -                for (Node n = elt.getFirstChild();
  -                     n != null;
  -                     n = n.getNextSibling()) {
  -                    propagateChanges(n, ALL_PROPERTIES);
  -                }
  +                invalidateProperties(elt, null);
               } else {
                   int count = 0;
               
  @@ -1754,17 +1741,7 @@
                               props[count++] = i;
                           }
                       }
  -                    firePropertiesChangedEvent(elt, props);
  -                    
  -                    Node c = getImportedChild(elt);
  -                    if (c != null) {
  -                        propagateChanges(c, props);
  -                    }
  -                    for (Node n = elt.getFirstChild();
  -                         n != null;
  -                         n = n.getNextSibling()) {
  -                        propagateChanges(n, props);
  -                    }
  +                    invalidateProperties(elt, props);
                   }
               }
               break;
  @@ -1789,137 +1766,141 @@
           style.putComputed(n, false);
       }
   
  -    /**
  -     * Invalidates all the stylable elements descendant of the given
  -     * node, and the node.
  -     */
  -    protected void invalidateTreeProperties(Node node) {
  -        if (node instanceof CSSStylableElement) {
  -            CSSStylableElement elt = (CSSStylableElement)node;
  -            StyleMap style = elt.getComputedStyleMap(null);
  -            if (style != null) {
  -                elt.setComputedStyleMap(null, null);
  -                firePropertiesChangedEvent(elt, ALL_PROPERTIES);
  -            }
  -        }
  -
  -        Node c = getImportedChild(node);
  -        if (c != null) {
  -            propagateChanges(c, ALL_PROPERTIES);
  -        }
  -        for (Node n = node.getFirstChild();
  -             n != null;
  -             n = n.getNextSibling()) {
  -            invalidateTreeProperties(n);
  -        }
  -    }
   
       /**
        * Invalidates all the properties of the given node.
        */
  -    protected void invalidateProperties(Node node) {
  -        if (node instanceof CSSStylableElement) {
  -            CSSStylableElement elt = (CSSStylableElement)node;
  -            StyleMap style = elt.getComputedStyleMap(null);
  -            if (style != null) {
  -                elt.setComputedStyleMap(null, null);
  -                firePropertiesChangedEvent(elt, ALL_PROPERTIES);
  +    protected void invalidateProperties(Node node, int [] properties) {
  +        if (!(node instanceof CSSStylableElement))
  +            return;  // Not Stylable sub tree
  +        // System.err.println("Node id: " + 
  +        //                    ((Element)node).getAttribute("id"));
  +
  +        CSSStylableElement elt = (CSSStylableElement)node;
  +        StyleMap style = elt.getComputedStyleMap(null);
  +        if (style == null)
  +            return;  // Nothing to invalidate.
  +        
  +        StyleMap newStyle = getCascadedStyleMap(elt, null);
  +        elt.setComputedStyleMap(null, newStyle);
  +        boolean [] diffs = new boolean[getNumberOfProperties()];
  +        int count =0;
  +        if (properties != null) {
  +            for (int i=0; i<properties.length; i++)
  +                diffs[properties[i]] = true;
  +            count = properties.length;
  +        }
  +
  +        for (int i=0; i<diffs.length; i++) {
  +            if (diffs[i]) continue; // Already marked changed.
  +
  +            Value nv = newStyle.getValue(i);
  +            Value ov = null;
  +            if (!style.isNullCascaded(i)) {
  +                ov = style.getValue(i);
  +                if (ov instanceof ComputedValue) {
  +                    ov = ((ComputedValue)ov).getCascadedValue();
  +                }
               }
  -        }
   
  -        Node c = getImportedChild(node);
  -        if (c != null) {
  -            propagateChanges(c, ALL_PROPERTIES);
  +            if (nv == ov) continue;
  +            if ((nv == null) || 
  +                (!nv.equals(ov) && !nv.getCssText().equals(ov.getCssText()))) {
  +                count++;
  +                diffs[i] = true;
  +            }
           }
  -        for (Node n = node.getFirstChild();
  -             n != null;
  -             n = n.getNextSibling()) {
  -            propagateChanges(n, ALL_PROPERTIES);
  +        int []props = null;
  +        if (count != 0) {
  +            props = new int[count];
  +            count = 0;
  +            for (int i=0; i<diffs.length; i++) {
  +                if (diffs[i])
  +                    props[count++] = i;
  +            }
           }
  +        propagateChanges(elt, props);
       }
   
       /**
        * Propagates the changes that occurs on the parent of the given node.
        */
       protected void propagateChanges(Node node, int[] props) {
  -        if (node instanceof CSSStylableElement) {
  -            CSSStylableElement elt = (CSSStylableElement)node;
  -            StyleMap style = elt.getComputedStyleMap(null);
  -            if (style != null) {
  -                boolean[] updated =
  -                    styleDeclarationUpdateHandler.updatedProperties;
  -                for (int i = getNumberOfProperties() - 1; i >= 0; --i) {
  -                    updated[i] = false;
  -                }
  +        if (!(node instanceof CSSStylableElement))
  +            return;
  +        CSSStylableElement elt = (CSSStylableElement)node;
  +        StyleMap style = elt.getComputedStyleMap(null);
  +        if (style != null) {
  +            boolean[] updated =
  +                styleDeclarationUpdateHandler.updatedProperties;
  +            for (int i = getNumberOfProperties() - 1; i >= 0; --i) {
  +                updated[i] = false;
  +            }
  +            if (props != null) {
                   for (int i = props.length - 1; i >= 0; --i) {
                       int idx = props[i];
  -                    if (style.isComputed(idx) &&
  -                        style.isParentRelative(idx)) {
  -                        updated[idx] = true;
  -                        clearComputedValue(style, idx);
  -                    }
  +                    updated[idx] = true;
                   }
  +            }
   
  -                // Invalidate the relative values
  -                boolean fs = (fontSizeIndex == -1)
  -                    ? false
  -                    : updated[fontSizeIndex];
  -                boolean lh = (lineHeightIndex == -1)
  -                    ? false
  -                    : updated[lineHeightIndex];
  -                boolean cl = (colorIndex == -1)
  -                    ? false
  -                    : updated[colorIndex];
  -                int count = 0;
  -
  -                for (int i = getNumberOfProperties() - 1; i >= 0; --i) {
  -                    if (!updated[i]) {
  -                        if (style.isComputed(i)) {
  -                            if (fs && style.isFontSizeRelative(i)) {
  -                                updated[i] = true;
  -                                count++;
  -                                clearComputedValue(style, i);
  -                            }
  -                            if (lh && style.isLineHeightRelative(i)) {
  -                                updated[i] = true;
  -                                count++;
  -                                clearComputedValue(style, i);
  -                            }
  -                            if (cl && style.isColorRelative(i)) {
  -                                updated[i] = true;
  -                                count++;
  -                                clearComputedValue(style, i);
  -                            }
  -                        }
  -                    } else {
  +            // Invalidate the relative values
  +            boolean fs = (fontSizeIndex == -1)
  +                ? false
  +                : updated[fontSizeIndex];
  +            boolean lh = (lineHeightIndex == -1)
  +                ? false
  +                : updated[lineHeightIndex];
  +            boolean cl = (colorIndex == -1)
  +                ? false
  +                : updated[colorIndex];
  +            int count = 0;
  +
  +            for (int i = getNumberOfProperties() - 1; i >= 0; --i) {
  +                if (updated[i]) {
  +                    count++;
  +                    continue;
  +                }
  +                if (style.isComputed(i)) {
  +                    if (fs && style.isFontSizeRelative(i)) {
  +                        updated[i] = true;
  +                        count++;
  +                        clearComputedValue(style, i);
  +                    }
  +                    if (lh && style.isLineHeightRelative(i)) {
  +                        updated[i] = true;
  +                        count++;
  +                        clearComputedValue(style, i);
  +                    }
  +                    if (cl && style.isColorRelative(i)) {
  +                        updated[i] = true;
                           count++;
  +                        clearComputedValue(style, i);
                       }
                   }
  +            }
   
  -                if (count > 0) {
  -                    props = new int[count];
  -                    count = 0;
  -                    for (int i = getNumberOfProperties() - 1; i >= 0; --i) {
  -                        if (updated[i]) {
  -                            props[count++] = i;
  -                        }
  +            if (count == 0) {
  +                props = null;
  +            } else {
  +                props = new int[count];
  +                count = 0;
  +                for (int i = getNumberOfProperties() - 1; i >= 0; --i) {
  +                    if (updated[i]) {
  +                        props[count++] = i;
                       }
  -                    firePropertiesChangedEvent(elt, props);
  -                } else {
  -                    props = null;
                   }
  +                firePropertiesChangedEvent(elt, props);
               }
           }
  -        if (props != null) {
  -            Node c = getImportedChild(node);
  -            if (c != null) {
  -                propagateChanges(c, props);
  -            }
  -            for (Node n = node.getFirstChild();
  -                 n != null;
  -                 n = n.getNextSibling()) {
  -                propagateChanges(n, props);
  -            }
  +
  +        Node c = getImportedChild(node);
  +        if (c != null) {
  +            invalidateProperties(c, props);
  +        }
  +        for (Node n = node.getFirstChild();
  +             n != null;
  +             n = n.getNextSibling()) {
  +            invalidateProperties(n, props);
           }
       }
   
  @@ -1976,6 +1957,7 @@
                                                      StyleMap style,
                                                      String property,
                                                      MutationEvent evt) {
  +        // System.err.println("update: " + property);
           int idx = getPropertyIndex(property);
   
           if (style.isImportant(idx)) {
  @@ -1991,8 +1973,6 @@
               return;
           }
           
  -        boolean comp = style.isComputed(idx);
  -
           switch (evt.getAttrChange()) {
           case MutationEvent.ADDITION:
           case MutationEvent.MODIFICATION:
  @@ -2021,26 +2001,7 @@
               break;
   
           case MutationEvent.REMOVAL:
  -            // Invalidate all the values.
  -            elt.setComputedStyleMap(null, null);
  -            
  -            firePropertiesChangedEvent(elt, ALL_PROPERTIES);
  -                    
  -            Node c = getImportedChild(elt);
  -            if (c != null) {
  -                propagateChanges(c, ALL_PROPERTIES);
  -            }
  -            for (Node n = elt.getFirstChild();
  -                 n != null;
  -                 n = n.getNextSibling()) {
  -                propagateChanges(n, ALL_PROPERTIES);
  -            }
  -            return;
  -        }
  -
  -        if (!comp) {
  -            // The previous value was not computed: nobody is
  -            // interested by this property modifications
  +            invalidateProperties(elt, null);
               return;
           }
   
  @@ -2087,17 +2048,8 @@
                   props[count++] = i;
               }
           }
  -        firePropertiesChangedEvent(elt, props);
   
  -        Node c = getImportedChild(elt);
  -        if (c != null) {
  -            propagateChanges(c, props);
  -        }
  -        for (Node n = elt.getFirstChild();
  -             n != null;
  -             n = n.getNextSibling()) {
  -            propagateChanges(n, props);
  -        }
  +        invalidateProperties(elt, props);
       }
   
       /**
  @@ -2111,7 +2063,7 @@
                   styleSheetNodes = null;
   
                   // Invalidate all the CSSStylableElements in the document.
  -                invalidateTreeProperties(document.getDocumentElement());
  +                invalidateProperties(document.getDocumentElement(), null);
                   return;
               }
               if (et instanceof CSSStylableElement) {
  @@ -2121,7 +2073,7 @@
                   for (Node n = ((Node)evt.getTarget()).getNextSibling();
                        n != null;
                        n = n.getNextSibling()) {
  -                    invalidateProperties(n);
  +                    invalidateProperties(n, null);
                   }
               }
           }
  @@ -2159,7 +2111,7 @@
                   styleSheetNodes = null;
   
                   // Invalidate all the CSSStylableElements in the document.
  -                invalidateTreeProperties(document.getDocumentElement());
  +                invalidateProperties(document.getDocumentElement(), null);
               } else if (removedStylableElementSibling != null) {
                   // Invalidate the CSSStylableElement siblings, to
                   // correctly match the adjacent selectors and
  @@ -2167,7 +2119,7 @@
                   for (Node n = removedStylableElementSibling;
                        n != null;
                        n = n.getNextSibling()) {
  -                    invalidateProperties(n);
  +                    invalidateProperties(n, null);
                   }
                   removedStylableElementSibling = null;
               }
  @@ -2184,7 +2136,7 @@
                   styleSheetNodes = null;
   
                   // Invalidate all the CSSStylableElements in the document.
  -                invalidateTreeProperties(document.getDocumentElement());
  +                invalidateProperties(document.getDocumentElement(), null);
               }
           }
       }
  @@ -2250,20 +2202,7 @@
                   selectorAttributes.contains(name)) {
                   // An attribute has been modified, invalidate all the
                   // properties to correctly match attribute selectors.
  -
  -                elt.setComputedStyleMap(null, null);
  -
  -                firePropertiesChangedEvent(elt, ALL_PROPERTIES);
  -                
  -                Node c = getImportedChild(elt);
  -                if (c != null) {
  -                    propagateChanges(c, ALL_PROPERTIES);
  -                }
  -                for (Node n = elt.getFirstChild();
  -                     n != null;
  -                     n = n.getNextSibling()) {
  -                    propagateChanges(n, ALL_PROPERTIES);
  -                }
  +                invalidateProperties(elt, null);
               }
           }
       }
  
  
  
  1.19      +14 -3     xml-batik/sources/org/apache/batik/gvt/UpdateTracker.java
  
  Index: UpdateTracker.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/UpdateTracker.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- UpdateTracker.java	16 Jul 2003 23:46:27 -0000	1.18
  +++ UpdateTracker.java	20 Jul 2003 22:32:30 -0000	1.19
  @@ -56,6 +56,7 @@
           while (i.hasNext()) {
               WeakReference gnWRef = (WeakReference)i.next();
               GraphicsNode  gn     = (GraphicsNode)gnWRef.get();
  +            //GraphicsNode  srcGN  = gn;
   
               // if the weak ref has been cleared then this node is no
               // longer part of the GVT tree (and the change should be
  @@ -131,6 +132,8 @@
                   //       srcORgn + "\n" + srcNRgn + "\n");
                   // <!>
                   Shape oRgn = srcORgn;
  +                // System.err.println("src: " + srcORgn);
  +                // System.err.println("GN: " + srcGN);
                   if (oat != null){
                       oRgn = oat.createTransformedShape(srcORgn);
                   }
  @@ -218,11 +221,13 @@
           }
   
           GraphicsNode chngSrc = gnce.getChangeSrc();
  -        Rectangle2D rgn;
  +        Rectangle2D rgn = null;
           if (chngSrc != null) {
               // A child node is moving in the tree so assign it's dirty
               // regions to this node before it moves.
  -            rgn = new ChngSrcRect(getNodeDirtyRegion(chngSrc));
  +            Rectangle2D drgn = getNodeDirtyRegion(chngSrc);
  +            if (drgn != null)
  +                rgn = new ChngSrcRect(drgn);
           } else {
               // Otherwise just use gn's current region.
               rgn = gn.getBounds();
  @@ -233,6 +238,12 @@
               if (r2d != null) r2d = r2d.createUnion(rgn);
               else             r2d = rgn;
           }
  +
  +        // if ((gn instanceof CompositeGraphicsNode) && 
  +        //     (r2d.getWidth() > 200)) {
  +        //     new Exception("Adding Large: " + gn).printStackTrace();
  +        // }
  +
           // Store the bounds for the future.
           fromBounds.put(gnWRef, r2d);
       }
  
  
  
  1.16      +38 -49    \
xml-batik/sources/org/apache/batik/script/rhino/WindowWrapper.java  
  Index: WindowWrapper.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/script/rhino/WindowWrapper.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- WindowWrapper.java	9 Jul 2003 02:10:11 -0000	1.15
  +++ WindowWrapper.java	20 Jul 2003 22:32:31 -0000	1.16
  @@ -370,34 +370,9 @@
                                  final String mime,
                                  final String content) {
               try {
  -                interpreter.callHandler(function,
  -                    new RhinoInterpreter.ArgumentsBuilder() {
  -                        public Object[] buildArguments() {
  -                            try {
  -                                Object[] arguments = new Object[1];
  -                                ScriptableObject so =
  -                                    (ScriptableObject)interpreter.evaluate
  -                                    (new StringReader("new Object()"));
  -                                so.put("success", so,
  -                                       (success) ?
  -                                       Boolean.TRUE : Boolean.FALSE);
  -                                if (mime != null) {
  -                                    so.put("contentType", so,
  -                                           Context.toObject(mime, scope));
  -                                }
  -                                if (content != null) {
  -                                    so.put("content", so,
  -                                           Context.toObject(content, scope));
  -                                }
  -                                arguments[0] = so;
  -                                return arguments;
  -                            } catch (IOException e) {
  -                                throw new WrappedException(e);
  -                            } catch (InterpreterException e) {
  -                                throw new WrappedException(e);
  -                            }
  -                        }
  -                    });
  +                interpreter.callHandler
  +                    (function,
  +                     new GetURLDoneArgBuilder(success, mime, content, scope));
               } catch (JavaScriptException e) {
                   throw new WrappedException(e);
               }
  @@ -451,30 +426,44 @@
               try {
                   interpreter.callMethod
                       (object, COMPLETE,
  -                     new RhinoInterpreter.ArgumentsBuilder() {
  -                         public Object[] buildArguments() {
  -                             Object[] arguments = new Object[1];
  -                             ScriptableObject so =
  -                                 new NativeObject();
  -                             so.put("success", so,
  -                                    (success) ?
  -                                    Boolean.TRUE : Boolean.FALSE);
  -                             if (mime != null) {
  -                                 so.put("contentType", so,
  -                                        Context.toObject(mime, scope));
  -                             }
  -                             if (content != null) {
  -                                 so.put("content", so,
  -                                        Context.toObject(content, scope));
  -                             }
  -                             arguments[0] = so;
  -                             return arguments;
  -                         }
  -                     });
  +                     new GetURLDoneArgBuilder(success, mime, content, scope));
               } catch (JavaScriptException e) {
                   Context.exit();
                   throw new WrappedException(e);
               }
           }
       }
  +
  +    static class GetURLDoneArgBuilder 
  +        implements RhinoInterpreter.ArgumentsBuilder {
  +        boolean success;
  +        String mime, content;
  +        ScriptableObject scope;
  +        public GetURLDoneArgBuilder(boolean success, 
  +                                    String mime, String content,
  +                                    ScriptableObject scope) {
  +            this.success = success;
  +            this.mime    = mime;
  +            this.content = content;
  +            this.scope   = scope;
  +        }
  +
  +        public Object[] buildArguments() {
  +            Object[] arguments = new Object[1];
  +            ScriptableObject so = new NativeObject();
  +            so.put("success", so,
  +                   (success) ? Boolean.TRUE : Boolean.FALSE);
  +            if (mime != null) {
  +                so.put("contentType", so,
  +                       Context.toObject(mime, scope));
  +            }
  +            if (content != null) {
  +                so.put("content", so,
  +                       Context.toObject(content, scope));
  +            }
  +            arguments[0] = so;
  +            return arguments;
  +        }
  +    }
  +    
   }
  
  
  
  1.109     +11 -9     \
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.108
  retrieving revision 1.109
  diff -u -r1.108 -r1.109
  --- samplesRendering.xml	16 Jul 2003 00:46:50 -0000	1.108
  +++ samplesRendering.xml	20 Jul 2003 22:32:31 -0000	1.109
  @@ -253,10 +253,18 @@
            <test id="samples/tests/spec/styling/alternateStylesheet.svg" />
            <test id="samples/tests/spec/styling/cssMedia.svg" />
            <test id="samples/tests/spec/styling/cssMediaList.svg" />
  -         <test id="samples/tests/spec/styling/smiley.svg" />
            <test id="samples/tests/spec/styling/emptyStyle.svg" />
  +         <test id="samples/tests/spec/styling/smiley.svg" />
  +         <test id="samples/tests/spec/styling/styleElement.svg" />
   
           <!-- Alternate stylesheet tests -->
  +        <!-- Sample tests, media test -->
  +        <testGroup id="media" \
class="org.apache.batik.test.svg.SVGMediaRenderingAccuracyTest">  +            <test \
id="samples/tests/spec/styling/cssMedia.svg-Screen" />  +            <test \
id="samples/tests/spec/styling/cssMedia.svg-Print" />  +            <test \
id="samples/tests/spec/styling/cssMedia.svg-Projection" />  +        </testGroup>
  +
           <testGroup id="alternate" \
                class="org.apache.batik.test.svg.SVGAlternateStyleSheetRenderingAccuracyTest">
                
               <test id="samples/tests/spec/styling/alternateStylesheet.svg-Hot" />
               <test id="samples/tests/spec/styling/alternateStylesheet.svg-Cold" />
  @@ -267,13 +275,6 @@
               <test id="samples/tests/spec/styling/smiley.svg-Oups" />
           </testGroup>
   
  -        <!-- Sample tests, media test -->
  -        <testGroup id="media" \
                class="org.apache.batik.test.svg.SVGMediaRenderingAccuracyTest">
  -            <test id="samples/tests/spec/styling/cssMedia.svg-Screen" />
  -            <test id="samples/tests/spec/styling/cssMedia.svg-Print" />
  -            <test id="samples/tests/spec/styling/cssMedia.svg-Projection" />
  -        </testGroup>
  -
       </testGroup>
   
       <testGroup id="tests.spec.text">
  @@ -369,5 +370,6 @@
           <test id="samples/tests/spec/scripting/rootSizeChange.svg" />
           <test id="samples/tests/spec/scripting/rectResizeOnClick.svg" />
           <test id="samples/tests/spec/scripting/setProperty.svg" />
  +        <test id="samples/tests/spec/scripting/styling.svg" />
       </testGroup>
   </testSuite>
  
  
  

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic