protected StyleSheet parseAndImport ( Object source , NetworkProcessor network , String encoding , SourceType type , StyleSheet sheet , Preparator preparator , URL base , List < MediaQuery > media ) throws CSSException , IOException { CSSParser parser = createParser ( source , network , encoding , type , base ) ; CSSParserExtractor extractor = parse ( parser , type , preparator , media ) ; for ( int i = 0 ; i < extractor . getImportPaths ( ) . size ( ) ; i ++ ) { String path = extractor . getImportPaths ( ) . get ( i ) ; List < MediaQuery > imedia = extractor . getImportMedia ( ) . get ( i ) ; if ( ( ( imedia == null || imedia . isEmpty ( ) ) && CSSFactory . getAutoImportMedia ( ) . matchesEmpty ( ) ) //no media query specified || CSSFactory . getAutoImportMedia ( ) . matchesOneOf ( imedia ) ) //or some media query matches to the autoload media spec { URL url = DataURLHandler . createURL ( base , path ) ; try { parseAndImport ( url , network , encoding , SourceType . URL , sheet , preparator , url , imedia ) ; } catch ( IOException e ) { log . warn ( "Couldn't read imported style sheet: {}" , e . getMessage ( ) ) ; } } else log . trace ( "Skipping import {} (media not matching)" , path ) ; } return addRulesToStyleSheet ( extractor . getRules ( ) , sheet ) ; }
Parses the source using the given infrastructure and returns the resulting style sheet . The imports are handled recursively .