mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Use a UrlExtraData type alias to unify url handling logic.
This commit is contained in:
parent
a097a293b5
commit
37585309e9
24 changed files with 166 additions and 272 deletions
|
@ -9,12 +9,10 @@ extern crate encoding;
|
|||
use cssparser::{stylesheet_encoding, EncodingSupport};
|
||||
use error_reporting::ParseErrorReporter;
|
||||
use media_queries::MediaList;
|
||||
use parser::ParserContextExtraData;
|
||||
use self::encoding::{EncodingRef, DecoderTrap};
|
||||
use servo_url::ServoUrl;
|
||||
use shared_lock::SharedRwLock;
|
||||
use std::str;
|
||||
use stylesheets::{Stylesheet, StylesheetLoader, Origin};
|
||||
use stylesheets::{Stylesheet, StylesheetLoader, Origin, UrlExtraData};
|
||||
|
||||
struct RustEncoding;
|
||||
|
||||
|
@ -50,26 +48,24 @@ impl Stylesheet {
|
|||
/// Takes care of decoding the network bytes and forwards the resulting
|
||||
/// string to `Stylesheet::from_str`.
|
||||
pub fn from_bytes(bytes: &[u8],
|
||||
base_url: ServoUrl,
|
||||
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,
|
||||
extra_data: ParserContextExtraData)
|
||||
error_reporter: &ParseErrorReporter)
|
||||
-> Stylesheet {
|
||||
let (string, _) = decode_stylesheet_bytes(
|
||||
bytes, protocol_encoding_label, environment_encoding);
|
||||
Stylesheet::from_str(&string,
|
||||
base_url,
|
||||
url_data,
|
||||
origin,
|
||||
media,
|
||||
shared_lock,
|
||||
stylesheet_loader,
|
||||
error_reporter,
|
||||
extra_data)
|
||||
error_reporter)
|
||||
}
|
||||
|
||||
/// Updates an empty stylesheet with a set of bytes that reached over the
|
||||
|
@ -79,14 +75,12 @@ impl Stylesheet {
|
|||
protocol_encoding_label: Option<&str>,
|
||||
environment_encoding: Option<EncodingRef>,
|
||||
stylesheet_loader: Option<&StylesheetLoader>,
|
||||
error_reporter: &ParseErrorReporter,
|
||||
extra_data: ParserContextExtraData) {
|
||||
error_reporter: &ParseErrorReporter) {
|
||||
let (string, _) = decode_stylesheet_bytes(
|
||||
bytes, protocol_encoding_label, environment_encoding);
|
||||
Self::update_from_str(existing,
|
||||
&string,
|
||||
stylesheet_loader,
|
||||
error_reporter,
|
||||
extra_data)
|
||||
error_reporter)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue