/** * Partially computes the style in the 'def' tree and set it in the 'use' * tree. * <p>Note: This method must be called only when 'use' has been * added to the DOM tree. * * @param refElement the referenced element * @param localRefElement the referenced element in the current document */ public static void computeStyleAndURIs(Element refElement, Element localRefElement, String uri) { // Pull fragement id off first... int idx = uri.indexOf('#'); if (idx != -1) uri = uri.substring(0,idx); // Only set xml:base if we have a real URL. if (uri.length() != 0) localRefElement.setAttributeNS(XML_NAMESPACE_URI, "base", uri); CSSEngine engine = CSSUtilities.getCSSEngine(localRefElement); CSSEngine refEngine = CSSUtilities.getCSSEngine(refElement); engine.importCascadedStyleMaps(refElement, refEngine, localRefElement); }
/** * Partially computes the style in the 'def' tree and set it in the 'use' * tree. * <p>Note: This method must be called only when 'use' has been * added to the DOM tree. * * @param refElement the referenced element * @param localRefElement the referenced element in the current document */ public static void computeStyleAndURIs(Element refElement, Element localRefElement, String uri) { // Pull fragement id off first... int idx = uri.indexOf('#'); if (idx != -1) uri = uri.substring(0,idx); // Only set xml:base if we have a real URL. if (uri.length() != 0) localRefElement.setAttributeNS(XML_NAMESPACE_URI, "base", uri); CSSEngine engine = CSSUtilities.getCSSEngine(localRefElement); CSSEngine refEngine = CSSUtilities.getCSSEngine(refElement); engine.importCascadedStyleMaps(refElement, refEngine, localRefElement); }
/** * Partially computes the style in the 'def' tree and set it in the 'use' * tree. * <p>Note: This method must be called only when 'use' has been * added to the DOM tree. * * @param refElement the referenced element * @param localRefElement the referenced element in the current document */ public static void computeStyleAndURIs(Element refElement, Element localRefElement, String uri) { // Pull fragement id off first... int idx = uri.indexOf('#'); if (idx != -1) uri = uri.substring(0,idx); // Only set xml:base if we have a real URL. if (uri.length() != 0) localRefElement.setAttributeNS(XML_NAMESPACE_URI, "base", uri); CSSEngine engine = CSSUtilities.getCSSEngine(localRefElement); CSSEngine refEngine = CSSUtilities.getCSSEngine(refElement); engine.importCascadedStyleMaps(refElement, refEngine, localRefElement); }
/** * Recursively imports the cascaded style from a source element * to an element of the current document. */ public void importCascadedStyleMaps(Element src, CSSEngine srceng, Element dest) { if (src instanceof CSSStylableElement) { CSSStylableElement csrc = (CSSStylableElement)src; CSSStylableElement cdest = (CSSStylableElement)dest; StyleMap sm = srceng.getCascadedStyleMap(csrc, null); sm.setFixedCascadedStyle(true); cdest.setComputedStyleMap(null, sm); if (pseudoElementNames != null) { int len = pseudoElementNames.length; for (int i = 0; i < len; i++) { String pe = pseudoElementNames[i]; sm = srceng.getCascadedStyleMap(csrc, pe); cdest.setComputedStyleMap(pe, sm); } } } for (Node dn = getCSSFirstChild(dest), sn = getCSSFirstChild(src); dn != null; dn = getCSSNextSibling(dn), sn = getCSSNextSibling(sn)) { if (sn.getNodeType() == Node.ELEMENT_NODE) { importCascadedStyleMaps((Element)sn, srceng, (Element)dn); } } }
/** * Recursively imports the cascaded style from a source element * to an element of the current document. */ public void importCascadedStyleMaps(Element src, CSSEngine srceng, Element dest) { if (src instanceof CSSStylableElement) { CSSStylableElement csrc = (CSSStylableElement)src; CSSStylableElement cdest = (CSSStylableElement)dest; StyleMap sm = srceng.getCascadedStyleMap(csrc, null); sm.setFixedCascadedStyle(true); cdest.setComputedStyleMap(null, sm); if (pseudoElementNames != null) { int len = pseudoElementNames.length; for (String pe : pseudoElementNames) { sm = srceng.getCascadedStyleMap(csrc, pe); cdest.setComputedStyleMap(pe, sm); } } } for (Node dn = getCSSFirstChild(dest), sn = getCSSFirstChild(src); dn != null; dn = getCSSNextSibling(dn), sn = getCSSNextSibling(sn)) { if (sn.getNodeType() == Node.ELEMENT_NODE) { importCascadedStyleMaps((Element)sn, srceng, (Element)dn); } } }
/** * Recursively imports the cascaded style from a source element * to an element of the current document. */ public void importCascadedStyleMaps(Element src, CSSEngine srceng, Element dest) { if (src instanceof CSSStylableElement) { CSSStylableElement csrc = (CSSStylableElement)src; CSSStylableElement cdest = (CSSStylableElement)dest; StyleMap sm = srceng.getCascadedStyleMap(csrc, null); sm.setFixedCascadedStyle(true); cdest.setComputedStyleMap(null, sm); if (pseudoElementNames != null) { int len = pseudoElementNames.length; for (String pe : pseudoElementNames) { sm = srceng.getCascadedStyleMap(csrc, pe); cdest.setComputedStyleMap(pe, sm); } } } for (Node dn = getCSSFirstChild(dest), sn = getCSSFirstChild(src); dn != null; dn = getCSSNextSibling(dn), sn = getCSSNextSibling(sn)) { if (sn.getNodeType() == Node.ELEMENT_NODE) { importCascadedStyleMaps((Element)sn, srceng, (Element)dn); } } }