mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Auto merge of #15552 - servo:cssparserup, r=nox
Update cssparser to 0.9 <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15552) <!-- Reviewable:end -->
This commit is contained in:
commit
216a89f776
17 changed files with 72 additions and 82 deletions
29
Cargo.lock
generated
29
Cargo.lock
generated
|
@ -285,7 +285,7 @@ version = "0.0.1"
|
|||
dependencies = [
|
||||
"azure 0.11.0 (git+https://github.com/servo/rust-azure)",
|
||||
"canvas_traits 0.0.1",
|
||||
"cssparser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -301,7 +301,7 @@ dependencies = [
|
|||
name = "canvas_traits"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"cssparser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -543,10 +543,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cssparser"
|
||||
version = "0.8.0"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -942,7 +941,7 @@ version = "0.0.1"
|
|||
dependencies = [
|
||||
"app_units 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1351,7 +1350,7 @@ dependencies = [
|
|||
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"canvas_traits 0.0.1",
|
||||
"cssparser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gfx 0.0.1",
|
||||
|
@ -1662,7 +1661,7 @@ name = "msg"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"plugins 0.0.1",
|
||||
|
@ -2264,7 +2263,7 @@ dependencies = [
|
|||
"caseless 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cmake 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"deny_public_fields 0.0.1",
|
||||
"devtools_traits 0.0.1",
|
||||
"domobject_derive 0.0.1",
|
||||
|
@ -2333,7 +2332,7 @@ dependencies = [
|
|||
"app_units 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"canvas_traits 0.0.1",
|
||||
"cssparser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gfx_traits 0.0.1",
|
||||
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2401,7 +2400,7 @@ name = "selectors"
|
|||
version = "0.18.0"
|
||||
dependencies = [
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -2754,7 +2753,7 @@ dependencies = [
|
|||
"bindgen 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2796,7 +2795,7 @@ name = "style_tests"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"app_units 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"html5ever-atoms 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2817,7 +2816,7 @@ name = "style_traits"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"app_units 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2832,7 +2831,7 @@ version = "0.0.1"
|
|||
dependencies = [
|
||||
"app_units 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"geckoservo 0.0.1",
|
||||
|
@ -3397,7 +3396,7 @@ dependencies = [
|
|||
"checksum core-foundation-sys 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "41115a6aa5d3e1e5ef98148373f25971d1fad53818553f216495f9e67e90a624"
|
||||
"checksum core-graphics 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b205856aba54bfd36e69a1058f45fbe0d3c37be7375309dcff4a22a2a631fea"
|
||||
"checksum core-text 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9703f459a41e622b15ca612dbc5fa4b30b6545a32864a83e0fdc538cfa08969c"
|
||||
"checksum cssparser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "03414777f8f1b026d920f7f96e4a19d0237456a0485fb6135847b7699c258ec2"
|
||||
"checksum cssparser 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e99bbf5004f7a9cbba7cac7b83320b88eea4008f227c842d4ff2de4b99147352"
|
||||
"checksum dbghelp-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "97590ba53bcb8ac28279161ca943a924d1fd4a8fb3fa63302591647c4fc5b850"
|
||||
"checksum dbus 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "94d266a872aaf68b50d02083c429a3686935ab6ab54824290509cdc422673eaf"
|
||||
"checksum debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9a032eac705ca39214d169f83e3d3da290af06d8d1d344d1baad2fd002dca4b3"
|
||||
|
|
|
@ -12,7 +12,7 @@ path = "lib.rs"
|
|||
[dependencies]
|
||||
azure = {git = "https://github.com/servo/rust-azure", features = ["plugins"]}
|
||||
canvas_traits = {path = "../canvas_traits"}
|
||||
cssparser = {version = "0.8", features = ["heap_size", "serde-serialization"]}
|
||||
cssparser = {version = "0.9", features = ["heap_size", "serde-serialization"]}
|
||||
euclid = "0.10.1"
|
||||
gleam = "0.2.8"
|
||||
ipc-channel = "0.5"
|
||||
|
|
|
@ -10,7 +10,7 @@ name = "canvas_traits"
|
|||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
cssparser = {version = "0.8", features = ["heap_size", "serde-serialization"]}
|
||||
cssparser = {version = "0.9", features = ["heap_size", "serde-serialization"]}
|
||||
euclid = "0.10.1"
|
||||
heapsize = "0.3.0"
|
||||
heapsize_derive = "0.1"
|
||||
|
|
|
@ -14,7 +14,7 @@ app_units = "0.3"
|
|||
atomic_refcell = "0.1"
|
||||
bitflags = "0.7"
|
||||
canvas_traits = {path = "../canvas_traits"}
|
||||
cssparser = {version = "0.8", features = ["heap_size", "serde-serialization"]}
|
||||
cssparser = {version = "0.9", features = ["heap_size", "serde-serialization"]}
|
||||
euclid = "0.10.1"
|
||||
fnv = "1.0"
|
||||
gfx = {path = "../gfx"}
|
||||
|
|
|
@ -11,7 +11,7 @@ path = "lib.rs"
|
|||
|
||||
[dependencies]
|
||||
bitflags = "0.7"
|
||||
cssparser = {version = "0.8", features = ["heap_size", "serde-serialization"]}
|
||||
cssparser = {version = "0.9", features = ["heap_size", "serde-serialization"]}
|
||||
heapsize = "0.3.0"
|
||||
heapsize_derive = "0.1"
|
||||
plugins = {path = "../plugins"}
|
||||
|
|
|
@ -34,7 +34,7 @@ byteorder = "1.0"
|
|||
canvas_traits = {path = "../canvas_traits"}
|
||||
caseless = "0.1.0"
|
||||
cookie = {version = "0.2.5", features = ["serialize-rustc"]}
|
||||
cssparser = {version = "0.8", features = ["heap_size", "serde-serialization"]}
|
||||
cssparser = {version = "0.9", features = ["heap_size", "serde-serialization"]}
|
||||
deny_public_fields = {path = "../deny_public_fields"}
|
||||
devtools_traits = {path = "../devtools_traits"}
|
||||
domobject_derive = {path = "../domobject_derive"}
|
||||
|
|
|
@ -13,7 +13,7 @@ path = "lib.rs"
|
|||
app_units = "0.3"
|
||||
atomic_refcell = "0.1"
|
||||
canvas_traits = {path = "../canvas_traits"}
|
||||
cssparser = {version = "0.8", features = ["heap_size", "serde-serialization"]}
|
||||
cssparser = {version = "0.9", features = ["heap_size", "serde-serialization"]}
|
||||
euclid = "0.10.1"
|
||||
gfx_traits = {path = "../gfx_traits"}
|
||||
heapsize = "0.3.0"
|
||||
|
|
|
@ -18,5 +18,5 @@ path = "lib.rs"
|
|||
[dependencies]
|
||||
bitflags = "0.7"
|
||||
matches = "0.1"
|
||||
cssparser = ">=0.6, <0.9"
|
||||
cssparser = "0.9"
|
||||
fnv = "1.0"
|
||||
|
|
|
@ -26,7 +26,7 @@ app_units = "0.3"
|
|||
atomic_refcell = "0.1"
|
||||
bitflags = "0.7"
|
||||
cfg-if = "0.1.0"
|
||||
cssparser = "0.8"
|
||||
cssparser = "0.9"
|
||||
encoding = "0.2"
|
||||
euclid = "0.10.1"
|
||||
fnv = "1.0"
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
use computed_values::{font_style, font_weight, font_stretch};
|
||||
use computed_values::font_family::FamilyName;
|
||||
use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
|
||||
#[cfg(feature = "gecko")] use cssparser::UnicodeRange;
|
||||
use parser::{ParserContext, log_css_error, Parse};
|
||||
use std::fmt;
|
||||
use std::iter;
|
||||
|
@ -238,7 +239,7 @@ macro_rules! font_face_descriptors {
|
|||
dest.write_str("@font-face {\n")?;
|
||||
$(
|
||||
dest.write_str(concat!(" ", $m_name, ": "))?;
|
||||
self.$m_ident.to_css(dest)?;
|
||||
ToCss::to_css(&self.$m_ident, dest)?;
|
||||
dest.write_str(";\n")?;
|
||||
)*
|
||||
$(
|
||||
|
@ -247,7 +248,7 @@ macro_rules! font_face_descriptors {
|
|||
// But it can be false for other descriptors.
|
||||
if self.$o_ident != $o_initial {
|
||||
dest.write_str(concat!(" ", $o_name, ": "))?;
|
||||
self.$o_ident.to_css(dest)?;
|
||||
ToCss::to_css(&self.$o_ident, dest)?;
|
||||
dest.write_str(";\n")?;
|
||||
}
|
||||
)*
|
||||
|
@ -298,8 +299,8 @@ font_face_descriptors! {
|
|||
"font-stretch" stretch: font_stretch::T = font_stretch::T::normal,
|
||||
|
||||
/// The ranges of code points outside of which this font face should not be used.
|
||||
"unicode-range" unicode_range: Vec<unicode_range::Range> = vec![
|
||||
unicode_range::Range { start: 0, end: unicode_range::MAX }
|
||||
"unicode-range" unicode_range: Vec<UnicodeRange> = vec![
|
||||
UnicodeRange { start: 0, end: 0x10FFFF }
|
||||
],
|
||||
]
|
||||
}
|
||||
|
@ -316,51 +317,3 @@ font_face_descriptors! {
|
|||
optional descriptors = [
|
||||
]
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-fonts/#unicode-range-desc
|
||||
#[cfg(feature = "gecko")]
|
||||
pub mod unicode_range {
|
||||
use cssparser::{Parser, Token};
|
||||
use parser::{ParserContext, Parse};
|
||||
use std::fmt;
|
||||
use style_traits::{ToCss, OneOrMoreCommaSeparated};
|
||||
|
||||
/// Maximum value of the end of a range
|
||||
pub const MAX: u32 = ::std::char::MAX as u32;
|
||||
|
||||
/// A single range: https://drafts.csswg.org/css-fonts/#urange-value
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub struct Range {
|
||||
/// Start of the range, inclusive
|
||||
pub start: u32,
|
||||
|
||||
/// End of the range, inclusive
|
||||
pub end: u32,
|
||||
}
|
||||
|
||||
impl OneOrMoreCommaSeparated for Range {}
|
||||
|
||||
impl Parse for Range {
|
||||
fn parse(_context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
|
||||
// FIXME: The unicode-range token has been removed from the CSS Syntax spec,
|
||||
// cssparser should be updated accordingly
|
||||
// and implement https://drafts.csswg.org/css-syntax/#urange instead
|
||||
match input.next() {
|
||||
Ok(Token::UnicodeRange(start, end)) => {
|
||||
if end <= MAX && start <= end {
|
||||
Ok(Range { start: start, end: end })
|
||||
} else {
|
||||
Err(())
|
||||
}
|
||||
}
|
||||
_ => Err(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToCss for Range {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
Token::UnicodeRange(self.start, self.end).to_css(dest)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use cssparser::{Parser, SourcePosition};
|
||||
use cssparser::{Parser, SourcePosition, UnicodeRange};
|
||||
use error_reporting::ParseErrorReporter;
|
||||
#[cfg(feature = "gecko")]
|
||||
use gecko_bindings::sugar::refptr::{GeckoArcPrincipal, GeckoArcURI};
|
||||
|
@ -109,3 +109,9 @@ impl<T> Parse for Vec<T> where T: Parse + OneOrMoreCommaSeparated {
|
|||
input.parse_comma_separated(|input| T::parse(context, input))
|
||||
}
|
||||
}
|
||||
|
||||
impl Parse for UnicodeRange {
|
||||
fn parse(_context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
|
||||
UnicodeRange::parse(input)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
#![deny(missing_docs)]
|
||||
|
||||
use {Atom, Prefix, Namespace};
|
||||
use cssparser::{AtRuleParser, Parser, QualifiedRuleParser, decode_stylesheet_bytes};
|
||||
use cssparser::{AtRuleParser, Parser, QualifiedRuleParser, stylesheet_encoding, EncodingSupport};
|
||||
use cssparser::{AtRuleType, RuleListParser, SourcePosition, Token, parse_one_rule};
|
||||
use cssparser::ToCss as ParserToCss;
|
||||
use encoding::EncodingRef;
|
||||
use encoding::{self, EncodingRef, DecoderTrap};
|
||||
use error_reporting::ParseErrorReporter;
|
||||
use font_face::{FontFaceRule, parse_font_face_block};
|
||||
use keyframes::{Keyframe, parse_keyframe_list};
|
||||
|
@ -24,6 +24,7 @@ use servo_config::prefs::PREFS;
|
|||
use servo_url::ServoUrl;
|
||||
use std::cell::Cell;
|
||||
use std::fmt;
|
||||
use std::str;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use style_traits::ToCss;
|
||||
|
@ -543,6 +544,33 @@ impl ToCss for StyleRule {
|
|||
}
|
||||
}
|
||||
|
||||
struct RustEncoding;
|
||||
|
||||
impl EncodingSupport for RustEncoding {
|
||||
type Encoding = EncodingRef;
|
||||
|
||||
fn utf8() -> Self::Encoding {
|
||||
encoding::all::UTF_8
|
||||
}
|
||||
|
||||
fn is_utf16_be_or_le(encoding: &Self::Encoding) -> bool {
|
||||
matches!(encoding.name(), "utf-16be" | "utf-16le")
|
||||
}
|
||||
|
||||
fn from_label(ascii_label: &[u8]) -> Option<Self::Encoding> {
|
||||
str::from_utf8(ascii_label).ok().and_then(encoding::label::encoding_from_whatwg_label)
|
||||
}
|
||||
}
|
||||
|
||||
fn decode_stylesheet_bytes(css: &[u8], protocol_encoding_label: Option<&str>,
|
||||
environment_encoding: Option<EncodingRef>)
|
||||
-> (String, EncodingRef) {
|
||||
let fallback_encoding = stylesheet_encoding::<RustEncoding>(
|
||||
css, protocol_encoding_label.map(str::as_bytes), environment_encoding);
|
||||
let (result, used_encoding) = encoding::decode(css, DecoderTrap::Replace, fallback_encoding);
|
||||
(result.unwrap(), used_encoding)
|
||||
}
|
||||
|
||||
impl Stylesheet {
|
||||
/// Parse a stylesheet from a set of bytes, potentially received over the
|
||||
/// network.
|
||||
|
|
|
@ -15,7 +15,7 @@ servo = ["heapsize", "heapsize_derive", "serde", "serde_derive",
|
|||
|
||||
[dependencies]
|
||||
app_units = "0.3"
|
||||
cssparser = "0.8"
|
||||
cssparser = "0.9"
|
||||
euclid = "0.10.1"
|
||||
heapsize = {version = "0.3.0", optional = true}
|
||||
heapsize_derive = {version = "0.1", optional = true}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
//! Helper types and traits for the handling of CSS values.
|
||||
|
||||
use app_units::Au;
|
||||
use cssparser::UnicodeRange;
|
||||
use std::fmt;
|
||||
|
||||
/// The real `ToCss` trait can't be implemented for types in crates that don't
|
||||
|
@ -27,6 +28,8 @@ pub trait ToCss {
|
|||
/// Marker trait to automatically implement ToCss for Vec<T>.
|
||||
pub trait OneOrMoreCommaSeparated {}
|
||||
|
||||
impl OneOrMoreCommaSeparated for UnicodeRange {}
|
||||
|
||||
impl<T> ToCss for Vec<T> where T: ToCss + OneOrMoreCommaSeparated {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
let mut iter = self.iter();
|
||||
|
@ -69,6 +72,7 @@ impl_to_css_for_predefined_type!(u32);
|
|||
impl_to_css_for_predefined_type!(::cssparser::Token<'a>);
|
||||
impl_to_css_for_predefined_type!(::cssparser::RGBA);
|
||||
impl_to_css_for_predefined_type!(::cssparser::Color);
|
||||
impl_to_css_for_predefined_type!(::cssparser::UnicodeRange);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! define_css_keyword_enum {
|
||||
|
|
|
@ -15,7 +15,7 @@ bindgen = ["style/use_bindgen"]
|
|||
[dependencies]
|
||||
app_units = "0.3"
|
||||
atomic_refcell = "0.1"
|
||||
cssparser = {version = "0.8"}
|
||||
cssparser = {version = "0.9"}
|
||||
env_logger = {version = "0.4", default-features = false} # disable `regex` to reduce code size
|
||||
euclid = "0.10.1"
|
||||
lazy_static = "0.2"
|
||||
|
|
|
@ -14,7 +14,7 @@ testing = ["style/testing"]
|
|||
|
||||
[dependencies]
|
||||
app_units = "0.3"
|
||||
cssparser = {version = "0.8", features = ["heap_size"]}
|
||||
cssparser = {version = "0.9", features = ["heap_size"]}
|
||||
euclid = "0.10.1"
|
||||
html5ever-atoms = "0.1"
|
||||
matches = "0.1"
|
||||
|
|
|
@ -14,7 +14,7 @@ doctest = false
|
|||
[dependencies]
|
||||
app_units = "0.3"
|
||||
atomic_refcell = "0.1"
|
||||
cssparser = {version = "0.8"}
|
||||
cssparser = "0.9"
|
||||
env_logger = "0.4"
|
||||
euclid = "0.10.1"
|
||||
lazy_static = "0.2"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue