tkormann    01/11/14 01:15:25

  Modified:    sources/org/apache/batik/swing/svg JSVGComponent.java
  Log:
  bug fix 3721. Anchor in external resources now works properly.
  
  Revision  Changes    Path
  1.30      +13 -2     xml-batik/sources/org/apache/batik/swing/svg/JSVGComponent.java
  
  Index: JSVGComponent.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/swing/svg/JSVGComponent.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- JSVGComponent.java        2001/11/06 15:04:51     1.29
  +++ JSVGComponent.java        2001/11/14 09:15:25     1.30
  @@ -153,7 +153,7 @@
    * building/rendering a document (invalid XML file, missing attributes...).</p>
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephane Hillion</a>
  - * @version $Id: JSVGComponent.java,v 1.29 2001/11/06 15:04:51 hillion Exp $
  + * @version $Id: JSVGComponent.java,v 1.30 2001/11/14 09:15:25 tkormann Exp $
    */
   public class JSVGComponent extends JGVTComponent {
   
  @@ -831,6 +831,12 @@
                       URL oldURI = ((SVGOMDocument)svgDocument).getURLObject();
                       URL newURI = null;
                       try {
  +                     // if the anchor element is in an external resource
  +                     if (elt.getOwnerDocument() != svgDocument) {
  +                         SVGOMDocument doc = 
  +                             (SVGOMDocument)elt.getOwnerDocument();
  +                         href = new URL(doc.getURLObject(), href).toString();
  +                     }
                           newURI = new URL(oldURI, href);
                       } catch (MalformedURLException e) {
                           userAgent.displayError(e);
  @@ -838,7 +844,6 @@
                       }
   
                       href = newURI.toString();
  -
                       svgUserAgent.openLink(href, true);
                   } else {
                       JSVGComponent.this.loadSVGDocument(href);
  @@ -851,6 +856,12 @@
                   URL oldURI = ((SVGOMDocument)svgDocument).getURLObject();
                   URL newURI = null;
                   try {
  +                 // if the anchor element is in an external resource
  +                 if (elt.getOwnerDocument() != svgDocument) {
  +                     SVGOMDocument doc = 
  +                         (SVGOMDocument)elt.getOwnerDocument();
  +                     href = new URL(doc.getURLObject(), href).toString();
  +                 }
                       newURI = new URL(oldURI, href);
                   } catch (MalformedURLException e) {
                       userAgent.displayError(e);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to