mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Update rustc to revision 2cfb5acb5a2751c759627377e602bac4f88f2d19.
This commit is contained in:
parent
cf616b90a2
commit
16c7060bc8
153 changed files with 2095 additions and 1298 deletions
|
@ -24,9 +24,6 @@ git = "https://github.com/servo/rust-url"
|
|||
[dependencies.cssparser]
|
||||
git = "https://github.com/servo/rust-cssparser"
|
||||
|
||||
[dependencies.encoding]
|
||||
git = "https://github.com/lifthrasiir/rust-encoding"
|
||||
|
||||
[dependencies.lazy_static]
|
||||
git = "https://github.com/Kimundi/lazy-static.rs"
|
||||
|
||||
|
@ -38,3 +35,4 @@ git = "https://github.com/servo/string-cache"
|
|||
|
||||
[dependencies]
|
||||
text_writer = "0.1.1"
|
||||
encoding = "0.2"
|
||||
|
|
|
@ -18,12 +18,14 @@ use servo_util::smallvec::VecLike;
|
|||
use servo_util::str::LengthOrPercentageOrAuto;
|
||||
|
||||
/// Legacy presentational attributes that take a length as defined in HTML5 § 2.4.4.4.
|
||||
#[deriving(Copy, PartialEq, Eq)]
|
||||
pub enum LengthAttribute {
|
||||
/// `<td width>`
|
||||
Width,
|
||||
}
|
||||
|
||||
/// Legacy presentational attributes that take an integer as defined in HTML5 § 2.4.4.2.
|
||||
#[deriving(Copy, PartialEq, Eq)]
|
||||
pub enum IntegerAttribute {
|
||||
/// `<input size>`
|
||||
Size,
|
||||
|
@ -32,6 +34,7 @@ pub enum IntegerAttribute {
|
|||
}
|
||||
|
||||
/// Legacy presentational attributes that take a nonnegative integer as defined in HTML5 § 2.4.4.2.
|
||||
#[deriving(Copy, PartialEq, Eq)]
|
||||
pub enum UnsignedIntegerAttribute {
|
||||
/// `<td border>`
|
||||
Border,
|
||||
|
@ -40,6 +43,7 @@ pub enum UnsignedIntegerAttribute {
|
|||
}
|
||||
|
||||
/// Legacy presentational attributes that take a simple color as defined in HTML5 § 2.4.6.
|
||||
#[deriving(Copy, PartialEq, Eq)]
|
||||
pub enum SimpleColorAttribute {
|
||||
/// `<body bgcolor>`
|
||||
BgColor,
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
extern crate collections;
|
||||
extern crate geom;
|
||||
extern crate serialize;
|
||||
extern crate sync;
|
||||
extern crate text_writer;
|
||||
extern crate url;
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ pub struct MediaQueryList {
|
|||
media_queries: Vec<MediaQuery>
|
||||
}
|
||||
|
||||
#[deriving(PartialEq, Eq, Copy)]
|
||||
pub enum Range<T> {
|
||||
Min(T),
|
||||
Max(T),
|
||||
|
@ -43,11 +44,12 @@ impl<T: Ord> Range<T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(PartialEq, Eq, Copy)]
|
||||
pub enum Expression {
|
||||
Width(Range<Au>),
|
||||
}
|
||||
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(PartialEq, Eq, Copy)]
|
||||
pub enum Qualifier {
|
||||
Only,
|
||||
Not,
|
||||
|
@ -70,13 +72,13 @@ impl MediaQuery {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(PartialEq, Eq, Copy)]
|
||||
pub enum MediaQueryType {
|
||||
All, // Always true
|
||||
MediaType(MediaType),
|
||||
}
|
||||
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(PartialEq, Eq, Copy)]
|
||||
pub enum MediaType {
|
||||
Screen,
|
||||
Print,
|
||||
|
|
|
@ -16,7 +16,7 @@ macro_rules! define_css_keyword_enum {
|
|||
};
|
||||
($name: ident: $( $css: expr => $variant: ident ),+) => {
|
||||
#[allow(non_camel_case_types)]
|
||||
#[deriving(Clone, Eq, PartialEq, FromPrimitive)]
|
||||
#[deriving(Clone, Eq, PartialEq, FromPrimitive, Copy)]
|
||||
pub enum $name {
|
||||
$( $variant ),+
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ pub mod specified {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Clone, PartialEq)]
|
||||
#[deriving(Clone, PartialEq, Copy)]
|
||||
pub enum Length {
|
||||
Au(Au), // application units
|
||||
Em(CSSFloat),
|
||||
|
@ -219,7 +219,7 @@ pub mod specified {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Clone, PartialEq)]
|
||||
#[deriving(Clone, PartialEq, Copy)]
|
||||
pub enum LengthOrPercentage {
|
||||
Length(Length),
|
||||
Percentage(CSSFloat), // [0 .. 100%] maps to [0.0 .. 1.0]
|
||||
|
@ -263,7 +263,7 @@ pub mod specified {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, PartialEq, Copy)]
|
||||
pub enum LengthOrPercentageOrAuto {
|
||||
Length(Length),
|
||||
Percentage(CSSFloat), // [0 .. 100%] maps to [0.0 .. 1.0]
|
||||
|
@ -309,7 +309,7 @@ pub mod specified {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, PartialEq, Copy)]
|
||||
pub enum LengthOrPercentageOrNone {
|
||||
Length(Length),
|
||||
Percentage(CSSFloat), // [0 .. 100%] maps to [0.0 .. 1.0]
|
||||
|
@ -355,7 +355,7 @@ pub mod specified {
|
|||
}
|
||||
|
||||
// http://dev.w3.org/csswg/css2/colors.html#propdef-background-position
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, PartialEq, Copy)]
|
||||
pub enum PositionComponent {
|
||||
Length(Length),
|
||||
Percentage(CSSFloat), // [0 .. 100%] maps to [0.0 .. 1.0]
|
||||
|
@ -395,7 +395,7 @@ pub mod specified {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Clone, PartialEq, PartialOrd)]
|
||||
#[deriving(Clone, PartialEq, PartialOrd, Copy)]
|
||||
pub struct Angle(pub CSSFloat);
|
||||
|
||||
impl fmt::Show for Angle {
|
||||
|
@ -452,7 +452,7 @@ pub mod specified {
|
|||
match self {
|
||||
&Image::Url(ref url) => {
|
||||
try!(dest.write_str("url(\""));
|
||||
try!(write!(CssStringWriter::new(dest), "{}", url));
|
||||
try!(write!(&mut CssStringWriter::new(dest), "{}", url));
|
||||
try!(dest.write_str("\")"));
|
||||
Ok(())
|
||||
}
|
||||
|
@ -522,7 +522,7 @@ pub mod specified {
|
|||
}
|
||||
|
||||
/// Specified values for an angle or a corner in a linear gradient.
|
||||
#[deriving(Clone, PartialEq)]
|
||||
#[deriving(Clone, PartialEq, Copy)]
|
||||
pub enum AngleOrCorner {
|
||||
Angle(Angle),
|
||||
Corner(HorizontalDirection, VerticalDirection),
|
||||
|
@ -718,6 +718,7 @@ pub mod computed {
|
|||
use std::fmt;
|
||||
use url::Url;
|
||||
|
||||
#[allow(missing_copy_implementations)] // It’s kinda big
|
||||
pub struct Context {
|
||||
pub inherited_font_weight: longhands::font_weight::computed_value::T,
|
||||
pub inherited_font_size: longhands::font_size::computed_value::T,
|
||||
|
@ -774,7 +775,7 @@ pub mod computed {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(PartialEq, Clone)]
|
||||
#[deriving(PartialEq, Clone, Copy)]
|
||||
pub enum LengthOrPercentage {
|
||||
Length(Au),
|
||||
Percentage(CSSFloat),
|
||||
|
@ -799,7 +800,7 @@ pub mod computed {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(PartialEq, Clone)]
|
||||
#[deriving(PartialEq, Clone, Copy)]
|
||||
pub enum LengthOrPercentageOrAuto {
|
||||
Length(Au),
|
||||
Percentage(CSSFloat),
|
||||
|
@ -827,7 +828,7 @@ pub mod computed {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(PartialEq, Clone)]
|
||||
#[deriving(PartialEq, Clone, Copy)]
|
||||
pub enum LengthOrPercentageOrNone {
|
||||
Length(Au),
|
||||
Percentage(CSSFloat),
|
||||
|
@ -892,7 +893,7 @@ pub mod computed {
|
|||
}
|
||||
|
||||
/// Computed values for one color stop in a linear gradient.
|
||||
#[deriving(Clone, PartialEq)]
|
||||
#[deriving(Clone, PartialEq, Copy)]
|
||||
pub struct ColorStop {
|
||||
/// The color of this stop.
|
||||
pub color: CSSColor,
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
pub use std::ascii::AsciiExt;
|
||||
use std::fmt;
|
||||
use std::fmt::Show;
|
||||
use std::sync::Arc;
|
||||
|
||||
use servo_util::logical_geometry::{WritingMode, LogicalMargin};
|
||||
use sync::Arc;
|
||||
pub use url::Url;
|
||||
|
||||
pub use cssparser::*;
|
||||
|
@ -279,7 +279,7 @@ pub mod longhands {
|
|||
% endfor
|
||||
|
||||
<%self:longhand name="border-top-left-radius">
|
||||
#[deriving(Clone, Show)]
|
||||
#[deriving(Clone, Show, PartialEq, Copy)]
|
||||
pub struct SpecifiedValue {
|
||||
pub radius: specified::LengthOrPercentage,
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ pub mod longhands {
|
|||
pub mod computed_value {
|
||||
use super::super::computed;
|
||||
|
||||
#[deriving(Clone, PartialEq, Show)]
|
||||
#[deriving(Clone, PartialEq, Copy, Show)]
|
||||
pub struct T {
|
||||
pub radius: computed::LengthOrPercentage,
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ pub mod longhands {
|
|||
pub mod computed_value {
|
||||
use std::fmt;
|
||||
|
||||
#[deriving(PartialEq, Clone)]
|
||||
#[deriving(PartialEq, Clone, Eq, Copy)]
|
||||
pub enum T {
|
||||
Auto,
|
||||
Number(i32),
|
||||
|
@ -543,7 +543,7 @@ pub mod longhands {
|
|||
|
||||
<%self:single_component_value name="line-height">
|
||||
use std::fmt;
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, PartialEq, Copy)]
|
||||
pub enum SpecifiedValue {
|
||||
Normal,
|
||||
Length(specified::Length),
|
||||
|
@ -579,7 +579,7 @@ pub mod longhands {
|
|||
pub mod computed_value {
|
||||
use super::super::{Au, CSSFloat};
|
||||
use std::fmt;
|
||||
#[deriving(PartialEq, Clone)]
|
||||
#[deriving(PartialEq, Copy, Clone)]
|
||||
pub enum T {
|
||||
Normal,
|
||||
Length(Au),
|
||||
|
@ -616,7 +616,7 @@ pub mod longhands {
|
|||
<% vertical_align_keywords = (
|
||||
"baseline sub super top text-top middle bottom text-bottom".split()) %>
|
||||
#[allow(non_camel_case_types)]
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, PartialEq, Copy)]
|
||||
pub enum SpecifiedValue {
|
||||
% for keyword in vertical_align_keywords:
|
||||
${to_rust_ident(keyword)},
|
||||
|
@ -654,7 +654,7 @@ pub mod longhands {
|
|||
use super::super::{Au, CSSFloat};
|
||||
use std::fmt;
|
||||
#[allow(non_camel_case_types)]
|
||||
#[deriving(PartialEq, Clone)]
|
||||
#[deriving(PartialEq, Copy, Clone)]
|
||||
pub enum T {
|
||||
% for keyword in vertical_align_keywords:
|
||||
${to_rust_ident(keyword)},
|
||||
|
@ -710,7 +710,7 @@ pub mod longhands {
|
|||
pub use super::computed_as_specified as to_computed_value;
|
||||
pub mod computed_value {
|
||||
use std::fmt;
|
||||
#[deriving(PartialEq, Clone)]
|
||||
#[deriving(PartialEq, Eq, Clone)]
|
||||
pub enum ContentItem {
|
||||
StringContent(String),
|
||||
}
|
||||
|
@ -722,7 +722,7 @@ pub mod longhands {
|
|||
}
|
||||
}
|
||||
#[allow(non_camel_case_types)]
|
||||
#[deriving(PartialEq, Clone)]
|
||||
#[deriving(PartialEq, Eq, Clone)]
|
||||
pub enum T {
|
||||
normal,
|
||||
none,
|
||||
|
@ -859,7 +859,7 @@ pub mod longhands {
|
|||
use super::super::super::common_types::computed::LengthOrPercentage;
|
||||
use std::fmt;
|
||||
|
||||
#[deriving(PartialEq, Clone)]
|
||||
#[deriving(PartialEq, Copy, Clone)]
|
||||
pub struct T {
|
||||
pub horizontal: LengthOrPercentage,
|
||||
pub vertical: LengthOrPercentage,
|
||||
|
@ -871,7 +871,7 @@ pub mod longhands {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, PartialEq, Copy)]
|
||||
pub struct SpecifiedValue {
|
||||
pub horizontal: specified::LengthOrPercentage,
|
||||
pub vertical: specified::LengthOrPercentage,
|
||||
|
@ -1023,7 +1023,7 @@ pub mod longhands {
|
|||
pub use super::computed_as_specified as to_computed_value;
|
||||
pub mod computed_value {
|
||||
use std::fmt;
|
||||
#[deriving(PartialEq, Clone)]
|
||||
#[deriving(PartialEq, Eq, Clone)]
|
||||
pub enum FontFamily {
|
||||
FamilyName(String),
|
||||
// Generic
|
||||
|
@ -1110,7 +1110,7 @@ pub mod longhands {
|
|||
|
||||
<%self:single_component_value name="font-weight">
|
||||
use std::fmt;
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, PartialEq, Eq, Copy)]
|
||||
pub enum SpecifiedValue {
|
||||
Bolder,
|
||||
Lighter,
|
||||
|
@ -1159,7 +1159,7 @@ pub mod longhands {
|
|||
}
|
||||
pub mod computed_value {
|
||||
use std::fmt;
|
||||
#[deriving(PartialEq, Clone)]
|
||||
#[deriving(PartialEq, Eq, Copy, Clone)]
|
||||
pub enum T {
|
||||
% for weight in range(100, 901, 100):
|
||||
Weight${weight},
|
||||
|
@ -1327,7 +1327,7 @@ pub mod longhands {
|
|||
<%self:longhand name="text-decoration">
|
||||
pub use super::computed_as_specified as to_computed_value;
|
||||
use std::fmt;
|
||||
#[deriving(PartialEq, Clone)]
|
||||
#[deriving(PartialEq, Eq, Copy, Clone)]
|
||||
pub struct SpecifiedValue {
|
||||
pub underline: bool,
|
||||
pub overline: bool,
|
||||
|
@ -1404,7 +1404,7 @@ pub mod longhands {
|
|||
derived_from="display text-decoration">
|
||||
pub use super::computed_as_specified as to_computed_value;
|
||||
|
||||
#[deriving(Clone, PartialEq)]
|
||||
#[deriving(Clone, PartialEq, Copy)]
|
||||
pub struct SpecifiedValue {
|
||||
pub underline: Option<RGBA>,
|
||||
pub overline: Option<RGBA>,
|
||||
|
@ -1516,7 +1516,7 @@ pub mod longhands {
|
|||
|
||||
pub mod computed_value {
|
||||
use servo_util::cursor::Cursor;
|
||||
#[deriving(Clone, PartialEq, Show)]
|
||||
#[deriving(Clone, PartialEq, Eq, Copy, Show)]
|
||||
pub enum T {
|
||||
AutoCursor,
|
||||
SpecifiedCursor(Cursor),
|
||||
|
@ -1581,7 +1581,7 @@ pub mod longhands {
|
|||
|
||||
pub type SpecifiedValue = Vec<SpecifiedBoxShadow>;
|
||||
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, PartialEq)]
|
||||
pub struct SpecifiedBoxShadow {
|
||||
pub offset_x: specified::Length,
|
||||
pub offset_y: specified::Length,
|
||||
|
@ -1612,7 +1612,7 @@ pub mod longhands {
|
|||
|
||||
pub type T = Vec<BoxShadow>;
|
||||
|
||||
#[deriving(Clone, PartialEq)]
|
||||
#[deriving(Clone, PartialEq, Copy)]
|
||||
pub struct BoxShadow {
|
||||
pub offset_x: Au,
|
||||
pub offset_y: Au,
|
||||
|
@ -1750,7 +1750,7 @@ pub mod longhands {
|
|||
pub mod computed_value {
|
||||
use super::super::Au;
|
||||
|
||||
#[deriving(Clone, PartialEq, Show)]
|
||||
#[deriving(Clone, PartialEq, Eq, Copy, Show)]
|
||||
pub struct ClipRect {
|
||||
pub top: Au,
|
||||
pub right: Option<Au>,
|
||||
|
@ -1761,7 +1761,7 @@ pub mod longhands {
|
|||
pub type T = Option<ClipRect>;
|
||||
}
|
||||
|
||||
#[deriving(Clone, Show)]
|
||||
#[deriving(Clone, Show, PartialEq, Copy)]
|
||||
pub struct SpecifiedClipRect {
|
||||
pub top: specified::Length,
|
||||
pub right: Option<specified::Length>,
|
||||
|
@ -2468,7 +2468,7 @@ impl CSSWideKeyword {
|
|||
}
|
||||
|
||||
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, PartialEq, Eq, Copy)]
|
||||
pub enum DeclaredValue<T> {
|
||||
SpecifiedValue(T),
|
||||
Initial,
|
||||
|
@ -2496,6 +2496,7 @@ pub enum PropertyDeclaration {
|
|||
}
|
||||
|
||||
|
||||
#[deriving(Eq, PartialEq, Copy)]
|
||||
pub enum PropertyDeclarationParseResult {
|
||||
UnknownProperty,
|
||||
ExperimentalProperty,
|
||||
|
@ -2645,6 +2646,7 @@ pub mod style_structs {
|
|||
use super::longhands;
|
||||
|
||||
% for style_struct in STYLE_STRUCTS:
|
||||
#[allow(missing_copy_implementations)]
|
||||
#[deriving(PartialEq, Clone)]
|
||||
pub struct ${style_struct.name} {
|
||||
% for longhand in style_struct.longhands:
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
use std::ascii::AsciiExt;
|
||||
use std::collections::HashMap;
|
||||
use std::hash::Hash;
|
||||
use sync::Arc;
|
||||
use std::sync::Arc;
|
||||
|
||||
use url::Url;
|
||||
|
||||
|
@ -24,7 +24,7 @@ use selectors::{PseudoElement, SelectorList, SimpleSelector};
|
|||
use selectors::{get_selector_list_selectors};
|
||||
use stylesheets::{Stylesheet, iter_stylesheet_media_rules, iter_stylesheet_style_rules};
|
||||
|
||||
#[deriving(Clone, PartialEq)]
|
||||
#[deriving(Clone, PartialEq, Eq, Copy)]
|
||||
pub enum StylesheetOrigin {
|
||||
UserAgent,
|
||||
Author,
|
||||
|
@ -624,6 +624,7 @@ fn matches_compound_selector<'a,E,N>(selector: &CompoundSelector,
|
|||
/// However since the selector "c1" raises
|
||||
/// NotMatchedAndRestartFromClosestDescendant. So the selector
|
||||
/// "b1 + c1 > b2 ~ " doesn't match and restart matching from "d1".
|
||||
#[deriving(PartialEq, Eq, Copy)]
|
||||
enum SelectorMatchingResult {
|
||||
Matched,
|
||||
NotMatchedAndRestartFromClosestLaterSibling,
|
||||
|
@ -763,6 +764,7 @@ fn matches_compound_selector_internal<'a,E,N>(selector: &CompoundSelector,
|
|||
}
|
||||
|
||||
bitflags! {
|
||||
#[deriving(Copy)]
|
||||
flags CommonStyleAffectingAttributes: u8 {
|
||||
const HIDDEN_ATTRIBUTE = 0x01,
|
||||
const NO_WRAP_ATTRIBUTE = 0x02,
|
||||
|
@ -777,6 +779,7 @@ pub struct CommonStyleAffectingAttributeInfo {
|
|||
pub mode: CommonStyleAffectingAttributeMode,
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub enum CommonStyleAffectingAttributeMode {
|
||||
IsPresent(CommonStyleAffectingAttributes),
|
||||
IsEqual(&'static str, CommonStyleAffectingAttributes),
|
||||
|
@ -1164,7 +1167,7 @@ impl<K: Eq + Hash, V> FindPush<K, V> for HashMap<K, Vec<V>> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use sync::Arc;
|
||||
use std::sync::Arc;
|
||||
use super::{DeclarationBlock, Rule, SelectorMap};
|
||||
use selectors::LocalName;
|
||||
use string_cache::Atom;
|
||||
|
@ -1198,7 +1201,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_rule_ordering_same_specificity(){
|
||||
let rules_list = get_mock_rules(["a.intro", "img.sidebar"]);
|
||||
let rules_list = get_mock_rules(&["a.intro", "img.sidebar"]);
|
||||
let a = &rules_list[0][0].declarations;
|
||||
let b = &rules_list[1][0].declarations;
|
||||
assert!((a.specificity, a.source_order).cmp(&(b.specificity, b.source_order)) == Less,
|
||||
|
@ -1207,21 +1210,21 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_get_id_name(){
|
||||
let rules_list = get_mock_rules([".intro", "#top"]);
|
||||
let rules_list = get_mock_rules(&[".intro", "#top"]);
|
||||
assert_eq!(SelectorMap::get_id_name(&rules_list[0][0]), None);
|
||||
assert_eq!(SelectorMap::get_id_name(&rules_list[1][0]), Some(atom!("top")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_class_name(){
|
||||
let rules_list = get_mock_rules([".intro.foo", "#top"]);
|
||||
let rules_list = get_mock_rules(&[".intro.foo", "#top"]);
|
||||
assert_eq!(SelectorMap::get_class_name(&rules_list[0][0]), Some(Atom::from_slice("intro")));
|
||||
assert_eq!(SelectorMap::get_class_name(&rules_list[1][0]), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_local_name(){
|
||||
let rules_list = get_mock_rules(["img.foo", "#top", "IMG", "ImG"]);
|
||||
let rules_list = get_mock_rules(&["img.foo", "#top", "IMG", "ImG"]);
|
||||
let check = |i, names: Option<(&str, &str)>| {
|
||||
assert!(SelectorMap::get_local_name(&rules_list[i][0])
|
||||
== names.map(|(name, lower_name)| LocalName {
|
||||
|
@ -1236,7 +1239,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_insert(){
|
||||
let rules_list = get_mock_rules([".intro.foo", "#top"]);
|
||||
let rules_list = get_mock_rules(&[".intro.foo", "#top"]);
|
||||
let mut selector_map = SelectorMap::new();
|
||||
selector_map.insert(rules_list[1][0].clone());
|
||||
assert_eq!(1, selector_map.id_hash.get(&atom!("top")).unwrap()[0].declarations.source_order);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use std::{cmp, iter};
|
||||
use std::ascii::{AsciiExt, OwnedAsciiExt};
|
||||
use sync::Arc;
|
||||
use std::sync::Arc;
|
||||
|
||||
use cssparser::ast::*;
|
||||
use cssparser::ast::ComponentValue::*;
|
||||
|
@ -16,6 +16,7 @@ use string_cache::{Atom, Namespace};
|
|||
use namespaces::NamespaceMap;
|
||||
|
||||
/// Ambient data used by the parser.
|
||||
#[deriving(Copy)]
|
||||
pub struct ParserContext {
|
||||
/// The origin of this stylesheet.
|
||||
pub origin: StylesheetOrigin,
|
||||
|
@ -28,7 +29,7 @@ pub struct Selector {
|
|||
pub specificity: u32,
|
||||
}
|
||||
|
||||
#[deriving(Eq, PartialEq, Clone, Hash)]
|
||||
#[deriving(Eq, PartialEq, Clone, Hash, Copy)]
|
||||
pub enum PseudoElement {
|
||||
Before,
|
||||
After,
|
||||
|
@ -43,7 +44,7 @@ pub struct CompoundSelector {
|
|||
pub next: Option<(Box<CompoundSelector>, Combinator)>, // c.next is left of c
|
||||
}
|
||||
|
||||
#[deriving(PartialEq, Clone)]
|
||||
#[deriving(PartialEq, Clone, Copy)]
|
||||
pub enum Combinator {
|
||||
Child, // >
|
||||
Descendant, // space
|
||||
|
@ -93,7 +94,7 @@ pub enum SimpleSelector {
|
|||
}
|
||||
|
||||
|
||||
#[deriving(Eq, PartialEq, Clone, Hash)]
|
||||
#[deriving(Eq, PartialEq, Clone, Hash, Copy)]
|
||||
pub enum CaseSensitivity {
|
||||
CaseSensitive, // Selectors spec says language-defined, but HTML says sensitive.
|
||||
CaseInsensitive,
|
||||
|
@ -667,7 +668,7 @@ fn skip_whitespace<I: Iterator<ComponentValue>>(iter: &mut Iter<I>) -> bool {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use sync::Arc;
|
||||
use std::sync::Arc;
|
||||
use cssparser;
|
||||
use namespaces::NamespaceMap;
|
||||
use selector_matching::StylesheetOrigin;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue