mirror of
https://github.com/servo/servo.git
synced 2025-07-02 21:13:39 +01:00
Upgrade to rust-encoding upstream.
This commit is contained in:
parent
4f673f031e
commit
b6b89639dc
4 changed files with 9 additions and 9 deletions
|
@ -8,7 +8,7 @@ use std::cell::Cell;
|
||||||
use std::comm;
|
use std::comm;
|
||||||
use std::comm::Port;
|
use std::comm::Port;
|
||||||
use std::task;
|
use std::task;
|
||||||
use encoding::EncodingObj;
|
use encoding::EncodingRef;
|
||||||
use encoding::all::UTF_8;
|
use encoding::all::UTF_8;
|
||||||
use style::Stylesheet;
|
use style::Stylesheet;
|
||||||
use servo_net::resource_task::{Load, LoadResponse, ProgressMsg, Payload, Done, ResourceTask};
|
use servo_net::resource_task::{Load, LoadResponse, ProgressMsg, Payload, Done, ResourceTask};
|
||||||
|
@ -26,7 +26,7 @@ pub fn spawn_css_parser(provenance: StylesheetProvenance,
|
||||||
let (result_port, result_chan) = comm::stream();
|
let (result_port, result_chan) = comm::stream();
|
||||||
|
|
||||||
// TODO: Get the actual value. http://dev.w3.org/csswg/css-syntax/#environment-encoding
|
// TODO: Get the actual value. http://dev.w3.org/csswg/css-syntax/#environment-encoding
|
||||||
let environment_encoding = UTF_8 as EncodingObj;
|
let environment_encoding = UTF_8 as EncodingRef;
|
||||||
|
|
||||||
let provenance_cell = Cell::new(provenance);
|
let provenance_cell = Cell::new(provenance);
|
||||||
do task::spawn {
|
do task::spawn {
|
||||||
|
|
|
@ -6,7 +6,7 @@ use std::iter::Iterator;
|
||||||
use std::ascii::StrAsciiExt;
|
use std::ascii::StrAsciiExt;
|
||||||
use extra::url::Url;
|
use extra::url::Url;
|
||||||
|
|
||||||
use encoding::EncodingObj;
|
use encoding::EncodingRef;
|
||||||
|
|
||||||
use cssparser::{decode_stylesheet_bytes, tokenize, parse_stylesheet_rules, ToCss};
|
use cssparser::{decode_stylesheet_bytes, tokenize, parse_stylesheet_rules, ToCss};
|
||||||
use cssparser::ast::*;
|
use cssparser::ast::*;
|
||||||
|
@ -23,7 +23,7 @@ pub struct Stylesheet {
|
||||||
/// cascading order)
|
/// cascading order)
|
||||||
rules: ~[CSSRule],
|
rules: ~[CSSRule],
|
||||||
namespaces: NamespaceMap,
|
namespaces: NamespaceMap,
|
||||||
encoding: EncodingObj,
|
encoding: EncodingRef,
|
||||||
base_url: Url,
|
base_url: Url,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ pub struct StyleRule {
|
||||||
impl Stylesheet {
|
impl Stylesheet {
|
||||||
pub fn from_bytes_iter<I: Iterator<~[u8]>>(
|
pub fn from_bytes_iter<I: Iterator<~[u8]>>(
|
||||||
mut input: I, base_url: Url, protocol_encoding_label: Option<&str>,
|
mut input: I, base_url: Url, protocol_encoding_label: Option<&str>,
|
||||||
environment_encoding: Option<EncodingObj>) -> Stylesheet {
|
environment_encoding: Option<EncodingRef>) -> Stylesheet {
|
||||||
let mut bytes = ~[];
|
let mut bytes = ~[];
|
||||||
// TODO: incremental decoding and tokinization/parsing
|
// TODO: incremental decoding and tokinization/parsing
|
||||||
for chunk in input {
|
for chunk in input {
|
||||||
|
@ -54,13 +54,13 @@ impl Stylesheet {
|
||||||
|
|
||||||
pub fn from_bytes(
|
pub fn from_bytes(
|
||||||
bytes: &[u8], base_url: Url, protocol_encoding_label: Option<&str>,
|
bytes: &[u8], base_url: Url, protocol_encoding_label: Option<&str>,
|
||||||
environment_encoding: Option<EncodingObj>) -> Stylesheet {
|
environment_encoding: Option<EncodingRef>) -> Stylesheet {
|
||||||
let (string, used_encoding) = decode_stylesheet_bytes(
|
let (string, used_encoding) = decode_stylesheet_bytes(
|
||||||
bytes, protocol_encoding_label, environment_encoding);
|
bytes, protocol_encoding_label, environment_encoding);
|
||||||
Stylesheet::from_str(string, base_url, used_encoding)
|
Stylesheet::from_str(string, base_url, used_encoding)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_str(css: &str, base_url: Url, encoding: EncodingObj) -> Stylesheet {
|
pub fn from_str(css: &str, base_url: Url, encoding: EncodingRef) -> Stylesheet {
|
||||||
static STATE_CHARSET: uint = 1;
|
static STATE_CHARSET: uint = 1;
|
||||||
static STATE_IMPORTS: uint = 2;
|
static STATE_IMPORTS: uint = 2;
|
||||||
static STATE_NAMESPACES: uint = 3;
|
static STATE_NAMESPACES: uint = 3;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 4eb52d5cb22e39c9edff848420c910b0b7ecafa5
|
Subproject commit 5178431109f4a51f38c257e36640702320c54958
|
|
@ -1 +1 @@
|
||||||
Subproject commit 47bef0fe76e094e7886f3eaabb652d0f43af1913
|
Subproject commit 1a6c011b697fe6d51a1d92a2504d6fac1b67d2dc
|
Loading…
Add table
Add a link
Reference in a new issue