aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/encoding_support.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2017-08-23 17:50:13 -0700
committerJosh Matthews <josh@joshmatthews.net>2017-08-24 10:41:06 -0700
commit1297c0ff51f1f5ab39221d6489574bcd7a85663b (patch)
tree33dba5dec67902da55351107336968a8145b3e0e /components/style/encoding_support.rs
parent2e775abfa4563fc5db467c5c79f9d2507f6bb2e7 (diff)
downloadservo-1297c0ff51f1f5ab39221d6489574bcd7a85663b.tar.gz
servo-1297c0ff51f1f5ab39221d6489574bcd7a85663b.zip
Devirtualize CSS error reporting.
Diffstat (limited to 'components/style/encoding_support.rs')
-rw-r--r--components/style/encoding_support.rs40
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,