flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcl...@apache.org
Subject [12/62] [abbrv] [partial] Merged Apache Flex 4.9.0 release branch
Date Tue, 08 Oct 2013 14:03:27 GMT
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGHKernElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGHKernElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGHKernElementBridge.java
index 3fc0cdf..988becc 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGHKernElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGHKernElementBridge.java
@@ -1,10 +1,11 @@
 /*
 
-   Copyright 2001  The Apache Software Foundation 
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
 
        http://www.apache.org/licenses/LICENSE-2.0
 
@@ -21,7 +22,7 @@ package org.apache.flex.forks.batik.bridge;
  * Bridge class for the <hkern> element.
  *
  * @author <a href="mailto:dean.jackson@cmis.csiro.au">Dean Jackson</a>
- * @version $Id: SVGHKernElementBridge.java,v 1.5 2004/08/18 07:12:34 vhardy Exp $
+ * @version $Id: SVGHKernElementBridge.java 475477 2006-11-15 22:44:28Z cam $
  */
 public class SVGHKernElementBridge extends SVGKernElementBridge {
 

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGImageElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGImageElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGImageElementBridge.java
index 098a39c..03fa612 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGImageElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGImageElementBridge.java
@@ -1,10 +1,11 @@
 /*
 
-   Copyright 2001-2004  The Apache Software Foundation 
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
 
        http://www.apache.org/licenses/LICENSE-2.0
 
@@ -25,19 +26,26 @@ import java.awt.geom.AffineTransform;
 import java.awt.geom.Rectangle2D;
 import java.io.BufferedInputStream;
 import java.io.InputStream;
+import java.io.InterruptedIOException;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.flex.forks.batik.css.engine.CSSEngine;
 import org.apache.flex.forks.batik.css.engine.SVGCSSEngine;
+import org.apache.flex.forks.batik.dom.AbstractNode;
+import org.apache.flex.forks.batik.dom.events.DOMMouseEvent;
+import org.apache.flex.forks.batik.dom.events.NodeEventTarget;
+import org.apache.flex.forks.batik.dom.svg.AbstractSVGAnimatedLength;
+import org.apache.flex.forks.batik.dom.svg.AnimatedLiveAttributeValue;
+import org.apache.flex.forks.batik.dom.svg.LiveAttributeException;
+import org.apache.flex.forks.batik.dom.svg.SVGOMAnimatedPreserveAspectRatio;
 import org.apache.flex.forks.batik.dom.svg.SVGOMDocument;
 import org.apache.flex.forks.batik.dom.svg.SVGOMElement;
-import org.apache.flex.forks.batik.dom.svg.XMLBaseSupport;
-import org.apache.flex.forks.batik.dom.util.XLinkSupport;
 import org.apache.flex.forks.batik.ext.awt.color.ICCColorSpaceExt;
 import org.apache.flex.forks.batik.ext.awt.image.renderable.ClipRable8Bit;
 import org.apache.flex.forks.batik.ext.awt.image.renderable.Filter;
+import org.apache.flex.forks.batik.ext.awt.image.spi.BrokenLinkProvider;
 import org.apache.flex.forks.batik.ext.awt.image.spi.ImageTagRegistry;
 import org.apache.flex.forks.batik.gvt.CanvasGraphicsNode;
 import org.apache.flex.forks.batik.gvt.CompositeGraphicsNode;
@@ -45,25 +53,26 @@ import org.apache.flex.forks.batik.gvt.GraphicsNode;
 import org.apache.flex.forks.batik.gvt.ImageNode;
 import org.apache.flex.forks.batik.gvt.RasterImageNode;
 import org.apache.flex.forks.batik.gvt.ShapeNode;
-import org.apache.flex.forks.batik.util.ParsedURL;
+import org.apache.flex.forks.batik.util.HaltingThread;
 import org.apache.flex.forks.batik.util.MimeTypeConstants;
+import org.apache.flex.forks.batik.util.ParsedURL;
+import org.apache.flex.forks.batik.util.XMLConstants;
+
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
-import org.w3c.dom.Node;
 import org.w3c.dom.events.DocumentEvent;
 import org.w3c.dom.events.Event;
 import org.w3c.dom.events.EventListener;
 import org.w3c.dom.events.EventTarget;
-import org.w3c.dom.events.MouseEvent;
-import org.w3c.dom.events.MutationEvent;
-import org.w3c.flex.forks.dom.svg.SVGDocument;
-import org.w3c.flex.forks.dom.svg.SVGSVGElement;
+import org.w3c.dom.svg.SVGDocument;
+import org.w3c.dom.svg.SVGImageElement;
+import org.w3c.dom.svg.SVGSVGElement;
 
 /**
  * Bridge class for the &lt;image> element.
  *
  * @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGImageElementBridge.java,v 1.72 2005/03/27 08:58:30 cam Exp $
+ * @version $Id: SVGImageElementBridge.java 579487 2007-09-26 06:40:16Z cam $
  */
 public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
 
@@ -104,12 +113,15 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
             return null;
         }
 
+        associateSVGContext(ctx, e, imageNode);
+
         hitCheckChildren = false;
         GraphicsNode node = buildImageGraphicsNode(ctx,e);
 
         if (node == null) {
-            String uriStr = XLinkSupport.getXLinkHref(e);
-            throw new BridgeException(e, ERR_URI_IMAGE_INVALID,
+            SVGImageElement ie = (SVGImageElement) e;
+            String uriStr = ie.getHref().getAnimVal();
+            throw new BridgeException(ctx, e, ERR_URI_IMAGE_INVALID,
                                       new Object[] {uriStr});
         }
 
@@ -127,45 +139,47 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
     }
 
     /**
-     * Create a Graphics node according to the 
+     * Create a Graphics node according to the
      * resource pointed by the href : RasterImageNode
      * for bitmaps, CompositeGraphicsNode for svg files.
      *
      * @param ctx : the bridge context to use
      * @param e the element that describes the graphics node to build
-     * 
+     *
      * @return the graphic node that represent the resource
      *  pointed by the reference
      */
     protected GraphicsNode buildImageGraphicsNode
         (BridgeContext ctx, Element e){
 
+        SVGImageElement ie = (SVGImageElement) e;
+
         // 'xlink:href' attribute - required
-        String uriStr = XLinkSupport.getXLinkHref(e);
+        String uriStr = ie.getHref().getAnimVal();
         if (uriStr.length() == 0) {
-            throw new BridgeException(e, ERR_ATTRIBUTE_MISSING,
+            throw new BridgeException(ctx, e, ERR_ATTRIBUTE_MISSING,
                                       new Object[] {"xlink:href"});
         }
         if (uriStr.indexOf('#') != -1) {
-            throw new BridgeException(e, ERR_ATTRIBUTE_VALUE_MALFORMED,
+            throw new BridgeException(ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED,
                                       new Object[] {"xlink:href", uriStr});
         }
 
         // Build the URL.
-        String baseURI = XMLBaseSupport.getCascadedXMLBase(e);
+        String baseURI = AbstractNode.getBaseURI(e);
         ParsedURL purl;
-        if (baseURI == null)
+        if (baseURI == null) {
             purl = new ParsedURL(uriStr);
-        else
+        } else {
             purl = new ParsedURL(baseURI, uriStr);
+        }
 
         return createImageGraphicsNode(ctx, e, purl);
     }
 
-    protected GraphicsNode createImageGraphicsNode(BridgeContext ctx, 
+    protected GraphicsNode createImageGraphicsNode(BridgeContext ctx,
                                                    Element e,
-                                                   ParsedURL purl)
-    {
+                                                   ParsedURL purl) {
         Rectangle2D bounds = getImageBounds(ctx, e);
         if ((bounds.getWidth() == 0) || (bounds.getHeight() == 0)) {
             ShapeNode sn = new ShapeNode();
@@ -183,8 +197,8 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
 
         try {
             userAgent.checkLoadExternalResource(purl, pDocURL);
-        } catch (SecurityException ex) {
-            throw new BridgeException(e, ERR_URI_UNSECURE,
+        } catch (SecurityException secEx ) {
+            throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE,
                                       new Object[] {purl});
         }
 
@@ -207,12 +221,12 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
                 throw ex;
             } catch (Exception ex) {
                 /* Nothing to do */
-            } 
+            }
 
             /* Check the ImageTagRegistry Cache */
             Filter img = reg.checkCache(purl, colorspace);
             if (img != null) {
-                return createRasterImageNode(ctx, e, img);
+                return createRasterImageNode(ctx, e, img, purl);
             }
         }
 
@@ -226,11 +240,12 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
         ProtectedStream reference = null;
         try {
             reference = openStream(e, purl);
-        } catch (SecurityException ex) {
-            throw new BridgeException(e, ERR_URI_UNSECURE,
+        } catch (SecurityException secEx ) {
+            throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE,
                                       new Object[] {purl});
         } catch (IOException ioe) {
-            return createBrokenImageNode(ctx, e, purl.toString());
+            return createBrokenImageNode(ctx, e, purl.toString(),
+                                         ioe.getLocalizedMessage());
         }
 
         {
@@ -240,11 +255,11 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
              * We tell the registry what the source purl is but we
              * tell it not to open that url.
              */
-            Filter img = reg.readURL(reference, purl, colorspace, 
+            Filter img = reg.readURL(reference, purl, colorspace,
                                      false, false);
             if (img != null) {
                 // It's a bouncing baby Raster...
-                return createRasterImageNode(ctx, e, img);
+                return createRasterImageNode(ctx, e, img, purl);
             }
         }
 
@@ -252,12 +267,15 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
             // Reset the stream for next try.
             reference.retry();
         } catch (IOException ioe) {
+            reference.release();
+            reference = null;
             try {
                 // Couldn't reset stream so reopen it.
                 reference = openStream(e, purl);
             } catch (IOException ioe2) {
                 // Since we already opened the stream this is unlikely.
-                return createBrokenImageNode(ctx, e, purl.toString());
+                return createBrokenImageNode(ctx, e, purl.toString(),
+                                             ioe2.getLocalizedMessage());
             }
         }
 
@@ -270,22 +288,31 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
             return createSVGImageNode(ctx, e, imgDocument);
         } catch (BridgeException ex) {
             throw ex;
-        } catch (SecurityException ex) {
-            throw new BridgeException(e, ERR_URI_UNSECURE,
+        } catch (SecurityException secEx ) {
+            throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE,
                                       new Object[] {purl});
+        } catch (InterruptedIOException iioe) {
+            if (HaltingThread.hasBeenHalted())
+                throw new InterruptedBridgeException();
+
+        } catch (InterruptedBridgeException ibe) {
+            throw ibe;
         } catch (Exception ex) {
             /* Nothing to do */
             // ex.printStackTrace();
-        } 
+        }
 
         try {
             reference.retry();
         } catch (IOException ioe) {
+            reference.release();
+            reference = null;
             try {
                 // Couldn't reset stream so reopen it.
                 reference = openStream(e, purl);
             } catch (IOException ioe2) {
-                return createBrokenImageNode(ctx, e, purl.toString());
+                return createBrokenImageNode(ctx, e, purl.toString(),
+                                             ioe2.getLocalizedMessage());
             }
         }
 
@@ -293,11 +320,11 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
             // Finally try to load the image as a raster image (JPG or
             // PNG) allowing the registry to open the url (so the
             // JDK readers can be checked).
-            Filter img = reg.readURL(reference, purl, colorspace, 
+            Filter img = reg.readURL(reference, purl, colorspace,
                                      true, true);
             if (img != null) {
                 // It's a bouncing baby Raster...
-                return createRasterImageNode(ctx, e, img);
+                return createRasterImageNode(ctx, e, img, purl);
             }
         } finally {
             reference.release();
@@ -305,8 +332,8 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
         return null;
     }
 
-    static public class ProtectedStream extends BufferedInputStream {
-        final static int BUFFER_SIZE = 8192;
+    public static class ProtectedStream extends BufferedInputStream {
+        static final int BUFFER_SIZE = 8192;
         ProtectedStream(InputStream is) {
             super(is, BUFFER_SIZE);
             super.mark(BUFFER_SIZE); // Remember start
@@ -342,7 +369,7 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
         }
     }
 
-    protected ProtectedStream openStream(Element e, ParsedURL purl) 
+    protected ProtectedStream openStream(Element e, ParsedURL purl)
         throws IOException {
         List mimeTypes = new ArrayList
             (ImageTagRegistry.getRegistry().getRegisteredMimeTypes());
@@ -381,7 +408,6 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
 
         // Bind the nodes for interactive and dynamic
         // HACK due to the way images are represented in GVT
-        ImageNode imgNode = (ImageNode)node;
         ctx.bind(e, node);
 
         if (ctx.isDynamic()) {
@@ -396,55 +422,58 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
     // BridgeUpdateHandler implementation //////////////////////////////////
 
     /**
-     * Invoked when an MutationEvent of type 'DOMAttrModified' is fired.
+     * Invoked when the animated value of an animatable attribute has changed.
      */
-    public void handleDOMAttrModifiedEvent(MutationEvent evt) {
-
-        String attrName = evt.getAttrName();
-        Node evtNode = evt.getRelatedNode();
-
-        if (attrName.equals(SVG_X_ATTRIBUTE) ||
-            attrName.equals(SVG_Y_ATTRIBUTE) ||
-	    attrName.equals(SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE)){
-            updateImageBounds();
-        } else if (( XLinkSupport.XLINK_NAMESPACE_URI.equals
-                     (evtNode.getNamespaceURI()) ) 
-                   && SVG_HREF_ATTRIBUTE.equals(evtNode.getLocalName()) ){
-            rebuildImageNode();
-	} else if(attrName.equals(SVG_WIDTH_ATTRIBUTE) ||
-                  attrName.equals(SVG_HEIGHT_ATTRIBUTE)) {
-            float oldV = 0, newV=0;
-            String s = evt.getPrevValue();
-            UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, e);
-
-            if (s.length() != 0) {
-                oldV = UnitProcessor.svgHorizontalCoordinateToUserSpace
-                    (s, attrName, uctx);
-            }
-            s = evt.getNewValue();
-            if (s.length() != 0) {
-                newV = UnitProcessor.svgHorizontalCoordinateToUserSpace
-                    (s, attrName, uctx);
-            }
-            if (oldV == newV) return;
-            
-            if ((oldV == 0) || (newV == 0))
+    public void handleAnimatedAttributeChanged
+            (AnimatedLiveAttributeValue alav) {
+        try {
+            String ns = alav.getNamespaceURI();
+            String ln = alav.getLocalName();
+            if (ns == null) {
+                if (ln.equals(SVG_X_ATTRIBUTE)
+                        || ln.equals(SVG_Y_ATTRIBUTE)) {
+                    updateImageBounds();
+                    return;
+                } else if (ln.equals(SVG_WIDTH_ATTRIBUTE)
+                        || ln.equals(SVG_HEIGHT_ATTRIBUTE)) {
+                    SVGImageElement ie = (SVGImageElement) e;
+                    ImageNode imageNode = (ImageNode) node;
+                    AbstractSVGAnimatedLength _attr;
+                    if (ln.charAt(0) == 'w') {
+                        _attr = (AbstractSVGAnimatedLength) ie.getWidth();
+                    } else {
+                        _attr = (AbstractSVGAnimatedLength) ie.getHeight();
+                    }
+                    float val = _attr.getCheckedValue();
+                    if (val == 0 || imageNode.getImage() instanceof ShapeNode) {
+                        rebuildImageNode();
+                    } else {
+                        updateImageBounds();
+                    }
+                    return;
+                } else if (ln.equals(SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE)) {
+                    updateImageBounds();
+                    return;
+                }
+            } else if (ns.equals(XLINK_NAMESPACE_URI)
+                    && ln.equals(XLINK_HREF_ATTRIBUTE)) {
                 rebuildImageNode();
-            else
-                updateImageBounds();
-        } else {
-            super.handleDOMAttrModifiedEvent(evt);
-	}
+                return;
+            }
+        } catch (LiveAttributeException ex) {
+            throw new BridgeException(ctx, ex);
+        }
+        super.handleAnimatedAttributeChanged(alav);
     }
 
     protected void updateImageBounds() {
         //retrieve the new bounds of the image tag
-        Rectangle2D	bounds = getImageBounds(ctx, e);
+        Rectangle2D bounds = getImageBounds(ctx, e);
         GraphicsNode imageNode = ((ImageNode)node).getImage();
-        float [] vb = null;
+        float[] vb = null;
         if (imageNode instanceof RasterImageNode) {
             //Raster image
-            Rectangle2D imgBounds = 
+            Rectangle2D imgBounds =
                 ((RasterImageNode)imageNode).getImageBounds();
             // create the implicit viewBox for the raster
             // image. The viewBox for a raster image is the size
@@ -459,7 +488,7 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
                 Element svgElement = imgDocument.getRootElement();
                 String viewBox = svgElement.getAttributeNS
                     (null, SVG_VIEW_BOX_ATTRIBUTE);
-                vb = ViewBox.parseViewBoxAttribute(e, viewBox);
+                vb = ViewBox.parseViewBoxAttribute(e, viewBox, ctx);
             }
         }
         if (imageNode != null) {
@@ -468,23 +497,41 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
             // the image node
             initializeViewport(ctx, e, imageNode, vb, bounds);
         }
-            
+
     }
 
     protected void rebuildImageNode() {
         // Reference copy of the imgDocument
         if ((imgDocument != null) && (listener != null)) {
-            EventTarget tgt = (EventTarget)imgDocument.getRootElement();
-
-            tgt.removeEventListener(SVG_EVENT_CLICK,     listener, false);
-            tgt.removeEventListener(SVG_EVENT_KEYDOWN,   listener, false);
-            tgt.removeEventListener(SVG_EVENT_KEYPRESS,  listener, false);
-            tgt.removeEventListener(SVG_EVENT_KEYUP,     listener, false);
-            tgt.removeEventListener(SVG_EVENT_MOUSEDOWN, listener, false);
-            tgt.removeEventListener(SVG_EVENT_MOUSEMOVE, listener, false);
-            tgt.removeEventListener(SVG_EVENT_MOUSEOUT,  listener, false);
-            tgt.removeEventListener(SVG_EVENT_MOUSEOVER, listener, false);
-            tgt.removeEventListener(SVG_EVENT_MOUSEUP,   listener, false);
+            NodeEventTarget tgt = (NodeEventTarget)imgDocument.getRootElement();
+
+            tgt.removeEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_CLICK,
+                 listener, false);
+            tgt.removeEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_KEYDOWN,
+                 listener, false);
+            tgt.removeEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_KEYPRESS,
+                 listener, false);
+            tgt.removeEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_KEYUP,
+                 listener, false);
+            tgt.removeEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEDOWN,
+                 listener, false);
+            tgt.removeEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEMOVE,
+                 listener, false);
+            tgt.removeEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEOUT,
+                 listener, false);
+            tgt.removeEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEOVER,
+                 listener, false);
+            tgt.removeEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEUP,
+                 listener, false);
             listener = null;
         }
 
@@ -503,8 +550,9 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
         imgNode.setImage(inode);
 
         if (inode == null) {
-            String uriStr = XLinkSupport.getXLinkHref(e);
-            throw new BridgeException(e, ERR_URI_IMAGE_INVALID,
+            SVGImageElement ie = (SVGImageElement) e;
+            String uriStr = ie.getHref().getAnimVal();
+            throw new BridgeException(ctx, e, ERR_URI_IMAGE_INVALID,
                                       new Object[] {uriStr});
         }
     }
@@ -539,18 +587,22 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
      */
     protected GraphicsNode createRasterImageNode(BridgeContext ctx,
                                                  Element       e,
-                                                 Filter        img) {
+                                                 Filter        img,
+                                                 ParsedURL     purl) {
         Rectangle2D bounds = getImageBounds(ctx, e);
         if ((bounds.getWidth() == 0) || (bounds.getHeight() == 0)) {
             ShapeNode sn = new ShapeNode();
             sn.setShape(bounds);
             return sn;
         }
-        Object           obj = img.getProperty
-            (SVGBrokenLinkProvider.SVG_BROKEN_LINK_DOCUMENT_PROPERTY);
-        if ((obj != null) && (obj instanceof SVGDocument)) {
-            // Ok so we are dealing with a broken link.
-            SVGOMDocument doc = (SVGOMDocument)obj;
+
+        if (BrokenLinkProvider.hasBrokenLinkProperty(img)) {
+            Object o=img.getProperty(BrokenLinkProvider.BROKEN_LINK_PROPERTY);
+            String msg = "unknown";
+            if (o instanceof String)
+                msg = (String)o;
+            SVGDocument doc = ctx.getUserAgent().getBrokenLinkDocument
+                (e, purl.toString(), msg);
             return createSVGImageNode(ctx, e, doc);
         }
 
@@ -584,18 +636,10 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
                                               Element e,
                                               SVGDocument imgDocument) {
         CSSEngine eng = ((SVGOMDocument)imgDocument).getCSSEngine();
-        if (eng != null) {
-            subCtx = (BridgeContext)eng.getCSSContext();
-        } else {
-            subCtx = new BridgeContext(ctx.getUserAgent(), 
-                                       ctx.getDocumentLoader());
-            subCtx.setGVTBuilder(ctx.getGVTBuilder());
-            subCtx.setDocument(imgDocument);
-            subCtx.initializeDocument(imgDocument);
-        }
+        subCtx = ctx.createSubBridgeContext((SVGOMDocument)imgDocument);
 
         CompositeGraphicsNode result = new CompositeGraphicsNode();
-        // handles the 'preserveAspectRatio', 'overflow' and 'clip' and 
+        // handles the 'preserveAspectRatio', 'overflow' and 'clip' and
         // sets the appropriate AffineTransform to the image node
         Rectangle2D bounds = getImageBounds(ctx, e);
 
@@ -616,8 +660,10 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
         node = (CanvasGraphicsNode)subCtx.getGVTBuilder().build
             (subCtx, svgElement);
 
-        if (eng == null) // If we "created" this document then add listerns.
+        if ((eng == null) && ctx.isInteractive()) {
+            // If we "created" this document then add listerns.
             subCtx.addUIEventListeners(imgDocument);
+        }
 
         // HACK: remove the clip set by the SVGSVGElement as the overflow
         // and clip properties must be ignored. The clip will be set later
@@ -631,9 +677,10 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
 
         // create the implicit viewBox for the SVG image. The viewBox for a
         // SVG image is the viewBox of the outermost SVG element of the SVG file
+        // XXX Use animated value of 'viewBox' here?
         String viewBox =
             svgElement.getAttributeNS(null, SVG_VIEW_BOX_ATTRIBUTE);
-        float [] vb = ViewBox.parseViewBoxAttribute(e, viewBox);
+        float[] vb = ViewBox.parseViewBoxAttribute(e, viewBox, ctx);
 
         initializeViewport(ctx, e, result, vb, bounds);
 
@@ -642,34 +689,70 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
         // to the <image> element (inside the original document).
         if (ctx.isInteractive()) {
             listener = new ForwardEventListener(svgElement, e);
-            EventTarget tgt = (EventTarget)svgElement;
-
-            tgt.addEventListener(SVG_EVENT_CLICK, listener, false);
-            subCtx.storeEventListener(tgt, SVG_EVENT_CLICK, listener, false);
-
-            tgt.addEventListener(SVG_EVENT_KEYDOWN, listener, false);
-            subCtx.storeEventListener(tgt, SVG_EVENT_KEYDOWN, listener, false);
-
-            tgt.addEventListener(SVG_EVENT_KEYPRESS, listener, false);
-            subCtx.storeEventListener(tgt, SVG_EVENT_KEYPRESS, listener, false);
-
-            tgt.addEventListener(SVG_EVENT_KEYUP, listener, false);
-            subCtx.storeEventListener(tgt, SVG_EVENT_KEYUP, listener, false);
-
-            tgt.addEventListener(SVG_EVENT_MOUSEDOWN, listener, false);
-            subCtx.storeEventListener(tgt, SVG_EVENT_MOUSEDOWN, listener,false);
-
-            tgt.addEventListener(SVG_EVENT_MOUSEMOVE, listener, false);
-            subCtx.storeEventListener(tgt, SVG_EVENT_MOUSEMOVE, listener,false);
-
-            tgt.addEventListener(SVG_EVENT_MOUSEOUT, listener, false);
-            subCtx.storeEventListener(tgt, SVG_EVENT_MOUSEOUT, listener, false);
-
-            tgt.addEventListener(SVG_EVENT_MOUSEOVER, listener, false);
-            subCtx.storeEventListener(tgt, SVG_EVENT_MOUSEOVER, listener,false);
-
-            tgt.addEventListener(SVG_EVENT_MOUSEUP, listener, false);
-            subCtx.storeEventListener(tgt, SVG_EVENT_MOUSEUP, listener, false);
+            NodeEventTarget tgt = (NodeEventTarget)svgElement;
+
+            tgt.addEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_CLICK,
+                 listener, false, null);
+            subCtx.storeEventListenerNS
+                (tgt, XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_CLICK,
+                 listener, false);
+
+            tgt.addEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_KEYDOWN,
+                 listener, false, null);
+            subCtx.storeEventListenerNS
+                (tgt, XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_KEYDOWN,
+                 listener, false);
+
+            tgt.addEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_KEYPRESS,
+                 listener, false, null);
+            subCtx.storeEventListenerNS
+                (tgt, XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_KEYPRESS,
+                 listener, false);
+
+            tgt.addEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_KEYUP,
+                 listener, false, null);
+            subCtx.storeEventListenerNS
+                (tgt, XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_KEYUP,
+                 listener, false);
+
+            tgt.addEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEDOWN,
+                 listener, false, null);
+            subCtx.storeEventListenerNS
+                (tgt, XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEDOWN,
+                 listener, false);
+
+            tgt.addEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEMOVE,
+                 listener, false, null);
+            subCtx.storeEventListenerNS
+                (tgt, XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEMOVE,
+                 listener, false);
+
+            tgt.addEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEOUT,
+                 listener, false, null);
+            subCtx.storeEventListenerNS
+                (tgt, XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEOUT,
+                 listener, false);
+
+            tgt.addEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEOVER,
+                 listener, false, null);
+            subCtx.storeEventListenerNS
+                (tgt, XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEOVER,
+                 listener, false);
+
+            tgt.addEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEUP,
+                 listener, false, null);
+            subCtx.storeEventListenerNS
+                (tgt, XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEUP,
+                 listener, false);
         }
 
         return result;
@@ -677,17 +760,35 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
 
     public void dispose() {
         if ((imgDocument != null) && (listener != null)) {
-            EventTarget tgt = (EventTarget)imgDocument.getRootElement();
-
-            tgt.removeEventListener(SVG_EVENT_CLICK,     listener, false);
-            tgt.removeEventListener(SVG_EVENT_KEYDOWN,   listener, false);
-            tgt.removeEventListener(SVG_EVENT_KEYPRESS,  listener, false);
-            tgt.removeEventListener(SVG_EVENT_KEYUP,     listener, false);
-            tgt.removeEventListener(SVG_EVENT_MOUSEDOWN, listener, false);
-            tgt.removeEventListener(SVG_EVENT_MOUSEMOVE, listener, false);
-            tgt.removeEventListener(SVG_EVENT_MOUSEOUT,  listener, false);
-            tgt.removeEventListener(SVG_EVENT_MOUSEOVER, listener, false);
-            tgt.removeEventListener(SVG_EVENT_MOUSEUP,   listener, false);
+            NodeEventTarget tgt = (NodeEventTarget)imgDocument.getRootElement();
+
+            tgt.removeEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_CLICK,
+                 listener, false);
+            tgt.removeEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_KEYDOWN,
+                 listener, false);
+            tgt.removeEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_KEYPRESS,
+                 listener, false);
+            tgt.removeEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_KEYUP,
+                 listener, false);
+            tgt.removeEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEDOWN,
+                 listener, false);
+            tgt.removeEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEMOVE,
+                 listener, false);
+            tgt.removeEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEOUT,
+                 listener, false);
+            tgt.removeEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEOVER,
+                 listener, false);
+            tgt.removeEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEUP,
+                 listener, false);
             listener = null;
         }
 
@@ -725,26 +826,25 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
         }
 
         public void handleEvent(Event e) {
-            MouseEvent evt = (MouseEvent) e;
-            MouseEvent newMouseEvent = (MouseEvent)
+            DOMMouseEvent evt = (DOMMouseEvent) e;
+            DOMMouseEvent newMouseEvent = (DOMMouseEvent)
                 // DOM Level 2 6.5 cast from Document to DocumentEvent is ok
                 ((DocumentEvent)imgElement.getOwnerDocument()).createEvent("MouseEvents");
 
-            newMouseEvent.initMouseEvent(evt.getType(),
-                                         evt.getBubbles(),
-                                         evt.getCancelable(),
-                                         evt.getView(),
-                                         evt.getDetail(),
-                                         evt.getScreenX(),
-                                         evt.getScreenY(),
-                                         evt.getClientX(),
-                                         evt.getClientY(),
-                                         evt.getCtrlKey(),
-                                         evt.getAltKey(),
-                                         evt.getShiftKey(),
-                                         evt.getMetaKey(),
-                                         evt.getButton(),
-                                         (EventTarget)imgElement);
+            newMouseEvent.initMouseEventNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI,
+                 evt.getType(),
+                 evt.getBubbles(),
+                 evt.getCancelable(),
+                 evt.getView(),
+                 evt.getDetail(),
+                 evt.getScreenX(),
+                 evt.getScreenY(),
+                 evt.getClientX(),
+                 evt.getClientY(),
+                 evt.getButton(),
+                 (EventTarget)imgElement,
+                 evt.getModifiersString());
             ((EventTarget)imgElement).dispatchEvent(newMouseEvent);
         }
     }
@@ -764,7 +864,7 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
     protected static void initializeViewport(BridgeContext ctx,
                                              Element e,
                                              GraphicsNode node,
-                                             float [] vb,
+                                             float[] vb,
                                              Rectangle2D bounds) {
 
         float x = (float)bounds.getX();
@@ -772,36 +872,45 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
         float w = (float)bounds.getWidth();
         float h = (float)bounds.getHeight();
 
-        AffineTransform at
-            = ViewBox.getPreserveAspectRatioTransform(e, vb, w, h);
-        at.preConcatenate(AffineTransform.getTranslateInstance(x, y));
-        node.setTransform(at);
-
-        // 'overflow' and 'clip'
-        Shape clip = null;
-        if (CSSUtilities.convertOverflow(e)) { // overflow:hidden
-            float [] offsets = CSSUtilities.convertClip(e);
-            if (offsets == null) { // clip:auto
-                clip = new Rectangle2D.Float(x, y, w, h);
-            } else { // clip:rect(<x> <y> <w> <h>)
-                // offsets[0] = top
-                // offsets[1] = right
-                // offsets[2] = bottom
-                // offsets[3] = left
-                clip = new Rectangle2D.Float(x+offsets[3],
-                                             y+offsets[0],
-                                             w-offsets[1]-offsets[3],
-                                             h-offsets[2]-offsets[0]);
+        try {
+            SVGImageElement ie = (SVGImageElement) e;
+            SVGOMAnimatedPreserveAspectRatio _par =
+                (SVGOMAnimatedPreserveAspectRatio) ie.getPreserveAspectRatio();
+            _par.check();
+
+            AffineTransform at = ViewBox.getPreserveAspectRatioTransform
+                (e, vb, w, h, _par, ctx);
+            at.preConcatenate(AffineTransform.getTranslateInstance(x, y));
+            node.setTransform(at);
+
+            // 'overflow' and 'clip'
+            Shape clip = null;
+            if (CSSUtilities.convertOverflow(e)) { // overflow:hidden
+                float [] offsets = CSSUtilities.convertClip(e);
+                if (offsets == null) { // clip:auto
+                    clip = new Rectangle2D.Float(x, y, w, h);
+                } else { // clip:rect(<x> <y> <w> <h>)
+                    // offsets[0] = top
+                    // offsets[1] = right
+                    // offsets[2] = bottom
+                    // offsets[3] = left
+                    clip = new Rectangle2D.Float(x+offsets[3],
+                                                 y+offsets[0],
+                                                 w-offsets[1]-offsets[3],
+                                                 h-offsets[2]-offsets[0]);
+                }
             }
-        }
 
-        if (clip != null) {
-            try {
-                at = at.createInverse(); // clip in user space
-                Filter filter = node.getGraphicsNodeRable(true);
-                clip = at.createTransformedShape(clip);
-                node.setClip(new ClipRable8Bit(filter, clip));
-            } catch (java.awt.geom.NoninvertibleTransformException ex) {}
+            if (clip != null) {
+                try {
+                    at = at.createInverse(); // clip in user space
+                    Filter filter = node.getGraphicsNodeRable(true);
+                    clip = at.createTransformedShape(clip);
+                    node.setClip(new ClipRable8Bit(filter, clip));
+                } catch (java.awt.geom.NoninvertibleTransformException ex) {}
+            }
+        } catch (LiveAttributeException ex) {
+            throw new BridgeException(ctx, ex);
         }
     }
 
@@ -848,75 +957,43 @@ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
      * @param ctx the bridge context
      * @param element the image element
      */
-    protected static
-        Rectangle2D getImageBounds(BridgeContext ctx, Element element) {
+    protected static Rectangle2D getImageBounds(BridgeContext ctx,
+                                                Element element) {
+        try {
+            SVGImageElement ie = (SVGImageElement) element;
 
-        UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, element);
+            // 'x' attribute - default is 0
+            AbstractSVGAnimatedLength _x =
+                (AbstractSVGAnimatedLength) ie.getX();
+            float x = _x.getCheckedValue();
 
-        // 'x' attribute - default is 0
-        String s = element.getAttributeNS(null, SVG_X_ATTRIBUTE);
-        float x = 0;
-        if (s.length() != 0) {
-            x = UnitProcessor.svgHorizontalCoordinateToUserSpace
-                (s, SVG_X_ATTRIBUTE, uctx);
-        }
+            // 'y' attribute - default is 0
+            AbstractSVGAnimatedLength _y =
+                (AbstractSVGAnimatedLength) ie.getY();
+            float y = _y.getCheckedValue();
 
-        // 'y' attribute - default is 0
-        s = element.getAttributeNS(null, SVG_Y_ATTRIBUTE);
-        float y = 0;
-        if (s.length() != 0) {
-            y = UnitProcessor.svgVerticalCoordinateToUserSpace
-                (s, SVG_Y_ATTRIBUTE, uctx);
-        }
+            // 'width' attribute - required
+            AbstractSVGAnimatedLength _width =
+                (AbstractSVGAnimatedLength) ie.getWidth();
+            float w = _width.getCheckedValue();
 
-        // 'width' attribute - required
-        s = element.getAttributeNS(null, SVG_WIDTH_ATTRIBUTE);
-        float w;
-        if (s.length() == 0) {
-            throw new BridgeException(element, ERR_ATTRIBUTE_MISSING,
-                                      new Object[] {SVG_WIDTH_ATTRIBUTE});
-        } else {
-            w = UnitProcessor.svgHorizontalLengthToUserSpace
-                (s, SVG_WIDTH_ATTRIBUTE, uctx);
-        }
+            // 'height' attribute - required
+            AbstractSVGAnimatedLength _height =
+                (AbstractSVGAnimatedLength) ie.getHeight();
+            float h = _height.getCheckedValue();
 
-        // 'height' attribute - required
-        s = element.getAttributeNS(null, SVG_HEIGHT_ATTRIBUTE);
-        float h;
-        if (s.length() == 0) {
-            throw new BridgeException(element, ERR_ATTRIBUTE_MISSING,
-                                      new Object[] {SVG_HEIGHT_ATTRIBUTE});
-        } else {
-            h = UnitProcessor.svgVerticalLengthToUserSpace
-                (s, SVG_HEIGHT_ATTRIBUTE, uctx);
+            return new Rectangle2D.Float(x, y, w, h);
+        } catch (LiveAttributeException ex) {
+            throw new BridgeException(ctx, ex);
         }
-
-        return new Rectangle2D.Float(x, y, w, h);
     }
 
     GraphicsNode createBrokenImageNode
-        (BridgeContext ctx, Element e, String uri) {
-        
-        String lname = "<Unknown Element>";
-        SVGDocument doc = null;
-        if (e != null) {
-            doc = (SVGDocument)e.getOwnerDocument();
-            lname = e.getLocalName();
-        }
-        String docUri;
-        if (doc == null)  docUri = "<Unknown Document>";
-        else              docUri = doc.getURL();
-        int line = ctx.getDocumentLoader().getLineNumber(e);
-        Object [] fullparams = new Object[4];
-        fullparams[0] = docUri;
-        fullparams[1] = new Integer(line);
-        fullparams[2] = lname;
-        fullparams[3] = uri;
-
-        SVGDocument blDoc = brokenLinkProvider.getBrokenLinkDocument
-            (this, ERR_URI_IO, fullparams);
-        hitCheckChildren = true;
-        return createSVGImageNode(ctx, e, blDoc);
+        (BridgeContext ctx, Element e, String uri, String message) {
+        SVGDocument doc = ctx.getUserAgent().getBrokenLinkDocument
+            (e, uri, Messages.formatMessage(URI_IMAGE_ERROR,
+                                           new Object[] { message } ));
+        return createSVGImageNode(ctx, e, doc);
     }
 
 

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGKernElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGKernElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGKernElementBridge.java
index 7920c00..08c2603 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGKernElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGKernElementBridge.java
@@ -1,10 +1,11 @@
 /*
 
-   Copyright 2001,2003  The Apache Software Foundation 
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
 
        http://www.apache.org/licenses/LICENSE-2.0
 
@@ -29,7 +30,7 @@ import org.w3c.dom.Element;
  * A base Bridge class for the kerning elements.
  *
  * @author <a href="mailto:dean.jackson@cmis.csiro.au">Dean Jackson</a>
- * @version $Id: SVGKernElementBridge.java,v 1.7 2005/02/27 02:08:51 deweese Exp $
+ * @version $Id: SVGKernElementBridge.java 478160 2006-11-22 13:35:06Z dvholten $
  */
 public abstract class SVGKernElementBridge extends AbstractSVGBridge {
 
@@ -56,17 +57,17 @@ public abstract class SVGKernElementBridge extends AbstractSVGBridge {
         if (k.length() == 0) {
             k = SVG_KERN_K_DEFAULT_VALUE;
         }
-        
+
         // get the kern float value
         float kernValue = Float.parseFloat(k);
-        
+
         // set up the first and second glyph sets and unicode ranges
         int firstGlyphLen = 0, secondGlyphLen = 0;
         int [] firstGlyphSet = null;
         int [] secondGlyphSet = null;
         List firstUnicodeRanges = new ArrayList();
         List secondUnicodeRanges = new ArrayList();
-        
+
         // process the u1 attribute
         StringTokenizer st = new StringTokenizer(u1, ",");
         while (st.hasMoreTokens()) {
@@ -79,14 +80,13 @@ public abstract class SVGKernElementBridge extends AbstractSVGBridge {
                     firstGlyphSet = glyphCodes;
                     firstGlyphLen = glyphCodes.length;
                 }else {
-                    if ((firstGlyphLen + glyphCodes.length) > 
+                    if ((firstGlyphLen + glyphCodes.length) >
                         firstGlyphSet.length) {
                         int sz = firstGlyphSet.length*2;
                         if (sz <firstGlyphLen + glyphCodes.length)
                             sz = firstGlyphLen + glyphCodes.length;
                         int [] tmp = new int[sz];
-                        for (int i = 0; i < firstGlyphLen; i++)
-                            tmp[i] = firstGlyphSet[i];
+                        System.arraycopy( firstGlyphSet, 0, tmp, 0, firstGlyphLen );
                         firstGlyphSet = tmp;
                     }
                     for (int i = 0; i < glyphCodes.length; i++)
@@ -94,7 +94,7 @@ public abstract class SVGKernElementBridge extends AbstractSVGBridge {
                 }
             }
         }
-        
+
         // process the u2 attrbute
         st = new StringTokenizer(u2, ",");
         while (st.hasMoreTokens()) {
@@ -107,14 +107,13 @@ public abstract class SVGKernElementBridge extends AbstractSVGBridge {
                     secondGlyphSet = glyphCodes;
                     secondGlyphLen = glyphCodes.length;
                 } else {
-                    if ((secondGlyphLen + glyphCodes.length) > 
+                    if ((secondGlyphLen + glyphCodes.length) >
                         secondGlyphSet.length) {
                         int sz = secondGlyphSet.length*2;
                         if (sz <secondGlyphLen + glyphCodes.length)
                             sz = secondGlyphLen + glyphCodes.length;
                         int [] tmp = new int[sz];
-                        for (int i = 0; i < secondGlyphLen; i++)
-                            tmp[i] = secondGlyphSet[i];
+                        System.arraycopy( secondGlyphSet, 0, tmp, 0, secondGlyphLen );
                         secondGlyphSet = tmp;
                     }
                     for (int i = 0; i < glyphCodes.length; i++)
@@ -122,7 +121,7 @@ public abstract class SVGKernElementBridge extends AbstractSVGBridge {
                 }
             }
         }
-        
+
         // process the g1 attribute
         st = new StringTokenizer(g1, ",");
         while (st.hasMoreTokens()) {
@@ -132,21 +131,20 @@ public abstract class SVGKernElementBridge extends AbstractSVGBridge {
                 firstGlyphSet = glyphCodes;
                 firstGlyphLen = glyphCodes.length;
             }else {
-                if ((firstGlyphLen + glyphCodes.length) > 
+                if ((firstGlyphLen + glyphCodes.length) >
                     firstGlyphSet.length) {
                     int sz = firstGlyphSet.length*2;
                     if (sz <firstGlyphLen + glyphCodes.length)
                         sz = firstGlyphLen + glyphCodes.length;
                     int [] tmp = new int[sz];
-                    for (int i = 0; i < firstGlyphLen; i++)
-                        tmp[i] = firstGlyphSet[i];
+                    System.arraycopy( firstGlyphSet, 0, tmp, 0, firstGlyphLen );
                     firstGlyphSet = tmp;
                 }
                 for (int i = 0; i < glyphCodes.length; i++)
                     firstGlyphSet[firstGlyphLen++] = glyphCodes[i];
             }
         }
-        
+
         // process the g2 attribute
         st = new StringTokenizer(g2, ",");
         while (st.hasMoreTokens()) {
@@ -156,14 +154,13 @@ public abstract class SVGKernElementBridge extends AbstractSVGBridge {
                 secondGlyphSet = glyphCodes;
                 secondGlyphLen = glyphCodes.length;
             } else {
-                if ((secondGlyphLen + glyphCodes.length) > 
+                if ((secondGlyphLen + glyphCodes.length) >
                     secondGlyphSet.length) {
                     int sz = secondGlyphSet.length*2;
                     if (sz <secondGlyphLen + glyphCodes.length)
                         sz = secondGlyphLen + glyphCodes.length;
                     int [] tmp = new int[sz];
-                    for (int i = 0; i < secondGlyphLen; i++)
-                        tmp[i] = secondGlyphSet[i];
+                    System.arraycopy( secondGlyphSet, 0, tmp, 0, secondGlyphLen );
                     secondGlyphSet = tmp;
                 }
                 for (int i = 0; i < glyphCodes.length; i++)
@@ -173,7 +170,7 @@ public abstract class SVGKernElementBridge extends AbstractSVGBridge {
 
         // construct the arrays
         int[] firstGlyphs;
-        if ((firstGlyphLen == 0) || 
+        if ((firstGlyphLen == 0) ||
             (firstGlyphLen == firstGlyphSet.length)) {
             firstGlyphs = firstGlyphSet;
         } else {
@@ -181,12 +178,12 @@ public abstract class SVGKernElementBridge extends AbstractSVGBridge {
             System.arraycopy(firstGlyphSet, 0, firstGlyphs, 0, firstGlyphLen);
         }
         int[] secondGlyphs;
-        if ((secondGlyphLen == 0) || 
+        if ((secondGlyphLen == 0) ||
             (secondGlyphLen == secondGlyphSet.length)) {
             secondGlyphs = secondGlyphSet;
         } else {
             secondGlyphs = new int[secondGlyphLen];
-            System.arraycopy(secondGlyphSet, 0, secondGlyphs, 0, 
+            System.arraycopy(secondGlyphSet, 0, secondGlyphs, 0,
                              secondGlyphLen);
         }
 
@@ -199,7 +196,7 @@ public abstract class SVGKernElementBridge extends AbstractSVGBridge {
         secondUnicodeRanges.toArray(secondRanges);
 
         // return the new Kern object
-        return new Kern(firstGlyphs, secondGlyphs, 
+        return new Kern(firstGlyphs, secondGlyphs,
                         firstRanges, secondRanges, kernValue);
     }
 }

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGLineElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGLineElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGLineElementBridge.java
index 65c25f2..1e936e1 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGLineElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGLineElementBridge.java
@@ -1,10 +1,11 @@
 /*
 
-   Copyright 2001-2004  The Apache Software Foundation 
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
 
        http://www.apache.org/licenses/LICENSE-2.0
 
@@ -19,16 +20,20 @@ package org.apache.flex.forks.batik.bridge;
 
 import java.awt.geom.Line2D;
 
+import org.apache.flex.forks.batik.dom.svg.AbstractSVGAnimatedLength;
+import org.apache.flex.forks.batik.dom.svg.AnimatedLiveAttributeValue;
+import org.apache.flex.forks.batik.dom.svg.LiveAttributeException;
+import org.apache.flex.forks.batik.dom.svg.SVGOMLineElement;
 import org.apache.flex.forks.batik.gvt.ShapeNode;
 import org.apache.flex.forks.batik.gvt.ShapePainter;
+
 import org.w3c.dom.Element;
-import org.w3c.dom.events.MutationEvent;
 
 /**
  * Bridge class for the &lt;line> element.
  *
  * @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGLineElementBridge.java,v 1.14 2004/08/18 07:12:35 vhardy Exp $
+ * @version $Id: SVGLineElementBridge.java 527382 2007-04-11 04:31:58Z cam $
  */
 public class SVGLineElementBridge extends SVGDecoratedShapeElementBridge {
 
@@ -87,60 +92,53 @@ public class SVGLineElementBridge extends SVGDecoratedShapeElementBridge {
                               Element e,
                               ShapeNode shapeNode) {
 
-        UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, e);
-        String s;
+        try {
+            SVGOMLineElement le = (SVGOMLineElement) e;
 
-        // 'x1' attribute - default is 0
-        s = e.getAttributeNS(null, SVG_X1_ATTRIBUTE);
-        float x1 = 0;
-        if (s.length() != 0) {
-            x1 = UnitProcessor.svgHorizontalCoordinateToUserSpace
-                (s, SVG_X1_ATTRIBUTE, uctx);
-        }
+            // 'x1' attribute - default is 0
+            AbstractSVGAnimatedLength _x1 =
+                (AbstractSVGAnimatedLength) le.getX1();
+            float x1 = _x1.getCheckedValue();
 
-        // 'y1' attribute - default is 0
-        s = e.getAttributeNS(null, SVG_Y1_ATTRIBUTE);
-        float y1 = 0;
-        if (s.length() != 0) {
-            y1 = UnitProcessor.svgVerticalCoordinateToUserSpace
-                (s, SVG_Y1_ATTRIBUTE, uctx);
-        }
+            // 'y1' attribute - default is 0
+            AbstractSVGAnimatedLength _y1 =
+                (AbstractSVGAnimatedLength) le.getY1();
+            float y1 = _y1.getCheckedValue();
 
-        // 'x2' attribute - default is 0
-        s = e.getAttributeNS(null, SVG_X2_ATTRIBUTE);
-        float x2 = 0;
-        if (s.length() != 0) {
-            x2 = UnitProcessor.svgHorizontalCoordinateToUserSpace
-                (s, SVG_X2_ATTRIBUTE, uctx);
-        }
+            // 'x2' attribute - default is 0
+            AbstractSVGAnimatedLength _x2 =
+                (AbstractSVGAnimatedLength) le.getX2();
+            float x2 = _x2.getCheckedValue();
 
-        // 'y2' attribute - default is 0
-        s = e.getAttributeNS(null, SVG_Y2_ATTRIBUTE);
-        float y2 = 0;
-        if (s.length() != 0) {
-            y2 = UnitProcessor.svgVerticalCoordinateToUserSpace
-                (s, SVG_Y2_ATTRIBUTE, uctx);
-        }
+            // 'y2' attribute - default is 0
+            AbstractSVGAnimatedLength _y2 =
+                (AbstractSVGAnimatedLength) le.getY2();
+            float y2 = _y2.getCheckedValue();
 
-        shapeNode.setShape(new Line2D.Float(x1, y1, x2, y2));
+            shapeNode.setShape(new Line2D.Float(x1, y1, x2, y2));
+        } catch (LiveAttributeException ex) {
+            throw new BridgeException(ctx, ex);
+        }
     }
 
     // BridgeUpdateHandler implementation //////////////////////////////////
 
     /**
-     * Invoked when an MutationEvent of type 'DOMAttrModified' is fired.
+     * Invoked when the animated value of an animatable attribute has changed.
      */
-    public void handleDOMAttrModifiedEvent(MutationEvent evt) {
-        String attrName = evt.getAttrName();
-        if (attrName.equals(SVG_X1_ATTRIBUTE) ||
-            attrName.equals(SVG_Y1_ATTRIBUTE) ||
-            attrName.equals(SVG_X2_ATTRIBUTE) ||
-            attrName.equals(SVG_Y2_ATTRIBUTE)) {
-
-            buildShape(ctx, e, (ShapeNode)node);
-            handleGeometryChanged();
-        } else {
-            super.handleDOMAttrModifiedEvent(evt);
+    public void handleAnimatedAttributeChanged
+            (AnimatedLiveAttributeValue alav) {
+        if (alav.getNamespaceURI() == null) {
+            String ln = alav.getLocalName();
+            if (ln.equals(SVG_X1_ATTRIBUTE)
+                    || ln.equals(SVG_Y1_ATTRIBUTE)
+                    || ln.equals(SVG_X2_ATTRIBUTE)
+                    || ln.equals(SVG_Y2_ATTRIBUTE)) {
+                buildShape(ctx, e, (ShapeNode)node);
+                handleGeometryChanged();
+                return;
+            }
         }
+        super.handleAnimatedAttributeChanged(alav);
     }
 }

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGLinearGradientElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGLinearGradientElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGLinearGradientElementBridge.java
index 76bbfef..7e22505 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGLinearGradientElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGLinearGradientElementBridge.java
@@ -1,10 +1,11 @@
 /*
 
-   Copyright 2001-2003  The Apache Software Foundation 
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
 
        http://www.apache.org/licenses/LICENSE-2.0
 
@@ -21,17 +22,20 @@ import java.awt.Color;
 import java.awt.Paint;
 import java.awt.geom.AffineTransform;
 import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
 
+import org.apache.flex.forks.batik.dom.svg.SVGContext;
 import org.apache.flex.forks.batik.ext.awt.LinearGradientPaint;
 import org.apache.flex.forks.batik.ext.awt.MultipleGradientPaint;
 import org.apache.flex.forks.batik.gvt.GraphicsNode;
+
 import org.w3c.dom.Element;
 
 /**
  * Bridge class for the &lt;linearGradient> element.
  *
  * @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGLinearGradientElementBridge.java,v 1.11 2004/08/18 07:12:35 vhardy Exp $
+ * @version $Id: SVGLinearGradientElementBridge.java 594740 2007-11-14 02:55:05Z cam $
  */
 public class SVGLinearGradientElementBridge
     extends AbstractSVGGradientElementBridge {
@@ -108,7 +112,21 @@ public class SVGLinearGradientElementBridge
             coordSystemType = SVGUtilities.OBJECT_BOUNDING_BOX;
         } else {
             coordSystemType = SVGUtilities.parseCoordinateSystem
-                (paintElement, SVG_GRADIENT_UNITS_ATTRIBUTE, s);
+                (paintElement, SVG_GRADIENT_UNITS_ATTRIBUTE, s, ctx);
+        }
+
+        // The last paragraph of section 7.11 in SVG 1.1 states that objects
+        // with zero width or height bounding boxes that use gradients with
+        // gradientUnits="objectBoundingBox" must not use the gradient.
+        SVGContext bridge = BridgeContext.getSVGContext(paintedElement);
+        if (coordSystemType == SVGUtilities.OBJECT_BOUNDING_BOX
+                && bridge instanceof AbstractGraphicsNodeBridge) {
+            // XXX Make this work for non-AbstractGraphicsNodeBridges, like
+            // the various text child bridges.
+            Rectangle2D bbox = ((AbstractGraphicsNodeBridge) bridge).getBBox();
+            if (bbox != null && bbox.getWidth() == 0 || bbox.getHeight() == 0) {
+                return null;
+            }
         }
 
         // additional transform to move to objectBoundingBox coordinate system
@@ -132,19 +150,19 @@ public class SVGLinearGradientElementBridge
                                                coordSystemType,
                                                uctx);
 
-	// If x1 = x2 and y1 = y2, then the area to be painted will be painted
-	// as a single color using the color and opacity of the last gradient
-	// stop.
+        // If x1 = x2 and y1 = y2, then the area to be painted will be painted
+        // as a single color using the color and opacity of the last gradient
+        // stop.
         if (p1.getX() == p2.getX() && p1.getY() == p2.getY()) {
             return colors[colors.length-1];
-	} else {
-	    return new LinearGradientPaint(p1,
-					   p2,
-					   offsets,
-					   colors,
-					   spreadMethod,
-					   colorSpace,
-					   transform);
-	}
+        } else {
+            return new LinearGradientPaint(p1,
+                                           p2,
+                                           offsets,
+                                           colors,
+                                           spreadMethod,
+                                           colorSpace,
+                                           transform);
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGMarkerElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGMarkerElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGMarkerElementBridge.java
index 01bee03..bc99364 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGMarkerElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGMarkerElementBridge.java
@@ -1,10 +1,11 @@
 /*
 
-   Copyright 2001-2003  The Apache Software Foundation 
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
 
        http://www.apache.org/licenses/LICENSE-2.0
 
@@ -35,10 +36,10 @@ import org.w3c.dom.Node;
  * Bridge class for the &lt;marker> element.
  *
  * @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGMarkerElementBridge.java,v 1.19 2004/08/18 07:12:35 vhardy Exp $
+ * @version $Id: SVGMarkerElementBridge.java 501922 2007-01-31 17:47:47Z dvholten $
  */
-public class SVGMarkerElementBridge extends AbstractSVGBridge
-    implements MarkerBridge, ErrorConstants {
+public class SVGMarkerElementBridge extends AnimatableGenericSVGBridge
+        implements MarkerBridge, ErrorConstants {
 
     /**
      * Constructs a new bridge for the &lt;marker> element.
@@ -129,9 +130,9 @@ public class SVGMarkerElementBridge extends AbstractSVGBridge
         } else {
             try {
                 orient = SVGUtilities.convertSVGNumber(s);
-            } catch (NumberFormatException ex) {
+            } catch (NumberFormatException nfEx ) {
                 throw new BridgeException
-                    (markerElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
+                    (ctx, markerElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
                      new Object [] {SVG_ORIENT_ATTRIBUTE, s});
             }
         }
@@ -148,7 +149,7 @@ public class SVGMarkerElementBridge extends AbstractSVGBridge
             unitsType = SVGUtilities.STROKE_WIDTH;
         } else {
             unitsType = SVGUtilities.parseMarkerCoordinateSystem
-                (markerElement, SVG_MARKER_UNITS_ATTRIBUTE, s);
+                (markerElement, SVG_MARKER_UNITS_ATTRIBUTE, s, ctx);
         }
 
         //
@@ -169,7 +170,7 @@ public class SVGMarkerElementBridge extends AbstractSVGBridge
         AffineTransform preserveAspectRatioTransform
             = ViewBox.getPreserveAspectRatioTransform(markerElement,
                                                       markerWidth,
-                                                      markerHeight);
+                                                      markerHeight, ctx);
         if (preserveAspectRatioTransform == null) {
             // disable the rendering of the element
             return null;
@@ -234,7 +235,7 @@ public class SVGMarkerElementBridge extends AbstractSVGBridge
         // in viewport space (this  is what the following transform
         // does) and used when placing the marker.
         //
-        float ref[] = {refX, refY};
+        float[] ref = {refX, refY};
         markerTxf.transform(ref, 0, ref, 0, 1);
         Marker marker = new Marker(markerContentNode,
                                    new Point2D.Float(ref[0], ref[1]),

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGMaskElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGMaskElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGMaskElementBridge.java
index 899aaa9..a9a4934 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGMaskElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGMaskElementBridge.java
@@ -1,10 +1,11 @@
 /*
 
-   Copyright 2001-2003  The Apache Software Foundation 
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
 
        http://www.apache.org/licenses/LICENSE-2.0
 
@@ -32,10 +33,10 @@ import org.w3c.dom.Node;
  * Bridge class for the &lt;mask> element.
  *
  * @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGMaskElementBridge.java,v 1.17 2004/08/18 07:12:35 vhardy Exp $
+ * @version $Id: SVGMaskElementBridge.java 475477 2006-11-15 22:44:28Z cam $
  */
-public class SVGMaskElementBridge extends AbstractSVGBridge
-    implements MaskBridge {
+public class SVGMaskElementBridge extends AnimatableGenericSVGBridge
+        implements MaskBridge {
 
     /**
      * Constructs a new bridge for the &lt;mask> element.
@@ -102,7 +103,7 @@ public class SVGMaskElementBridge extends AbstractSVGBridge
         s = maskElement.getAttributeNS(null, SVG_TRANSFORM_ATTRIBUTE);
         if (s.length() != 0) {
             Tx = SVGUtilities.convertTransform
-                (maskElement, SVG_TRANSFORM_ATTRIBUTE, s);
+                (maskElement, SVG_TRANSFORM_ATTRIBUTE, s, ctx);
         } else {
             Tx = new AffineTransform();
         }
@@ -114,7 +115,7 @@ public class SVGMaskElementBridge extends AbstractSVGBridge
             coordSystemType = SVGUtilities.USER_SPACE_ON_USE;
         } else {
             coordSystemType = SVGUtilities.parseCoordinateSystem
-                (maskElement, SVG_MASK_CONTENT_UNITS_ATTRIBUTE, s);
+                (maskElement, SVG_MASK_CONTENT_UNITS_ATTRIBUTE, s, ctx);
         }
 
         // additional transform to move to objectBoundingBox coordinate system

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGMissingGlyphElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGMissingGlyphElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGMissingGlyphElementBridge.java
index 4ac88ef..0b8007c 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGMissingGlyphElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGMissingGlyphElementBridge.java
@@ -1,10 +1,11 @@
 /*
 
-   Copyright 2001  The Apache Software Foundation 
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
 
        http://www.apache.org/licenses/LICENSE-2.0
 
@@ -21,7 +22,7 @@ package org.apache.flex.forks.batik.bridge;
  * Bridge class for the &lt;missing-glyph> element.
  *
  * @author <a href="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a>
- * @version $Id: SVGMissingGlyphElementBridge.java,v 1.3 2004/08/18 07:12:35 vhardy Exp $
+ * @version $Id: SVGMissingGlyphElementBridge.java 475477 2006-11-15 22:44:28Z cam $
  */
 public class SVGMissingGlyphElementBridge extends SVGGlyphElementBridge {
 

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGPathElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGPathElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGPathElementBridge.java
index d87007c..11ac4bf 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGPathElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGPathElementBridge.java
@@ -1,10 +1,11 @@
 /*
 
-   Copyright 2001-2004  The Apache Software Foundation 
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
 
        http://www.apache.org/licenses/LICENSE-2.0
 
@@ -21,23 +22,25 @@ import java.awt.Shape;
 import java.awt.geom.GeneralPath;
 import java.awt.geom.Point2D;
 
-import org.apache.flex.forks.batik.css.engine.CSSEngineEvent;
 import org.apache.flex.forks.batik.css.engine.SVGCSSEngine;
+import org.apache.flex.forks.batik.dom.svg.AnimatedLiveAttributeValue;
+import org.apache.flex.forks.batik.dom.svg.LiveAttributeException;
+import org.apache.flex.forks.batik.dom.svg.SVGAnimatedPathDataSupport;
+import org.apache.flex.forks.batik.dom.svg.SVGOMAnimatedPathData;
+import org.apache.flex.forks.batik.dom.svg.SVGOMPathElement;
 import org.apache.flex.forks.batik.dom.svg.SVGPathContext;
 import org.apache.flex.forks.batik.ext.awt.geom.PathLength;
 import org.apache.flex.forks.batik.gvt.ShapeNode;
 import org.apache.flex.forks.batik.parser.AWTPathProducer;
-import org.apache.flex.forks.batik.parser.ParseException;
-import org.apache.flex.forks.batik.parser.PathParser;
 
 import org.w3c.dom.Element;
-import org.w3c.dom.events.MutationEvent;
+import org.w3c.dom.svg.SVGPathSegList;
 
 /**
  * Bridge class for the &lt;path> element.
  *
  * @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGPathElementBridge.java,v 1.20 2005/02/27 02:08:51 deweese Exp $
+ * @version $Id: SVGPathElementBridge.java 594018 2007-11-12 04:17:41Z cam $
  */
 public class SVGPathElementBridge extends SVGDecoratedShapeElementBridge 
        implements SVGPathContext {
@@ -78,44 +81,35 @@ public class SVGPathElementBridge extends SVGDecoratedShapeElementBridge
                               Element e,
                               ShapeNode shapeNode) {
 
-
-        String s = e.getAttributeNS(null, SVG_D_ATTRIBUTE);
-        if (s.length() != 0) {
-            AWTPathProducer app = new AWTPathProducer();
+        SVGOMPathElement pe = (SVGOMPathElement) e;
+        AWTPathProducer app = new AWTPathProducer();
+        try {
+            // 'd' attribute - required
+            SVGOMAnimatedPathData _d = pe.getAnimatedPathData();
+            _d.check();
+            SVGPathSegList p = _d.getAnimatedPathSegList();
             app.setWindingRule(CSSUtilities.convertFillRule(e));
-            try {
-                PathParser pathParser = new PathParser();
-                pathParser.setPathHandler(app);
-                pathParser.parse(s);
-            } catch (ParseException ex) {
-                BridgeException bex
-                    = new BridgeException(e, ERR_ATTRIBUTE_VALUE_MALFORMED,
-                                          new Object[] {SVG_D_ATTRIBUTE});
-                bex.setGraphicsNode(shapeNode);
-                throw bex;
-            } finally {
-                shapeNode.setShape(app.getShape());
-            }
+            SVGAnimatedPathDataSupport.handlePathSegList(p, app);
+        } catch (LiveAttributeException ex) {
+            throw new BridgeException(ctx, ex);
+        } finally {
+            shapeNode.setShape(app.getShape());
         }
     }
 
     // BridgeUpdateHandler implementation //////////////////////////////////
 
     /**
-     * Invoked when an MutationEvent of type 'DOMAttrModified' is fired.
+     * Invoked when the animated value of an animatable attribute has changed.
      */
-    public void handleDOMAttrModifiedEvent(MutationEvent evt) {
-        String attrName = evt.getAttrName();
-        if (attrName.equals(SVG_D_ATTRIBUTE)) {
-            if ( evt.getNewValue().length() == 0 ){
-                ((ShapeNode)node).setShape(DEFAULT_SHAPE);
-            }
-            else{
-                buildShape(ctx, e, (ShapeNode)node);
-            }
+    public void handleAnimatedAttributeChanged
+            (AnimatedLiveAttributeValue alav) {
+        if (alav.getNamespaceURI() == null &&
+                alav.getLocalName().equals(SVG_D_ATTRIBUTE)) {
+            buildShape(ctx, e, (ShapeNode) node);
             handleGeometryChanged();
         } else {
-            super.handleDOMAttrModifiedEvent(evt);
+            super.handleAnimatedAttributeChanged(alav);
         }
     }
 
@@ -130,10 +124,22 @@ public class SVGPathElementBridge extends SVGDecoratedShapeElementBridge
         }
     }
 
-    Shape      pathLengthShape = null;
-    PathLength pathLength      = null;
+    // SVGPathContext ////////////////////////////////////////////////////////
+
+    /**
+     * The cached Shape used for computing the path length.
+     */
+    protected Shape pathLengthShape;
+
+    /**
+     * The cached PathLength object used for computing the path length.
+     */
+    protected PathLength pathLength;
 
-    PathLength getPathLengthObj() {
+    /**
+     * Returns the PathLength object that tracks the length of the path.
+     */
+    protected PathLength getPathLengthObj() {
         Shape s = ((ShapeNode)node).getShape();
         if (pathLengthShape != s) {
             pathLength = new PathLength(s);
@@ -142,14 +148,28 @@ public class SVGPathElementBridge extends SVGDecoratedShapeElementBridge
         return pathLength;
     }
 
-    // SVGPathContext interface
+    /**
+     * Returns the total length of the path.
+     */
     public float getTotalLength() {
         PathLength pl = getPathLengthObj();
         return pl.lengthOfPath();
     }
 
+    /**
+     * Returns the point at the given distance along the path.
+     */
     public Point2D getPointAtLength(float distance) {
         PathLength pl = getPathLengthObj();
         return pl.pointAtLength(distance);
     }
+
+    /**
+     * Returns the index of the path segment at the given distance along the
+     * path.
+     */
+    public int getPathSegAtLength(float distance) {
+        PathLength pl = getPathLengthObj();
+        return pl.segmentAtLength(distance);
+    }
 }

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGPatternElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGPatternElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGPatternElementBridge.java
index 85912fa..7b8c87b 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGPatternElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGPatternElementBridge.java
@@ -1,10 +1,11 @@
 /*
 
-   Copyright 2001-2004  The Apache Software Foundation 
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
 
        http://www.apache.org/licenses/LICENSE-2.0
 
@@ -43,10 +44,10 @@ import org.w3c.dom.Node;
  * Bridge class for the &lt;pattern> element.
  *
  * @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGPatternElementBridge.java,v 1.27 2004/08/18 07:12:35 vhardy Exp $
+ * @version $Id: SVGPatternElementBridge.java 475477 2006-11-15 22:44:28Z cam $
  */
-public class SVGPatternElementBridge extends AbstractSVGBridge
-    implements PaintBridge, ErrorConstants {
+public class SVGPatternElementBridge extends AnimatableGenericSVGBridge
+        implements PaintBridge, ErrorConstants {
 
     /**
      * Constructs a new SVGPatternElementBridge.
@@ -102,7 +103,7 @@ public class SVGPatternElementBridge extends AbstractSVGBridge
             (patternElement, null, SVG_PATTERN_TRANSFORM_ATTRIBUTE, ctx);
         if (s.length() != 0) {
             patternTransform = SVGUtilities.convertTransform
-                (patternElement, SVG_PATTERN_TRANSFORM_ATTRIBUTE, s);
+                (patternElement, SVG_PATTERN_TRANSFORM_ATTRIBUTE, s, ctx);
         } else {
             patternTransform = new AffineTransform();
         }
@@ -118,7 +119,7 @@ public class SVGPatternElementBridge extends AbstractSVGBridge
             contentCoordSystem = SVGUtilities.USER_SPACE_ON_USE;
         } else {
             contentCoordSystem = SVGUtilities.parseCoordinateSystem
-                (patternElement, SVG_PATTERN_CONTENT_UNITS_ATTRIBUTE, s);
+                (patternElement, SVG_PATTERN_CONTENT_UNITS_ATTRIBUTE, s, ctx);
         }
 
         // Compute a transform according to viewBox,  preserveAspectRatio
@@ -171,7 +172,7 @@ public class SVGPatternElementBridge extends AbstractSVGBridge
             float h = (float)patternRegion.getHeight();
             AffineTransform preserveAspectRatioTransform
                 = ViewBox.getPreserveAspectRatioTransform
-                (patternElement, viewBoxStr, aspectRatioStr, w, h);
+                (patternElement, viewBoxStr, aspectRatioStr, w, h, ctx);
 
             patternContentTransform.concatenate(preserveAspectRatioTransform);
         } else {
@@ -238,7 +239,7 @@ public class SVGPatternElementBridge extends AbstractSVGBridge
      */
     protected static
         RootGraphicsNode extractPatternContent(Element patternElement,
-                                                    BridgeContext ctx) {
+                                               BridgeContext ctx) {
 
         List refs = new LinkedList();
         for (;;) {
@@ -256,12 +257,12 @@ public class SVGPatternElementBridge extends AbstractSVGBridge
                 (SVGOMDocument)patternElement.getOwnerDocument();
             ParsedURL purl = new ParsedURL(doc.getURL(), uri);
             if (!purl.complete())
-                throw new BridgeException(patternElement,
+                throw new BridgeException(ctx, patternElement,
                                           ERR_URI_MALFORMED,
                                           new Object[] {uri});
 
             if (contains(refs, purl)) {
-                throw new BridgeException(patternElement,
+                throw new BridgeException(ctx, patternElement,
                                           ERR_XLINK_HREF_CIRCULAR_DEPENDENCIES,
                                           new Object[] {uri});
             }
@@ -360,6 +361,4 @@ public class SVGPatternElementBridge extends AbstractSVGBridge
         }
 
     }
-
 }
-


Mime
View raw message