diff options
Diffstat (limited to 'components/style/encoding_support.rs')
-rw-r--r-- | components/style/encoding_support.rs | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/components/style/encoding_support.rs b/components/style/encoding_support.rs index 6560342e942..a354938c3a7 100644 --- a/components/style/encoding_support.rs +++ b/components/style/encoding_support.rs @@ -49,17 +49,19 @@ impl Stylesheet { /// /// Takes care of decoding the network bytes and forwards the resulting /// string to `Stylesheet::from_str`. - pub fn from_bytes(bytes: &[u8], - url_data: UrlExtraData, - protocol_encoding_label: Option<&str>, - environment_encoding: Option<EncodingRef>, - origin: Origin, - media: MediaList, - shared_lock: SharedRwLock, - stylesheet_loader: Option<&StylesheetLoader>, - error_reporter: &ParseErrorReporter, - quirks_mode: QuirksMode) - -> Stylesheet { + pub fn from_bytes<R>(bytes: &[u8], + url_data: UrlExtraData, + protocol_encoding_label: Option<&str>, + environment_encoding: Option<EncodingRef>, + origin: Origin, + media: MediaList, + shared_lock: SharedRwLock, + stylesheet_loader: Option<&StylesheetLoader>, + error_reporter: &R, + quirks_mode: QuirksMode) + -> Stylesheet + where R: ParseErrorReporter + { let (string, _) = decode_stylesheet_bytes( bytes, protocol_encoding_label, environment_encoding); Stylesheet::from_str(&string, @@ -75,13 +77,15 @@ impl Stylesheet { /// Updates an empty stylesheet with a set of bytes that reached over the /// network. - pub fn update_from_bytes(existing: &Stylesheet, - bytes: &[u8], - protocol_encoding_label: Option<&str>, - environment_encoding: Option<EncodingRef>, - url_data: UrlExtraData, - stylesheet_loader: Option<&StylesheetLoader>, - error_reporter: &ParseErrorReporter) { + pub fn update_from_bytes<R>(existing: &Stylesheet, + bytes: &[u8], + protocol_encoding_label: Option<&str>, + environment_encoding: Option<EncodingRef>, + url_data: UrlExtraData, + stylesheet_loader: Option<&StylesheetLoader>, + error_reporter: &R) + where R: ParseErrorReporter + { let (string, _) = decode_stylesheet_bytes( bytes, protocol_encoding_label, environment_encoding); Self::update_from_str(existing, |