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:34 UTC

[19/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/BridgeContext.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BridgeContext.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BridgeContext.java
index 7745f45..b94f893 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BridgeContext.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BridgeContext.java
@@ -1,10 +1,11 @@
 /*
 
-   Copyright 2000-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
 
@@ -22,8 +23,8 @@ import java.awt.geom.Dimension2D;
 import java.io.IOException;
 import java.io.InterruptedIOException;
 import java.lang.ref.SoftReference;
+import java.lang.ref.WeakReference;
 import java.net.MalformedURLException;
-import java.net.URL;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -34,6 +35,7 @@ import java.util.Map;
 import java.util.Set;
 import java.util.WeakHashMap;
 
+import org.apache.flex.forks.batik.bridge.svg12.SVG12BridgeContext;
 import org.apache.flex.forks.batik.bridge.svg12.SVG12BridgeExtension;
 import org.apache.flex.forks.batik.css.engine.CSSContext;
 import org.apache.flex.forks.batik.css.engine.CSSEngine;
@@ -43,11 +45,16 @@ import org.apache.flex.forks.batik.css.engine.CSSEngineUserAgent;
 import org.apache.flex.forks.batik.css.engine.SVGCSSEngine;
 import org.apache.flex.forks.batik.css.engine.SystemColorSupport;
 import org.apache.flex.forks.batik.css.engine.value.Value;
+import org.apache.flex.forks.batik.dom.AbstractNode;
+import org.apache.flex.forks.batik.dom.events.NodeEventTarget;
+import org.apache.flex.forks.batik.dom.svg.AnimatedAttributeListener;
+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.SVGDOMImplementation;
 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.SVGStylableElement;
+import org.apache.flex.forks.batik.dom.xbl.XBLManager;
 import org.apache.flex.forks.batik.gvt.CompositeGraphicsNode;
 import org.apache.flex.forks.batik.gvt.GraphicsNode;
 import org.apache.flex.forks.batik.gvt.TextPainter;
@@ -58,6 +65,7 @@ import org.apache.flex.forks.batik.util.CleanerThread;
 import org.apache.flex.forks.batik.util.ParsedURL;
 import org.apache.flex.forks.batik.util.SVGConstants;
 import org.apache.flex.forks.batik.util.Service;
+import org.apache.flex.forks.batik.util.XMLConstants;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -67,7 +75,7 @@ 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.dom.svg.SVGDocument;
 
 /**
  * This class represents a context used by the various bridges and the
@@ -80,7 +88,7 @@ import org.w3c.flex.forks.dom.svg.SVGDocument;
  * a SVG DOM tree such as the current viewport or the user agent.
  *
  * @author <a href="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a>
- * @version $Id: BridgeContext.java,v 1.83 2005/03/29 10:48:02 deweese Exp $
+ * @version $Id: BridgeContext.java 599681 2007-11-30 02:55:48Z cam $
  */
 public class BridgeContext implements ErrorConstants, CSSContext {
 
@@ -90,6 +98,11 @@ public class BridgeContext implements ErrorConstants, CSSContext {
     protected Document document;
 
     /**
+     * Whether the document is an SVG 1.2 document.
+     */
+    protected boolean isSVG12;
+
+    /**
      * The GVT builder that might be used to create a GVT subtree.
      */
     protected GVTBuilder gvtBuilder;
@@ -147,6 +160,22 @@ public class BridgeContext implements ErrorConstants, CSSContext {
     protected Map namespaceURIMap;
 
     /**
+     * Default bridge.
+     * When a bridge is requested for an element type that does not have a
+     * bridge, and there is no other bridge for elements in the same namespace,
+     * the default bridge is returned.  This is used for custom elements,
+     * which all use the same bridge type.
+     */
+    protected Bridge defaultBridge;
+
+    /**
+     * Default bridge reserved namespaces set.
+     * Default bridges will not be created for elements that have a
+     * namespace URI present in this set.
+     */
+    protected Set reservedNamespaceSet;
+
+    /**
      * Element Data Map:
      * This is a general location for elements to 'cache'
      * data.  Such as the graphics tree for a pattern or
@@ -158,7 +187,6 @@ public class BridgeContext implements ErrorConstants, CSSContext {
      */
     protected Map elementDataMap;
 
-
     /**
      * The interpreter pool used to handle scripts.
      */
@@ -186,20 +214,21 @@ public class BridgeContext implements ErrorConstants, CSSContext {
      * the DOM tree (in practice text holds references to the source
      * text elements for font resolution).
      */
-    public final static int STATIC      = 0;
+    public static final int STATIC      = 0;
+
     /**
      * Indicates that DOM listeners should be registered to support,
      * 'interactivity' this includes anchors and cursors, but does not
      * include support for DOM modifications.
      */
-    public final static int INTERACTIVE = 1;
+    public static final int INTERACTIVE = 1;
 
     /**
      * Indicates that all DOM listeners should be registered. This supports
      * 'interactivity' (anchors and cursors), as well as DOM modifications
      * listeners to update the GVT rendering tree.
      */
-    public final static int DYNAMIC     = 2;
+    public static final int DYNAMIC     = 2;
 
     /**
      * Whether the bridge should support dynamic, or interactive features.
@@ -212,9 +241,35 @@ public class BridgeContext implements ErrorConstants, CSSContext {
     protected UpdateManager updateManager;
 
     /**
-     * Constructs a new empty bridge context.
+     * The XBL manager.
      */
-    protected BridgeContext() {}
+    protected XBLManager xblManager;
+
+    /**
+     * The bridge context for the primary document, if this is a bridge
+     * context for a resource document.
+     */
+    protected BridgeContext primaryContext;
+
+    /**
+     * Set of WeakReferences to child BridgeContexts.
+     */
+    protected HashSet childContexts = new HashSet();
+
+    /**
+     * The animation engine for the document.
+     */
+    protected SVGAnimationEngine animationEngine;
+
+    /**
+     * The animation limiting mode.
+     */
+    protected int animationLimitingMode;
+
+    /**
+     * The amount of animation limiting.
+     */
+    protected float animationLimitingAmount;
 
     /**
      * By default we share a unique instance of InterpreterPool.
@@ -222,6 +277,11 @@ public class BridgeContext implements ErrorConstants, CSSContext {
     private static InterpreterPool sharedPool = new InterpreterPool();
 
     /**
+     * Constructs a new empty bridge context.
+     */
+    protected BridgeContext() {}
+
+    /**
      * Constructs a new bridge context.
      * @param userAgent the user agent
      */
@@ -257,6 +317,56 @@ public class BridgeContext implements ErrorConstants, CSSContext {
     }
 
     /**
+     * Calls dispose on this BridgeContext, if it is a child context.
+     */
+    protected void finalize() {
+        if (primaryContext != null) {
+            dispose();
+        }
+    }
+
+    /**
+     * This function creates a new 'sub' BridgeContext to associated
+     * with 'newDoc' if one currently doesn't exist, otherwise it
+     * returns the BridgeContext currently associated with the
+     * document.
+     * @param newDoc The document to get/create a BridgeContext for.
+     */
+    public BridgeContext createSubBridgeContext(SVGOMDocument newDoc) {
+        BridgeContext subCtx;
+
+        CSSEngine eng = newDoc.getCSSEngine();
+        if (eng != null) {
+            subCtx = (BridgeContext) newDoc.getCSSEngine().getCSSContext();
+            return subCtx;
+        }
+
+        subCtx = createBridgeContext(newDoc);
+        subCtx.primaryContext = primaryContext != null ? primaryContext : this;
+        subCtx.primaryContext.childContexts.add(new WeakReference(subCtx));
+        subCtx.dynamicStatus = dynamicStatus;
+        subCtx.setGVTBuilder(getGVTBuilder());
+        subCtx.setTextPainter(getTextPainter());
+        subCtx.setDocument(newDoc);
+        subCtx.initializeDocument(newDoc);
+        if (isInteractive())
+            subCtx.addUIEventListeners(newDoc);
+        return subCtx;
+    }
+
+    /**
+     * This function creates a new BridgeContext, it mostly
+     * exists so subclasses can provide an instance of
+     * themselves when a sub BridgeContext is needed.
+     */
+    public BridgeContext createBridgeContext(SVGOMDocument doc) {
+        if (doc.isSVG12()) {
+            return new SVG12BridgeContext(getUserAgent(), getDocumentLoader());
+        }
+        return new BridgeContext(getUserAgent(), getDocumentLoader());
+    }
+
+    /**
      * Initializes the given document.
      */
     protected void initializeDocument(Document document) {
@@ -272,10 +382,10 @@ public class BridgeContext implements ErrorConstants, CSSContext {
             String uri = userAgent.getUserStyleSheetURI();
             if (uri != null) {
                 try {
-                    URL url = new URL(uri);
+                    ParsedURL url = new ParsedURL(uri);
                     eng.setUserAgentStyleSheet
                         (eng.parseStyleSheet(url, "all"));
-                } catch (MalformedURLException e) {
+                } catch (Exception e) {
                     userAgent.displayError(e);
                 }
             }
@@ -298,17 +408,17 @@ public class BridgeContext implements ErrorConstants, CSSContext {
      * might be used by bridges (especially SVGTextElementBridge) to set the
      * text painter of each TextNode.
      *
-     * @param textPainter the text painter for text nodes 
+     * @param textPainter the text painter for text nodes
      */
     public void setTextPainter(TextPainter textPainter) {
-	this.textPainter = textPainter;
+        this.textPainter = textPainter;
     }
 
     /**
      * Returns the text painter that will be used be text nodes.
      */
     public TextPainter getTextPainter() {
-	return textPainter;
+        return textPainter;
     }
 
     /**
@@ -328,6 +438,7 @@ public class BridgeContext implements ErrorConstants, CSSContext {
             fontFamilyMap = null;
         }
         this.document = document;
+        this.isSVG12 = ((SVGOMDocument) document).isSVG12();
         registerSVGBridges();
     }
 
@@ -351,20 +462,19 @@ public class BridgeContext implements ErrorConstants, CSSContext {
     }
 
     /**
-     * Set Element Data.
-     * Associates data object with element so it can be
-     * retrieved later.
+     * Associates a data object with a node so it can be retrieved later.
+     * This is primarily used for caching the graphics node generated from
+     * a 'pattern' element.  A soft reference to the data object is used.
      */
     public void setElementData(Node n, Object data) {
-        if (elementDataMap == null)
+        if (elementDataMap == null) {
             elementDataMap = new WeakHashMap();
+        }
         elementDataMap.put(n, new SoftReference(data));
     }
 
     /**
-     * Set Element Data.
-     * Associates data object with element so it can be
-     * retrieved later.
+     * Retrieves a data object associated with the given node.
      */
     public Object getElementData(Node n) {
         if (elementDataMap == null)
@@ -516,8 +626,8 @@ public class BridgeContext implements ErrorConstants, CSSContext {
     }
 
     /**
-     * Sets the document as a STATIC, INTERACTIVE or DYNAMIC document. 
-     * Call this method before the build phase 
+     * Sets the document as a STATIC, INTERACTIVE or DYNAMIC document.
+     * Call this method before the build phase
      * (ie. before <tt>gvtBuilder.build(...)</tt>)
      * otherwise, that will have no effect.
      *
@@ -549,7 +659,6 @@ public class BridgeContext implements ErrorConstants, CSSContext {
             setDynamicState(STATIC);
     }
 
-
     /**
      * Returns the update manager, if the bridge supports dynamic features.
      */
@@ -564,60 +673,132 @@ public class BridgeContext implements ErrorConstants, CSSContext {
         updateManager = um;
     }
 
+    /**
+     * Sets the update manager on the given BridgeContext.
+     */
+    protected void setUpdateManager(BridgeContext ctx, UpdateManager um) {
+        ctx.setUpdateManager(um);
+    }
+
+    /**
+     * Sets the xblManager variable of the given BridgeContext.
+     */
+    protected void setXBLManager(BridgeContext ctx, XBLManager xm) {
+        ctx.xblManager = xm;
+    }
+
+    /**
+     * Returns whether the managed document is an SVG 1.2 document.
+     */
+    public boolean isSVG12() {
+        return isSVG12;
+    }
+
+    /**
+     * Returns the primary bridge context.
+     */
+    public BridgeContext getPrimaryBridgeContext() {
+        if (primaryContext != null) {
+            return primaryContext;
+        }
+        return this;
+    }
+
+    /**
+     * Returns an array of the child contexts.
+     */
+    public BridgeContext[] getChildContexts() {
+        BridgeContext[] res = new BridgeContext[childContexts.size()];
+        Iterator it = childContexts.iterator();
+        for (int i = 0; i < res.length; i++) {
+            WeakReference wr = (WeakReference) it.next();
+            res[i] = (BridgeContext) wr.get();
+        }
+        return res;
+    }
+
+    /**
+     * Returns the AnimationEngine for the document.  Creates one if
+     * it doesn't exist.
+     */
+    public SVGAnimationEngine getAnimationEngine() {
+        if (animationEngine == null) {
+            animationEngine = new SVGAnimationEngine(document, this);
+            setAnimationLimitingMode();
+        }
+        return animationEngine;
+    }
+
     // reference management //////////////////////////////////////////////////
 
     /**
-     * Returns the element referenced by the specified element by the
-     * specified uri. The referenced element can not be a Document.
-     *
+     * Returns a new URIResolver object.
+     */
+    public URIResolver createURIResolver(SVGDocument doc, DocumentLoader dl) {
+        return new URIResolver(doc, dl);
+    }
+
+    /**
+     * Returns the node referenced by the specified element by the specified
+     * uri. The referenced node can be either an element given by a fragment
+     * ID, or the document node.
      * @param e the element referencing
-     * @param uri the uri of the referenced element
+     * @param uri the uri of the referenced node
      */
-    public Element getReferencedElement(Element e, String uri) {
+    public Node getReferencedNode(Element e, String uri) {
         try {
             SVGDocument document = (SVGDocument)e.getOwnerDocument();
-            URIResolver ur = new URIResolver(document, documentLoader);
-            Element ref = ur.getElement(uri, e);
+            URIResolver ur = createURIResolver(document, documentLoader);
+            Node ref = ur.getNode(uri, e);
             if (ref == null) {
-                throw new BridgeException(e, ERR_URI_BAD_TARGET,
+                throw new BridgeException(this, e, ERR_URI_BAD_TARGET,
                                           new Object[] {uri});
             } else {
-                SVGOMDocument refDoc = (SVGOMDocument)ref.getOwnerDocument();
+                SVGOMDocument refDoc =
+                    (SVGOMDocument) (ref.getNodeType() == Node.DOCUMENT_NODE
+                                       ? ref
+                                       : ref.getOwnerDocument());
                 // This is new rather than attaching this BridgeContext
-                // with the new document we now create a whole new 
+                // with the new document we now create a whole new
                 // BridgeContext to go with the new document.
                 // This means that the new document has it's own
                 // world of stuff and it should avoid memory leaks
                 // since the new document isn't 'tied into' this
                 // bridge context.
                 if (refDoc != document) {
-                    CSSEngine eng = refDoc.getCSSEngine();
-                    if (eng == null) {
-                        BridgeContext subCtx;
-                        subCtx = new BridgeContext(getUserAgent(),
-                                                   getDocumentLoader());
-                        subCtx.setGVTBuilder(getGVTBuilder());
-                        subCtx.setDocument(refDoc);
-                        subCtx.initializeDocument(refDoc);
-                    }
+                    createSubBridgeContext(refDoc);
                 }
                 return ref;
             }
         } catch (MalformedURLException ex) {
-            throw new BridgeException(e, ERR_URI_MALFORMED,
+            throw new BridgeException(this, e, ex, ERR_URI_MALFORMED,
                                       new Object[] {uri});
         } catch (InterruptedIOException ex) {
             throw new InterruptedBridgeException();
         } catch (IOException ex) {
-            throw new BridgeException(e, ERR_URI_IO,
-                                      new Object[] {uri});
-        } catch (IllegalArgumentException ex) {
-            throw new BridgeException(e, ERR_URI_REFERENCE_A_DOCUMENT,
+            //ex.printStackTrace();
+            throw new BridgeException(this, e, ex, ERR_URI_IO,
                                       new Object[] {uri});
         } catch (SecurityException ex) {
-            throw new BridgeException(e, ERR_URI_UNSECURE,
+            throw new BridgeException(this, e, ex, ERR_URI_UNSECURE,
+                                      new Object[] {uri});
+        }
+    }
+
+    /**
+     * Returns the element referenced by the specified element by the
+     * specified uri. The referenced element can not be a Document.
+     *
+     * @param e the element referencing
+     * @param uri the uri of the referenced element
+     */
+    public Element getReferencedElement(Element e, String uri) {
+        Node ref = getReferencedNode(e, uri);
+        if (ref != null && ref.getNodeType() != Node.ELEMENT_NODE) {
+            throw new BridgeException(this, e, ERR_URI_REFERENCE_A_DOCUMENT,
                                       new Object[] {uri});
         }
+        return (Element) ref;
     }
 
     // Viewport //////////////////////////////////////////////////////////////
@@ -684,72 +865,76 @@ public class BridgeContext implements ErrorConstants, CSSContext {
     // Bindings //////////////////////////////////////////////////////////////
 
     /**
-     * Binds the specified GraphicsNode to the specified Element. This method
+     * Binds the specified GraphicsNode to the specified Node. This method
      * automatically bind the graphics node to the element and the element to
      * the graphics node.
      *
-     * @param element the element to bind to the specified graphics node
-     * @param node the graphics node to bind to the specified element
+     * @param node the DOM Node to bind to the specified graphics node
+     * @param gn the graphics node to bind to the specified element
      */
-    public void bind(Element element, GraphicsNode node) {
+    public void bind(Node node, GraphicsNode gn) {
         if (elementNodeMap == null) {
             elementNodeMap = new WeakHashMap();
             nodeElementMap = new WeakHashMap();
         }
-        elementNodeMap.put(element, new SoftReference(node));
-        nodeElementMap.put(node, new SoftReference(element));
+        elementNodeMap.put(node, new SoftReference(gn));
+        nodeElementMap.put(gn, new SoftReference(node));
     }
 
     /**
-     * Removes the binding of the specified Element.
+     * Removes the binding of the specified Node.
      *
-     * @param element the element to unbind
+     * @param node the DOM Node to unbind
      */
-    public void unbind(Element element) {
+    public void unbind(Node node) {
         if (elementNodeMap == null) {
             return;
         }
-        GraphicsNode node = null;
-        SoftReference sr = (SoftReference)elementNodeMap.get(element);
+        GraphicsNode gn = null;
+        SoftReference sr = (SoftReference)elementNodeMap.get(node);
         if (sr != null)
-            node = (GraphicsNode)sr.get();
-        elementNodeMap.remove(element);
-        if (node != null)
-            nodeElementMap.remove(node);
+            gn = (GraphicsNode)sr.get();
+        elementNodeMap.remove(node);
+        if (gn != null)
+            nodeElementMap.remove(gn);
     }
 
     /**
-     * Returns the GraphicsNode associated to the specified Element or
+     * Returns the GraphicsNode associated to the specified Node or
      * null if any.
      *
-     * @param element the element associated to the graphics node to return
+     * @param node the DOM Node associated to the graphics node to return
      */
-    public GraphicsNode getGraphicsNode(Element element) {
+    public GraphicsNode getGraphicsNode(Node node) {
         if (elementNodeMap != null) {
-            SoftReference sr = (SoftReference)elementNodeMap.get(element);
-            if (sr != null) 
+            SoftReference sr = (SoftReference)elementNodeMap.get(node);
+            if (sr != null)
                 return (GraphicsNode)sr.get();
         }
         return null;
     }
 
     /**
-     * Returns the Element associated to the specified GraphicsNode or
+     * Returns the Node associated to the specified GraphicsNode or
      * null if any.
      *
-     * @param node the graphics node associated to the element to return
+     * @param gn the graphics node associated to the element to return
      */
-    public Element getElement(GraphicsNode node) {
+    public Element getElement(GraphicsNode gn) {
         if (nodeElementMap != null) {
-            SoftReference sr = (SoftReference)nodeElementMap.get(node);
-            if (sr != null) 
-                return (Element)sr.get();
+            SoftReference sr = (SoftReference)nodeElementMap.get(gn);
+            if (sr != null) {
+                Node n = (Node) sr.get();
+                if (n.getNodeType() == Node.ELEMENT_NODE) {
+                    return (Element) n;
+                }
+            }
         }
         return null;
     }
 
     // Bridge management /////////////////////////////////////////////////////
- 
+
     /**
      * Returns true if the specified element has a GraphicsNodeBridge
      * associated to it, false otherwise.
@@ -771,6 +956,13 @@ public class BridgeContext implements ErrorConstants, CSSContext {
     }
 
     /**
+     * Returns the bridge for the document node.
+     */
+    public DocumentBridge getDocumentBridge() {
+        return new SVGDocumentBridge();
+    }
+
+    /**
      * Returns the bridge associated with the specified element.
      *
      * @param element the element
@@ -793,11 +985,18 @@ public class BridgeContext implements ErrorConstants, CSSContext {
      *
      */
     public Bridge getBridge(String namespaceURI, String localName) {
-        HashMap localNameMap = (HashMap) namespaceURIMap.get(namespaceURI);
-        if (localNameMap == null) {
-            return null;
+        Bridge bridge = null;
+        if (namespaceURIMap != null) {
+            HashMap localNameMap = (HashMap) namespaceURIMap.get(namespaceURI);
+            if (localNameMap != null) {
+                bridge = (Bridge)localNameMap.get(localName);
+            }
+        }
+        if (bridge == null
+                && (reservedNamespaceSet == null
+                    || !reservedNamespaceSet.contains(namespaceURI))) {
+            bridge = defaultBridge;
         }
-        Bridge bridge = (Bridge)localNameMap.get(localName);
         if (isDynamic()) {
             return bridge == null ? null : bridge.getInstance();
         } else {
@@ -835,7 +1034,7 @@ public class BridgeContext implements ErrorConstants, CSSContext {
     }
 
     /**
-     * Associates the specified <tt>Bridge</tt> object with it's 
+     * Associates the specified <tt>Bridge</tt> object with it's
      * namespace URI and local name.
      *
      * @param bridge the bridge that manages the element
@@ -868,6 +1067,44 @@ public class BridgeContext implements ErrorConstants, CSSContext {
         }
     }
 
+    /**
+     * Sets the <tt>Bridge</tt> object to be used for foreign
+     * namespace elements.
+     *
+     * @param bridge the bridge that manages the element
+     */
+    public void setDefaultBridge(Bridge bridge) {
+        defaultBridge = bridge;
+    }
+
+    /**
+     * Adds a namespace URI to avoid when creating default bridges.
+     */
+    public void putReservedNamespaceURI(String namespaceURI) {
+        if (namespaceURI == null) {
+            namespaceURI = "";
+        }
+        if (reservedNamespaceSet == null) {
+            reservedNamespaceSet = new HashSet();
+        }
+        reservedNamespaceSet.add(namespaceURI);
+    }
+
+    /**
+     * Removes a namespace URI to avoid when creating default bridges.
+     */
+    public void removeReservedNamespaceURI(String namespaceURI) {
+        if (namespaceURI == null) {
+            namespaceURI = "";
+        }
+        if (reservedNamespaceSet != null) {
+            reservedNamespaceSet.remove(namespaceURI);
+            if (reservedNamespaceSet.isEmpty()) {
+                reservedNamespaceSet = null;
+            }
+        }
+    }
+
     // dynamic support ////////////////////////////////////////////////////////
 
     /**
@@ -879,7 +1116,7 @@ public class BridgeContext implements ErrorConstants, CSSContext {
     /**
      * The DOM EventListener to receive 'DOMCharacterDataModified' event.
      */
-    protected EventListener domCharacterDataModifiedListener;
+    protected EventListener domCharacterDataModifiedEventListener;
 
     /**
      * The DOM EventListener to receive 'DOMAttrModified' event.
@@ -902,6 +1139,11 @@ public class BridgeContext implements ErrorConstants, CSSContext {
     protected CSSEngineListener cssPropertiesChangedListener;
 
     /**
+     * The listener to receive notification of animated attribute changes.
+     */
+    protected AnimatedAttributeListener animatedAttributeListener;
+
+    /**
      * The EventListener that is responsible of managing DOM focus event.
      */
     protected FocusManager focusManager;
@@ -912,57 +1154,70 @@ public class BridgeContext implements ErrorConstants, CSSContext {
     protected CursorManager cursorManager = new CursorManager(this);
 
     /**
-     * Adds EventListeners to the input document to handle the cursor 
+     * Adds EventListeners to the input document to handle the cursor
      * property.
-     * This is not done in the addDOMListeners method because 
-     * addDOMListeners is only used for dynamic content whereas 
+     * This is not done in the addDOMListeners method because
+     * addDOMListeners is only used for dynamic content whereas
      * cursor support is provided for all content.
      * Also note that it is very important that the listeners be
      * registered for the capture phase as the 'default' behavior
-     * for cursors is handled by the BridgeContext during the 
+     * for cursors is handled by the BridgeContext during the
      * capture phase and the 'custom' behavior (handling of 'auto'
-     * on anchors, for example), is handled during the bubling phase.
+     * on anchors, for example), is handled during the bubbling phase.
      */
     public void addUIEventListeners(Document doc) {
-        EventTarget evtTarget = (EventTarget)doc.getDocumentElement();
+        NodeEventTarget evtTarget = (NodeEventTarget)doc.getDocumentElement();
 
         DOMMouseOverEventListener domMouseOverListener =
             new DOMMouseOverEventListener();
-        evtTarget.addEventListener(SVGConstants.SVG_EVENT_MOUSEOVER, 
-                                   domMouseOverListener,
-                                   true);
-        storeEventListener(evtTarget, SVGConstants.SVG_EVENT_MOUSEOVER, 
-                           domMouseOverListener, true);
+        evtTarget.addEventListenerNS
+            (XMLConstants.XML_EVENTS_NAMESPACE_URI,
+             SVGConstants.SVG_EVENT_MOUSEOVER,
+             domMouseOverListener, true, null);
+        storeEventListenerNS
+            (evtTarget,
+             XMLConstants.XML_EVENTS_NAMESPACE_URI,
+             SVGConstants.SVG_EVENT_MOUSEOVER,
+             domMouseOverListener, true);
 
         DOMMouseOutEventListener domMouseOutListener =
             new DOMMouseOutEventListener();
-        evtTarget.addEventListener(SVGConstants.SVG_EVENT_MOUSEOUT,
-                                   domMouseOutListener,
-                                   true);
-        storeEventListener(evtTarget, SVGConstants.SVG_EVENT_MOUSEOUT, 
-                           domMouseOutListener, true);
+        evtTarget.addEventListenerNS
+            (XMLConstants.XML_EVENTS_NAMESPACE_URI,
+             SVGConstants.SVG_EVENT_MOUSEOUT,
+             domMouseOutListener, true, null);
+        storeEventListenerNS
+            (evtTarget,
+             XMLConstants.XML_EVENTS_NAMESPACE_URI,
+             SVGConstants.SVG_EVENT_MOUSEOUT,
+             domMouseOutListener, true);
 
     }
 
-
     public void removeUIEventListeners(Document doc) {
         EventTarget evtTarget = (EventTarget)doc.getDocumentElement();
         synchronized (eventListenerSet) {
             Iterator i = eventListenerSet.iterator();
             while (i.hasNext()) {
                 EventListenerMememto elm = (EventListenerMememto)i.next();
-                EventTarget   et = elm.getTarget();
+                NodeEventTarget et = elm.getTarget();
                 if (et == evtTarget) {
                     EventListener el = elm.getListener();
                     boolean       uc = elm.getUseCapture();
                     String        t  = elm.getEventType();
-                    if ((et == null) || (el == null) || (t == null))
+                    boolean       n  = elm.getNamespaced();
+                    if (et == null || el == null || t == null) {
                         continue;
-                    et.removeEventListener(t, el, uc);
+                    }
+                    if (n) {
+                        String ns = elm.getNamespaceURI();
+                        et.removeEventListenerNS(ns, t, el, uc);
+                    } else {
+                        et.removeEventListener(t, el, uc);
+                    }
                 }
             }
         }
-        
     }
 
     /**
@@ -971,39 +1226,74 @@ public class BridgeContext implements ErrorConstants, CSSContext {
      * properties and update the GVT tree in response.
      */
     public void addDOMListeners() {
-        EventTarget evtTarget = (EventTarget)document;
+        SVGOMDocument doc = (SVGOMDocument)document;
 
         domAttrModifiedEventListener = new DOMAttrModifiedEventListener();
-        evtTarget.addEventListener("DOMAttrModified",
-                                   domAttrModifiedEventListener,
-                                   true);
+        doc.addEventListenerNS
+            (XMLConstants.XML_EVENTS_NAMESPACE_URI,
+             "DOMAttrModified",
+             domAttrModifiedEventListener, true, null);
 
         domNodeInsertedEventListener = new DOMNodeInsertedEventListener();
-        evtTarget.addEventListener("DOMNodeInserted",
-                                   domNodeInsertedEventListener,
-                                   true);
+        doc.addEventListenerNS
+            (XMLConstants.XML_EVENTS_NAMESPACE_URI,
+             "DOMNodeInserted",
+             domNodeInsertedEventListener, true, null);
 
         domNodeRemovedEventListener = new DOMNodeRemovedEventListener();
-        evtTarget.addEventListener("DOMNodeRemoved",
-                                   domNodeRemovedEventListener,
-                                   true);
+        doc.addEventListenerNS
+            (XMLConstants.XML_EVENTS_NAMESPACE_URI,
+             "DOMNodeRemoved",
+             domNodeRemovedEventListener, true, null);
 
-        domCharacterDataModifiedListener = 
-            new DOMCharacterDataModifiedListener();
-        evtTarget.addEventListener("DOMCharacterDataModified",
-                                   domCharacterDataModifiedListener,
-                                   true);
+        domCharacterDataModifiedEventListener =
+            new DOMCharacterDataModifiedEventListener();
+        doc.addEventListenerNS
+            (XMLConstants.XML_EVENTS_NAMESPACE_URI,
+             "DOMCharacterDataModified",
+             domCharacterDataModifiedEventListener, true, null);
 
+        animatedAttributeListener = new AnimatedAttrListener();
+        doc.addAnimatedAttributeListener(animatedAttributeListener);
 
         focusManager = new FocusManager(document);
 
-        SVGOMDocument svgDocument = (SVGOMDocument)document;
-        CSSEngine cssEngine = svgDocument.getCSSEngine();
+        CSSEngine cssEngine = doc.getCSSEngine();
         cssPropertiesChangedListener = new CSSPropertiesChangedListener();
         cssEngine.addCSSEngineListener(cssPropertiesChangedListener);
     }
 
     /**
+     * Removes event listeners from the DOM and CSS engine.
+     */
+    protected void removeDOMListeners() {
+        SVGOMDocument doc = (SVGOMDocument)document;
+
+        doc.removeEventListenerNS
+            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMAttrModified",
+             domAttrModifiedEventListener, true);
+        doc.removeEventListenerNS
+            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeInserted",
+             domNodeInsertedEventListener, true);
+        doc.removeEventListenerNS
+            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeRemoved",
+             domNodeRemovedEventListener, true);
+        doc.removeEventListenerNS
+            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMCharacterDataModified",
+             domCharacterDataModifiedEventListener, true);
+
+        doc.removeAnimatedAttributeListener(animatedAttributeListener);
+
+        CSSEngine cssEngine = doc.getCSSEngine();
+        if (cssEngine != null) {
+            cssEngine.removeCSSEngineListener
+                (cssPropertiesChangedListener);
+            cssEngine.dispose();
+            doc.setCSSEngine(null);
+        }
+    }
+
+    /**
      * Adds to the eventListenerSet the specified event listener
      * registration.
      */
@@ -1016,7 +1306,21 @@ public class BridgeContext implements ErrorConstants, CSSContext {
         }
     }
 
-    public static class SoftReferenceMememto 
+    /**
+     * Adds to the eventListenerSet the specified event listener
+     * registration.
+     */
+    protected void storeEventListenerNS(EventTarget t,
+                                        String n,
+                                        String s,
+                                        EventListener l,
+                                        boolean b) {
+        synchronized (eventListenerSet) {
+            eventListenerSet.add(new EventListenerMememto(t, n, s, l, b, this));
+        }
+    }
+
+    public static class SoftReferenceMememto
         extends CleanerThread.SoftReferenceCleared {
         Object mememto;
         Set    set;
@@ -1044,13 +1348,15 @@ public class BridgeContext implements ErrorConstants, CSSContext {
     protected static class EventListenerMememto {
 
         public SoftReference target; // Soft ref to EventTarget
-        public SoftReference listener; // Soft ref to EventListener 
+        public SoftReference listener; // Soft ref to EventListener
         public boolean useCapture;
+        public String namespaceURI;
         public String eventType;
+        public boolean namespaced;
 
-        public EventListenerMememto(EventTarget t, 
-                                    String s, 
-                                    EventListener l, 
+        public EventListenerMememto(EventTarget t,
+                                    String s,
+                                    EventListener l,
                                     boolean b,
                                     BridgeContext ctx) {
             Set set = ctx.eventListenerSet;
@@ -1060,66 +1366,89 @@ public class BridgeContext implements ErrorConstants, CSSContext {
             useCapture = b;
         }
 
+        public EventListenerMememto(EventTarget t,
+                                    String n,
+                                    String s,
+                                    EventListener l,
+                                    boolean b,
+                                    BridgeContext ctx) {
+            this(t, s, l, b, ctx);
+            namespaceURI = n;
+            namespaced = true;
+        }
+
         public EventListener getListener() {
             return (EventListener)listener.get();
         }
-        public EventTarget getTarget() {
-            return (EventTarget)target.get();
+        public NodeEventTarget getTarget() {
+            return (NodeEventTarget)target.get();
         }
         public boolean getUseCapture() {
             return useCapture;
         }
+        public String getNamespaceURI() {
+            return namespaceURI;
+        }
         public String getEventType() {
             return eventType;
         }
+        public boolean getNamespaced() {
+            return namespaced;
+        }
     }
 
+    /**
+     * Adds the GVT listener for AWT event support.
+     */
+    public void addGVTListener(Document doc) {
+        BridgeEventSupport.addGVTListener(this, doc);
+    }
+
+    /**
+     * Clears the list of child BridgeContexts and disposes them if there are
+     * no more references to them.
+     */
+    protected void clearChildContexts() {
+        childContexts.clear();
+    }
 
     /**
      * Disposes this BridgeContext.
      */
     public void dispose() {
+        clearChildContexts();
 
         synchronized (eventListenerSet) {
-        // remove all listeners added by Bridges
+            // remove all listeners added by Bridges
             Iterator iter = eventListenerSet.iterator();
-        while (iter.hasNext()) {
-            EventListenerMememto m = (EventListenerMememto)iter.next();
-            EventTarget   et = m.getTarget();
-            EventListener el = m.getListener();
-            boolean       uc = m.getUseCapture();
-            String        t  = m.getEventType();
-            if ((et == null) || (el == null) || (t == null))
-                continue;
-            et.removeEventListener(t, el, uc);
+            while (iter.hasNext()) {
+                EventListenerMememto m = (EventListenerMememto)iter.next();
+                NodeEventTarget et = m.getTarget();
+                EventListener   el = m.getListener();
+                boolean         uc = m.getUseCapture();
+                String          t  = m.getEventType();
+                boolean         n  = m.getNamespaced();
+                if (et == null || el == null || t == null) {
+                    continue;
+                }
+                if (n) {
+                    String ns = m.getNamespaceURI();
+                    et.removeEventListenerNS(ns, t, el, uc);
+                } else {
+                    et.removeEventListener(t, el, uc);
+                }
             }
         }
 
         if (document != null) {
-            EventTarget evtTarget = (EventTarget)document;
-
-            evtTarget.removeEventListener("DOMAttrModified",
-                                          domAttrModifiedEventListener, 
-                                          true);
-            evtTarget.removeEventListener("DOMNodeInserted",
-                                          domNodeInsertedEventListener, 
-                                          true);
-            evtTarget.removeEventListener("DOMNodeRemoved",
-                                          domNodeRemovedEventListener, 
-                                          true);
-            evtTarget.removeEventListener("DOMCharacterDataModified",
-                                          domCharacterDataModifiedListener, 
-                                          true);
-            
-            SVGOMDocument svgDocument = (SVGOMDocument)document;
-            CSSEngine cssEngine = svgDocument.getCSSEngine();
-            if (cssEngine != null) {
-                cssEngine.removeCSSEngineListener
-                    (cssPropertiesChangedListener);
-                cssEngine.dispose();
-                svgDocument.setCSSEngine(null);
-            }
+            removeDOMListeners();
         }
+
+        if (animationEngine != null) {
+            animationEngine.dispose();
+            animationEngine = null;
+        }
+
         Iterator iter = interpreterMap.values().iterator();
         while (iter.hasNext()) {
             Interpreter interpreter = (Interpreter)iter.next();
@@ -1131,21 +1460,34 @@ public class BridgeContext implements ErrorConstants, CSSContext {
         if (focusManager != null) {
             focusManager.dispose();
         }
+        if (elementDataMap != null) {
+            elementDataMap.clear();
+        }
+        if (nodeElementMap != null) {
+            nodeElementMap.clear();
+        }
+        if (elementNodeMap != null) {
+            elementNodeMap.clear();
+        }        
     }
 
     /**
-     * Returns the SVGContext associated to the specified Node or null if any.
+     * Returns the SVGContext associated to the specified Node or null if
+     * there is none.
      */
     protected static SVGContext getSVGContext(Node node) {
         if (node instanceof SVGOMElement) {
-            return ((SVGOMElement)node).getSVGContext();
+            return ((SVGOMElement) node).getSVGContext();
+        } else if (node instanceof SVGOMDocument) {
+            return ((SVGOMDocument) node).getSVGContext();
         } else {
             return null;
         }
     }
 
     /**
-     * Returns the SVGContext associated to the specified Node or null if any.
+     * Returns the BridgeUpdateHandler associated to the specified Node
+     * or null if there is none.
      */
     protected static BridgeUpdateHandler getBridgeUpdateHandler(Node node) {
         SVGContext ctx = getSVGContext(node);
@@ -1158,6 +1500,12 @@ public class BridgeContext implements ErrorConstants, CSSContext {
     protected class DOMAttrModifiedEventListener implements EventListener {
 
         /**
+         * Creates a new DOMAttrModifiedEventListener.
+         */
+        public DOMAttrModifiedEventListener() {
+        }
+
+        /**
          * Handles 'DOMAttrModified' event type.
          */
         public void handleEvent(Event evt) {
@@ -1177,6 +1525,16 @@ public class BridgeContext implements ErrorConstants, CSSContext {
      * The DOM EventListener invoked when the mouse exits an element
      */
     protected class DOMMouseOutEventListener implements EventListener {
+
+        /**
+         * Creates a new DOMMouseOutEventListener.
+         */
+        public DOMMouseOutEventListener() {
+        }
+
+        /**
+         * Handles 'mouseout' MouseEvent event type.
+         */
         public void handleEvent(Event evt) {
             MouseEvent me = (MouseEvent)evt;
             Element newTarget = (Element)me.getRelatedTarget();
@@ -1184,7 +1542,7 @@ public class BridgeContext implements ErrorConstants, CSSContext {
             if (newTarget != null)
                 cursor = CSSUtilities.convertCursor
                     (newTarget, BridgeContext.this);
-            if (cursor == null) 
+            if (cursor == null)
                 cursor = CursorManager.DEFAULT_CURSOR;
 
             userAgent.setSVGCursor(cursor);
@@ -1193,37 +1551,50 @@ public class BridgeContext implements ErrorConstants, CSSContext {
 
 
     /**
-     * The DOM EventListener invoked when the mouse mouves over a new 
+     * The DOM EventListener invoked when the mouse mouves over a new
      * element.
-     * 
+     *
      * Here is how cursors are handled:
-     * 
+     *
      */
     protected class DOMMouseOverEventListener implements EventListener {
+
+        /**
+         * Creates a new DOMMouseOverEventListener.
+         */
+        public DOMMouseOverEventListener() {
+        }
+
         /**
          * Handles 'mouseover' MouseEvent event type.
          */
         public void handleEvent(Event evt) {
             Element target = (Element)evt.getTarget();
             Cursor cursor = CSSUtilities.convertCursor(target, BridgeContext.this);
-            
+
             if (cursor != null) {
                 userAgent.setSVGCursor(cursor);
             }
         }
     }
-    
+
     /**
      * The DOM EventListener invoked when a node is added.
      */
     protected class DOMNodeInsertedEventListener implements EventListener {
 
         /**
+         * Creates a new DOMNodeInsertedEventListener.
+         */
+        public DOMNodeInsertedEventListener() {
+        }
+
+        /**
          * Handles 'DOMNodeInserted' event type.
          */
         public void handleEvent(Event evt) {
             MutationEvent me = (MutationEvent)evt;
-            BridgeUpdateHandler h = 
+            BridgeUpdateHandler h =
                 getBridgeUpdateHandler(me.getRelatedNode());
             if (h != null) {
                 try {
@@ -1243,6 +1614,12 @@ public class BridgeContext implements ErrorConstants, CSSContext {
     protected class DOMNodeRemovedEventListener implements EventListener {
 
         /**
+         * Creates a new DOMNodeRemovedEventListener.
+         */
+        public DOMNodeRemovedEventListener() {
+        }
+
+        /**
          * Handles 'DOMNodeRemoved' event type.
          */
         public void handleEvent(Event evt) {
@@ -1261,15 +1638,22 @@ public class BridgeContext implements ErrorConstants, CSSContext {
     /**
      * The DOM EventListener invoked when a character data is changed.
      */
-    protected class DOMCharacterDataModifiedListener implements EventListener {
+    protected class DOMCharacterDataModifiedEventListener
+            implements EventListener {
 
         /**
-         * Handles 'DOMNodeRemoved' event type.
+         * Creates a new DOMCharacterDataModifiedEventListener.
+         */
+        public DOMCharacterDataModifiedEventListener() {
+        }
+
+        /**
+         * Handles 'DOMCharacterDataModified' event type.
          */
         public void handleEvent(Event evt) {
             Node node = (Node)evt.getTarget();
             while (node != null && !(node instanceof SVGOMElement)) {
-                node = node.getParentNode();
+                node = (Node) ((AbstractNode) node).getParentNodeEventTarget();
             }
             BridgeUpdateHandler h = getBridgeUpdateHandler(node);
             if (h != null) {
@@ -1289,6 +1673,12 @@ public class BridgeContext implements ErrorConstants, CSSContext {
     protected class CSSPropertiesChangedListener implements CSSEngineListener {
 
         /**
+         * Creates a new CSSPropertiesChangedListener.
+         */
+        public CSSPropertiesChangedListener() {
+        }
+
+        /**
          * Handles CSSEngineEvent that describes the CSS properties
          * that have changed on a particular element.
          */
@@ -1296,11 +1686,10 @@ public class BridgeContext implements ErrorConstants, CSSContext {
             Element elem = evt.getElement();
             SVGContext ctx = getSVGContext(elem);
             if (ctx == null) {
-                GraphicsNode pgn = getGraphicsNode
-                    ((Element)elem.getParentNode());
+                GraphicsNode pgn = getGraphicsNode(elem.getParentNode());
                 if ((pgn == null) || !(pgn instanceof CompositeGraphicsNode)) {
                     // Something changed in this element but we really don't
-                    // care since it's parent isn't displayed either.
+                    // care since its parent isn't displayed either.
                     return;
                 }
                 CompositeGraphicsNode parent = (CompositeGraphicsNode)pgn;
@@ -1319,7 +1708,7 @@ public class BridgeContext implements ErrorConstants, CSSContext {
                             (BridgeContext.this, elem);
                         if (childNode == null) {
                             // the added element is not a graphic element?
-                            break; 
+                            break;
                         }
                         int idx = -1;
                         for(Node ps = elem.getPreviousSibling(); ps != null;
@@ -1337,7 +1726,7 @@ public class BridgeContext implements ErrorConstants, CSSContext {
                         }
                         // insert after prevSibling, if
                         // it was -1 this becomes 0 (first slot)
-                        idx++; 
+                        idx++;
                         parent.add(idx, childNode);
                         break;
                     }
@@ -1348,6 +1737,54 @@ public class BridgeContext implements ErrorConstants, CSSContext {
         }
     }
 
+    /**
+     * A listener class for changes to animated attributes in the document.
+     */
+    protected class AnimatedAttrListener
+        implements AnimatedAttributeListener {
+
+        /**
+         * Creates a new AnimatedAttributeListener.
+         */
+        public AnimatedAttrListener() {
+        }
+
+        /**
+         * Called to notify an object of a change to the animated value of
+         * an animated XML attribute.
+         * @param e the owner element of the changed animated attribute
+         * @param alav the AnimatedLiveAttributeValue that changed
+         */
+        public void animatedAttributeChanged(Element e,
+                                             AnimatedLiveAttributeValue alav) {
+            BridgeUpdateHandler h = getBridgeUpdateHandler(e);
+            if (h != null) {
+                try {
+                    h.handleAnimatedAttributeChanged(alav);
+                } catch (Exception ex) {
+                    userAgent.displayError(ex);
+                }
+            }
+        }
+
+        /**
+         * Called to notify an object of a change to the value of an 'other'
+         * animation.
+         * @param e the element being animated
+         * @param type the type of animation whose value changed
+         */
+        public void otherAnimationChanged(Element e, String type) {
+            BridgeUpdateHandler h = getBridgeUpdateHandler(e);
+            if (h != null) {
+                try {
+                    h.handleOtherAnimationChanged(type);
+                } catch (Exception ex) {
+                    userAgent.displayError(ex);
+                }
+            }
+        }
+    }
+
     // CSS context ////////////////////////////////////////////////////////////
 
     /**
@@ -1399,7 +1836,7 @@ public class BridgeContext implements ErrorConstants, CSSContext {
      */
     public float getPixelToMillimeter() {
         return getPixelUnitToMillimeter();
-            
+
     }
 
     /**
@@ -1429,19 +1866,19 @@ public class BridgeContext implements ErrorConstants, CSSContext {
      * This method throws a SecurityException if the resource
      * found at url and referenced from docURL
      * should not be loaded.
-     * 
+     *
      * This is a convenience method to call checkLoadExternalResource
-     * on the ExternalResourceSecurity strategy returned by 
+     * on the ExternalResourceSecurity strategy returned by
      * getExternalResourceSecurity.
      *
      * @param resourceURL url for the script, as defined in
      *        the resource's xlink:href attribute. If that
      *        attribute was empty, then this parameter should
      *        be null
-     * @param docURL url for the document into which the 
+     * @param docURL url for the document into which the
      *        resource was found.
      */
-    public void 
+    public void
         checkLoadExternalResource(ParsedURL resourceURL,
                                   ParsedURL docURL) throws SecurityException {
         userAgent.checkLoadExternalResource(resourceURL,
@@ -1455,14 +1892,14 @@ public class BridgeContext implements ErrorConstants, CSSContext {
     public boolean isDynamicDocument(Document doc) {
         return BaseScriptingEnvironment.isDynamicDocument(this, doc);
     }
-    
+
     /**
      * Tells whether the given SVG document is Interactive.
      * We say it is, if it has any &lt;title>, &lt;desc>, or &lt;a> elements,
      * of if the 'cursor' property is anything but Auto on any element.
      */
     public boolean isInteractiveDocument(Document doc) {
-        
+
         Element root = ((SVGDocument)doc).getRootElement();
         if (!SVGConstants.SVG_NAMESPACE_URI.equals(root.getNamespaceURI()))
             return false;
@@ -1486,7 +1923,7 @@ public class BridgeContext implements ErrorConstants, CSSContext {
     public boolean checkInteractiveElement(SVGDocument doc,
                                            Element e) {
         String tag = e.getLocalName();
-        
+
         // Check if it's one of our important element.
         if (SVGConstants.SVG_A_TAG.equals(tag))
             return true;
@@ -1510,7 +1947,7 @@ public class BridgeContext implements ErrorConstants, CSSContext {
 
         /* We would like to do this but the CSS Engine isn't setup when
            we want to do this.
-           
+
         // Check if cursor property is set to something other than 'auto'.
         Value cursorValue = CSSUtilities.getComputedStyle
             (e, SVGCSSEngine.CURSOR_INDEX);
@@ -1535,7 +1972,59 @@ public class BridgeContext implements ErrorConstants, CSSContext {
         }
         return false;
     }
-    
+
+    /**
+     * Sets the animation limiting mode to "none".
+     */
+    public void setAnimationLimitingNone() {
+        animationLimitingMode = 0;
+        if (animationEngine != null) {
+            setAnimationLimitingMode();
+        }
+    }
+
+    /**
+     * Sets the animation limiting mode to a percentage of CPU.
+     * @param pc the maximum percentage of CPU to use (0 &lt; pc ≤ 1)
+     */
+    public void setAnimationLimitingCPU(float pc) {
+        animationLimitingMode = 1;
+        animationLimitingAmount = pc;
+        if (animationEngine != null) {
+            setAnimationLimitingMode();
+        }
+    }
+
+    /**
+     * Sets the animation limiting mode to a number of frames per second.
+     * @param fps the maximum number of frames per second (fps &gt; 0)
+     */
+    public void setAnimationLimitingFPS(float fps) {
+        animationLimitingMode = 2;
+        animationLimitingAmount = fps;
+        if (animationEngine != null) {
+            setAnimationLimitingMode();
+        }
+    }
+
+    /**
+     * Set the animationg limiting mode on the animation engine.
+     */
+    protected void setAnimationLimitingMode() {
+        switch (animationLimitingMode) {
+            case 0: // unlimited
+                animationEngine.setAnimationLimitingNone();
+                break;
+            case 1: // %cpu
+                animationEngine.setAnimationLimitingCPU
+                    (animationLimitingAmount);
+                break;
+            case 2: // fps
+                animationEngine.setAnimationLimitingFPS
+                    (animationLimitingAmount);
+                break;
+        }
+    }
 
     // bridge extensions support //////////////////////////////////////////////
 
@@ -1591,7 +2080,7 @@ public class BridgeContext implements ErrorConstants, CSSContext {
      */
     protected static List globalExtensions = null;
 
-    public synchronized static List getGlobalBridgeExtensions() {
+    public static synchronized List getGlobalBridgeExtensions() {
         if (globalExtensions != null) {
             return globalExtensions;
         }
@@ -1617,7 +2106,7 @@ public class BridgeContext implements ErrorConstants, CSSContext {
             }
         }
         return globalExtensions;
-    }        
+    }
 
     public static class CSSEngineUserAgentWrapper implements CSSEngineUserAgent {
         UserAgent ua;

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BridgeEventSupport.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BridgeEventSupport.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BridgeEventSupport.java
index 9040e1d..f4732c6 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BridgeEventSupport.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BridgeEventSupport.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
 
@@ -22,10 +23,14 @@ import java.awt.event.KeyEvent;
 import java.awt.geom.NoninvertibleTransformException;
 import java.awt.geom.Point2D;
 import java.awt.geom.Rectangle2D;
+import java.lang.ref.SoftReference;
 import java.text.AttributedCharacterIterator;
 import java.util.List;
 
 import org.apache.flex.forks.batik.dom.events.DOMKeyEvent;
+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.util.DOMUtilities;
 import org.apache.flex.forks.batik.gvt.GraphicsNode;
 import org.apache.flex.forks.batik.gvt.TextNode;
 import org.apache.flex.forks.batik.gvt.event.EventDispatcher;
@@ -38,24 +43,29 @@ import org.apache.flex.forks.batik.gvt.text.GVTAttributedCharacterIterator;
 import org.apache.flex.forks.batik.gvt.text.TextHit;
 import org.apache.flex.forks.batik.gvt.text.TextSpanLayout;
 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.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;
 
 /**
  * This class is responsible of tracking GraphicsNodeMouseEvent and
  * fowarding them to the DOM as regular DOM MouseEvent.
  *
  * @author <a href="mailto:tkormann@ilog.fr">Thierry Kormann</a>
- * @version $Id: BridgeEventSupport.java,v 1.59 2005/03/27 08:58:30 cam Exp $
+ * @version $Id: BridgeEventSupport.java 580012 2007-09-27 13:33:47Z cam $
  */
-public class BridgeEventSupport implements SVGConstants {
+public abstract class BridgeEventSupport implements SVGConstants {
+
+    public static final
+        AttributedCharacterIterator.Attribute TEXT_COMPOUND_ID =
+        GVTAttributedCharacterIterator.TextAttribute.TEXT_COMPOUND_ID;
 
-    private BridgeEventSupport() {}
+    protected BridgeEventSupport() {}
 
     /**
      * Is called only for the root element in order to dispatch GVT
@@ -72,19 +82,49 @@ public class BridgeEventSupport implements SVGConstants {
                 // add an unload listener on the SVGDocument to remove
                 // that listener for dispatching events
                 EventListener l = new GVTUnloadListener(dispatcher, listener);
-                EventTarget target = (EventTarget)doc;
-                target.addEventListener("SVGUnload", l, false);
-                ctx.storeEventListener(target, "SVGUnload", l, false);
+                NodeEventTarget target = (NodeEventTarget)doc;
+                target.addEventListenerNS
+                    (XMLConstants.XML_EVENTS_NAMESPACE_URI,
+                     "SVGUnload",
+                     l, false, null);
+                storeEventListenerNS
+                    (ctx, target,
+                     XMLConstants.XML_EVENTS_NAMESPACE_URI,
+                     "SVGUnload",
+                     l, false);
             }
         }
     }
 
+    /**
+     * Calls storeEventListener on the given BridgeContext.
+     */
+    protected static void storeEventListener(BridgeContext ctx,
+                                             EventTarget e,
+                                             String t,
+                                             EventListener l,
+                                             boolean c) {
+        ctx.storeEventListener(e, t, l, c);
+    }
+
+    /**
+     * Calls storeEventListenerNS on the given BridgeContext.
+     */
+    protected static void storeEventListenerNS(BridgeContext ctx,
+                                               EventTarget e,
+                                               String n,
+                                               String t,
+                                               EventListener l,
+                                               boolean c) {
+        ctx.storeEventListenerNS(e, n, t, l, c);
+    }
+
     protected static class GVTUnloadListener implements EventListener {
 
         protected EventDispatcher dispatcher;
         protected Listener listener;
 
-        public GVTUnloadListener(EventDispatcher dispatcher, 
+        public GVTUnloadListener(EventDispatcher dispatcher,
                                  Listener listener) {
             this.dispatcher = dispatcher;
             this.listener = listener;
@@ -93,17 +133,19 @@ public class BridgeEventSupport implements SVGConstants {
         public void handleEvent(Event evt) {
             dispatcher.removeGraphicsNodeMouseListener(listener);
             dispatcher.removeGraphicsNodeKeyListener(listener);
-            evt.getTarget().removeEventListener
-                (SVGConstants.SVG_SVGUNLOAD_EVENT_TYPE, this, false);
+            NodeEventTarget et = (NodeEventTarget) evt.getTarget();
+            et.removeEventListenerNS
+                (XMLConstants.XML_EVENTS_NAMESPACE_URI, "SVGUnload",
+                 this, false);
         }
     }
 
     /**
      * A GraphicsNodeMouseListener that dispatch DOM events accordingly.
      */
-    protected static class Listener 
-        implements GraphicsNodeMouseListener, GraphicsNodeKeyListener {
-        
+    protected static class Listener implements GraphicsNodeMouseListener,
+                                               GraphicsNodeKeyListener {
+
         protected BridgeContext context;
         protected UserAgent ua;
         protected Element lastTargetElement;
@@ -121,6 +163,7 @@ public class BridgeEventSupport implements SVGConstants {
          * @param evt the graphics node key event
          */
         public void keyPressed(GraphicsNodeKeyEvent evt) {
+            // XXX isDown is not preventing key repeats
             if (!isDown) {
                 isDown = true;
                 dispatchKeyEvent("keydown", evt);
@@ -149,25 +192,28 @@ public class BridgeEventSupport implements SVGConstants {
             dispatchKeyEvent("keypress", evt);
         }
 
-        protected void dispatchKeyEvent(String eventType, 
+        /**
+         * Dispatch a DOM 2 Draft Key event.
+         */
+        protected void dispatchKeyEvent(String eventType,
                                         GraphicsNodeKeyEvent evt) {
             FocusManager fmgr = context.getFocusManager();
             if (fmgr == null) return;
 
             Element targetElement = (Element)fmgr.getCurrentEventTarget();
             if (targetElement == null) {
-                return;
+                targetElement = context.getDocument().getDocumentElement();
             }
             DocumentEvent d = (DocumentEvent)targetElement.getOwnerDocument();
             DOMKeyEvent keyEvt = (DOMKeyEvent)d.createEvent("KeyEvents");
-            keyEvt.initKeyEvent(eventType, 
-                                true, 
-                                true, 
-                                evt.isControlDown(), 
+            keyEvt.initKeyEvent(eventType,
+                                true,
+                                true,
+                                evt.isControlDown(),
                                 evt.isAltDown(),
-                                evt.isShiftDown(), 
+                                evt.isShiftDown(),
                                 evt.isMetaDown(),
-                                mapKeyCode(evt.getKeyCode()), 
+                                mapKeyCode(evt.getKeyCode()),
                                 evt.getKeyChar(),
                                 null);
 
@@ -187,7 +233,7 @@ public class BridgeEventSupport implements SVGConstants {
         protected final int mapKeyCode(int keyCode) {
             switch (keyCode) {
                 case KeyEvent.VK_ENTER:
-                    return DOMKeyEvent.DOM_VK_ENTER; 
+                    return DOMKeyEvent.DOM_VK_ENTER;
             case KeyEvent.VK_KANA_LOCK:
                 return DOMKeyEvent.DOM_VK_UNDEFINED;
             case KeyEvent.VK_INPUT_METHOD_ON_OFF:
@@ -212,7 +258,17 @@ public class BridgeEventSupport implements SVGConstants {
         }
 
         public void mouseEntered(GraphicsNodeMouseEvent evt) {
-            dispatchMouseEvent("mouseover", evt, true);
+            Point clientXY = evt.getClientPoint();
+            GraphicsNode node = evt.getGraphicsNode();
+            Element targetElement = getEventTarget
+                (node, new Point2D.Float(evt.getX(), evt.getY()));
+            Element relatedElement = getRelatedElement(evt);
+            dispatchMouseEvent("mouseover",
+                               targetElement,
+                               relatedElement,
+                               clientXY,
+                               evt,
+                               true);
         }
 
         public void mouseExited(GraphicsNodeMouseEvent evt) {
@@ -221,12 +277,13 @@ public class BridgeEventSupport implements SVGConstants {
             GraphicsNode node = evt.getRelatedNode();
             Element targetElement = getEventTarget(node, clientXY);
             if (lastTargetElement != null) {
-                dispatchMouseEvent("mouseout", 
+                dispatchMouseEvent("mouseout",
                                    lastTargetElement, // target
                                    targetElement,     // relatedTarget
                                    clientXY,
                                    evt,
                                    true);
+                lastTargetElement = null;
             }
         }
 
@@ -241,7 +298,7 @@ public class BridgeEventSupport implements SVGConstants {
             Element holdLTE = lastTargetElement;
             if (holdLTE != targetElement) {
                 if (holdLTE != null) {
-                    dispatchMouseEvent("mouseout", 
+                    dispatchMouseEvent("mouseout",
                                        holdLTE, // target
                                        targetElement,     // relatedTarget
                                        clientXY,
@@ -249,7 +306,7 @@ public class BridgeEventSupport implements SVGConstants {
                                        true);
                 }
                 if (targetElement != null) {
-                    dispatchMouseEvent("mouseover", 
+                    dispatchMouseEvent("mouseover",
                                        targetElement,     // target
                                        holdLTE, // relatedTarget
                                        clientXY,
@@ -257,7 +314,7 @@ public class BridgeEventSupport implements SVGConstants {
                                        true);
                 }
             }
-            dispatchMouseEvent("mousemove", 
+            dispatchMouseEvent("mousemove",
                                targetElement,     // target
                                null,              // relatedTarget
                                clientXY,
@@ -281,11 +338,11 @@ public class BridgeEventSupport implements SVGConstants {
             Element targetElement = getEventTarget
                 (node, new Point2D.Float(evt.getX(), evt.getY()));
             Element relatedElement = getRelatedElement(evt);
-            dispatchMouseEvent(eventType, 
+            dispatchMouseEvent(eventType,
                                targetElement,
                                relatedElement,
-                               clientXY, 
-                               evt, 
+                               clientXY,
+                               evt,
                                cancelable);
         }
 
@@ -322,26 +379,27 @@ public class BridgeEventSupport implements SVGConstants {
 
             }
             */
-            short button = getButton(evt);
             Point screenXY = evt.getScreenPoint();
             // create the coresponding DOM MouseEvent
             DocumentEvent d = (DocumentEvent)targetElement.getOwnerDocument();
-            MouseEvent mouseEvt = (MouseEvent)d.createEvent("MouseEvents");
-            mouseEvt.initMouseEvent(eventType, 
-                                    true, 
-                                    cancelable, 
-                                    null,
-                                    evt.getClickCount(),
-                                    screenXY.x, 
-                                    screenXY.y,
-                                    clientXY.x,
-                                    clientXY.y,
-                                    evt.isControlDown(), 
-                                    evt.isAltDown(),
-                                    evt.isShiftDown(), 
-                                    evt.isMetaDown(),
-                                    button, 
-                                    (EventTarget)relatedElement);
+            DOMMouseEvent mouseEvt
+                = (DOMMouseEvent)d.createEvent("MouseEvents");
+            String modifiers
+                = DOMUtilities.getModifiersList(evt.getLockState(),
+                                                evt.getModifiers());
+            mouseEvt.initMouseEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI,
+                                      eventType,
+                                      true,
+                                      cancelable,
+                                      null,
+                                      evt.getClickCount(),
+                                      screenXY.x,
+                                      screenXY.y,
+                                      clientXY.x,
+                                      clientXY.y,
+                                      (short) (evt.getButton() - 1),
+                                      (EventTarget)relatedElement,
+                                      modifiers);
 
             try {
                 ((EventTarget)targetElement).dispatchEvent(mouseEvt);
@@ -367,21 +425,6 @@ public class BridgeEventSupport implements SVGConstants {
         }
 
         /**
-         * Returns the mouse event button.
-         *
-         * @param evt the GVT GraphicsNodeMouseEvent
-         */
-        protected short getButton(GraphicsNodeMouseEvent evt) {
-            short button = 1;
-            if ((GraphicsNodeMouseEvent.BUTTON1_MASK & evt.getModifiers()) != 0) {
-                button = 0;
-            } else if ((GraphicsNodeMouseEvent.BUTTON3_MASK & evt.getModifiers()) != 0) {
-                button = 2;
-            }
-            return button;
-        }
-
-        /**
          * Returns the element that is the target of the specified
          * event or null if any.
          *
@@ -394,8 +437,8 @@ public class BridgeEventSupport implements SVGConstants {
             // is a tspan or textPath
 
             if (target != null && node instanceof TextNode) {
-		TextNode textNode = (TextNode)node;
-		List list = textNode.getTextRuns();
+                TextNode textNode = (TextNode)node;
+                List list = textNode.getTextRuns();
                 Point2D pt = (Point2D)coords.clone();
                 // place coords in text node coordinate system
                 try {
@@ -412,10 +455,12 @@ public class BridgeEventSupport implements SVGConstants {
                         float y = (float)pt.getY();
                         TextHit textHit = layout.hitTestChar(x, y);
                         Rectangle2D bounds = layout.getBounds2D();
-                        if ((textHit != null) && 
+                        if ((textHit != null) &&
                             (bounds != null) && bounds.contains(x, y)) {
-                            Object delimiter = aci.getAttribute
-                                (GVTAttributedCharacterIterator.TextAttribute.TEXT_COMPOUND_DELIMITER);
+                            SoftReference sr;
+                            sr =(SoftReference)aci.getAttribute
+                                (TEXT_COMPOUND_ID);
+                            Object delimiter = sr.get();
                             if (delimiter instanceof Element) {
                                 return (Element)delimiter;
                             }

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BridgeException.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BridgeException.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BridgeException.java
index c85d5cc..ee26a19 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BridgeException.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BridgeException.java
@@ -1,10 +1,11 @@
 /*
 
-   Copyright 2000-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
 
@@ -17,15 +18,17 @@
  */
 package org.apache.flex.forks.batik.bridge;
 
+import org.apache.flex.forks.batik.dom.svg.LiveAttributeException;
 import org.apache.flex.forks.batik.gvt.GraphicsNode;
+
 import org.w3c.dom.Element;
-import org.w3c.flex.forks.dom.svg.SVGDocument;
+import org.w3c.dom.svg.SVGDocument;
 
 /**
  * Thrown when the bridge has detected an error.
  *
  * @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: BridgeException.java,v 1.8 2004/08/18 07:12:30 vhardy Exp $
+ * @version $Id: BridgeException.java 501922 2007-01-31 17:47:47Z dvholten $
  */
 public class BridgeException extends RuntimeException {
 
@@ -35,6 +38,11 @@ public class BridgeException extends RuntimeException {
     /** The error code. */
     protected String code;
 
+    /**
+     * The message.
+     */
+    protected String message;
+
     /** The paramters to use for the error message. */
     protected Object [] params;
 
@@ -45,30 +53,101 @@ public class BridgeException extends RuntimeException {
     protected GraphicsNode node;
 
     /**
+     * Constructs a new <tt>BridgeException</tt> based on the specified
+     * <tt>LiveAttributeException</tt>.
+     *
+     * @param ctx the bridge context to use for determining the element's
+     *            source position
+     * @param ex the {@link LiveAttributeException}
+     */
+    public BridgeException(BridgeContext ctx, LiveAttributeException ex) {
+        switch (ex.getCode()) {
+            case LiveAttributeException.ERR_ATTRIBUTE_MISSING:
+                this.code = ErrorConstants.ERR_ATTRIBUTE_MISSING;
+                break;
+            case LiveAttributeException.ERR_ATTRIBUTE_MALFORMED:
+                this.code = ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED;
+                break;
+            case LiveAttributeException.ERR_ATTRIBUTE_NEGATIVE:
+                this.code = ErrorConstants.ERR_LENGTH_NEGATIVE;
+                break;
+            default:
+                throw new IllegalStateException
+                    ("Unknown LiveAttributeException error code "
+                     + ex.getCode());
+        }
+        this.e = ex.getElement();
+        this.params = new Object[] { ex.getAttributeName(), ex.getValue() };
+        if (e != null && ctx != null) {
+            this.line = ctx.getDocumentLoader().getLineNumber(e);
+        }
+    }
+
+     /**
      * Constructs a new <tt>BridgeException</tt> with the specified parameters.
      *
-     * @param e the element on which the error occured
+     * @param ctx the bridge context to use for determining the element's
+     *            source position
+     * @param e the element on which the error occurred
      * @param code the error code
      * @param params the parameters to use for the error message
      */
-    public BridgeException(Element e, String code, Object [] params) {
+    public BridgeException(BridgeContext ctx, Element e, String code,
+                           Object[] params) {
+
         this.e = e;
         this.code = code;
         this.params = params;
+        if (e != null && ctx != null) {
+            this.line = ctx.getDocumentLoader().getLineNumber(e);
+        }
     }
 
     /**
-     * Returns the element on which the error occurred.
+     * Constructs a new <tt>BridgeException</tt> with the specified parameters.
+     *
+     * @param ctx the bridge context to use for determining the element's
+     *            source position
+     * @param e the element on which the error occurred
+     * @param ex the exception which was the root-cause for this exception
+     * @param code the error code
+     * @param params the parameters to use for the error message
      */
-    public Element getElement() {
-        return e;
+    public BridgeException(BridgeContext ctx, Element e, Exception ex, String code,
+                           Object[] params) {
+
+        // todo ex can be chained in jdk >= 1.4
+        this.e = e;
+
+        message = ex.getMessage();
+        this.code = code;
+        this.params = params;
+        if (e != null && ctx != null) {
+            this.line = ctx.getDocumentLoader().getLineNumber(e);
+        }
+    }
+
+    /**
+     * Constructs a new <tt>BridgeException</tt> with the specified parameters.
+     *
+     * @param ctx the bridge context to use for determining the element's
+     *            source position
+     * @param e the element on which the error occurred
+     * @param message the error message
+     */
+    public BridgeException(BridgeContext ctx, Element e, String message) {
+        this.e = e;
+        this.message = message;
+        if (e != null && ctx != null) {
+            this.line = ctx.getDocumentLoader().getLineNumber(e);
+        }
     }
 
     /**
-     * Returns the line number on which the error occurred.
+     * Returns the element on which the error occurred.
      */
-    public void setLineNumber(int line) {
-        this.line = line;
+    public Element getElement() {
+        return e;
     }
 
     /**
@@ -91,6 +170,10 @@ public class BridgeException extends RuntimeException {
      * Returns the error message according to the error code and parameters.
      */
     public String getMessage() {
+        if (message != null) {
+            return message;
+        }
+
         String uri;
         String lname = "<Unknown Element>";
         SVGDocument doc = null;
@@ -104,9 +187,7 @@ public class BridgeException extends RuntimeException {
         fullparams[0] = uri;
         fullparams[1] = new Integer(line);
         fullparams[2] = lname;
-        for (int i=0; i < params.length; ++i) {
-            fullparams[i+3] = params[i];
-        }
+        System.arraycopy( params, 0, fullparams, 3, params.length );
         return Messages.formatMessage(code, fullparams);
     }
 

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BridgeExtension.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BridgeExtension.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BridgeExtension.java
index 1d46fe7..2dc9a36 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BridgeExtension.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BridgeExtension.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,6 +25,9 @@ import org.w3c.dom.Element;
 /**
  * This is a Service interface for classes that want to extend the
  * functionality of the Bridge, to support new tags in the rendering tree.
+ *
+ * @author <a href="mailto:thomas.deweese@kodak.com">Thomas DeWeese</a>
+ * @version $Id: BridgeExtension.java 478160 2006-11-22 13:35:06Z dvholten $
  */
 public interface BridgeExtension {
 
@@ -31,9 +35,9 @@ public interface BridgeExtension {
      * Return the priority of this Extension.  Extensions are
      * registered from lowest to highest priority.  So if for some
      * reason you need to come before/after another existing extension
-     * make sure your priority is lower/higher than theirs.  
+     * make sure your priority is lower/higher than theirs.
      */
-    public float getPriority();
+    float getPriority();
 
     /**
      * This should return the list of extensions implemented
@@ -43,31 +47,31 @@ public interface BridgeExtension {
      * @return An iterator containing strings one for each implemented
      *         extension.
      */
-     public Iterator getImplementedExtensions();
+    Iterator getImplementedExtensions();
 
     /**
      * This should return the individual or company name responsible
      * for the this implementation of the extension.
      */
-    public String getAuthor();
+    String getAuthor();
 
     /**
      * This should return a contact address (usually an e-mail address).
      */
-    public String getContactAddress();
+    String getContactAddress();
 
     /**
      * This should return a URL where information can be obtained on
      * this extension.
      */
-    public String getURL();
+    String getURL();
 
     /**
      * Human readable description of the extension.
      * Perhaps that should be a resource for internationalization?
      * (although I suppose it could be done internally)
      */
-    public String getDescription();
+    String getDescription();
 
     /**
      * This method should update the BridgeContext with support
@@ -77,7 +81,7 @@ public interface BridgeExtension {
      *
      * @param ctx The BridgeContext instance to be updated
      */
-    public void registerTags(BridgeContext ctx);
+    void registerTags(BridgeContext ctx);
 
     /**
      * Whether the presence of the specified element should cause
@@ -86,5 +90,5 @@ public interface BridgeExtension {
      *
      * @param e The element to check.
      */
-    public boolean isDynamicElement(Element e);
+    boolean isDynamicElement(Element e);
 }

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BridgeUpdateHandler.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BridgeUpdateHandler.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BridgeUpdateHandler.java
index 25a0687..305356d 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BridgeUpdateHandler.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/BridgeUpdateHandler.java
@@ -1,10 +1,11 @@
 /*
 
-   Copyright 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
 
@@ -18,6 +19,8 @@
 package org.apache.flex.forks.batik.bridge;
 
 import org.apache.flex.forks.batik.css.engine.CSSEngineEvent;
+import org.apache.flex.forks.batik.dom.svg.AnimatedLiveAttributeValue;
+
 import org.w3c.dom.events.MutationEvent;
 
 /**
@@ -25,7 +28,7 @@ import org.w3c.dom.events.MutationEvent;
  * 
  * @author <a href="mailto:vincent.hardy@apache.org">Vincent Hardy</a>
  * @author <a href="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a>
- * @version $Id: BridgeUpdateHandler.java,v 1.7 2004/08/18 07:12:31 vhardy Exp $
+ * @version $Id: BridgeUpdateHandler.java 475477 2006-11-15 22:44:28Z cam $
  */
 public interface BridgeUpdateHandler {
     
@@ -56,6 +59,16 @@ public interface BridgeUpdateHandler {
     void handleCSSEngineEvent(CSSEngineEvent evt);
 
     /**
+     * Invoked when the animated value of an animated attribute has changed.
+     */
+    void handleAnimatedAttributeChanged(AnimatedLiveAttributeValue alav);
+
+    /**
+     * Invoked when an 'other' animation value has changed.
+     */
+    void handleOtherAnimationChanged(String type);
+
+    /**
      * Disposes this BridgeUpdateHandler and releases all resources.
      */
     void dispose();