public StyleSheet parseStyleSheetForDocument(Document document, String rules, URL uri, String media, Object location) { XhtmlCssEngine engine = getCssEngine(document); if (engine == null) { return new StyleSheet(); } return engine.parseStyleSheet(rules, uri, media, location); }
/** * Returns the associated style-sheet. */ public StyleSheet getCSSStyleSheet() { if (styleSheet == null) { HashMap<String, String> attrs = getPseudoAttributes(); String type = attrs.get("type"); if ("text/css".equals(type)) { String title = attrs.get("title"); String media = attrs.get("media"); String href = attrs.get("href"); String alternate = attrs.get("alternate"); SVGOMDocument doc = (SVGOMDocument)getOwnerDocument(); ParsedURL durl = doc.getParsedURL(); ParsedURL burl = new ParsedURL(durl, href); CSSEngine e = doc.getCSSEngine(); styleSheet = e.parseStyleSheet(burl, media); styleSheet.setAlternate("yes".equals(alternate)); styleSheet.setTitle(title); } } return styleSheet; }
/** * <b>SAC</b>: Implements {@link * org.w3c.css.sac.DocumentHandler#startMedia(SACMediaList)}. */ public void startMedia(SACMediaList media) throws CSSException { MediaRule mr = new MediaRule(); mr.setMediaList(media); mr.setParent(styleSheet); styleSheet.append(mr); styleSheet = mr; }
/** * Parses and creates a new style-sheet. * @param rules The style-sheet rules to parse. * @param uri The style-sheet URI. * @param media The target media of the style-sheet. */ public StyleSheet parseStyleSheet(String rules, ParsedURL uri, String media) throws DOMException { StyleSheet ss = new StyleSheet(); try { ss.setMedia(parser.parseMedia(media)); } catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return ss; } parseStyleSheet(ss, rules, uri); return ss; }
StyleSheet ss = ssn.getCSSStyleSheet(); if (ss != null && (!ss.isAlternate() || ss.getTitle() == null || ss.getTitle().equals(alternateStyleSheet)) && mediaMatch(ss.getMedia())) { addMatchingRules(rules, ss, elt, pseudo);
styleSheet.setAlternate(isAlternate); if (title.length() == 0 && !isAlternate) { styleSheet.setTitle(title); styleSheet.setupFilters();
/** * <b>SAC</b>: Implements {@link * org.w3c.css.sac.DocumentHandler#endMedia(SACMediaList)}. */ public void endMedia(SACMediaList media) throws CSSException { styleSheet = styleSheet.getParent(); }
/** * Parses and creates a new style-sheet. * @param rules The style-sheet rules to parse. * @param uri The style-sheet URI. * @param media The target media of the style-sheet. */ public StyleSheet parseStyleSheet(String rules, ParsedURL uri, String media) throws DOMException { StyleSheet ss = new StyleSheet(); try { ss.setMedia(parser.parseMedia(media)); } catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return ss; } parseStyleSheet(ss, rules, uri); return ss; }
StyleSheet ss = ssn.getCSSStyleSheet(); if (ss != null && (!ss.isAlternate() || ss.getTitle() == null || ss.getTitle().equals(alternateStyleSheet)) && mediaMatch(ss.getMedia())) { addMatchingRules(rules, ss, elt, pseudo);
styleSheet.setAlternate(isAlternate); if (title.length() == 0 && !isAlternate) { styleSheet.setTitle(title); styleSheet.setupFilters();
/** * <b>SAC</b>: Implements {@link * org.w3c.css.sac.DocumentHandler#endMedia(SACMediaList)}. */ public void endMedia(SACMediaList media) throws CSSException { styleSheet = styleSheet.getParent(); }
/** * Parses and fills the given style-sheet. * @param ss The stylesheet to fill. * @param uri The base URI. */ protected void parseStyleSheet(StyleSheet ss, InputSource is, ParsedURL uri) throws IOException { parser.setSelectorFactory(CSSSelectorFactory.INSTANCE); parser.setConditionFactory(cssConditionFactory); try { cssBaseURI = uri; styleSheetDocumentHandler.styleSheet = ss; parser.setDocumentHandler(styleSheetDocumentHandler); parser.parseStyleSheet(is); // Load the imported sheets. int len = ss.getSize(); for (int i = 0; i < len; i++) { Rule r = ss.getRule(i); if (r.getType() != ImportRule.TYPE) { // @import rules must be the first rules. break; } ImportRule ir = (ImportRule)r; parseStyleSheet(ir, ir.getURI()); } } finally { cssBaseURI = null; } }
/** * Parses and creates a new style-sheet. * @param rules The style-sheet rules to parse. * @param uri The style-sheet URI. * @param media The target media of the style-sheet. */ public StyleSheet parseStyleSheet(String rules, ParsedURL uri, String media) throws DOMException { StyleSheet ss = new StyleSheet(); try { ss.setMedia(parser.parseMedia(media)); } catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return ss; } parseStyleSheet(ss, rules, uri); return ss; }
StyleSheet ss = ssn.getCSSStyleSheet(); if (ss != null && (!ss.isAlternate() || ss.getTitle() == null || ss.getTitle().equals(alternateStyleSheet)) && mediaMatch(ss.getMedia())) { addMatchingRules(rules, ss, elt, pseudo);
/** * Returns the associated style-sheet. */ public StyleSheet getCSSStyleSheet() { if (styleSheet == null) { HashMap<String, String> attrs = getPseudoAttributes(); String type = attrs.get("type"); if ("text/css".equals(type)) { String title = attrs.get("title"); String media = attrs.get("media"); String href = attrs.get("href"); String alternate = attrs.get("alternate"); SVGOMDocument doc = (SVGOMDocument)getOwnerDocument(); ParsedURL durl = doc.getParsedURL(); ParsedURL burl = new ParsedURL(durl, href); CSSEngine e = doc.getCSSEngine(); styleSheet = e.parseStyleSheet(burl, media); styleSheet.setAlternate("yes".equals(alternate)); styleSheet.setTitle(title); } } return styleSheet; }
private StyleSheet parseStyleSheetForDocument(Document document, InputSource inputSource, URL uri, String media, Object location) { XhtmlCssEngine engine = getCssEngine(document); if (engine == null) { return new StyleSheet(); } return engine.parseStyleSheet(inputSource, uri, media, location); }
/** * <b>SAC</b>: Implements {@link * org.w3c.css.sac.DocumentHandler#startMedia(SACMediaList)}. */ public void startMedia(SACMediaList media) throws CSSException { MediaRule mr = new MediaRule(); mr.setMediaList(media); mr.setParent(styleSheet); styleSheet.append(mr); styleSheet = mr; }
/** * <b>SAC</b>: Implements {@link * org.w3c.css.sac.DocumentHandler#endMedia(SACMediaList)}. */ public void endMedia(SACMediaList media) throws CSSException { styleSheet = styleSheet.getParent(); }