You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by jm...@apache.org on 2013/10/08 16:03:35 UTC

[20/62] [abbrv] [partial] Merged Apache Flex 4.9.0 release branch

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AbstractGraphicsNodeBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AbstractGraphicsNodeBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AbstractGraphicsNodeBridge.java
index fb6de66..c08d325 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AbstractGraphicsNodeBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AbstractGraphicsNodeBridge.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
 
@@ -24,8 +25,14 @@ import java.lang.ref.SoftReference;
 
 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.events.AbstractEvent;
+import org.apache.flex.forks.batik.dom.svg.AbstractSVGTransformList;
+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.SVGContext;
+import org.apache.flex.forks.batik.dom.svg.SVGMotionAnimatableElement;
 import org.apache.flex.forks.batik.dom.svg.SVGOMElement;
+import org.apache.flex.forks.batik.dom.svg.SVGOMAnimatedTransformList;
 import org.apache.flex.forks.batik.ext.awt.geom.SegmentList;
 import org.apache.flex.forks.batik.gvt.CanvasGraphicsNode;
 import org.apache.flex.forks.batik.gvt.CompositeGraphicsNode;
@@ -33,8 +40,11 @@ import org.apache.flex.forks.batik.gvt.GraphicsNode;
 
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
+import org.w3c.dom.events.DocumentEvent;
+import org.w3c.dom.events.EventTarget;
 import org.w3c.dom.events.MutationEvent;
-import org.w3c.flex.forks.dom.svg.SVGFitToViewBox;
+import org.w3c.dom.svg.SVGFitToViewBox;
+import org.w3c.dom.svg.SVGTransformable;
 
 /**
  * The base bridge class for SVG graphics node. By default, the namespace URI is
@@ -55,18 +65,13 @@ import org.w3c.flex.forks.dom.svg.SVGFitToViewBox;
  * </ul>
  *
  * @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: AbstractGraphicsNodeBridge.java,v 1.40 2005/02/27 02:08:51 deweese Exp $
+ * @version $Id: AbstractGraphicsNodeBridge.java 598518 2007-11-27 05:07:26Z cam $
  */
-public abstract class AbstractGraphicsNodeBridge extends AbstractSVGBridge
-    implements SVGContext, 
-               BridgeUpdateHandler, 
-               GraphicsNodeBridge, 
+public abstract class AbstractGraphicsNodeBridge extends AnimatableSVGBridge
+    implements SVGContext,
+               BridgeUpdateHandler,
+               GraphicsNodeBridge,
                ErrorConstants {
-    
-    /**
-     * The element that has been handled by this bridge.
-     */
-    protected Element e;
 
     /**
      * The graphics node constructed by this bridge.
@@ -74,9 +79,14 @@ public abstract class AbstractGraphicsNodeBridge extends AbstractSVGBridge
     protected GraphicsNode node;
 
     /**
-     * The bridge context to use for dynamic updates.
+     * Whether the document is an SVG 1.2 document.
+     */
+    protected boolean isSVG12;
+
+    /**
+     * The unit context for length conversions.
      */
-    protected BridgeContext ctx;
+    protected UnitProcessor.Context unitContext;
 
     /**
      * Constructs a new abstract bridge.
@@ -97,14 +107,15 @@ public abstract class AbstractGraphicsNodeBridge extends AbstractSVGBridge
         }
 
         GraphicsNode node = instantiateGraphicsNode();
+
         // 'transform'
-        String s = e.getAttributeNS(null, SVG_TRANSFORM_ATTRIBUTE);
-        if (s.length() != 0) {
-            node.setTransform
-                (SVGUtilities.convertTransform(e, SVG_TRANSFORM_ATTRIBUTE, s));
-        }
+        setTransform(node, e, ctx);
+
         // 'visibility'
         node.setVisible(CSSUtilities.convertVisibility(e));
+
+        associateSVGContext(ctx, e, node);
+
         return node;
     }
 
@@ -148,26 +159,75 @@ public abstract class AbstractGraphicsNodeBridge extends AbstractSVGBridge
     }
 
     /**
+     * Returns an {@link AffineTransform} that is the transformation to
+     * be applied to the node.
+     */
+    protected AffineTransform computeTransform(SVGTransformable te,
+                                               BridgeContext ctx) {
+        try {
+            AffineTransform at = new AffineTransform();
+
+            // 'transform'
+            SVGOMAnimatedTransformList atl =
+                (SVGOMAnimatedTransformList) te.getTransform();
+            if (atl.isSpecified()) {
+                atl.check();
+                AbstractSVGTransformList tl =
+                    (AbstractSVGTransformList) te.getTransform().getAnimVal();
+                at.concatenate(tl.getAffineTransform());
+            }
+
+            // motion animation
+            if (e instanceof SVGMotionAnimatableElement) {
+                SVGMotionAnimatableElement mae = (SVGMotionAnimatableElement) e;
+                AffineTransform mat = mae.getMotionTransform();
+                if (mat != null) {
+                    at.concatenate(mat);
+                }
+            }
+
+            return at;
+        } catch (LiveAttributeException ex) {
+            throw new BridgeException(ctx, ex);
+        }
+    }
+
+    /**
+     * Sets the graphics node's transform to the current animated transform
+     * value.
+     */
+    protected void setTransform(GraphicsNode n, Element e, BridgeContext ctx) {
+        n.setTransform(computeTransform((SVGTransformable) e, ctx));
+    }
+
+    /**
+     * Associates the {@link SVGContext} with the element.  This method should
+     * be called even for static documents, since some bridges will need to
+     * access animated attribute values even during the first build.
+     */
+    protected void associateSVGContext(BridgeContext ctx,
+                                       Element e,
+                                       GraphicsNode node) {
+        this.e = e;
+        this.node = node;
+        this.ctx = ctx;
+        this.unitContext = UnitProcessor.createContext(ctx, e);
+        this.isSVG12 = ctx.isSVG12();
+        ((SVGOMElement)e).setSVGContext(this);
+    }
+
+    /**
      * This method is invoked during the build phase if the document
-     * is dynamic. The responsability of this method is to ensure that
+     * is dynamic. The responsibility of this method is to ensure that
      * any dynamic modifications of the element this bridge is
      * dedicated to, happen on its associated GVT product.
      */
     protected void initializeDynamicSupport(BridgeContext ctx,
                                             Element e,
                                             GraphicsNode node) {
-        if (!ctx.isInteractive())
-            return;
-
-        // Bind the nodes for interactive and dynamic
-        ctx.bind(e, node);
-
-        if (ctx.isDynamic()) {
-            // only set context for dynamic documents not interactive.
-            this.e = e;
-            this.node = node;
-            this.ctx = ctx;
-            ((SVGOMElement)e).setSVGContext(this);
+        if (ctx.isInteractive()) {
+            // Bind the nodes for interactive and dynamic.
+            ctx.bind(e, node);
         }
     }
 
@@ -177,33 +237,46 @@ public abstract class AbstractGraphicsNodeBridge extends AbstractSVGBridge
      * Invoked when an MutationEvent of type 'DOMAttrModified' is fired.
      */
     public void handleDOMAttrModifiedEvent(MutationEvent evt) {
-        String attrName = evt.getAttrName();
-        if (attrName.equals(SVG_TRANSFORM_ATTRIBUTE)) {
-            String s = evt.getNewValue();
-            AffineTransform at = GraphicsNode.IDENTITY;
-            if (s.length() != 0) {
-                at = SVGUtilities.convertTransform
-                    (e, SVG_TRANSFORM_ATTRIBUTE, s);
-            }
-            node.setTransform(at);
-            handleGeometryChanged();
-        }
     }
 
     /**
-     * Invoked when the geometry of an graphical element has changed.
+     * Invoked when the geometry of a graphical element has changed.
      */
-    protected  void handleGeometryChanged() {
+    protected void handleGeometryChanged() {
         node.setFilter(CSSUtilities.convertFilter(e, node, ctx));
         node.setMask(CSSUtilities.convertMask(e, node, ctx));
         node.setClip(CSSUtilities.convertClipPath(e, node, ctx));
+        if (isSVG12) {
+            if (!SVG_USE_TAG.equals(e.getLocalName())) {
+                // ShapeChange events get fired only for basic shapes and paths.
+                fireShapeChangeEvent();
+            }
+            fireBBoxChangeEvent();
+        }
+    }
+
+    /**
+     * Fires a ShapeChange event on the element this bridge is managing.
+     */
+    protected void fireShapeChangeEvent() {
+        DocumentEvent d = (DocumentEvent) e.getOwnerDocument();
+        AbstractEvent evt = (AbstractEvent) d.createEvent("SVGEvents");
+        evt.initEventNS(SVG_NAMESPACE_URI,
+                        "shapechange",
+                        true,
+                        false);
+        try {
+            ((EventTarget) e).dispatchEvent(evt);
+        } catch (RuntimeException ex) {
+            ctx.getUserAgent().displayError(ex);
+        }
     }
 
     /**
      * Invoked when an MutationEvent of type 'DOMNodeInserted' is fired.
      */
     public void handleDOMNodeInsertedEvent(MutationEvent evt) {
-        if ( evt.getTarget() instanceof Element ){
+        if (evt.getTarget() instanceof Element) {
             // Handle "generic" bridges.
             Element e2 = (Element)evt.getTarget();
             Bridge b = ctx.getBridge(e2);
@@ -217,13 +290,21 @@ public abstract class AbstractGraphicsNodeBridge extends AbstractSVGBridge
      * Invoked when an MutationEvent of type 'DOMNodeRemoved' is fired.
      */
     public void handleDOMNodeRemovedEvent(MutationEvent evt) {
+        Node parent = e.getParentNode();
+        if (parent instanceof SVGOMElement) {
+            SVGContext bridge = ((SVGOMElement) parent).getSVGContext();
+            if (bridge instanceof SVGSwitchElementBridge) {
+                ((SVGSwitchElementBridge) bridge).handleChildElementRemoved(e);
+                return;
+            }
+        }
         CompositeGraphicsNode gn = node.getParent();
         gn.remove(node);
         disposeTree(e);
     }
 
     /**
-     * Invoked when an MutationEvent of type 'DOMCharacterDataModified' 
+     * Invoked when an MutationEvent of type 'DOMCharacterDataModified'
      * is fired.
      */
     public void handleDOMCharacterDataModified(MutationEvent evt) {
@@ -236,21 +317,35 @@ public abstract class AbstractGraphicsNodeBridge extends AbstractSVGBridge
         SVGOMElement elt = (SVGOMElement)e;
         elt.setSVGContext(null);
         ctx.unbind(e);
+
+        bboxShape = null;
     }
 
+    /**
+     * Disposes all resources related to the specified node and its subtree.
+     */
+    protected void disposeTree(Node node) {
+        disposeTree(node, true);
+    }
 
     /**
-     * Disposes all resources related to the specified node and its subtree
+     * Disposes all resources related to the specified node and its subtree,
+     * and optionally removes the nodes' {@link SVGContext}.
      */
-    static void disposeTree(Node node) {
+    protected void disposeTree(Node node, boolean removeContext) {
         if (node instanceof SVGOMElement) {
             SVGOMElement elt = (SVGOMElement)node;
-            BridgeUpdateHandler h = (BridgeUpdateHandler)elt.getSVGContext();
-            if (h != null)
+            SVGContext ctx = elt.getSVGContext();
+            if (ctx instanceof BridgeUpdateHandler) {
+                BridgeUpdateHandler h = (BridgeUpdateHandler) ctx;
+                if (removeContext) {
+                    elt.setSVGContext(null);
+                }
                 h.dispose();
+            }
         }
-        for (Node n = node.getFirstChild(); n!=null; n = n.getNextSibling()) {
-            disposeTree(n);
+        for (Node n = node.getFirstChild(); n != null; n = n.getNextSibling()) {
+            disposeTree(n, removeContext);
         }
     }
 
@@ -259,9 +354,13 @@ public abstract class AbstractGraphicsNodeBridge extends AbstractSVGBridge
      */
     public void handleCSSEngineEvent(CSSEngineEvent evt) {
         try {
-            int [] properties = evt.getProperties();
-            for (int i=0; i < properties.length; ++i) {
-                handleCSSPropertyChanged(properties[i]);
+            SVGCSSEngine eng = (SVGCSSEngine) evt.getSource();
+            int[] properties = evt.getProperties();
+            for (int i = 0; i < properties.length; i++) {
+                int idx = properties[i];
+                handleCSSPropertyChanged(idx);
+                String pn = eng.getPropertyName(idx);
+                fireBaseAttributeListeners(pn);
             }
         } catch (Exception ex) {
             ctx.getUserAgent().displayError(ex);
@@ -295,14 +394,72 @@ public abstract class AbstractGraphicsNodeBridge extends AbstractSVGBridge
             if (!getDisplay(e)) {
                 // Remove the subtree.
                 CompositeGraphicsNode parent = node.getParent();
-                int idx = parent.indexOf(node);
                 parent.remove(node);
-                disposeTree(e);
+                disposeTree(e, false);
             }
             break;
         }
     }
 
+    /**
+     * Invoked when the animated value of an animatable attribute has changed.
+     */
+    public void handleAnimatedAttributeChanged
+            (AnimatedLiveAttributeValue alav) {
+        if (alav.getNamespaceURI() == null
+                && alav.getLocalName().equals(SVG_TRANSFORM_ATTRIBUTE)) {
+            setTransform(node, e, ctx);
+            handleGeometryChanged();
+        }
+    }
+
+    /**
+     * Invoked when an 'other' animation value has changed.
+     */
+    public void handleOtherAnimationChanged(String type) {
+        if (type.equals("motion")) {
+            setTransform(node, e, ctx);
+            handleGeometryChanged();
+        }
+    }
+
+    /**
+     * Checks if the bounding box of the node has changed, and if so,
+     * fires a bboxchange event on the element.
+     */
+    protected void checkBBoxChange() {
+        if (e != null) {
+            /*Rectangle2D oldBBox = bbox;
+            Rectangle2D newBBox = getBBox();
+            if (oldBBox != newBBox && newBBox != null) {
+                if (oldBBox == null ||
+                        oldBBox.getX() != bbox.getX()
+                        || oldBBox.getY() != bbox.getY()
+                        || oldBBox.getWidth() != bbox.getWidth()
+                        || oldBBox.getHeight() != bbox.getHeight()) {*/
+                    fireBBoxChangeEvent();
+                /*}
+            }*/
+        }
+    }
+
+    /**
+     * Fires an svg:bboxchange event on the element.
+     */
+    protected void fireBBoxChangeEvent() {
+        DocumentEvent d = (DocumentEvent) e.getOwnerDocument();
+        AbstractEvent evt = (AbstractEvent) d.createEvent("SVGEvents");
+        evt.initEventNS(SVG_NAMESPACE_URI,
+                        "RenderedBBoxChange",
+                        true,
+                        false);
+        try {
+            ((EventTarget) e).dispatchEvent(evt);
+        } catch (RuntimeException ex) {
+            ctx.getUserAgent().displayError(ex);
+        }
+    }
+
     // SVGContext implementation ///////////////////////////////////////////
 
     /**
@@ -319,7 +476,6 @@ public abstract class AbstractGraphicsNodeBridge extends AbstractSVGBridge
      */
     public float getPixelToMM() {
         return getPixelUnitToMillimeter();
-            
     }
 
     protected SoftReference bboxShape = null;
@@ -332,8 +488,11 @@ public abstract class AbstractGraphicsNodeBridge extends AbstractSVGBridge
      * stroke-width and filter effects).
      */
     public Rectangle2D getBBox() {
+        if (node == null) {
+            return null;
+        }
         Shape s = node.getOutline();
-        
+
         if ((bboxShape != null) && (s == bboxShape.get())) return bbox;
         bboxShape = new SoftReference(s); // don't keep this live.
         bbox = null;

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AbstractSVGBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AbstractSVGBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AbstractSVGBridge.java
index 252b499..79ea0d4 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AbstractSVGBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AbstractSVGBridge.java
@@ -1,10 +1,11 @@
 /*
 
-   Copyright 2001-2002  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
 
@@ -23,7 +24,7 @@ import org.apache.flex.forks.batik.util.SVGConstants;
  * The base bridge class for SVG elements.
  *
  * @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: AbstractSVGBridge.java,v 1.5 2004/08/18 07:12:30 vhardy Exp $
+ * @version $Id: AbstractSVGBridge.java 475477 2006-11-15 22:44:28Z cam $
  */
 public abstract class AbstractSVGBridge implements Bridge, SVGConstants {
 

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AbstractSVGFilterPrimitiveElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AbstractSVGFilterPrimitiveElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AbstractSVGFilterPrimitiveElementBridge.java
index 1cd52cb..5dd8720 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AbstractSVGFilterPrimitiveElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AbstractSVGFilterPrimitiveElementBridge.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
 
@@ -36,11 +37,11 @@ import org.w3c.dom.Element;
  * The base bridge class for SVG filter primitives.
  *
  * @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: AbstractSVGFilterPrimitiveElementBridge.java,v 1.11 2004/08/18 07:12:30 vhardy Exp $
+ * @version $Id: AbstractSVGFilterPrimitiveElementBridge.java 501922 2007-01-31 17:47:47Z dvholten $
  */
 public abstract class AbstractSVGFilterPrimitiveElementBridge
-    extends AbstractSVGBridge
-    implements FilterPrimitiveBridge, ErrorConstants {
+        extends AnimatableGenericSVGBridge
+        implements FilterPrimitiveBridge, ErrorConstants {
 
     /**
      * Constructs a new bridge for a filter primitive element.
@@ -99,7 +100,7 @@ public abstract class AbstractSVGFilterPrimitiveElementBridge
 
         String s = filterElement.getAttributeNS(null, SVG_IN2_ATTRIBUTE);
         if (s.length() == 0) {
-            throw new BridgeException(filterElement, ERR_ATTRIBUTE_MISSING,
+            throw new BridgeException(ctx, filterElement, ERR_ATTRIBUTE_MISSING,
                                       new Object [] {SVG_IN2_ATTRIBUTE});
         }
         return getFilterSource(filterElement,
@@ -194,14 +195,14 @@ public abstract class AbstractSVGFilterPrimitiveElementBridge
                 if (SVG_BACKGROUND_IMAGE_VALUE.equals(s)) {
                     // BackgroundImage
                     source = new BackgroundRable8Bit(filteredNode);
-                    source = new PadRable8Bit(source, filterRegion, 
+                    source = new PadRable8Bit(source, filterRegion,
                                               PadMode.ZERO_PAD);
                 }
             } else if (SVG_BACKGROUND_ALPHA_VALUE.equals(s)) {
                 // BackgroundAlpha
                 source = new BackgroundRable8Bit(filteredNode);
                 source = new FilterAlphaRable(source);
-                source = new PadRable8Bit(source, filterRegion, 
+                source = new PadRable8Bit(source, filterRegion,
                                           PadMode.ZERO_PAD);
             }
             break;
@@ -244,19 +245,21 @@ public abstract class AbstractSVGFilterPrimitiveElementBridge
      * @param filterElement the filter primitive element
      * @param attrName the name of the attribute
      * @param defaultValue the default value of the attribute
+     * @param ctx the BridgeContext to use for error information
      */
     protected static int convertInteger(Element filterElement,
                                         String attrName,
-                                        int defaultValue) {
+                                        int defaultValue,
+                                        BridgeContext ctx) {
         String s = filterElement.getAttributeNS(null, attrName);
         if (s.length() == 0) {
             return defaultValue;
         } else {
             try {
                 return SVGUtilities.convertSVGInteger(s);
-            } catch (NumberFormatException ex) {
+            } catch (NumberFormatException nfEx ) {
                 throw new BridgeException
-                    (filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
+                    (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
                      new Object[] {attrName, s});
             }
         }
@@ -270,10 +273,12 @@ public abstract class AbstractSVGFilterPrimitiveElementBridge
      * @param filterElement the filter primitive element
      * @param attrName the name of the attribute
      * @param defaultValue the default value of the attribute
+     * @param ctx the BridgeContext to use for error information
      */
     protected static float convertNumber(Element filterElement,
                                          String attrName,
-                                         float defaultValue) {
+                                         float defaultValue,
+                                         BridgeContext ctx) {
 
         String s = filterElement.getAttributeNS(null, attrName);
         if (s.length() == 0) {
@@ -281,10 +286,10 @@ public abstract class AbstractSVGFilterPrimitiveElementBridge
         } else {
             try {
                 return SVGUtilities.convertSVGNumber(s);
-            } catch (NumberFormatException ex) {
+            } catch (NumberFormatException nfEx) {
                 throw new BridgeException
-                    (filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
-                     new Object[] {attrName, s, ex});
+                    (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
+                     new Object[] {attrName, s, nfEx});
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AbstractSVGGradientElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AbstractSVGGradientElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AbstractSVGGradientElementBridge.java
index 434d26c..f28a211 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AbstractSVGGradientElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AbstractSVGGradientElementBridge.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
 
@@ -24,11 +25,12 @@ import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 
-import org.apache.flex.forks.batik.dom.svg.SVGOMDocument;
+import org.apache.flex.forks.batik.dom.AbstractNode;
 import org.apache.flex.forks.batik.dom.util.XLinkSupport;
 import org.apache.flex.forks.batik.ext.awt.MultipleGradientPaint;
 import org.apache.flex.forks.batik.gvt.GraphicsNode;
 import org.apache.flex.forks.batik.util.ParsedURL;
+
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
@@ -36,10 +38,11 @@ import org.w3c.dom.Node;
  * Bridge class for vending gradients.
  *
  * @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: AbstractSVGGradientElementBridge.java,v 1.12 2004/08/18 07:12:30 vhardy Exp $
+ * @version $Id: AbstractSVGGradientElementBridge.java 501922 2007-01-31 17:47:47Z dvholten $
  */
-public abstract class AbstractSVGGradientElementBridge extends AbstractSVGBridge
-    implements PaintBridge, ErrorConstants {
+public abstract class AbstractSVGGradientElementBridge
+        extends AnimatableGenericSVGBridge
+        implements PaintBridge, ErrorConstants {
 
     /**
      * Constructs a new AbstractSVGGradientElementBridge.
@@ -89,7 +92,7 @@ public abstract class AbstractSVGGradientElementBridge extends AbstractSVGBridge
         s = SVGUtilities.getChainableAttributeNS
             (paintElement, null, SVG_SPREAD_METHOD_ATTRIBUTE, ctx);
         if (s.length() != 0) {
-            spreadMethod = convertSpreadMethod(paintElement, s);
+            spreadMethod = convertSpreadMethod(paintElement, s, ctx);
         }
 
         // 'color-interpolation' CSS property
@@ -102,7 +105,7 @@ public abstract class AbstractSVGGradientElementBridge extends AbstractSVGBridge
             (paintElement, null, SVG_GRADIENT_TRANSFORM_ATTRIBUTE, ctx);
         if (s.length() != 0) {
             transform = SVGUtilities.convertTransform
-                (paintElement, SVG_GRADIENT_TRANSFORM_ATTRIBUTE, s);
+                (paintElement, SVG_GRADIENT_TRANSFORM_ATTRIBUTE, s, ctx);
         } else {
             transform = new AffineTransform();
         }
@@ -150,9 +153,10 @@ public abstract class AbstractSVGGradientElementBridge extends AbstractSVGBridge
      *
      * @param paintElement the paint Element with a spreadMethod
      * @param s the spread method
+     * @param ctx the BridgeContext to use for error information
      */
     protected static MultipleGradientPaint.CycleMethodEnum convertSpreadMethod
-        (Element paintElement, String s) {
+        (Element paintElement, String s, BridgeContext ctx) {
         if (SVG_REPEAT_VALUE.equals(s)) {
             return MultipleGradientPaint.REPEAT;
         }
@@ -163,7 +167,7 @@ public abstract class AbstractSVGGradientElementBridge extends AbstractSVGBridge
             return MultipleGradientPaint.NO_CYCLE;
         }
         throw new BridgeException
-            (paintElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
+            (ctx, paintElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
              new Object[] {SVG_SPREAD_METHOD_ATTRIBUTE, s});
     }
 
@@ -191,15 +195,11 @@ public abstract class AbstractSVGGradientElementBridge extends AbstractSVGBridge
                 return null; // no xlink:href found, exit
             }
             // check if there is circular dependencies
-            SVGOMDocument doc = (SVGOMDocument)paintElement.getOwnerDocument();
-            ParsedURL purl = new ParsedURL(doc.getURL(), uri);
-            if (!purl.complete())
-                throw new BridgeException(paintElement,
-                                          ERR_URI_MALFORMED,
-                                          new Object[] {uri});
+            String baseURI = ((AbstractNode) paintElement).getBaseURI();
+            ParsedURL purl = new ParsedURL(baseURI, uri);
 
             if (contains(refs, purl)) {
-                throw new BridgeException(paintElement,
+                throw new BridgeException(ctx, paintElement,
                                           ERR_XLINK_HREF_CIRCULAR_DEPENDENCIES,
                                           new Object[] {uri});
             }
@@ -290,8 +290,8 @@ public abstract class AbstractSVGGradientElementBridge extends AbstractSVGBridge
     /**
      * Bridge class for the gradient &lt;stop> element.
      */
-    public static class SVGStopElementBridge extends AbstractSVGBridge
-        implements Bridge {
+    public static class SVGStopElementBridge extends AnimatableGenericSVGBridge
+            implements Bridge {
 
         /**
          * Returns 'stop'.
@@ -315,16 +315,17 @@ public abstract class AbstractSVGGradientElementBridge extends AbstractSVGBridge
 
             String s = stopElement.getAttributeNS(null, SVG_OFFSET_ATTRIBUTE);
             if (s.length() == 0) {
-                throw new BridgeException(stopElement, ERR_ATTRIBUTE_MISSING,
-                                          new Object[] {SVG_OFFSET_ATTRIBUTE});
+                throw new BridgeException
+                    (ctx, stopElement, ERR_ATTRIBUTE_MISSING,
+                     new Object[] {SVG_OFFSET_ATTRIBUTE});
             }
             float offset;
             try {
                 offset = SVGUtilities.convertRatio(s);
-            } catch (NumberFormatException ex) {
+            } catch (NumberFormatException nfEx ) {
                 throw new BridgeException
-                    (stopElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
-                     new Object[] {SVG_OFFSET_ATTRIBUTE, s, ex});
+                    (ctx, stopElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
+                     new Object[] {SVG_OFFSET_ATTRIBUTE, s, nfEx });
             }
             Color color
                 = CSSUtilities.convertStopColor(stopElement, opacity, ctx);

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AbstractSVGLightingElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AbstractSVGLightingElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AbstractSVGLightingElementBridge.java
index 7bff8b2..0451f3b 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AbstractSVGLightingElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AbstractSVGLightingElementBridge.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
 
@@ -31,7 +32,7 @@ import org.w3c.dom.Node;
  * Bridge class for the &lt;feDiffuseLighting> element.
  *
  * @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: AbstractSVGLightingElementBridge.java,v 1.5 2004/08/18 07:12:30 vhardy Exp $
+ * @version $Id: AbstractSVGLightingElementBridge.java 501922 2007-01-31 17:47:47Z dvholten $
  */
 public abstract class AbstractSVGLightingElementBridge
     extends AbstractSVGFilterPrimitiveElementBridge {
@@ -78,8 +79,10 @@ public abstract class AbstractSVGLightingElementBridge
      * feDiffuseLighting or feSpecularLighting filter primitive element.
      *
      * @param filterElement the filter primitive element
+     * @param ctx the BridgeContext to use for error information
      */
-    protected static double [] convertKernelUnitLength(Element filterElement) {
+    protected static double[] convertKernelUnitLength(Element filterElement,
+                                                      BridgeContext ctx) {
         String s = filterElement.getAttributeNS
             (null, SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE);
         if (s.length() == 0) {
@@ -94,15 +97,15 @@ public abstract class AbstractSVGLightingElementBridge
             } else {
                 units[1] = units[0];
             }
-        } catch (NumberFormatException ex) {
+        } catch (NumberFormatException nfEx ) {
             throw new BridgeException
-                (filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
+                (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
                  new Object[] {SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE, s});
 
         }
         if (tokens.hasMoreTokens() || units[0] <= 0 || units[1] <= 0) {
             throw new BridgeException
-                (filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
+                (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
                  new Object[] {SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE, s});
         }
         return units;
@@ -111,8 +114,8 @@ public abstract class AbstractSVGLightingElementBridge
     /**
      * The base bridge class for light element.
      */
-    protected static abstract class AbstractSVGLightElementBridge
-        extends AbstractSVGBridge {
+    protected abstract static class AbstractSVGLightElementBridge
+        extends AnimatableGenericSVGBridge {
 
         /**
          * Creates a <tt>Light</tt> according to the specified parameters.
@@ -160,33 +163,33 @@ public abstract class AbstractSVGLightingElementBridge
                                  Color color) {
 
             // 'x' attribute - default is 0
-            double x = convertNumber(lightElement, SVG_X_ATTRIBUTE, 0);
+            double x = convertNumber(lightElement, SVG_X_ATTRIBUTE, 0, ctx);
 
             // 'y' attribute - default is 0
-            double y = convertNumber(lightElement, SVG_Y_ATTRIBUTE, 0);
+            double y = convertNumber(lightElement, SVG_Y_ATTRIBUTE, 0, ctx);
 
             // 'z' attribute - default is 0
-            double z = convertNumber(lightElement, SVG_Z_ATTRIBUTE, 0);
+            double z = convertNumber(lightElement, SVG_Z_ATTRIBUTE, 0, ctx);
 
             // 'pointsAtX' attribute - default is 0
-            double px
-                = convertNumber(lightElement, SVG_POINTS_AT_X_ATTRIBUTE, 0);
+            double px = convertNumber(lightElement, SVG_POINTS_AT_X_ATTRIBUTE,
+                                      0, ctx);
 
             // 'pointsAtY' attribute - default is 0
-            double py
-                = convertNumber(lightElement, SVG_POINTS_AT_Y_ATTRIBUTE, 0);
+            double py = convertNumber(lightElement, SVG_POINTS_AT_Y_ATTRIBUTE,
+                                      0, ctx);
 
             // 'pointsAtZ' attribute - default is 0
-            double pz
-                = convertNumber(lightElement, SVG_POINTS_AT_Z_ATTRIBUTE, 0);
+            double pz = convertNumber(lightElement, SVG_POINTS_AT_Z_ATTRIBUTE,
+                                      0, ctx);
 
             // 'specularExponent' attribute - default is 1
             double specularExponent = convertNumber
-                (lightElement, SVG_SPECULAR_EXPONENT_ATTRIBUTE, 1);
+                (lightElement, SVG_SPECULAR_EXPONENT_ATTRIBUTE, 1, ctx);
 
             // 'limitingConeAngle' attribute - default is 90
             double limitingConeAngle = convertNumber
-                (lightElement, SVG_LIMITING_CONE_ANGLE_ATTRIBUTE, 90);
+                (lightElement, SVG_LIMITING_CONE_ANGLE_ATTRIBUTE, 90, ctx);
 
             return new SpotLight(x, y, z,
                                  px, py, pz,
@@ -229,11 +232,11 @@ public abstract class AbstractSVGLightingElementBridge
 
             // 'azimuth' attribute - default is 0
             double azimuth
-                = convertNumber(lightElement, SVG_AZIMUTH_ATTRIBUTE, 0);
+                = convertNumber(lightElement, SVG_AZIMUTH_ATTRIBUTE, 0, ctx);
 
             // 'elevation' attribute - default is 0
             double elevation
-                = convertNumber(lightElement, SVG_ELEVATION_ATTRIBUTE, 0);
+                = convertNumber(lightElement, SVG_ELEVATION_ATTRIBUTE, 0, ctx);
 
             return new DistantLight(azimuth, elevation, color);
         }
@@ -271,13 +274,13 @@ public abstract class AbstractSVGLightingElementBridge
                                  Color color) {
 
             // 'x' attribute - default is 0
-            double x = convertNumber(lightElement, SVG_X_ATTRIBUTE, 0);
+            double x = convertNumber(lightElement, SVG_X_ATTRIBUTE, 0, ctx);
 
             // 'y' attribute - default is 0
-            double y = convertNumber(lightElement, SVG_Y_ATTRIBUTE, 0);
+            double y = convertNumber(lightElement, SVG_Y_ATTRIBUTE, 0, ctx);
 
             // 'z' attribute - default is 0
-            double z = convertNumber(lightElement, SVG_Z_ATTRIBUTE, 0);
+            double z = convertNumber(lightElement, SVG_Z_ATTRIBUTE, 0, ctx);
 
             return new PointLight(x, y, z, color);
         }

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AnimatableGenericSVGBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AnimatableGenericSVGBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AnimatableGenericSVGBridge.java
new file mode 100644
index 0000000..da170ae
--- /dev/null
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AnimatableGenericSVGBridge.java
@@ -0,0 +1,168 @@
+/*
+
+   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
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+package org.apache.flex.forks.batik.bridge;
+
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Rectangle2D;
+
+import org.apache.flex.forks.batik.css.engine.CSSEngineEvent;
+import org.apache.flex.forks.batik.dom.svg.AnimatedLiveAttributeValue;
+import org.apache.flex.forks.batik.dom.svg.SVGContext;
+import org.apache.flex.forks.batik.dom.svg.SVGOMElement;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.events.MutationEvent;
+
+/**
+ * Abstract bridge class for animatable elements that do not produce
+ * a GraphicsNode.
+ *
+ * @author <a href="mailto:cam%40mcc%2eid%2eau">Cameron McCormack</a>
+ * @version $Id: AnimatableGenericSVGBridge.java 475477 2006-11-15 22:44:28Z cam $
+ */
+public abstract class AnimatableGenericSVGBridge
+        extends AnimatableSVGBridge
+        implements GenericBridge, BridgeUpdateHandler, SVGContext {
+
+    /**
+     * Invoked to handle an <tt>Element</tt> for a given <tt>BridgeContext</tt>.
+     * For example, see the <tt>SVGTitleElementBridge</tt>.
+     *
+     * @param ctx the bridge context to use
+     * @param e the element being handled
+     */
+    public void handleElement(BridgeContext ctx, Element e) {
+        if (ctx.isDynamic()) {
+            this.e = e;
+            this.ctx = ctx;
+            ((SVGOMElement) e).setSVGContext(this);
+        }
+    }
+
+    // SVGContext ////////////////////////////////////////////////////////////
+
+    /**
+     * Returns the size of a px CSS unit in millimeters.
+     */
+    public float getPixelUnitToMillimeter() {
+        return ctx.getUserAgent().getPixelUnitToMillimeter();
+    }
+
+    /**
+     * Returns the size of a px CSS unit in millimeters.
+     * This will be removed after next release.
+     * @see #getPixelUnitToMillimeter()
+     */
+    public float getPixelToMM() {
+        return getPixelUnitToMillimeter();
+    }
+
+    /**
+     * Returns the tight bounding box in current user space (i.e.,
+     * after application of the transform attribute, if any) on the
+     * geometry of all contained graphics elements, exclusive of
+     * stroke-width and filter effects).
+     */
+    public Rectangle2D getBBox() {
+        return null;
+    }
+
+    /**
+     * Returns the transform from the global transform space to pixels.
+     */
+    public AffineTransform getScreenTransform() {
+        return ctx.getUserAgent().getTransform();
+    }
+
+    /**
+     * Sets the transform to be used from the global transform space to pixels.
+     */
+    public void setScreenTransform(AffineTransform at) {
+        ctx.getUserAgent().setTransform(at);
+    }
+
+    /**
+     * Returns the transformation matrix from current user units
+     * (i.e., after application of the transform attribute, if any) to
+     * the viewport coordinate system for the nearestViewportElement.
+     */
+    public AffineTransform getCTM() {
+        return null;
+    }
+
+    /**
+     * Returns the global transformation matrix from the current
+     * element to the root.
+     */
+    public AffineTransform getGlobalTransform() {
+        return null;
+    }
+
+    /**
+     * Returns the width of the viewport which directly contains the
+     * associated element.
+     */
+    public float getViewportWidth() {
+        return 0f;
+    }
+
+    /**
+     * Returns the height of the viewport which directly contains the
+     * associated element.
+     */
+    public float getViewportHeight() {
+        return 0f;
+    }
+
+    /**
+     * Returns the font-size on the associated element.
+     */
+    public float getFontSize() {
+        return 0f;
+    }
+
+    // BridgeUpdateHandler ///////////////////////////////////////////////////
+
+    public void dispose() {
+        ((SVGOMElement) e).setSVGContext(null);
+    }
+
+    public void handleDOMNodeInsertedEvent(MutationEvent evt) { 
+    }
+
+    public void handleDOMCharacterDataModified(MutationEvent evt) { 
+    }
+
+    public void handleDOMNodeRemovedEvent(MutationEvent evt) { 
+        dispose();
+    }
+
+    public void handleDOMAttrModifiedEvent(MutationEvent evt) {
+    }
+
+    public void handleCSSEngineEvent(CSSEngineEvent evt) {
+    }
+
+    public void handleAnimatedAttributeChanged
+            (AnimatedLiveAttributeValue alav) {
+    }
+
+    public void handleOtherAnimationChanged(String type) {
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AnimatableSVGBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AnimatableSVGBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AnimatableSVGBridge.java
new file mode 100644
index 0000000..d87baf3
--- /dev/null
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AnimatableSVGBridge.java
@@ -0,0 +1,99 @@
+/*
+
+   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
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+package org.apache.flex.forks.batik.bridge;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import org.apache.flex.forks.batik.dom.anim.AnimationTarget;
+import org.apache.flex.forks.batik.dom.anim.AnimationTargetListener;
+import org.apache.flex.forks.batik.dom.svg.SVGAnimationTargetContext;
+
+import org.w3c.dom.Element;
+
+/**
+ * Abstract bridge class for those elements that can be animated.
+ *
+ * @author <a href="mailto:cam%40mcc%2eid%2eau">Cameron McCormack</a>
+ * @version $Id: AnimatableSVGBridge.java 490655 2006-12-28 05:19:44Z cam $
+ */
+public abstract class AnimatableSVGBridge
+        extends AbstractSVGBridge
+        implements SVGAnimationTargetContext {
+
+    /**
+     * The element that has been handled by this bridge.
+     */
+    protected Element e;
+
+    /**
+     * The bridge context to use for dynamic updates.
+     */
+    protected BridgeContext ctx;
+
+    /**
+     * Map of CSS property names to {@link LinkedList}s of
+     * {@link AnimationTargetListener}s.
+     */
+    protected HashMap targetListeners;
+
+    // SVGAnimationTargetContext /////////////////////////////////////////////
+
+    /**
+     * Adds a listener for changes to the given attribute value.
+     */
+    public void addTargetListener(String pn, AnimationTargetListener l) {
+        if (targetListeners == null) {
+            targetListeners = new HashMap();
+        }
+        LinkedList ll = (LinkedList) targetListeners.get(pn);
+        if (ll == null) {
+            ll = new LinkedList();
+            targetListeners.put(pn, ll);
+        }
+        ll.add(l);
+    }
+
+    /**
+     * Removes a listener for changes to the given attribute value.
+     */
+    public void removeTargetListener(String pn, AnimationTargetListener l) {
+        LinkedList ll = (LinkedList) targetListeners.get(pn);
+        ll.remove(l);
+    }
+
+    /**
+     * Fires the listeners registered for changes to the base value of the
+     * given CSS property.
+     */
+    protected void fireBaseAttributeListeners(String pn) {
+        if (targetListeners != null) {
+            LinkedList ll = (LinkedList) targetListeners.get(pn);
+            if (ll != null) {
+                Iterator it = ll.iterator();
+                while (it.hasNext()) {
+                    AnimationTargetListener l =
+                        (AnimationTargetListener) it.next();
+                    l.baseValueChanged((AnimationTarget) e, null, pn, true);
+                }
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AnimationSupport.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AnimationSupport.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AnimationSupport.java
new file mode 100644
index 0000000..1cf73c9
--- /dev/null
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/AnimationSupport.java
@@ -0,0 +1,99 @@
+/*
+
+   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
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+package org.apache.flex.forks.batik.bridge;
+
+import java.util.Calendar;
+
+import org.apache.flex.forks.batik.anim.timing.TimedElement;
+import org.apache.flex.forks.batik.dom.events.DOMTimeEvent;
+import org.apache.flex.forks.batik.dom.svg.IdContainer;
+import org.apache.flex.forks.batik.dom.svg.SVGOMAnimationElement;
+import org.apache.flex.forks.batik.dom.svg.SVGOMUseShadowRoot;
+import org.apache.flex.forks.batik.util.XMLConstants;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.events.DocumentEvent;
+import org.w3c.dom.events.EventTarget;
+import org.w3c.dom.smil.TimeEvent;
+
+/**
+ * Class that provides utilities for animation support.
+ *
+ * @author <a href="mailto:cam%40mcc%2eid%2eau">Cameron McCormack</a>
+ * @version $Id: AnimationSupport.java 579494 2007-09-26 07:40:20Z cam $
+ */
+public abstract class AnimationSupport {
+
+    /**
+     * Fires a {@link TimeEvent} on the given {@link EventTarget}.
+     */
+    public static void fireTimeEvent(EventTarget target, String eventType,
+                                     Calendar time, int detail) {
+        DocumentEvent de = (DocumentEvent) ((Node) target).getOwnerDocument();
+        DOMTimeEvent evt = (DOMTimeEvent) de.createEvent("TimeEvent");
+        evt.initTimeEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI, eventType,
+                            null,
+                            detail);
+        evt.setTimestamp(time.getTime().getTime());
+        target.dispatchEvent(evt);
+    }
+
+    /**
+     * Returns the timed element with the given ID, using the given node
+     * as the context for the lookup.
+     */
+    public static TimedElement getTimedElementById(String id, Node n) {
+        Element e = getElementById(id, n);
+        if (e instanceof SVGOMAnimationElement) {
+            SVGAnimationElementBridge b = (SVGAnimationElementBridge)
+                ((SVGOMAnimationElement) e).getSVGContext();
+            return b.getTimedElement();
+        }
+        return null;
+    }
+
+    /**
+     * Returns the event target with the given ID, using the given
+     * node as the context for the lookup.
+     */
+    public static EventTarget getEventTargetById(String id, Node n) {
+        return (EventTarget) getElementById(id, n);
+    }
+
+    /**
+     * Returns the element with the given ID, using the given node
+     * as the context for the lookup.
+     */
+    protected static Element getElementById(String id, Node n) {
+        Node p = n.getParentNode();
+        while (p != null) {
+            n = p;
+            if (n instanceof SVGOMUseShadowRoot) {
+                p = ((SVGOMUseShadowRoot) n).getCSSParentNode();
+            } else {
+                p = n.getParentNode();
+            }
+        }
+        if (n instanceof IdContainer) {
+            return ((IdContainer) n).getElementById(id);
+        }
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BaseScriptingEnvironment.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BaseScriptingEnvironment.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BaseScriptingEnvironment.java
index 5fb3a5d..7f91946 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BaseScriptingEnvironment.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BaseScriptingEnvironment.java
@@ -1,10 +1,11 @@
 /*
 
-   Copyright 2002-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
 
@@ -18,9 +19,12 @@
 package org.apache.flex.forks.batik.bridge;
 
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.io.PushbackInputStream;
 import java.io.Reader;
 import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.HashSet;
@@ -29,13 +33,18 @@ import java.util.List;
 import java.util.Set;
 import java.util.jar.Manifest;
 
-import org.apache.flex.forks.batik.dom.svg.XMLBaseSupport;
+import org.apache.flex.forks.batik.dom.AbstractElement;
+import org.apache.flex.forks.batik.dom.events.AbstractEvent;
+import org.apache.flex.forks.batik.dom.events.NodeEventTarget;
 import org.apache.flex.forks.batik.dom.util.XLinkSupport;
 import org.apache.flex.forks.batik.script.Interpreter;
 import org.apache.flex.forks.batik.script.InterpreterException;
+import org.apache.flex.forks.batik.script.ScriptEventWrapper;
 import org.apache.flex.forks.batik.script.ScriptHandler;
 import org.apache.flex.forks.batik.util.ParsedURL;
 import org.apache.flex.forks.batik.util.SVGConstants;
+import org.apache.flex.forks.batik.util.XMLConstants;
+
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -44,15 +53,15 @@ 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.flex.forks.dom.svg.SVGDocument;
-import org.w3c.flex.forks.dom.svg.SVGSVGElement;
-import org.w3c.flex.forks.dom.svg.EventListenerInitializer;
+import org.w3c.dom.svg.SVGDocument;
+import org.w3c.dom.svg.SVGSVGElement;
+import org.w3c.dom.svg.EventListenerInitializer;
 
 /**
  * This class is the base class for SVG scripting.
  *
  * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
- * @version $Id: BaseScriptingEnvironment.java,v 1.35 2005/03/27 08:58:30 cam Exp $
+ * @version $Id: BaseScriptingEnvironment.java 594737 2007-11-14 01:47:08Z cam $
  */
 public class BaseScriptingEnvironment {
     /**
@@ -202,8 +211,14 @@ public class BaseScriptingEnvironment {
     }
 
 
-    protected final static String EVENT_NAME = "event";
-    protected final static String ALTERNATE_EVENT_NAME = "evt";
+    protected static final String EVENT_NAME = "event";
+    protected static final String ALTERNATE_EVENT_NAME = "evt";
+
+    /**
+     * The 'application/ecmascript' MIME type.
+     */
+    protected static final String APPLICATION_ECMASCRIPT =
+        "application/ecmascript";
 
     /**
      * The bridge context.
@@ -312,7 +327,7 @@ public class BaseScriptingEnvironment {
         }
 
         for (int i = 0; i < len; i++) {
-            Element script = (Element)scripts.item(i);
+            AbstractElement script = (AbstractElement) scripts.item(i);
             String type = script.getAttributeNS
                 (null, SVGConstants.SVG_TYPE_ATTRIBUTE);
 
@@ -326,8 +341,7 @@ public class BaseScriptingEnvironment {
             if (type.equals(SVGConstants.SVG_SCRIPT_TYPE_JAVA)) {
                 try {
                     String href = XLinkSupport.getXLinkHref(script);
-                    ParsedURL purl = new ParsedURL
-                        (XMLBaseSupport.getCascadedXMLBase(script), href);
+                    ParsedURL purl = new ParsedURL(script.getBaseURI(), href);
 
                     checkCompatibleScriptURL(type, purl);
 
@@ -395,17 +409,80 @@ public class BaseScriptingEnvironment {
             try {
                 String href = XLinkSupport.getXLinkHref(script);
                 String desc = null;
-                Reader reader;
+                Reader reader = null;
 
                 if (href.length() > 0) {
                     desc = href;
 
                     // External script.
-                    ParsedURL purl = new ParsedURL
-                        (XMLBaseSupport.getCascadedXMLBase(script), href);
+                    ParsedURL purl = new ParsedURL(script.getBaseURI(), href);
 
                     checkCompatibleScriptURL(type, purl);
-                    reader = new InputStreamReader(purl.openStream());
+                    InputStream is = purl.openStream();
+                    String mediaType = purl.getContentTypeMediaType();
+                    String enc = purl.getContentTypeCharset();
+                    if (enc != null) {
+                        try {
+                            reader = new InputStreamReader(is, enc);
+                        } catch (UnsupportedEncodingException uee) {
+                            enc = null;
+                        }
+                    }
+                    if (reader == null) {
+                        if (APPLICATION_ECMASCRIPT.equals(mediaType)) {
+                            // No encoding was specified in the MIME type, so
+                            // infer it according to RFC 4329.
+                            if (purl.hasContentTypeParameter("version")) {
+                                // Future versions of application/ecmascript 
+                                // are not supported, so skip this script 
+                                // element if the version parameter is present.
+                                continue;
+                            }
+
+                            PushbackInputStream pbis =
+                                new PushbackInputStream(is, 8);
+                            byte[] buf = new byte[4];
+                            int read = pbis.read(buf);
+                            if (read > 0) {
+                                pbis.unread(buf, 0, read);
+                                if (read >= 2) {
+                                    if (buf[0] == (byte)0xff &&
+                                            buf[1] == (byte)0xfe) {
+                                        if (read >= 4 && buf[2] == 0 &&
+                                                buf[3] == 0) {
+                                            enc = "UTF32-LE";
+                                            pbis.skip(4);
+                                        } else {
+                                            enc = "UTF-16LE";
+                                            pbis.skip(2);
+                                        }
+                                    } else if (buf[0] == (byte)0xfe &&
+                                            buf[1] == (byte)0xff) {
+                                        enc = "UTF-16BE";
+                                        pbis.skip(2);
+                                    } else if (read >= 3
+                                            && buf[0] == (byte)0xef 
+                                            && buf[1] == (byte)0xbb
+                                            && buf[2] == (byte)0xbf) {
+                                        enc = "UTF-8";
+                                        pbis.skip(3);
+                                    } else if (read >= 4 && buf[0] == 0 &&
+                                            buf[1] == 0 &&
+                                            buf[2] == (byte)0xfe &&
+                                            buf[3] == (byte)0xff) {
+                                        enc = "UTF-32BE";
+                                        pbis.skip(4);
+                                    }
+                                }
+                                if (enc == null) {
+                                    enc = "UTF-8";
+                                }
+                            }
+                            reader = new InputStreamReader(pbis, enc);
+                        } else {
+                            reader = new InputStreamReader(is);
+                        }
+                    }
                 } else {
                     checkCompatibleScriptURL(type, docPURL);
                     DocumentLoader dl = bridgeContext.getDocumentLoader();
@@ -415,7 +492,7 @@ public class BaseScriptingEnvironment {
                     desc = Messages.formatMessage
                         (INLINE_SCRIPT_DESCRIPTION,
                          new Object [] {d.getURL(),
-                                        "<"+script.getNodeName()+">", 
+                                        "<"+script.getNodeName()+">",
                                         new Integer(line)});
                     // Inline script.
                     Node n = script.getFirstChild();
@@ -468,6 +545,8 @@ public class BaseScriptingEnvironment {
     public void dispatchSVGLoadEvent() {
         SVGSVGElement root = (SVGSVGElement)document.getDocumentElement();
         String lang = root.getContentScriptType();
+        long documentStartTime = System.currentTimeMillis();
+        bridgeContext.getAnimationEngine().start(documentStartTime);
         dispatchSVGLoad(root, true, lang);
     }
 
@@ -485,11 +564,19 @@ public class BaseScriptingEnvironment {
             }
         }
 
-        Event ev;
         DocumentEvent de = (DocumentEvent)elt.getOwnerDocument();
-        ev = de.createEvent("SVGEvents");
-        ev.initEvent("SVGLoad", false, false);
-        EventTarget t = (EventTarget)elt;
+        AbstractEvent ev = (AbstractEvent) de.createEvent("SVGEvents");
+        String type;
+        if (bridgeContext.isSVG12()) {
+            type = "load";
+        } else {
+            type = "SVGLoad";
+        }
+        ev.initEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI,
+                       type,
+                       false,
+                       false);
+        NodeEventTarget t = (NodeEventTarget)elt;
 
         final String s =
             elt.getAttributeNS(null, SVGConstants.SVG_ONLOAD_ATTRIBUTE);
@@ -520,14 +607,20 @@ public class BaseScriptingEnvironment {
         final String desc = Messages.formatMessage
             (EVENT_SCRIPT_DESCRIPTION,
              new Object [] {d.getURL(),
-                            SVGConstants.SVG_ONLOAD_ATTRIBUTE, 
+                            SVGConstants.SVG_ONLOAD_ATTRIBUTE,
                             new Integer(line)});
 
         EventListener l = new EventListener() {
                 public void handleEvent(Event evt) {
                     try {
-                        interp.bindObject(EVENT_NAME, evt);
-                        interp.bindObject(ALTERNATE_EVENT_NAME, evt);
+                        Object event;
+                        if (evt instanceof ScriptEventWrapper) {
+                            event = ((ScriptEventWrapper) evt).getEventObject();
+                        } else {
+                            event = evt;
+                        }
+                        interp.bindObject(EVENT_NAME, event);
+                        interp.bindObject(ALTERNATE_EVENT_NAME, event);
                         interp.evaluate(new StringReader(s), desc);
                     } catch (IOException io) {
                     } catch (InterpreterException e) {
@@ -535,30 +628,46 @@ public class BaseScriptingEnvironment {
                     }
                 }
             };
-        t.addEventListener("SVGLoad", l, false);
+        t.addEventListenerNS
+            (XMLConstants.XML_EVENTS_NAMESPACE_URI, type,
+             l, false, null);
         t.dispatchEvent(ev);
-        t.removeEventListener("SVGLoad", l, false);
+        t.removeEventListenerNS
+            (XMLConstants.XML_EVENTS_NAMESPACE_URI, type,
+             l, false);
     }
 
     /**
      * Method to dispatch SVG Zoom event.
      */
     protected void dispatchSVGZoomEvent() {
-        dispatchSVGDocEvent("SVGZoom");
+        if (bridgeContext.isSVG12()) {
+            dispatchSVGDocEvent("zoom");
+        } else {
+            dispatchSVGDocEvent("SVGZoom");
+        }
     }
 
     /**
      * Method to dispatch SVG Scroll event.
      */
     protected void dispatchSVGScrollEvent() {
-        dispatchSVGDocEvent("SVGScroll");
+        if (bridgeContext.isSVG12()) {
+            dispatchSVGDocEvent("scroll");
+        } else {
+            dispatchSVGDocEvent("SVGScroll");
+        }
     }
 
     /**
      * Method to dispatch SVG Resize event.
      */
     protected void dispatchSVGResizeEvent() {
-        dispatchSVGDocEvent("SVGResize");
+        if (bridgeContext.isSVG12()) {
+            dispatchSVGDocEvent("resize");
+        } else {
+            dispatchSVGDocEvent("SVGResize");
+        }
     }
 
     protected void dispatchSVGDocEvent(String eventType) {
@@ -568,8 +677,11 @@ public class BaseScriptingEnvironment {
         EventTarget t = root;
 
         DocumentEvent de = (DocumentEvent)document;
-        Event ev = de.createEvent("SVGEvents");
-        ev.initEvent(eventType, false, false);
+        AbstractEvent ev = (AbstractEvent) de.createEvent("SVGEvents");
+        ev.initEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI,
+                       eventType,
+                       false,
+                       false);
         t.dispatchEvent(ev);
     }
 
@@ -691,22 +803,22 @@ public class BaseScriptingEnvironment {
                            String enc) {
         }
 
-        public void postURL(String uri, String content, 
+        public void postURL(String uri, String content,
                             org.apache.flex.forks.batik.script.Window.URLResponseHandler h) {
             postURL(uri, content, h, "text/plain", null);
         }
 
-        public void postURL(String uri, String content, 
-                            org.apache.flex.forks.batik.script.Window.URLResponseHandler h, 
+        public void postURL(String uri, String content,
+                            org.apache.flex.forks.batik.script.Window.URLResponseHandler h,
                      String mimeType) {
             postURL(uri, content, h, mimeType, null);
         }
 
-        public void postURL(String uri, 
-                            String content, 
-                            org.apache.flex.forks.batik.script.Window.URLResponseHandler h, 
-                            String mimeType, 
-                            String fEnc) { 
+        public void postURL(String uri,
+                            String content,
+                            org.apache.flex.forks.batik.script.Window.URLResponseHandler h,
+                            String mimeType,
+                            String fEnc) {
         }
 
 

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/Bridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/Bridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/Bridge.java
index f3ee39e..c164f2c 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/Bridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/Bridge.java
@@ -1,10 +1,11 @@
 /*
 
-   Copyright 2000-2002  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,11 +20,11 @@ package org.apache.flex.forks.batik.bridge;
 
 /**
  * A tagging interface that all bridges must implement. A bridge is
- * responsible on creating and maintaining an appropriate object
+ * responsible for creating and maintaining an appropriate object
  * according to an Element.
  *
  * @author <a href="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a>
- * @version $Id: Bridge.java,v 1.8 2004/08/18 07:12:30 vhardy Exp $
+ * @version $Id: Bridge.java 475477 2006-11-15 22:44:28Z cam $
  */
 public interface Bridge {