Rule r = ss.getRule(i);
int len = ss.getSize(); for (int i = 0; i < len; i++) { Rule r = ss.getRule(i); switch (r.getType()) { case StyleRule.TYPE:
int len = ss.getSize(); for (int i = 0; i < len; i++) { Rule r = ss.getRule(i); switch (r.getType()) { case StyleRule.TYPE:
int len = ss.getSize(); for (int i = 0; i < len; i++) { Rule r = ss.getRule(i); switch (r.getType()) { case StyleRule.TYPE:
/** * 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 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 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; } }
/** * 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; } } }