/** * Returns a printable representation of this style-sheet. */ public String toString(CSSEngine eng) { StringBuffer sb = new StringBuffer( size * 8 ); for (int i = 0; i < size; i++) { sb.append(rules[i].toString(eng)); } return sb.toString(); } }
Rule r = ss.getRule(i); switch (r.getType()) { case StyleRule.TYPE:
for (int i = 0; i < len; i++) { Rule r = ss.getRule(i); switch (r.getType()) { case StyleRule.TYPE: StyleRule style = (StyleRule)r;
for (int i = 0; i < len; i++) { Rule r = ss.getRule(i); switch (r.getType()) { case StyleRule.TYPE: StyleRule style = (StyleRule)r;
/** * Returns a printable representation of this style-sheet. */ public String toString(CSSEngine eng) { StringBuffer sb = new StringBuffer( size * 8 ); for (int i = 0; i < size; i++) { sb.append(rules[i].toString(eng)); } return sb.toString(); } }
for (int i = 0; i < len; i++) { Rule r = ss.getRule(i); switch (r.getType()) { case StyleRule.TYPE: StyleRule style = (StyleRule)r;
/** * Returns a printable representation of this style-sheet. */ public String toString(CSSEngine eng) { StringBuffer sb = new StringBuffer( size * 8 ); for (int i = 0; i < size; i++) { sb.append(rules[i].toString(eng)); } return sb.toString(); } }
/** * 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; } }
/** * Returns a printable representation of this media rule. */ public String toString(CSSEngine eng) { StringBuffer sb = new StringBuffer(); sb.append("@media"); if (mediaList != null) { for (int i = 0; i < mediaList.getLength(); i++) { sb.append(' '); sb.append(mediaList.item(i)); } } sb.append(" {\n"); for (int i = 0; i < size; i++) { sb.append(rules[i].toString(eng)); } sb.append("}\n"); return sb.toString(); } }
/** * 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; } }
/** * Returns a printable representation of this media rule. */ public String toString(CSSEngine eng) { StringBuffer sb = new StringBuffer(); sb.append("@media"); if (mediaList != null) { for (int i = 0; i < mediaList.getLength(); i++) { sb.append(' '); sb.append(mediaList.item(i)); } } sb.append(" {\n"); for (int i = 0; i < size; i++) { sb.append(rules[i].toString(eng)); } sb.append("}\n"); return sb.toString(); } }
/** * 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; } }
/** * Returns a printable representation of this media rule. */ public String toString(CSSEngine eng) { StringBuffer sb = new StringBuffer(); sb.append("@media"); if (mediaList != null) { for (int i = 0; i < mediaList.getLength(); i++) { sb.append(' '); sb.append(mediaList.item(i)); } } sb.append(" {\n"); for (int i = 0; i < size; i++) { sb.append(rules[i].toString(eng)); } sb.append("}\n"); return sb.toString(); } }
/** * 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; } } }
/** * 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; } } }
/** * 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; } } }