@@ -6,9 +6,7 @@ use std::str;
66
77use encoding:: label:: encoding_from_whatwg_label;
88use encoding:: all:: UTF_8 ;
9- use encoding:: Encoding ;
10- use encoding:: DecodeReplace ;
11- use encoding:: decode;
9+ use encoding:: { EncodingObj , DecodeReplace , decode} ;
1210
1311use tokenizer:: { tokenize, Tokenizer } ;
1412use parser:: { parse_stylesheet_rules, StylesheetParser } ;
@@ -33,8 +31,8 @@ use parser::{parse_stylesheet_rules, StylesheetParser};
3331/// A 2-tuple of a decoded Unicode string
3432/// and the `Encoding` object that was used.
3533pub fn decode_stylesheet_bytes ( css : & [ u8 ] , protocol_encoding_label : Option < & str > ,
36- environment_encoding : Option < & ' static Encoding > )
37- -> ( ~str , & ' static Encoding ) {
34+ environment_encoding : Option < EncodingObj > )
35+ -> ( ~str , EncodingObj ) {
3836 // http://dev.w3.org/csswg/css-syntax/#the-input-byte-stream
3937 match protocol_encoding_label {
4038 None => ( ) ,
@@ -56,7 +54,7 @@ pub fn decode_stylesheet_bytes(css: &[u8], protocol_encoding_label: Option<&str>
5654 None => ( ) ,
5755 Some ( fallback) => match fallback. name ( ) {
5856 "utf-16be" | "utf-16le"
59- => return decode_replace ( css, UTF_8 as & ' static Encoding ) ,
57+ => return decode_replace ( css, UTF_8 as EncodingObj ) ,
6058 _ => return decode_replace ( css, fallback) ,
6159 }
6260 }
@@ -67,12 +65,12 @@ pub fn decode_stylesheet_bytes(css: &[u8], protocol_encoding_label: Option<&str>
6765 None => ( ) ,
6866 Some ( fallback) => return decode_replace ( css, fallback)
6967 }
70- return decode_replace ( css, UTF_8 as & ' static Encoding )
68+ return decode_replace ( css, UTF_8 as EncodingObj )
7169}
7270
7371
7472#[ inline]
75- fn decode_replace ( input : & [ u8 ] , fallback_encoding : & ' static Encoding ) -> ( ~str , & ' static Encoding ) {
73+ fn decode_replace ( input : & [ u8 ] , fallback_encoding : EncodingObj ) -> ( ~str , EncodingObj ) {
7674 let ( result, used_encoding) = decode ( input, DecodeReplace , fallback_encoding) ;
7775 ( result. unwrap ( ) , used_encoding)
7876}
@@ -94,8 +92,8 @@ fn decode_replace(input: &[u8], fallback_encoding: &'static Encoding)-> (~str, &
9492/// and the `Encoding` object that was used.
9593pub fn parse_stylesheet_rules_from_bytes (
9694 css_bytes : & [ u8 ] , protocol_encoding_label : Option < & str > ,
97- environment_encoding : Option < & ' static Encoding > )
98- -> ( StylesheetParser < Tokenizer > , & ' static Encoding ) {
95+ environment_encoding : Option < EncodingObj > )
96+ -> ( StylesheetParser < Tokenizer > , EncodingObj ) {
9997 let ( css_unicode, encoding) = decode_stylesheet_bytes (
10098 css_bytes, protocol_encoding_label, environment_encoding) ;
10199 ( parse_stylesheet_rules ( tokenize ( css_unicode) ) , encoding)
0 commit comments