hillion     02/05/21 02:51:38

  Modified:    sources/org/apache/batik/bridge
                        BaseScriptingEnvironment.java
                        ScriptingEnvironment.java
               sources/org/apache/batik/css/engine CSSEngine.java
               sources/org/apache/batik/css/engine/sac
                        AbstractElementSelector.java CSSAndCondition.java
                        CSSAttributeCondition.java CSSChildSelector.java
                        CSSClassCondition.java CSSConditionFactory.java
                        CSSConditionalSelector.java
                        CSSDescendantSelector.java
                        CSSDirectAdjacentSelector.java CSSIdCondition.java
                        CSSLangCondition.java CSSPseudoClassCondition.java
                        ExtendedCondition.java ExtendedSelector.java
               sources/org/apache/batik/dom/svg SVGOMStyleElement.java
                        SVGStyleSheetProcessingInstruction.java
  Log:
  - Added support for addition/modification/removal of CSS stylesheets,
  - added support for attribute/id/adjacent selector and :first-child
    dynamic updates,
  - external scripts can now be gzipped.
  
  Revision  Changes    Path
  1.9       +7 -3      
xml-batik/sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
  
  Index: BaseScriptingEnvironment.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/bridge/BaseScriptingEnvironment.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- BaseScriptingEnvironment.java     2 May 2002 12:40:59 -0000       1.8
  +++ BaseScriptingEnvironment.java     21 May 2002 09:51:37 -0000      1.9
  @@ -35,6 +35,7 @@
   import org.apache.batik.script.InterpreterException;
   import org.apache.batik.script.ScriptHandler;
   
  +import org.apache.batik.util.ParsedURL;
   import org.apache.batik.util.SVGConstants;
   
   import org.w3c.dom.Document;
  @@ -55,9 +56,10 @@
    * This class is the base class for SVG scripting.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephane Hillion</a>
  - * @version $Id: BaseScriptingEnvironment.java,v 1.8 2002/05/02 12:40:59 vhardy Exp 
$
  + * @version $Id: BaseScriptingEnvironment.java,v 1.9 2002/05/21 09:51:37 hillion 
Exp $
    */
   public class BaseScriptingEnvironment {
  +
       /**
        * Tells whether the given SVG document is dynamic.
        */
  @@ -307,7 +309,8 @@
                       url = new URL(XMLBaseSupport.getCascadedXMLBase(script));
                       url = new URL(url, href);
                       checkCompatibleScriptURL(type, url);
  -                    reader = new InputStreamReader(url.openStream());
  +                    ParsedURL purl = new ParsedURL(url);
  +                    reader = new InputStreamReader(purl.openStream());
                   } else {
                       // Inline script.
                       Node n = script.getFirstChild();
  @@ -353,7 +356,8 @@
                                                                 docURL);
   
           if (security == null) {
  -            security = new DefaultScriptSecurity(scriptType, scriptURL, docURL);
  +            security = new DefaultScriptSecurity(scriptType, scriptURL,
  +                                                 docURL);
           }
   
           security.checkLoadScript();
  
  
  
  1.28      +5 -3      
xml-batik/sources/org/apache/batik/bridge/ScriptingEnvironment.java
  
  Index: ScriptingEnvironment.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/bridge/ScriptingEnvironment.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- ScriptingEnvironment.java 14 May 2002 08:57:31 -0000      1.27
  +++ ScriptingEnvironment.java 21 May 2002 09:51:38 -0000      1.28
  @@ -47,7 +47,7 @@
    * This class contains the informations needed by the SVG scripting.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephane Hillion</a>
  - * @version $Id: ScriptingEnvironment.java,v 1.27 2002/05/14 08:57:31 vhardy Exp $
  + * @version $Id: ScriptingEnvironment.java,v 1.28 2002/05/21 09:51:38 hillion Exp $
    */
   public class ScriptingEnvironment extends BaseScriptingEnvironment {
   
  @@ -332,10 +332,12 @@
                   target.addEventListener("DOMFocusIn", focusinListener, false);
               }
               if (elt.hasAttributeNS(null, "onfocusout")) {
  -                target.addEventListener("DOMFocusOut", focusoutListener, false);
  +                target.addEventListener("DOMFocusOut", focusoutListener,
  +                                        false);
               }
               if (elt.hasAttributeNS(null, "onactivate")) {
  -                target.addEventListener("DOMActivate", activateListener, false);
  +                target.addEventListener("DOMActivate", activateListener,
  +                                        false);
               }
               if (elt.hasAttributeNS(null, "onclick")) {
                   target.addEventListener("click", clickListener, false);
  
  
  
  1.12      +300 -76   xml-batik/sources/org/apache/batik/css/engine/CSSEngine.java
  
  Index: CSSEngine.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/engine/CSSEngine.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- CSSEngine.java    16 May 2002 16:33:41 -0000      1.11
  +++ CSSEngine.java    21 May 2002 09:51:38 -0000      1.12
  @@ -58,7 +58,7 @@
    * This is the base class for all the CSS engines.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephane Hillion</a>
  - * @version $Id: CSSEngine.java,v 1.11 2002/05/16 16:33:41 hillion Exp $
  + * @version $Id: CSSEngine.java,v 1.12 2002/05/21 09:51:38 hillion Exp $
    */
   public abstract class CSSEngine {
   
  @@ -277,16 +277,56 @@
       protected EventListener domAttrModifiedListener;
   
       /**
  +     * The DOMNodeInserted event listener.
  +     */
  +    protected EventListener domNodeInsertedListener;
  +
  +    /**
  +     * The DOMNodeRemoved event listener.
  +     */
  +    protected EventListener domNodeRemovedListener;
  +
  +    /**
  +     * The DOMSubtreeModified event listener.
  +     */
  +    protected EventListener domSubtreeModifiedListener;
  +
  +    /**
  +     * The DOMCharacterDataModified event listener.
  +     */
  +    protected EventListener domCharacterDataModifiedListener;
  +
  +    /**
  +     * Whether a style sheet as been removed from the document.
  +     */
  +    protected boolean styleSheetRemoved;
  +
  +    /**
  +     * The right sibling of the last removed node.
  +     */
  +    protected Node removedStylableElementSibling;
  +
  +    /**
        * The listeners.
        */
       protected List listeners = Collections.synchronizedList(new LinkedList());
   
       /**
  +     * The attributes found in stylesheets selectors.
  +     */
  +    protected Set selectorAttributes;
  +
  +    /**
        * Used to fire a change event for all the properties.
        */
       protected final int[] ALL_PROPERTIES;
   
       /**
  +     * The CSS condition factory.
  +     */
  +    protected CSSConditionFactory cssConditionFactory;
  +
  +    /**
        * Creates a new CSSEngine.
        * @param doc The associated document.
        * @param uri The document URI.
  @@ -328,6 +368,8 @@
           classLocalName = cln;
           cssContext = ctx;
   
  +        cssConditionFactory = new CSSConditionFactory(cns, cln, null, "id");
  +
           int len = vm.length;
           indexes = new StringIntMap(len);
           valueManagers = vm;
  @@ -373,6 +415,23 @@
               et.addEventListener("DOMAttrModified",
                                   domAttrModifiedListener,
                                   false);
  +            domNodeInsertedListener = new DOMNodeInsertedListener();
  +            et.addEventListener("DOMNodeInserted",
  +                                domNodeInsertedListener,
  +                                false);
  +            domNodeRemovedListener = new DOMNodeRemovedListener();
  +            et.addEventListener("DOMNodeRemoved",
  +                                domNodeRemovedListener,
  +                                false);
  +            domSubtreeModifiedListener = new DOMSubtreeModifiedListener();
  +            et.addEventListener("DOMSubtreeModified",
  +                                domSubtreeModifiedListener,
  +                                false);
  +            domCharacterDataModifiedListener =
  +                new DOMCharacterDataModifiedListener();
  +            et.addEventListener("DOMCharacterDataModified",
  +                                domCharacterDataModifiedListener,
  +                                false);
               styleDeclarationUpdateHandler =
                   new StyleDeclarationUpdateHandler();
           }
  @@ -394,6 +453,18 @@
               et.removeEventListener("DOMAttrModified",
                                      domAttrModifiedListener,
                                      false);
  +            et.removeEventListener("DOMNodeInserted",
  +                                   domNodeInsertedListener,
  +                                   false);
  +            et.removeEventListener("DOMNodeRemoved",
  +                                   domNodeRemovedListener,
  +                                   false);
  +            et.removeEventListener("DOMSubtreeModified",
  +                                   domSubtreeModifiedListener,
  +                                   false);
  +            et.removeEventListener("DOMCharacterDataModified",
  +                                   domCharacterDataModifiedListener,
  +                                   false);
           }
       }
   
  @@ -642,7 +713,7 @@
               if (style.length() > 0) {
                   try {
                       parser.setSelectorFactory(CSSSelectorFactory.INSTANCE);
  -                    parser.setConditionFactory(CSSConditionFactory.INSTANCE);
  +                    parser.setConditionFactory(cssConditionFactory);
                       styleDeclarationDocumentHandler.styleMap = result;
                       parser.setDocumentHandler(styleDeclarationDocumentHandler);
                       parser.parseStyleDeclaration(style);
  @@ -723,13 +794,66 @@
       public List getStyleSheetNodes() {
           if (styleSheetNodes == null) {
               styleSheetNodes = new ArrayList();
  +            selectorAttributes = new HashSet();
               // Find all the style-sheets in the document.
               findStyleSheetNodes(document);
  +            int len = styleSheetNodes.size();
  +            for (int i = 0; i < len; i++) {
  +                CSSStyleSheetNode ssn;
  +                ssn = (CSSStyleSheetNode)styleSheetNodes.get(i);
  +                StyleSheet ss = ssn.getCSSStyleSheet();
  +                if (ss != null) {
  +                    findSelectorAttributes(selectorAttributes, ss);
  +                }
  +            }
           }
           return styleSheetNodes;
       }
   
       /**
  +     * An auxiliary method for getStyleSheets().
  +     */
  +    protected void findStyleSheetNodes(Node n) {
  +        if (n instanceof CSSStyleSheetNode) {
  +            styleSheetNodes.add(n);
  +        }
  +        for (Node nd = n.getFirstChild();
  +             nd != null;
  +             nd = nd.getNextSibling()) {
  +            findStyleSheetNodes(nd);
  +        }
  +    }
  +
  +    /**
  +     * Finds the selector attributes in the given stylesheet.
  +     */
  +    protected void findSelectorAttributes(Set attrs, StyleSheet ss) {
  +        int len = ss.getSize();
  +        for (int i = 0; i < len; i++) {
  +            Rule r = ss.getRule(i);
  +            switch (r.getType()) {
  +            case StyleRule.TYPE:
  +                StyleRule style = (StyleRule)r;
  +                SelectorList sl = style.getSelectorList();
  +                int slen = sl.getLength();
  +                for (int j = 0; j < slen; j++) {
  +                    ExtendedSelector s = (ExtendedSelector)sl.item(j);
  +                    s.fillAttributeSet(attrs);
  +                }
  +                break;
  +
  +            case MediaRule.TYPE:
  +            case ImportRule.TYPE:
  +                MediaRule mr = (MediaRule)r;
  +                if (mediaMatch(mr.getMediaList())) {
  +                    findSelectorAttributes(attrs, mr);
  +                }
  +                break;
  +            }
  +        }
  +    }
  +
  +    /**
        * Parses and creates a property value.
        * @param prop The property name.
        * @param value The property value.
  @@ -760,7 +884,7 @@
       public StyleDeclaration parseStyleDeclaration(String value) {
           try {
               parser.setSelectorFactory(CSSSelectorFactory.INSTANCE);
  -            parser.setConditionFactory(CSSConditionFactory.INSTANCE);
  +            parser.setConditionFactory(cssConditionFactory);
               cssBaseURI = documentURI;
               styleDeclarationBuilder.styleDeclaration = new StyleDeclaration();
               parser.setDocumentHandler(styleDeclarationBuilder);
  @@ -893,7 +1017,7 @@
       protected void parseStyleSheet(StyleSheet ss, InputSource is, URL uri)
           throws IOException {
           parser.setSelectorFactory(CSSSelectorFactory.INSTANCE);
  -        parser.setConditionFactory(CSSConditionFactory.INSTANCE);
  +        parser.setConditionFactory(cssConditionFactory);
           cssBaseURI = uri;
           styleSheetDocumentHandler.styleSheet = ss;
           parser.setDocumentHandler(styleSheetDocumentHandler);
  @@ -915,20 +1039,6 @@
       }
   
       /**
  -     * An auxiliary method for getStyleSheets().
  -     */
  -    protected void findStyleSheetNodes(Node n) {
  -        if (n instanceof CSSStyleSheetNode) {
  -            styleSheetNodes.add(n);
  -        }
  -        for (Node nd = n.getFirstChild();
  -             nd != null;
  -             nd = nd.getNextSibling()) {
  -            findStyleSheetNodes(nd);
  -        }
  -    }
  -
  -    /**
        * Adds the rules of the given style-sheet to a style-map.
        */
       protected void putStyleSheetRules(Element elt,
  @@ -1481,7 +1591,7 @@
                   element = elt;
                   try {
                       parser.setSelectorFactory(CSSSelectorFactory.INSTANCE);
  -                    parser.setConditionFactory(CSSConditionFactory.INSTANCE);
  +                    parser.setConditionFactory(cssConditionFactory);
                       styleDeclarationUpdateHandler.styleMap = style;
                       parser.setDocumentHandler(styleDeclarationUpdateHandler);
                       parser.parseStyleDeclaration(decl);
  @@ -1533,10 +1643,6 @@
                        n != null;
                        n = n.getNextSibling()) {
                       propagateChanges(n, ALL_PROPERTIES);
  -                    c = getImportedChild(n);
  -                    if (c != null) {
  -                        propagateChanges(c, ALL_PROPERTIES);
  -                    }
                   }
               } else {
                   int count = 0;
  @@ -1589,16 +1695,12 @@
                       
                       Node c = getImportedChild(elt);
                       if (c != null) {
  -                        propagateChanges(c, ALL_PROPERTIES);
  +                        propagateChanges(c, props);
                       }
                       for (Node n = elt.getFirstChild();
                            n != null;
                            n = n.getNextSibling()) {
                           propagateChanges(n, props);
  -                        c = getImportedChild(n);
  -                        if (c != null) {
  -                            propagateChanges(c, props);
  -                        }
                       }
                   }
               }
  @@ -1625,6 +1727,55 @@
       }
   
       /**
  +     * Invalidates all the stylable elements descendant of the given
  +     * node, and the node.
  +     */
  +    protected void invalidateTreeProperties(Node node) {
  +        if (node instanceof CSSStylableElement) {
  +            CSSStylableElement elt = (CSSStylableElement)node;
  +            StyleMap style = elt.getComputedStyleMap(null);
  +            if (style != null) {
  +                elt.setComputedStyleMap(null, null);
  +                firePropertiesChangedEvent(elt, ALL_PROPERTIES);
  +            }
  +        }
  +
  +        Node c = getImportedChild(node);
  +        if (c != null) {
  +            propagateChanges(c, ALL_PROPERTIES);
  +        }
  +        for (Node n = node.getFirstChild();
  +             n != null;
  +             n = n.getNextSibling()) {
  +            invalidateTreeProperties(n);
  +        }
  +    }
  +
  +    /**
  +     * Invalidates all the properties of the given node.
  +     */
  +    protected void invalidateProperties(Node node) {
  +        if (node instanceof CSSStylableElement) {
  +            CSSStylableElement elt = (CSSStylableElement)node;
  +            StyleMap style = elt.getComputedStyleMap(null);
  +            if (style != null) {
  +                elt.setComputedStyleMap(null, null);
  +                firePropertiesChangedEvent(elt, ALL_PROPERTIES);
  +            }
  +        }
  +
  +        Node c = getImportedChild(node);
  +        if (c != null) {
  +            propagateChanges(c, ALL_PROPERTIES);
  +        }
  +        for (Node n = node.getFirstChild();
  +             n != null;
  +             n = n.getNextSibling()) {
  +            propagateChanges(n, ALL_PROPERTIES);
  +        }
  +    }
  +
  +    /**
        * Propagates the changes that occurs on the parent of the given node.
        */
       protected void propagateChanges(Node node, int[] props) {
  @@ -1699,16 +1850,12 @@
           if (props != null) {
               Node c = getImportedChild(node);
               if (c != null) {
  -                propagateChanges(c, ALL_PROPERTIES);
  +                propagateChanges(c, props);
               }
               for (Node n = node.getFirstChild();
                    n != null;
                    n = n.getNextSibling()) {
                   propagateChanges(n, props);
  -                c = getImportedChild(n);
  -                if (c != null) {
  -                    propagateChanges(c, props);
  -                }
               }
           }
       }
  @@ -1858,15 +2005,100 @@
   
           Node c = getImportedChild(elt);
           if (c != null) {
  -            propagateChanges(c, ALL_PROPERTIES);
  +            propagateChanges(c, props);
           }
           for (Node n = elt.getFirstChild();
                n != null;
                n = n.getNextSibling()) {
               propagateChanges(n, props);
  -            c = getImportedChild(n);
  -            if (c != null) {
  -                propagateChanges(c, props);
  +        }
  +    }
  +
  +    /**
  +     * To handle the insertion of a CSSStyleSheetNode in the
  +     * associated document.
  +     */
  +    protected class DOMNodeInsertedListener implements EventListener {
  +        public void handleEvent(Event evt) {
  +            EventTarget et = evt.getTarget();
  +            if (et instanceof CSSStyleSheetNode) {
  +                styleSheetNodes = null;
  +
  +                // Invalidate all the CSSStylableElements in the document.
  +                invalidateTreeProperties(document.getDocumentElement());
  +                return;
  +            }
  +            if (et instanceof CSSStylableElement) {
  +                // Invalidate the CSSStylableElement siblings, to
  +                // correctly match the adjacent selectors and
  +                // first-child pseudo-class.
  +                for (Node n = ((Node)evt.getTarget()).getNextSibling();
  +                     n != null;
  +                     n = n.getNextSibling()) {
  +                    invalidateProperties(n);
  +                }
  +            }
  +        }
  +    }
  +
  +    /**
  +     * To handle the removal of a CSSStyleSheetNode from the
  +     * associated document.
  +     */
  +    protected class DOMNodeRemovedListener implements EventListener {
  +        public void handleEvent(Event evt) {
  +            EventTarget et = evt.getTarget();
  +            if (et instanceof CSSStyleSheetNode) {
  +                // Wait for the DOMSubtreeModified to do the invalidations
  +                // because at this time the node is in the tree.
  +                styleSheetRemoved = true;
  +            } else if (et instanceof CSSStylableElement) {
  +                // Wait for the DOMSubtreeModified to do the invalidations
  +                // because at this time the node is in the tree.
  +                removedStylableElementSibling = ((Node)et).getNextSibling();
  +            }
  +            // Clears the computed styles in the removed tree.
  +            disposeStyleMaps((Node)et);
  +        }
  +    }
  +
  +    /**
  +     * To handle the removal of a CSSStyleSheetNode from the
  +     * associated document.
  +     */
  +    protected class DOMSubtreeModifiedListener implements EventListener {
  +        public void handleEvent(Event evt) {
  +            if (styleSheetRemoved) {
  +                styleSheetRemoved = false;
  +                styleSheetNodes = null;
  +
  +                // Invalidate all the CSSStylableElements in the document.
  +                invalidateTreeProperties(document.getDocumentElement());
  +            } else if (removedStylableElementSibling != null) {
  +                // Invalidate the CSSStylableElement siblings, to
  +                // correctly match the adjacent selectors and
  +                // first-child pseudo-class.
  +                for (Node n = removedStylableElementSibling;
  +                     n != null;
  +                     n = n.getNextSibling()) {
  +                    invalidateProperties(n);
  +                }
  +                removedStylableElementSibling = null;
  +            }
  +        }
  +    }
  +
  +    /**
  +     * To handle the modification of a CSSStyleSheetNode.
  +     */
  +    protected class DOMCharacterDataModifiedListener implements EventListener {
  +        public void handleEvent(Event evt) {
  +            Node n = (Node)evt.getTarget();
  +            if (n.getParentNode() instanceof CSSStyleSheetNode) {
  +                styleSheetNodes = null;
  +
  +                // Invalidate all the CSSStylableElements in the document.
  +                invalidateTreeProperties(document.getDocumentElement());
               }
           }
       }
  @@ -1907,52 +2139,44 @@
                       return;
                   }
               }
  -            if ((attrNS == null && classNamespaceURI == null) ||
  -                (attrNS != null && attrNS.equals(classNamespaceURI))) {
  -                String name = (attrNS == null)
  -                    ? attr.getNodeName()
  -                    : attr.getLocalName();
  -                if (name.equals(classLocalName)) {
  -                    // The class attribute has been modified...
  -                    // ...invalidate all the properties.
  -
  -                    elt.setComputedStyleMap(null, null);
   
  -                    firePropertiesChangedEvent(elt, ALL_PROPERTIES);
  +            String name = (attrNS == null)
  +                ? attr.getNodeName()
  +                : attr.getLocalName();
                       
  -                    Node c = getImportedChild(elt);
  -                    if (c != null) {
  -                        propagateChanges(c, ALL_PROPERTIES);
  +            if (nonCSSPresentationalHints != null) {
  +                if ((attrNS == null &&
  +                     nonCSSPresentationalHintsNamespaceURI == null) ||
  +                    (attrNS != null &&
  +                     attrNS.equals(nonCSSPresentationalHintsNamespaceURI))) {
  +                    if (nonCSSPresentationalHints.contains(name)) {
  +                        // The 'name' attribute which represents a non CSS
  +                        // presentational hint has been modified.
  +
  +                        nonCSSPresentationalHintUpdated(elt, style, name,
  +                                                        mevt);
  +                        return;
                       }
  -                    for (Node n = elt.getFirstChild();
  -                         n != null;
  -                         n = n.getNextSibling()) {
  -                        propagateChanges(n, ALL_PROPERTIES);
  -                        c = getImportedChild(n);
  -                        if (c != null) {
  -                            propagateChanges(c, ALL_PROPERTIES);
  -                        }
  -                    }
  -
  -                    return;
                   }
               }
  -            if (nonCSSPresentationalHints == null) {
  -                return;
  -            }
  -            if ((attrNS == null &&
  -                 nonCSSPresentationalHintsNamespaceURI == null) ||
  -                (attrNS != null &&
  -                 attrNS.equals(nonCSSPresentationalHintsNamespaceURI))) {
  -                String name = (attrNS == null)
  -                    ? attr.getNodeName()
  -                    : attr.getLocalName();
   
  -                if (nonCSSPresentationalHints.contains(name)) {
  -                    // The 'name' attribute which represents a non CSS
  -                    // presentational hint has been modified.
  +            if (selectorAttributes != null &&
  +                selectorAttributes.contains(name)) {
  +                // An attribute has been modified, invalidate all the
  +                // properties to correctly match attribute selectors.
   
  -                    nonCSSPresentationalHintUpdated(elt, style, name, mevt);
  +                elt.setComputedStyleMap(null, null);
  +
  +                firePropertiesChangedEvent(elt, ALL_PROPERTIES);
  +                
  +                Node c = getImportedChild(elt);
  +                if (c != null) {
  +                    propagateChanges(c, ALL_PROPERTIES);
  +                }
  +                for (Node n = elt.getFirstChild();
  +                     n != null;
  +                     n = n.getNextSibling()) {
  +                    propagateChanges(n, ALL_PROPERTIES);
                   }
               }
           }
  
  
  
  1.2       +9 -1      
xml-batik/sources/org/apache/batik/css/engine/sac/AbstractElementSelector.java
  
  Index: AbstractElementSelector.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/sac/AbstractElementSelector.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractElementSelector.java      18 Mar 2002 10:31:09 -0000      1.1
  +++ AbstractElementSelector.java      21 May 2002 09:51:38 -0000      1.2
  @@ -8,6 +8,8 @@
   
   package org.apache.batik.css.engine.sac;
   
  +import java.util.Set;
  +
   import org.w3c.css.sac.ElementSelector;
   
   /**
  @@ -15,7 +17,7 @@
    * interface.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephane Hillion</a>
  - * @version $Id: AbstractElementSelector.java,v 1.1 2002/03/18 10:31:09 hillion Exp 
$
  + * @version $Id: AbstractElementSelector.java,v 1.2 2002/05/21 09:51:38 hillion Exp 
$
    */
   public abstract class AbstractElementSelector
       implements ElementSelector,
  @@ -66,5 +68,11 @@
        */
       public String getLocalName() {
        return localName;
  +    }
  +
  +    /**
  +     * Fills the given set with the attribute names found in this selector.
  +     */
  +    public void fillAttributeSet(Set attrSet) {
       }
   }
  
  
  
  1.2       +11 -1     
xml-batik/sources/org/apache/batik/css/engine/sac/CSSAndCondition.java
  
  Index: CSSAndCondition.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/sac/CSSAndCondition.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CSSAndCondition.java      18 Mar 2002 10:31:09 -0000      1.1
  +++ CSSAndCondition.java      21 May 2002 09:51:38 -0000      1.2
  @@ -8,6 +8,8 @@
   
   package org.apache.batik.css.engine.sac;
   
  +import java.util.Set;
  +
   import org.w3c.css.sac.Condition;
   import org.w3c.dom.Element;
   
  @@ -16,7 +18,7 @@
    * {@link org.w3c.css.sac.CombinatorCondition} interface.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephane Hillion</a>
  - * @version $Id: CSSAndCondition.java,v 1.1 2002/03/18 10:31:09 hillion Exp $
  + * @version $Id: CSSAndCondition.java,v 1.2 2002/05/21 09:51:38 hillion Exp $
    */
   public class CSSAndCondition extends AbstractCombinatorCondition {
       /**
  @@ -40,6 +42,14 @@
       public boolean match(Element e, String pseudoE) {
        return ((ExtendedCondition)getFirstCondition()).match(e, pseudoE) &&
                  ((ExtendedCondition)getSecondCondition()).match(e, pseudoE);
  +    }
  +
  +    /**
  +     * Fills the given set with the attribute names found in this selector.
  +     */
  +    public void fillAttributeSet(Set attrSet) {
  +     ((ExtendedCondition)getFirstCondition()).fillAttributeSet(attrSet);
  +        ((ExtendedCondition)getSecondCondition()).fillAttributeSet(attrSet);
       }
   
       /**
  
  
  
  1.2       +10 -1     
xml-batik/sources/org/apache/batik/css/engine/sac/CSSAttributeCondition.java
  
  Index: CSSAttributeCondition.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/sac/CSSAttributeCondition.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CSSAttributeCondition.java        18 Mar 2002 10:31:09 -0000      1.1
  +++ CSSAttributeCondition.java        21 May 2002 09:51:38 -0000      1.2
  @@ -8,6 +8,8 @@
   
   package org.apache.batik.css.engine.sac;
   
  +import java.util.Set;
  +
   import org.w3c.dom.Element;
   
   /**
  @@ -15,7 +17,7 @@
    * {@link org.w3c.css.sac.AttributeCondition} interface.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephane Hillion</a>
  - * @version $Id: CSSAttributeCondition.java,v 1.1 2002/03/18 10:31:09 hillion Exp $
  + * @version $Id: CSSAttributeCondition.java,v 1.2 2002/05/21 09:51:38 hillion Exp $
    */
   public class CSSAttributeCondition extends AbstractAttributeCondition {
       /**
  @@ -101,6 +103,13 @@
            return !e.getAttribute(getLocalName()).equals("");
        }
        return e.getAttribute(getLocalName()).equals(val);
  +    }
  +
  +    /**
  +     * Fills the given set with the attribute names found in this selector.
  +     */
  +    public void fillAttributeSet(Set attrSet) {
  +        attrSet.add(localName);
       }
   
       /**
  
  
  
  1.2       +11 -1     
xml-batik/sources/org/apache/batik/css/engine/sac/CSSChildSelector.java
  
  Index: CSSChildSelector.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/sac/CSSChildSelector.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CSSChildSelector.java     18 Mar 2002 10:31:09 -0000      1.1
  +++ CSSChildSelector.java     21 May 2002 09:51:38 -0000      1.2
  @@ -8,6 +8,8 @@
   
   package org.apache.batik.css.engine.sac;
   
  +import java.util.Set;
  +
   import org.w3c.css.sac.Selector;
   import org.w3c.css.sac.SimpleSelector;
   import org.w3c.dom.Element;
  @@ -18,7 +20,7 @@
    * {@link org.w3c.css.sac.DescendantSelector} interface.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephane Hillion</a>
  - * @version $Id: CSSChildSelector.java,v 1.1 2002/03/18 10:31:09 hillion Exp $
  + * @version $Id: CSSChildSelector.java,v 1.2 2002/05/21 09:51:38 hillion Exp $
    */
   public class CSSChildSelector extends AbstractDescendantSelector {
   
  @@ -48,6 +50,14 @@
                   ((ExtendedSelector)getSimpleSelector()).match(e, pseudoE);
        }
        return false;
  +    }
  +
  +    /**
  +     * Fills the given set with the attribute names found in this selector.
  +     */
  +    public void fillAttributeSet(Set attrSet) {
  +        ((ExtendedSelector)getAncestorSelector()).fillAttributeSet(attrSet);
  +        ((ExtendedSelector)getSimpleSelector()).fillAttributeSet(attrSet);
       }
   
       /**
  
  
  
  1.2       +4 -3      
xml-batik/sources/org/apache/batik/css/engine/sac/CSSClassCondition.java
  
  Index: CSSClassCondition.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/sac/CSSClassCondition.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CSSClassCondition.java    18 Mar 2002 10:31:09 -0000      1.1
  +++ CSSClassCondition.java    21 May 2002 09:51:38 -0000      1.2
  @@ -17,16 +17,17 @@
    * {@link org.w3c.css.sac.AttributeCondition} interface.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephane Hillion</a>
  - * @version $Id: CSSClassCondition.java,v 1.1 2002/03/18 10:31:09 hillion Exp $
  + * @version $Id: CSSClassCondition.java,v 1.2 2002/05/21 09:51:38 hillion Exp $
    */
   public class CSSClassCondition extends CSSAttributeCondition {
   
       /**
        * Creates a new CSSAttributeCondition object.
        */
  -    public CSSClassCondition(String namespaceURI,
  +    public CSSClassCondition(String localName,
  +                             String namespaceURI,
                                String value) {
  -     super("class", namespaceURI, true, value);
  +     super(localName, namespaceURI, true, value);
       }
       
       /**
  
  
  
  1.2       +27 -7     
xml-batik/sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
  
  Index: CSSConditionFactory.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CSSConditionFactory.java  18 Mar 2002 10:31:09 -0000      1.1
  +++ CSSConditionFactory.java  21 May 2002 09:51:38 -0000      1.2
  @@ -24,19 +24,39 @@
    * {@link org.w3c.css.sac.ConditionFactory} interface.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephane Hillion</a>
  - * @version $Id: CSSConditionFactory.java,v 1.1 2002/03/18 10:31:09 hillion Exp $
  + * @version $Id: CSSConditionFactory.java,v 1.2 2002/05/21 09:51:38 hillion Exp $
    */
   public class CSSConditionFactory implements ConditionFactory {
   
       /**
  -     * The instance of this class.
  +     * The class attribute namespace URI.
        */
  -    public final static ConditionFactory INSTANCE = new CSSConditionFactory();
  +    protected String classNamespaceURI;
   
       /**
  -     * This class does not need to be instantiated.
  +     * The class attribute local name.
        */
  -    protected CSSConditionFactory() {
  +    protected String classLocalName;
  +    
  +    /**
  +     * The id attribute namespace URI.
  +     */
  +    protected String idNamespaceURI;
  +
  +    /**
  +     * The id attribute local name.
  +     */
  +    protected String idLocalName;
  +    
  +    /**
  +     * Creates a new condition factory.
  +     */
  +    public CSSConditionFactory(String cns,  String cln,
  +                               String idns, String idln) {
  +        classNamespaceURI = cns;
  +        classLocalName = cln;
  +        idNamespaceURI = idns;
  +        idLocalName = idln;
       }
   
       /**
  @@ -98,7 +118,7 @@
        */    
       public AttributeCondition createIdCondition(String value)
           throws CSSException {
  -     return new CSSIdCondition(value);
  +     return new CSSIdCondition(idNamespaceURI, idLocalName, value);
       }
   
       /**
  @@ -143,7 +163,7 @@
       public AttributeCondition createClassCondition(String namespaceURI,
                                                   String value)
        throws CSSException {
  -     return new CSSClassCondition(namespaceURI, value);
  +     return new CSSClassCondition(classLocalName, classNamespaceURI, value);
       }
   
       /**
  
  
  
  1.2       +11 -1     
xml-batik/sources/org/apache/batik/css/engine/sac/CSSConditionalSelector.java
  
  Index: CSSConditionalSelector.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/sac/CSSConditionalSelector.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CSSConditionalSelector.java       18 Mar 2002 10:31:09 -0000      1.1
  +++ CSSConditionalSelector.java       21 May 2002 09:51:38 -0000      1.2
  @@ -8,6 +8,8 @@
   
   package org.apache.batik.css.engine.sac;
   
  +import java.util.Set;
  +
   import org.w3c.css.sac.Condition;
   import org.w3c.css.sac.ConditionalSelector;
   import org.w3c.css.sac.SimpleSelector;
  @@ -18,7 +20,7 @@
    * {@link org.w3c.css.sac.ConditionalSelector} interface.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephane Hillion</a>
  - * @version $Id: CSSConditionalSelector.java,v 1.1 2002/03/18 10:31:09 hillion Exp $
  + * @version $Id: CSSConditionalSelector.java,v 1.2 2002/05/21 09:51:38 hillion Exp $
    */
   public class CSSConditionalSelector
       implements ConditionalSelector,
  @@ -69,6 +71,14 @@
       public boolean match(Element e, String pseudoE) {
        return ((ExtendedSelector)getSimpleSelector()).match(e, pseudoE) &&
               ((ExtendedCondition)getCondition()).match(e, pseudoE);
  +    }
  +
  +    /**
  +     * Fills the given set with the attribute names found in this selector.
  +     */
  +    public void fillAttributeSet(Set attrSet) {
  +     ((ExtendedSelector)getSimpleSelector()).fillAttributeSet(attrSet);
  +        ((ExtendedCondition)getCondition()).fillAttributeSet(attrSet);
       }
   
       /**
  
  
  
  1.2       +10 -1     
xml-batik/sources/org/apache/batik/css/engine/sac/CSSDescendantSelector.java
  
  Index: CSSDescendantSelector.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/sac/CSSDescendantSelector.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CSSDescendantSelector.java        18 Mar 2002 10:31:09 -0000      1.1
  +++ CSSDescendantSelector.java        21 May 2002 09:51:38 -0000      1.2
  @@ -8,6 +8,8 @@
   
   package org.apache.batik.css.engine.sac;
   
  +import java.util.Set;
  +
   import org.w3c.css.sac.Selector;
   import org.w3c.css.sac.SimpleSelector;
   import org.w3c.dom.Element;
  @@ -18,7 +20,7 @@
    * {@link org.w3c.css.sac.DescendantSelector} interface.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephane Hillion</a>
  - * @version $Id: CSSDescendantSelector.java,v 1.1 2002/03/18 10:31:09 hillion Exp $
  + * @version $Id: CSSDescendantSelector.java,v 1.2 2002/05/21 09:51:38 hillion Exp $
    */
   public class CSSDescendantSelector extends AbstractDescendantSelector {
   
  @@ -53,6 +55,13 @@
            }
        }
        return false;
  +    }
  +
  +    /**
  +     * Fills the given set with the attribute names found in this selector.
  +     */
  +    public void fillAttributeSet(Set attrSet) {
  +        ((ExtendedSelector)getSimpleSelector()).fillAttributeSet(attrSet);
       }
   
       /**
  
  
  
  1.2       +11 -1     
xml-batik/sources/org/apache/batik/css/engine/sac/CSSDirectAdjacentSelector.java
  
  Index: CSSDirectAdjacentSelector.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/sac/CSSDirectAdjacentSelector.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CSSDirectAdjacentSelector.java    18 Mar 2002 10:31:09 -0000      1.1
  +++ CSSDirectAdjacentSelector.java    21 May 2002 09:51:38 -0000      1.2
  @@ -8,6 +8,8 @@
   
   package org.apache.batik.css.engine.sac;
   
  +import java.util.Set;
  +
   import org.w3c.css.sac.Selector;
   import org.w3c.css.sac.SimpleSelector;
   import org.w3c.dom.Element;
  @@ -18,7 +20,7 @@
    * {@link org.w3c.css.sac.DescendantSelector} interface.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephane Hillion</a>
  - * @version $Id: CSSDirectAdjacentSelector.java,v 1.1 2002/03/18 10:31:09 hillion 
Exp $
  + * @version $Id: CSSDirectAdjacentSelector.java,v 1.2 2002/05/21 09:51:38 hillion 
Exp $
    */
   
   public class CSSDirectAdjacentSelector extends AbstractSiblingSelector {
  @@ -53,6 +55,14 @@
                   ((ExtendedSelector)getSiblingSelector()).match(e, pseudoE);
        }       
        return false;
  +    }
  +
  +    /**
  +     * Fills the given set with the attribute names found in this selector.
  +     */
  +    public void fillAttributeSet(Set attrSet) {
  +        ((ExtendedSelector)getSelector()).fillAttributeSet(attrSet);
  +        ((ExtendedSelector)getSiblingSelector()).fillAttributeSet(attrSet);
       }
   
       /**
  
  
  
  1.2       +26 -4     
xml-batik/sources/org/apache/batik/css/engine/sac/CSSIdCondition.java
  
  Index: CSSIdCondition.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/sac/CSSIdCondition.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CSSIdCondition.java       18 Mar 2002 10:31:09 -0000      1.1
  +++ CSSIdCondition.java       21 May 2002 09:51:38 -0000      1.2
  @@ -8,6 +8,8 @@
   
   package org.apache.batik.css.engine.sac;
   
  +import java.util.Set;
  +
   import org.apache.batik.css.engine.CSSStylableElement;
   import org.w3c.dom.Element;
   
  @@ -16,15 +18,28 @@
    * {@link org.w3c.css.sac.AttributeCondition} interface.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephane Hillion</a>
  - * @version $Id: CSSIdCondition.java,v 1.1 2002/03/18 10:31:09 hillion Exp $
  + * @version $Id: CSSIdCondition.java,v 1.2 2002/05/21 09:51:38 hillion Exp $
    */
   
   public class CSSIdCondition extends AbstractAttributeCondition {
  +
  +    /**
  +     * The id attribute namespace URI.
  +     */
  +    protected String namespaceURI;
  +
  +    /**
  +     * The id attribute local name.
  +     */
  +    protected String localName;
  +
       /**
        * Creates a new CSSAttributeCondition object.
        */
  -    public CSSIdCondition(String value) {
  +    public CSSIdCondition(String ns, String ln, String value) {
        super(value);
  +        namespaceURI = ns;
  +        localName = ln;
       }
   
       /**
  @@ -40,7 +55,7 @@
        * org.w3c.css.sac.AttributeCondition#getNamespaceURI()}.
        */    
       public String getNamespaceURI() {
  -     return null;
  +     return namespaceURI;
       }
   
       /**
  @@ -48,7 +63,7 @@
        * org.w3c.css.sac.AttributeCondition#getLocalName()}.
        */
       public String getLocalName() {
  -     return "id";
  +     return localName;
       }
   
       /**
  @@ -66,6 +81,13 @@
        return (e instanceof CSSStylableElement)
            ? ((CSSStylableElement)e).getXMLId().equals(getValue())
            : false;
  +    }
  +
  +    /**
  +     * Fills the given set with the attribute names found in this selector.
  +     */
  +    public void fillAttributeSet(Set attrSet) {
  +        attrSet.add(localName);
       }
   
       /**
  
  
  
  1.2       +10 -1     
xml-batik/sources/org/apache/batik/css/engine/sac/CSSLangCondition.java
  
  Index: CSSLangCondition.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/sac/CSSLangCondition.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CSSLangCondition.java     18 Mar 2002 10:31:09 -0000      1.1
  +++ CSSLangCondition.java     21 May 2002 09:51:38 -0000      1.2
  @@ -8,6 +8,8 @@
   
   package org.apache.batik.css.engine.sac;
   
  +import java.util.Set;
  +
   import org.w3c.css.sac.LangCondition;
   import org.w3c.dom.Element;
   
  @@ -16,7 +18,7 @@
    * {@link org.w3c.css.sac.LangCondition} interface.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephane Hillion</a>
  - * @version $Id: CSSLangCondition.java,v 1.1 2002/03/18 10:31:09 hillion Exp $
  + * @version $Id: CSSLangCondition.java,v 1.2 2002/05/21 09:51:38 hillion Exp $
    */
   
   public class CSSLangCondition
  @@ -73,6 +75,13 @@
        */
       public boolean match(Element e, String pseudoE) {
        return e.getAttribute("lang").startsWith(getLang());
  +    }
  +
  +    /**
  +     * Fills the given set with the attribute names found in this selector.
  +     */
  +    public void fillAttributeSet(Set attrSet) {
  +        attrSet.add("lang");
       }
   
       /**
  
  
  
  1.2       +9 -1      
xml-batik/sources/org/apache/batik/css/engine/sac/CSSPseudoClassCondition.java
  
  Index: CSSPseudoClassCondition.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/sac/CSSPseudoClassCondition.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CSSPseudoClassCondition.java      18 Mar 2002 10:31:09 -0000      1.1
  +++ CSSPseudoClassCondition.java      21 May 2002 09:51:38 -0000      1.2
  @@ -8,6 +8,8 @@
   
   package org.apache.batik.css.engine.sac;
   
  +import java.util.Set;
  +
   import org.apache.batik.css.engine.CSSStylableElement;
   import org.w3c.dom.Element;
   
  @@ -16,7 +18,7 @@
    * {@link org.w3c.css.sac.AttributeCondition} interface.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephane Hillion</a>
  - * @version $Id: CSSPseudoClassCondition.java,v 1.1 2002/03/18 10:31:09 hillion Exp 
$
  + * @version $Id: CSSPseudoClassCondition.java,v 1.2 2002/05/21 09:51:38 hillion Exp 
$
    */
   public class CSSPseudoClassCondition extends AbstractAttributeCondition {
       /**
  @@ -83,6 +85,12 @@
        return (e instanceof CSSStylableElement)
            ? ((CSSStylableElement)e).isPseudoInstanceOf(getValue())
            : false;
  +    }
  +
  +    /**
  +     * Fills the given set with the attribute names found in this selector.
  +     */
  +    public void fillAttributeSet(Set attrSet) {
       }
   
       /**
  
  
  
  1.2       +8 -1      
xml-batik/sources/org/apache/batik/css/engine/sac/ExtendedCondition.java
  
  Index: ExtendedCondition.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/sac/ExtendedCondition.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ExtendedCondition.java    18 Mar 2002 10:31:09 -0000      1.1
  +++ ExtendedCondition.java    21 May 2002 09:51:38 -0000      1.2
  @@ -8,6 +8,8 @@
   
   package org.apache.batik.css.engine.sac;
   
  +import java.util.Set;
  +
   import org.w3c.css.sac.Condition;
   import org.w3c.dom.Element;
   
  @@ -16,7 +18,7 @@
    * {@link org.w3c.css.sac.Condition} interface.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephane Hillion</a>
  - * @version $Id: ExtendedCondition.java,v 1.1 2002/03/18 10:31:09 hillion Exp $
  + * @version $Id: ExtendedCondition.java,v 1.2 2002/05/21 09:51:38 hillion Exp $
    */
   public interface ExtendedCondition extends Condition {
   
  @@ -29,4 +31,9 @@
        * Returns the specificity of this condition.
        */
       int getSpecificity();
  +
  +    /**
  +     * Fills the given set with the attribute names found in this selector.
  +     */
  +    void fillAttributeSet(Set attrSet);
   }
  
  
  
  1.2       +8 -1      
xml-batik/sources/org/apache/batik/css/engine/sac/ExtendedSelector.java
  
  Index: ExtendedSelector.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/css/engine/sac/ExtendedSelector.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ExtendedSelector.java     18 Mar 2002 10:31:09 -0000      1.1
  +++ ExtendedSelector.java     21 May 2002 09:51:38 -0000      1.2
  @@ -8,6 +8,8 @@
   
   package org.apache.batik.css.engine.sac;
   
  +import java.util.Set;
  +
   import org.w3c.css.sac.Selector;
   import org.w3c.dom.Element;
   
  @@ -15,7 +17,7 @@
    * This interface extends the {@link org.w3c.css.sac.Selector}.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephane Hillion</a>
  - * @version $Id: ExtendedSelector.java,v 1.1 2002/03/18 10:31:09 hillion Exp $
  + * @version $Id: ExtendedSelector.java,v 1.2 2002/05/21 09:51:38 hillion Exp $
    */
   public interface ExtendedSelector extends Selector {
   
  @@ -28,4 +30,9 @@
        * Returns the specificity of this selector.
        */
       int getSpecificity();
  +
  +    /**
  +     * Fills the given set with the attribute names found in this selector.
  +     */
  +    void fillAttributeSet(Set attrSet);
   }
  
  
  
  1.12      +30 -13    
xml-batik/sources/org/apache/batik/dom/svg/SVGOMStyleElement.java
  
  Index: SVGOMStyleElement.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/dom/svg/SVGOMStyleElement.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SVGOMStyleElement.java    24 Apr 2002 13:01:26 -0000      1.11
  +++ SVGOMStyleElement.java    21 May 2002 09:51:38 -0000      1.12
  @@ -20,15 +20,21 @@
   
   import org.w3c.dom.DOMException;
   import org.w3c.dom.Node;
  -import org.w3c.dom.stylesheets.LinkStyle;
  +
   import org.w3c.dom.css.DOMImplementationCSS;
  +
  +import org.w3c.dom.events.Event;
  +import org.w3c.dom.events.EventListener;
  +
  +import org.w3c.dom.stylesheets.LinkStyle;
  +
   import org.w3c.dom.svg.SVGStyleElement;
   
   /**
    * This class implements {@link SVGStyleElement}.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephane Hillion</a>
  - * @version $Id: SVGOMStyleElement.java,v 1.11 2002/04/24 13:01:26 hillion Exp $
  + * @version $Id: SVGOMStyleElement.java,v 1.12 2002/05/21 09:51:38 hillion Exp $
    */
   public class SVGOMStyleElement
       extends    SVGOMElement
  @@ -51,12 +57,18 @@
       /**
        * The style sheet.
        */
  -    protected org.w3c.dom.stylesheets.StyleSheet sheet;
  +    protected transient org.w3c.dom.stylesheets.StyleSheet sheet;
   
       /**
  -     * The style-sheet.
  +     * The DOM CSS style-sheet.
        */
  -    protected StyleSheet styleSheet;
  +    protected transient StyleSheet styleSheet;
  +
  +    /**
  +     * The listener used to track the content changes.
  +     */
  +    protected transient EventListener domCharacterDataModifiedListener =
  +        new DOMCharacterDataModifiedListener();
   
       /**
        * Creates a new SVGOMStyleElement object.
  @@ -71,7 +83,6 @@
        */
       public SVGOMStyleElement(String prefix, AbstractDocument owner) {
           super(prefix, owner);
  -
       }
   
       /**
  @@ -112,6 +123,9 @@
                   }
                   String  media = getAttributeNS(null, SVG_MEDIA_ATTRIBUTE);
                   styleSheet = e.parseStyleSheet(text, burl, media);
  +                addEventListener("DOMCharacterDataModified",
  +                                 domCharacterDataModifiedListener,
  +                                 false);
               }
           }
           return styleSheet;
  @@ -126,13 +140,6 @@
       }
   
       /**
  -     * Returns the URI of the referenced stylesheet.
  -     */
  -    public String getStyleSheetURI() {
  -        return XMLBaseSupport.getCascadedXMLBase(this);
  -    }
  -
  -    /**
        * <b>DOM</b>: Implements {@link SVGStyleElement#getXMLspace()}.
        */
       public String getXMLspace() {
  @@ -203,5 +210,15 @@
        */
       protected Node newNode() {
           return new SVGOMStyleElement();
  +    }
  +
  +    /**
  +     * The DOMCharacterDataModified listener.
  +     */
  +    protected class DOMCharacterDataModifiedListener
  +        implements EventListener {
  +        public void handleEvent(Event evt) {
  +            styleSheet = null;
  +        }
       }
   }
  
  
  
  1.4       +11 -1     
xml-batik/sources/org/apache/batik/dom/svg/SVGStyleSheetProcessingInstruction.java
  
  Index: SVGStyleSheetProcessingInstruction.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/dom/svg/SVGStyleSheetProcessingInstruction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SVGStyleSheetProcessingInstruction.java   29 Apr 2002 12:25:05 -0000      1.3
  +++ SVGStyleSheetProcessingInstruction.java   21 May 2002 09:51:38 -0000      1.4
  @@ -25,6 +25,7 @@
   
   import org.w3c.css.sac.InputSource;
   
  +import org.w3c.dom.DOMException;
   import org.w3c.dom.Node;
   
   /**
  @@ -32,7 +33,7 @@
    * instructions.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephane Hillion</a>
  - * @version $Id: SVGStyleSheetProcessingInstruction.java,v 1.3 2002/04/29 12:25:05 
hillion Exp $
  + * @version $Id: SVGStyleSheetProcessingInstruction.java,v 1.4 2002/05/21 09:51:38 
hillion Exp $
    */
   public class SVGStyleSheetProcessingInstruction
       extends StyleSheetProcessingInstruction
  @@ -105,6 +106,15 @@
               }
           }
           return styleSheet;
  +    }
  +
  +    /**
  +     * <b>DOM</b>: Implements {@link
  +     * org.w3c.dom.ProcessingInstruction#setData(String)}.
  +     */
  +    public void setData(String data) throws DOMException {
  +     super.setData(data);
  +        styleSheet = null;
       }
   
       /**
  
  
  

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

Reply via email to