Browse Source

Pull request #9553: REPORT-104378 Apache XmI Graphics Batik 升级1.17

Merge in CORE/base-third from ~YUAN.WANG/base-third:release/10.0 to release/10.0

* commit '3d1348533e68a06593a395d6a72061315dd3dcfb':
  REPORT-104378 Apache XmI Graphics Batik 升级1.17
release/10.0
Yuan.Wang-王垣 8 months ago
parent
commit
f7eb4e7a93
  1. 2
      fine-xmlgraphics/xmlgraphics-batik/README.md
  2. 11
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/AnimationEngine.java
  3. 4
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/AbstractSVGAnimatedValue.java
  4. 22
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SAXSVGDocumentFactory.java
  5. 12
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVG12DOMImplementation.java
  6. 21
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGOMDocument.java
  7. 14
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/rasterizer/Main.java
  8. 6
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/rasterizer/SVGConverter.java
  9. 21
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/AboutDialog.java
  10. 11
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
  11. 37
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/BridgeContext.java
  12. 3
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/DefaultExternalResourceSecurity.java
  13. 22
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/FlowTextPainter.java
  14. 10
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/SVGAElementBridge.java
  15. 4
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/SVGFontFace.java
  16. 9
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/SVGFontFamily.java
  17. 13
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/SVGUseElementBridge.java
  18. 16
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/SVGUtilities.java
  19. 11
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/UserAgent.java
  20. 2
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/UserAgentAdapter.java
  21. 24
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/extension/svg/META-INF/services/org.apache.batik.bridge.BridgeExtension
  22. 24
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/extension/svg/META-INF/services/org.apache.batik.dom.DomExtension
  23. 13
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/extension/svg/org/apache/batik/extensions/README.txt
  24. 57
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/script/rhino/RhinoClassShutter.java
  25. 12
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/svggen/DOMTreeManager.java
  26. 24
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/transcoder/SVGAbstractTranscoder.java
  27. 20
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/transcoder/image/ImageTranscoder.java
  28. 12
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
  29. 2
      fine-xmlgraphics/xmlgraphics-batik/src/main/resources/NOTICE
  30. 6
      fine-xmlgraphics/xmlgraphics-batik/src/main/resources/org/org/apache/batik/anim/dom/resources/UserAgentStyleSheet.css
  31. 68
      fine-xmlgraphics/xmlgraphics-batik/src/main/resources/org/org/apache/batik/anim/dom/resources/dtdids.properties
  32. 28
      fine-xmlgraphics/xmlgraphics-batik/src/main/resources/org/org/apache/batik/anim/resources/Messages.properties

2
fine-xmlgraphics/xmlgraphics-batik/README.md

@ -1,2 +1,2 @@
源码地址:https://github.com/apache/xmlgraphics-batik <br>
版本:1.16
版本:1.17

11
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/AnimationEngine.java

@ -18,6 +18,11 @@
*/
package org.apache.batik.anim;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.apache.batik.anim.dom.AnimationTarget;
import org.apache.batik.anim.dom.AnimationTargetListener;
import org.apache.batik.anim.timing.TimedDocumentRoot;
@ -25,12 +30,8 @@ import org.apache.batik.anim.timing.TimedElement;
import org.apache.batik.anim.timing.TimegraphListener;
import org.apache.batik.anim.values.AnimatableValue;
import org.apache.batik.util.DoublyIndexedTable;
import org.w3c.dom.Document;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.w3c.dom.Document;
/**
* An abstract base class for managing animation in a document.

4
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/AbstractSVGAnimatedValue.java

@ -18,10 +18,10 @@
*/
package org.apache.batik.anim.dom;
import org.apache.batik.anim.values.AnimatableValue;
import java.util.LinkedList;
import org.apache.batik.anim.values.AnimatableValue;
/**
* An abstract base class for the <code>SVGAnimated*</code> classes, that
* implements an {@link AnimatedAttributeListener} list.

22
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SAXSVGDocumentFactory.java

@ -18,24 +18,26 @@
*/
package org.apache.batik.anim.dom;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;
import java.net.MalformedURLException;
import java.util.MissingResourceException;
import java.util.Properties;
import org.apache.batik.dom.AbstractDocument;
import org.apache.batik.dom.svg.SVGDocumentFactory;
import org.apache.batik.dom.util.SAXDocumentFactory;
import org.apache.batik.util.MimeTypeConstants;
import org.apache.batik.util.ParsedURL;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.svg.SVGDocument;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;
import java.net.MalformedURLException;
import java.util.MissingResourceException;
import java.util.Properties;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.svg.SVGDocument;
/**
* This class contains methods for creating SVGDocument instances

12
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVG12DOMImplementation.java

@ -18,6 +18,9 @@
*/
package org.apache.batik.anim.dom;
import java.net.URL;
import java.util.HashMap;
import org.apache.batik.css.engine.CSSContext;
import org.apache.batik.css.engine.CSSEngine;
import org.apache.batik.css.engine.SVG12CSSEngine;
@ -32,21 +35,20 @@ import org.apache.batik.dom.events.DocumentEventSupport;
import org.apache.batik.dom.events.EventSupport;
import org.apache.batik.dom.svg12.SVGOMWheelEvent;
import org.apache.batik.dom.svg12.XBLOMShadowTreeEvent;
import org.apache.batik.dom.util.DOMUtilities;
import org.apache.batik.util.ParsedURL;
import org.apache.batik.util.SVG12Constants;
import org.apache.batik.util.XBLConstants;
import org.w3c.css.sac.InputSource;
import org.w3c.dom.DOMException;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentType;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.DOMException;
import org.w3c.dom.Element;
import org.w3c.dom.events.Event;
import java.net.URL;
import java.util.HashMap;
/**
* This class implements the {@link DOMImplementation} interface.
* It provides support the SVG 1.2 documents.

21
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGOMDocument.java

@ -18,7 +18,15 @@
*/
package org.apache.batik.anim.dom;
import org.apache.batik.constants.XMLConstants;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Locale;
import java.util.MissingResourceException;
import org.apache.batik.css.engine.CSSNavigableDocument;
import org.apache.batik.css.engine.CSSNavigableDocumentListener;
import org.apache.batik.css.engine.CSSStylableElement;
@ -41,6 +49,8 @@ import org.apache.batik.i18n.Localizable;
import org.apache.batik.i18n.LocalizableSupport;
import org.apache.batik.util.ParsedURL;
import org.apache.batik.util.SVGConstants;
import org.apache.batik.constants.XMLConstants;
import org.w3c.dom.Attr;
import org.w3c.dom.CDATASection;
import org.w3c.dom.Comment;
@ -63,15 +73,6 @@ import org.w3c.dom.svg.SVGDocument;
import org.w3c.dom.svg.SVGLangSpace;
import org.w3c.dom.svg.SVGSVGElement;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Locale;
import java.util.MissingResourceException;
/**
* This class implements {@link SVGDocument}.
*

14
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/rasterizer/Main.java

@ -501,11 +501,11 @@ public class Main implements SVGConverterController {
public static String CL_OPTION_CONSTRAIN_SCRIPT_ORIGIN_DESCRIPTION
= Messages.get("Main.cl.option.constrain.script.origin.description", "No description");
public static String CL_OPTION_BLOCK_EXTERNAL_RESOURCES
= Messages.get("Main.cl.option.block.external.resources", "-blockExternalResources");
public static String CL_OPTION_ALLOW_EXTERNAL_RESOURCES
= Messages.get("Main.cl.option.allow.external.resources", "-allowExternalResources");
public static String CL_OPTION_BLOCK_EXTERNAL_RESOURCES_DESCRIPTION
= Messages.get("Main.cl.option.block.external.resources.description", "No description");
public static String CL_OPTION_ALLOW_EXTERNAL_RESOURCES_DESCRIPTION
= Messages.get("Main.cl.option.allow.external.resources.description", "No description");
/**
* Option to turn off secure execution of scripts
@ -836,14 +836,14 @@ public class Main implements SVGConverterController {
}
});
optionMap.put(CL_OPTION_BLOCK_EXTERNAL_RESOURCES,
optionMap.put(CL_OPTION_ALLOW_EXTERNAL_RESOURCES,
new NoValueOptionHandler(){
public void handleOption(SVGConverter c){
c.allowExternalResources = false;
c.allowExternalResources = true;
}
public String getOptionDescription(){
return CL_OPTION_BLOCK_EXTERNAL_RESOURCES_DESCRIPTION;
return CL_OPTION_ALLOW_EXTERNAL_RESOURCES_DESCRIPTION;
}
});
}

6
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/rasterizer/SVGConverter.java

@ -253,7 +253,7 @@ public class SVGConverter {
the document which references them. */
protected boolean constrainScriptOrigin = true;
protected boolean allowExternalResources = true;
protected boolean allowExternalResources;
/** Controls whether scripts should be run securely or not */
protected boolean securityOff = false;
@ -927,8 +927,8 @@ public class SVGConverter {
map.put(ImageTranscoder.KEY_CONSTRAIN_SCRIPT_ORIGIN, Boolean.FALSE);
}
if (!allowExternalResources) {
map.put(ImageTranscoder.KEY_ALLOW_EXTERNAL_RESOURCES, Boolean.FALSE);
if (allowExternalResources) {
map.put(ImageTranscoder.KEY_ALLOW_EXTERNAL_RESOURCES, Boolean.TRUE);
}
return map;

21
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/AboutDialog.java

@ -18,16 +18,6 @@
*/
package org.apache.batik.apps.svgbrowser;
import org.apache.batik.Version;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JWindow;
import javax.swing.border.BevelBorder;
import java.net.URL;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Frame;
@ -37,6 +27,17 @@ import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.net.URL;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JWindow;
import javax.swing.border.BevelBorder;
import org.apache.batik.Version;
/**
* A dialog showing the revision of the Batik viewer as well

11
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java

@ -18,6 +18,11 @@
*/
package org.apache.batik.bridge;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.lang.ref.SoftReference;
import org.apache.batik.anim.dom.AnimatedLiveAttributeValue;
import org.apache.batik.anim.dom.SVGOMAnimatedTransformList;
import org.apache.batik.anim.dom.SVGOMElement;
@ -32,6 +37,7 @@ import org.apache.batik.ext.awt.geom.SegmentList;
import org.apache.batik.gvt.CanvasGraphicsNode;
import org.apache.batik.gvt.CompositeGraphicsNode;
import org.apache.batik.gvt.GraphicsNode;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.events.DocumentEvent;
@ -40,11 +46,6 @@ import org.w3c.dom.events.MutationEvent;
import org.w3c.dom.svg.SVGFitToViewBox;
import org.w3c.dom.svg.SVGTransformable;
import java.lang.ref.SoftReference;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
/**
* The base bridge class for SVG graphics node. By default, the namespace URI is
* the SVG namespace. Override the <code>getNamespaceURI</code> if you want to add

37
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/BridgeContext.java

@ -18,6 +18,23 @@
*/
package org.apache.batik.bridge;
import java.awt.Cursor;
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.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
import org.apache.batik.anim.dom.AnimatedAttributeListener;
import org.apache.batik.anim.dom.AnimatedLiveAttributeValue;
import org.apache.batik.anim.dom.SVGDOMImplementation;
@ -26,7 +43,6 @@ import org.apache.batik.anim.dom.SVGOMElement;
import org.apache.batik.anim.dom.SVGStylableElement;
import org.apache.batik.bridge.svg12.SVG12BridgeContext;
import org.apache.batik.bridge.svg12.SVG12BridgeExtension;
import org.apache.batik.constants.XMLConstants;
import org.apache.batik.css.engine.CSSContext;
import org.apache.batik.css.engine.CSSEngine;
import org.apache.batik.css.engine.CSSEngineEvent;
@ -48,6 +64,8 @@ import org.apache.batik.util.CleanerThread;
import org.apache.batik.util.ParsedURL;
import org.apache.batik.util.SVGConstants;
import org.apache.batik.util.Service;
import org.apache.batik.constants.XMLConstants;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@ -58,23 +76,6 @@ import org.w3c.dom.events.MouseEvent;
import org.w3c.dom.events.MutationEvent;
import org.w3c.dom.svg.SVGDocument;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.lang.ref.SoftReference;
import java.lang.ref.WeakReference;
import java.net.MalformedURLException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
import java.awt.Cursor;
import java.awt.geom.Dimension2D;
/**
* This class represents a context used by the various bridges and the
* builder. A bridge context is associated to a particular document

3
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/DefaultExternalResourceSecurity.java

@ -77,6 +77,9 @@ public class DefaultExternalResourceSecurity implements ExternalResourceSecurity
ParsedURL docURL){
// Make sure that the archives comes from the same host
// as the document itself
if (DATA_PROTOCOL.equals(externalResourceURL.getProtocol())) {
return;
}
if (docURL == null) {
se = new SecurityException
(Messages.formatMessage(ERROR_CANNOT_ACCESS_DOCUMENT_URL,

22
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/FlowTextPainter.java

@ -19,6 +19,17 @@
package org.apache.batik.bridge;
import java.awt.font.FontRenderContext;
import java.awt.font.TextAttribute;
import java.text.AttributedCharacterIterator;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import org.apache.batik.gvt.flow.BlockInfo;
import org.apache.batik.gvt.flow.FlowRegions;
import org.apache.batik.gvt.flow.GlyphGroupInfo;
@ -32,17 +43,6 @@ import org.apache.batik.gvt.font.GVTLineMetrics;
import org.apache.batik.gvt.font.MultiGlyphVector;
import org.apache.batik.gvt.text.GVTAttributedCharacterIterator;
import java.text.AttributedCharacterIterator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.awt.font.FontRenderContext;
import java.awt.font.TextAttribute;
/**
* One line Class Desc
*

10
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/SVGAElementBridge.java

@ -18,22 +18,24 @@
*/
package org.apache.batik.bridge;
import java.awt.Cursor;
import java.util.List;
import org.apache.batik.anim.dom.SVGOMAElement;
import org.apache.batik.anim.dom.SVGOMAnimationElement;
import org.apache.batik.anim.dom.SVGOMDocument;
import org.apache.batik.constants.XMLConstants;
import org.apache.batik.dom.events.AbstractEvent;
import org.apache.batik.dom.events.NodeEventTarget;
import org.apache.batik.gvt.GraphicsNode;
import org.apache.batik.util.ParsedURL;
import org.apache.batik.constants.XMLConstants;
import org.w3c.dom.Element;
import org.w3c.dom.events.Event;
import org.w3c.dom.events.EventListener;
import org.w3c.dom.svg.SVGAElement;
import java.util.List;
import java.awt.Cursor;
/**
* Bridge class for the &lt;a&gt; element.
*

4
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/SVGFontFace.java

@ -18,11 +18,11 @@
*/
package org.apache.batik.bridge;
import java.util.List;
import org.apache.batik.gvt.font.GVTFontFamily;
import org.w3c.dom.Element;
import java.util.List;
/**
* This class represents a &lt;font-face&gt; element or @font-face rule
*

9
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/SVGFontFamily.java

@ -18,19 +18,20 @@
*/
package org.apache.batik.bridge;
import java.lang.ref.SoftReference;
import java.text.AttributedCharacterIterator;
import java.util.Map;
import org.apache.batik.gvt.font.GVTFont;
import org.apache.batik.gvt.font.GVTFontFace;
import org.apache.batik.gvt.font.GVTFontFamily;
import org.apache.batik.gvt.text.GVTAttributedCharacterIterator;
import org.apache.batik.util.SVGConstants;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import java.lang.ref.SoftReference;
import java.text.AttributedCharacterIterator;
import java.util.Map;
/**
* A font family class for SVG fonts.
*

13
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/SVGUseElementBridge.java

@ -18,17 +18,23 @@
*/
package org.apache.batik.bridge;
import java.awt.Cursor;
import java.awt.RenderingHints;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import org.apache.batik.anim.dom.AbstractSVGAnimatedLength;
import org.apache.batik.anim.dom.AnimatedLiveAttributeValue;
import org.apache.batik.anim.dom.SVGOMAnimatedLength;
import org.apache.batik.anim.dom.SVGOMDocument;
import org.apache.batik.anim.dom.SVGOMUseElement;
import org.apache.batik.constants.XMLConstants;
import org.apache.batik.dom.events.NodeEventTarget;
import org.apache.batik.dom.svg.LiveAttributeException;
import org.apache.batik.dom.svg.SVGOMUseShadowRoot;
import org.apache.batik.gvt.CompositeGraphicsNode;
import org.apache.batik.gvt.GraphicsNode;
import org.apache.batik.constants.XMLConstants;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
@ -38,11 +44,6 @@ import org.w3c.dom.events.EventListener;
import org.w3c.dom.svg.SVGTransformable;
import org.w3c.dom.svg.SVGUseElement;
import java.awt.Cursor;
import java.awt.RenderingHints;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
/**
* Bridge class for the &lt;use&gt; element.
*

16
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/SVGUtilities.java

@ -18,6 +18,14 @@
*/
package org.apache.batik.bridge;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import java.util.StringTokenizer;
import org.apache.batik.css.engine.CSSEngine;
import org.apache.batik.dom.util.XLinkSupport;
import org.apache.batik.dom.util.XMLSupport;
@ -36,14 +44,6 @@ import org.w3c.dom.svg.SVGElement;
import org.w3c.dom.svg.SVGLangSpace;
import org.w3c.dom.svg.SVGNumberList;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import java.util.StringTokenizer;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
/**
* A collection of utility methods for SVG.
*

11
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/UserAgent.java

@ -18,17 +18,18 @@
*/
package org.apache.batik.bridge;
import java.awt.Cursor;
import java.awt.Point;
import java.awt.geom.AffineTransform;
import java.awt.geom.Dimension2D;
import org.apache.batik.gvt.event.EventDispatcher;
import org.apache.batik.util.ParsedURL;
import org.w3c.dom.Element;
import org.w3c.dom.svg.SVGAElement;
import org.w3c.dom.svg.SVGDocument;
import java.awt.Cursor;
import java.awt.Point;
import java.awt.geom.AffineTransform;
import java.awt.geom.Dimension2D;
/**
* An interface that provides access to the User Agent informations
* needed by the bridge.

2
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/UserAgentAdapter.java

@ -362,7 +362,7 @@ public class UserAgentAdapter implements UserAgent {
public ExternalResourceSecurity
getExternalResourceSecurity(ParsedURL resourceURL,
ParsedURL docURL) {
return new RelaxedExternalResourceSecurity(resourceURL, docURL);
return new DefaultExternalResourceSecurity(resourceURL, docURL);
}
/**

24
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/extension/svg/META-INF/services/org.apache.batik.bridge.BridgeExtension

@ -0,0 +1,24 @@
# -----------------------------------------------------------------------------
#
# 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.
#
# This file registers the example Bridge extension as a service for the
# Bridge context.
#
# $Id$
# -----------------------------------------------------------------------------
org.apache.batik.extension.svg.BatikBridgeExtension

24
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/extension/svg/META-INF/services/org.apache.batik.dom.DomExtension

@ -0,0 +1,24 @@
# -----------------------------------------------------------------------------
#
# 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.
#
# This file registers the example DOM extension as a service for the
# SVGOMDocument.
#
# $Id$
# -----------------------------------------------------------------------------
org.apache.batik.extension.svg.BatikDomExtension

13
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/extension/svg/org/apache/batik/extensions/README.txt

@ -0,0 +1,13 @@
The Jar files in this directory start the same application as in the
parent directory, except they include the Batik Extensions on the jar
file class path. This means that that the Batik Extensions will work
with the applications started by these jar files.
Great care should be used when using the Batik Extensions as these are
not part of the SVG standard. If you write content that uses these
extensions you must be aware that this is not conformant SVG content
and other SVG renderers will not render these documents. These
extensions should only be used in content used in closed systems.
The primary purpose of these extensions is demonstrative and to
generate feedback to the development of the SVG standard.

57
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/script/rhino/RhinoClassShutter.java

@ -20,7 +20,7 @@ package org.apache.batik.script.rhino;
import org.mozilla.javascript.ClassShutter;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
/**
@ -30,7 +30,7 @@ import java.util.List;
* @version $Id$
*/
public class RhinoClassShutter implements ClassShutter {
private static final List<String> WHITELIST = Arrays.asList("java.io.PrintStream", "java.lang.System", "java.net.URL");
public static final List<String> WHITELIST = new ArrayList<>();
/*
public RhinoClassShutter() {
@ -59,56 +59,11 @@ public class RhinoClassShutter implements ClassShutter {
* Returns whether the given class is visible to scripts.
*/
public boolean visibleToScripts(String fullClassName) {
if (!WHITELIST.contains(fullClassName) && !fullClassName.endsWith("Permission") && !fullClassName.startsWith("org.")) {
return false;
}
// Don't let them mess with script engine's internals.
if (fullClassName.startsWith("org.mozilla.javascript"))
return false;
if (fullClassName.startsWith("org.apache.batik.")) {
// Just get package within batik.
String batikPkg = fullClassName.substring(17);
// Don't let them mess with Batik script internals.
if (batikPkg.startsWith("script"))
return false;
// Don't let them get global structures.
if (batikPkg.startsWith("apps"))
return false;
// Don't let them get scripting stuff from bridge, but specifically
// allow access to:
//
// o.a.b.bridge.ScriptingEnvironment$Window$IntervalScriptTimerTask
// o.a.b.bridge.ScriptingEnvironment$Window$IntervalRunnableTimerTask
// o.a.b.bridge.ScriptingEnvironment$Window$TimeoutScriptTimerTask
// o.a.b.bridge.ScriptingEnvironment$Window$TimeoutRunnableTimerTask
//
// since objects of these classes are returned by setInterval() and
// setTimeout().
if (batikPkg.startsWith("bridge.")) {
String batikBridgeClass = batikPkg.substring(7);
if (batikBridgeClass.startsWith("ScriptingEnvironment")) {
if (batikBridgeClass.startsWith("$Window$", 20)) {
String c = batikBridgeClass.substring(28);
if (c.equals("IntervalScriptTimerTask")
|| c.equals("IntervalRunnableTimerTask")
|| c.equals("TimeoutScriptTimerTask")
|| c.equals("TimeoutRunnableTimerTask")) {
return true;
}
}
return false;
}
if (batikBridgeClass.startsWith("BaseScriptingEnvironment")) {
return false;
}
for (String v : WHITELIST) {
if (fullClassName.matches(v)) {
return true;
}
}
return true;
return false;
}
}

12
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/svggen/DOMTreeManager.java

@ -18,18 +18,18 @@
*/
package org.apache.batik.svggen;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.Collections;
import org.apache.batik.ext.awt.g2d.GraphicContext;
import org.w3c.dom.Comment;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
/**
* This class is used by the SVGGraphics2D SVG Generator to manage
* addition of new Nodes to the SVG DOM Tree. This class handles

24
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/transcoder/SVGAbstractTranscoder.java

@ -18,6 +18,14 @@
*/
package org.apache.batik.transcoder;
import java.awt.Dimension;
import java.awt.geom.AffineTransform;
import java.awt.geom.Dimension2D;
import java.awt.geom.Rectangle2D;
import java.util.LinkedList;
import java.util.List;
import java.util.StringTokenizer;
import org.apache.batik.anim.dom.SAXSVGDocumentFactory;
import org.apache.batik.anim.dom.SVGDOMImplementation;
import org.apache.batik.anim.dom.SVGOMDocument;
@ -27,8 +35,8 @@ import org.apache.batik.bridge.BridgeException;
import org.apache.batik.bridge.DefaultScriptSecurity;
import org.apache.batik.bridge.ExternalResourceSecurity;
import org.apache.batik.bridge.GVTBuilder;
import org.apache.batik.bridge.NoLoadExternalResourceSecurity;
import org.apache.batik.bridge.NoLoadScriptSecurity;
import org.apache.batik.bridge.RelaxedExternalResourceSecurity;
import org.apache.batik.bridge.RelaxedScriptSecurity;
import org.apache.batik.bridge.SVGUtilities;
import org.apache.batik.bridge.ScriptSecurity;
@ -52,14 +60,6 @@ import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.svg.SVGSVGElement;
import java.util.LinkedList;
import java.util.List;
import java.util.StringTokenizer;
import java.awt.Dimension;
import java.awt.geom.AffineTransform;
import java.awt.geom.Dimension2D;
import java.awt.geom.Rectangle2D;
/**
* This class may be the base class of all transcoders which take an
* SVG document as input and which need to build a DOM tree. The
@ -1116,9 +1116,9 @@ public abstract class SVGAbstractTranscoder extends XMLAbstractTranscoder {
public ExternalResourceSecurity getExternalResourceSecurity(ParsedURL resourceURL, ParsedURL docURL) {
if (isAllowExternalResources()) {
return super.getExternalResourceSecurity(resourceURL, docURL);
return new RelaxedExternalResourceSecurity(resourceURL, docURL);
}
return new NoLoadExternalResourceSecurity();
return super.getExternalResourceSecurity(resourceURL, docURL);
}
public boolean isAllowExternalResources() {
@ -1126,7 +1126,7 @@ public abstract class SVGAbstractTranscoder extends XMLAbstractTranscoder {
if (b != null) {
return b;
}
return true;
return false;
}
}
}

20
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/transcoder/image/ImageTranscoder.java

@ -18,6 +18,16 @@
*/
package org.apache.batik.transcoder.image;
import java.awt.AlphaComposite;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
import java.awt.image.SinglePixelPackedSampleModel;
import org.apache.batik.ext.awt.image.GraphicsUtil;
import org.apache.batik.gvt.renderer.ConcreteImageRendererFactory;
import org.apache.batik.gvt.renderer.ImageRenderer;
@ -30,16 +40,6 @@ import org.apache.batik.transcoder.keys.BooleanKey;
import org.apache.batik.transcoder.keys.PaintKey;
import org.w3c.dom.Document;
import java.awt.AlphaComposite;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
import java.awt.image.SinglePixelPackedSampleModel;
/**
* This class enables to transcode an input to an image of any format.
*

12
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java

@ -19,6 +19,12 @@
package org.apache.batik.transcoder.svg2svg;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
import org.apache.batik.dom.util.DOMUtilities;
import org.apache.batik.transcoder.AbstractTranscoder;
import org.apache.batik.transcoder.ErrorHandler;
@ -31,12 +37,6 @@ import org.apache.batik.transcoder.keys.IntegerKey;
import org.apache.batik.transcoder.keys.StringKey;
import org.w3c.dom.Document;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
/**
* This class is a trancoder from SVG to SVG.
*

2
fine-xmlgraphics/xmlgraphics-batik/src/main/resources/NOTICE

@ -1,5 +1,5 @@
Apache Batik
Copyright 1999-2022 The Apache Software Foundation
Copyright 1999-2023 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).

6
fine-xmlgraphics/xmlgraphics-batik/src/main/resources/org/org/apache/batik/anim/dom/resources/UserAgentStyleSheet.css

@ -0,0 +1,6 @@
/*
* The default SVG style sheet.
*/
svg, symbol, image, marker, pattern, foreignObject { overflow: hidden }
/* svg { width:attr(width); height:attr(height) } */

68
fine-xmlgraphics/xmlgraphics-batik/src/main/resources/org/org/apache/batik/anim/dom/resources/dtdids.properties

@ -0,0 +1,68 @@
# -----------------------------------------------------------------------------
#
# 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.
#
# The publicIds property represents the list of SVG DTD IDs supported by
# this SVG DOMImplementation.
#
# $Id$
# -----------------------------------------------------------------------------
publicIds = \
-//W3C//DTD SVG 1.0//EN\
-//W3C//DTD SVG 20010904//EN\
-//W3C//DTD SVG 20001102//EN\
-//W3C//DTD SVG 20000802//EN\
-//W3C//DTD SVG 20000303 Stylable//EN\
-//W3C//DTD SVG 1.1//EN\
-//W3C//DTD SVG 1.1 Basic//EN\
-//W3C//DTD SVG 1.1 Tiny//EN\
-//W3C//DTD SVG 1.2//EN
systemId.-//W3C//DTD_SVG_1.0//EN = resources/svg10.dtd
systemId.-//W3C//DTD_SVG_20010904//EN = resources/svg10.dtd
systemId.-//W3C//DTD_SVG_20001102//EN = resources/svg10.dtd
systemId.-//W3C//DTD_SVG_20000802//EN = resources/svg10.dtd
systemId.-//W3C//DTD_SVG_20000303_Stylable//EN = resources/svg10.dtd
systemId.-//W3C//DTD_SVG_1.1//EN = resources/svg11-flat.dtd
systemId.-//W3C//DTD_SVG_1.1_Basic//EN = resources/svg11-basic-flat.dtd
systemId.-//W3C//DTD_SVG_1.1_Tiny//EN = resources/svg11-tiny-flat.dtd
systemId.-//W3C//DTD_SVG_1.2//EN = resources/svg12-flat.dtd
#
# The skippablePublicIds property represents the list of SVG DTD's we
# can safely skip if we are not validating. Since SVG may move to
# schema you shouldn't count on any entities from these files anyways.
#
skippablePublicIds = \
-//W3C//DTD SVG 1.0//EN\
-//W3C//DTD SVG 20010904//EN\
-//W3C//DTD SVG 20001102//EN\
-//W3C//DTD SVG 20000802//EN\
-//W3C//DTD SVG 20000303 Stylable//EN\
-//W3C//DTD SVG 1.1//EN\
-//W3C//DTD SVG 1.1 Basic//EN\
-//W3C//DTD SVG 1.1 Tiny//EN\
-//W3C//DTD SVG 1.2//EN
#
# This is an absolutely minimal DTD for SVG 1.0/1.1
# It just defines the svg and xlink namespaces.
skipDTD = \
<!ELEMENT svg (desc|title|metadata|defs)*> \
<!ATTLIST svg xmlns CDATA #FIXED "http://www.w3.org/2000/svg" \
xmlns:xlink CDATA #FIXED "http://www.w3.org/1999/xlink" >

28
fine-xmlgraphics/xmlgraphics-batik/src/main/resources/org/org/apache/batik/anim/resources/Messages.properties

@ -0,0 +1,28 @@
# -----------------------------------------------------------------------------
#
# 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.
#
# $Id$
# -----------------------------------------------------------------------------
attribute.malformed = \
The attribute "{1}" of the element <{0}> is invalid
values.to.by.missing = \
None of "values", "to" or "by" are specified on the element <{0}>
values.to.by.path.missing = \
None of "values", "to", "by" or "path" are specified on the element <{0}>
Loading…
Cancel
Save