diff options
author | Tetsuharu OHZEKI <saneyuki.snyk@gmail.com> | 2014-12-18 19:51:41 +0900 |
---|---|---|
committer | Tetsuharu OHZEKI <saneyuki.snyk@gmail.com> | 2014-12-19 01:49:24 +0900 |
commit | 135ee60f5a4f8676c32bef837a8c1152cd7610e4 (patch) | |
tree | bbfd9232b6c76bb291534e03aedd1d0ef3eac42c | |
parent | d7f38a8973c1baac2a68bd83a0c141deef920bac (diff) | |
download | servo-135ee60f5a4f8676c32bef837a8c1152cd7610e4.tar.gz servo-135ee60f5a4f8676c32bef837a8c1152cd7610e4.zip |
style: Remove glob imports added in #4405
-rw-r--r-- | components/layout/css/matching.rs | 8 | ||||
-rw-r--r-- | components/layout/table_cell.rs | 2 | ||||
-rw-r--r-- | components/layout/wrapper.rs | 2 | ||||
-rw-r--r-- | components/script/dom/element.rs | 6 | ||||
-rw-r--r-- | components/style/legacy.rs | 13 | ||||
-rw-r--r-- | components/style/selector_matching.rs | 22 | ||||
-rw-r--r-- | components/style/selectors.rs | 58 |
7 files changed, 53 insertions, 58 deletions
diff --git a/components/layout/css/matching.rs b/components/layout/css/matching.rs index f8d4a3f72c2..4251769de60 100644 --- a/components/layout/css/matching.rs +++ b/components/layout/css/matching.rs @@ -559,10 +559,10 @@ impl<'ln> MatchMethods for LayoutNode<'ln> { // In terms of `SimpleSelector`s, these two functions will insert and remove: - // - `LocalNameSelector` - // - `NamepaceSelector` - // - `IDSelector` - // - `ClassSelector` + // - `SimpleSelector::LocalName` + // - `SimpleSelector::Namepace` + // - `SimpleSelector::ID` + // - `SimpleSelector::Class` fn insert_into_bloom_filter(&self, bf: &mut BloomFilter) { // Only elements are interesting. diff --git a/components/layout/table_cell.rs b/components/layout/table_cell.rs index a10ac9cf7a2..3d1f1fd54e3 100644 --- a/components/layout/table_cell.rs +++ b/components/layout/table_cell.rs @@ -39,7 +39,7 @@ impl TableCellFlow { -> TableCellFlow { TableCellFlow { block_flow: BlockFlow::from_node_and_fragment(node, fragment), - column_span: node.get_unsigned_integer_attribute(UnsignedIntegerAttribute::ColSpanUnsignedIntegerAttribute) + column_span: node.get_unsigned_integer_attribute(UnsignedIntegerAttribute::ColSpan) .unwrap_or(1), visible: visible, } diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index 53677273832..c197c60242a 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -594,7 +594,7 @@ impl<'le> TElement<'le> for LayoutElement<'le> { fn has_nonzero_border(self) -> bool { unsafe { match self.element - .get_unsigned_integer_attribute_for_layout(UnsignedIntegerAttribute::BorderUnsignedIntegerAttribute) { + .get_unsigned_integer_attribute_for_layout(UnsignedIntegerAttribute::Border) { None | Some(0) => false, _ => true, } diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index ec97ee451e5..da1ff1d408f 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -369,7 +369,7 @@ impl RawLayoutElementHelpers for Element { attribute: UnsignedIntegerAttribute) -> Option<u32> { match attribute { - UnsignedIntegerAttribute::BorderUnsignedIntegerAttribute => { + UnsignedIntegerAttribute::Border => { if self.is_htmltableelement() { let this: &HTMLTableElement = mem::transmute(self); this.get_border() @@ -379,7 +379,7 @@ impl RawLayoutElementHelpers for Element { None } } - UnsignedIntegerAttribute::ColSpanUnsignedIntegerAttribute => { + UnsignedIntegerAttribute::ColSpan => { if self.is_htmltablecellelement() { let this: &HTMLTableCellElement = mem::transmute(self); this.get_colspan() @@ -397,7 +397,7 @@ impl RawLayoutElementHelpers for Element { unsafe fn get_simple_color_attribute_for_layout(&self, attribute: SimpleColorAttribute) -> Option<RGBA> { match attribute { - SimpleColorAttribute::BgColorSimpleColorAttribute => { + SimpleColorAttribute::BgColor => { if self.is_htmlbodyelement() { let this: &HTMLBodyElement = mem::transmute(self); this.get_background_color() diff --git a/components/style/legacy.rs b/components/style/legacy.rs index 504471d7b04..357609cc534 100644 --- a/components/style/legacy.rs +++ b/components/style/legacy.rs @@ -5,9 +5,6 @@ //! Legacy presentational attributes defined in the HTML5 specification: `<td width>`, //! `<input size>`, and so forth. -use self::UnsignedIntegerAttribute::*; -use self::SimpleColorAttribute::*; - use node::{TElement, TElementAttributes, TNode}; use properties::DeclaredValue::SpecifiedValue; use properties::PropertyDeclaration::*; @@ -36,15 +33,15 @@ pub enum IntegerAttribute { /// Legacy presentational attributes that take a nonnegative integer as defined in HTML5 § 2.4.4.2. pub enum UnsignedIntegerAttribute { /// `<td border>` - BorderUnsignedIntegerAttribute, + Border, /// `<td colspan>` - ColSpanUnsignedIntegerAttribute, + ColSpan, } /// Legacy presentational attributes that take a simple color as defined in HTML5 § 2.4.6. pub enum SimpleColorAttribute { /// `<body bgcolor>` - BgColorSimpleColorAttribute, + BgColor, } /// Extension methods for `Stylist` that cause rules to be synthesized for legacy attributes. @@ -210,7 +207,7 @@ impl PresentationalHintSynthesis for Stylist { TElementAttributes, V: VecLike< DeclarationBlock> { - match element.get_simple_color_attribute(BgColorSimpleColorAttribute) { + match element.get_simple_color_attribute(SimpleColorAttribute::BgColor) { None => {} Some(color) => { matching_rules_list.vec_push(DeclarationBlock::from_declaration( @@ -229,7 +226,7 @@ impl PresentationalHintSynthesis for Stylist { E: TElement<'a> + TElementAttributes, V: VecLike<DeclarationBlock> { - match element.get_unsigned_integer_attribute(BorderUnsignedIntegerAttribute) { + match element.get_unsigned_integer_attribute(UnsignedIntegerAttribute::Border) { None => {} Some(length) => { let width_value = specified::Length::Au(Au::from_px(length as int)); diff --git a/components/style/selector_matching.rs b/components/style/selector_matching.rs index 787209ebc57..203c70ff7f5 100644 --- a/components/style/selector_matching.rs +++ b/components/style/selector_matching.rs @@ -222,7 +222,7 @@ impl SelectorMap { match *ss { // TODO(pradeep): Implement case-sensitivity based on the document type and quirks // mode. - SimpleSelector::IDSelector(ref id) => return Some(id.clone()), + SimpleSelector::ID(ref id) => return Some(id.clone()), _ => {} } } @@ -236,7 +236,7 @@ impl SelectorMap { match *ss { // TODO(pradeep): Implement case-sensitivity based on the document type and quirks // mode. - SimpleSelector::ClassSelector(ref class) => return Some(class.clone()), + SimpleSelector::Class(ref class) => return Some(class.clone()), _ => {} } } @@ -248,7 +248,7 @@ impl SelectorMap { let simple_selector_sequence = &rule.selector.simple_selectors; for ss in simple_selector_sequence.iter() { match *ss { - SimpleSelector::LocalNameSelector(ref name) => { + SimpleSelector::LocalName(ref name) => { return Some(name.clone()) } _ => {} @@ -665,23 +665,23 @@ fn can_fast_reject<'a,E,N>(mut selector: &CompoundSelector, for ss in selector.simple_selectors.iter() { match *ss { - SimpleSelector::LocalNameSelector(LocalName { ref name, ref lower_name }) => { + SimpleSelector::LocalName(LocalName { ref name, ref lower_name }) => { if !bf.might_contain(name) && !bf.might_contain(lower_name) { return Some(SelectorMatchingResult::NotMatchedGlobally); } }, - SimpleSelector::NamespaceSelector(ref namespace) => { + SimpleSelector::Namespace(ref namespace) => { if !bf.might_contain(namespace) { return Some(SelectorMatchingResult::NotMatchedGlobally); } }, - SimpleSelector::IDSelector(ref id) => { + SimpleSelector::ID(ref id) => { if !bf.might_contain(id) { return Some(SelectorMatchingResult::NotMatchedGlobally); } }, - SimpleSelector::ClassSelector(ref class) => { + SimpleSelector::Class(ref class) => { if !bf.might_contain(class) { return Some(SelectorMatchingResult::NotMatchedGlobally); } @@ -830,25 +830,25 @@ pub fn matches_simple_selector<'a,E,N>(selector: &SimpleSelector, -> bool where E: TElement<'a>, N: TNode<'a,E> { match *selector { - SimpleSelector::LocalNameSelector(LocalName { ref name, ref lower_name }) => { + SimpleSelector::LocalName(LocalName { ref name, ref lower_name }) => { let name = if element.is_html_element_in_html_document() { lower_name } else { name }; let element = element.as_element(); element.get_local_name() == name } - SimpleSelector::NamespaceSelector(ref namespace) => { + SimpleSelector::Namespace(ref namespace) => { let element = element.as_element(); element.get_namespace() == namespace } // TODO: case-sensitivity depends on the document type and quirks mode - SimpleSelector::IDSelector(ref id) => { + SimpleSelector::ID(ref id) => { *shareable = false; let element = element.as_element(); element.get_id().map_or(false, |attr| { attr == *id }) } - SimpleSelector::ClassSelector(ref class) => { + SimpleSelector::Class(ref class) => { let element = element.as_element(); element.has_class(class) } diff --git a/components/style/selectors.rs b/components/style/selectors.rs index 52c84f94569..4ad7e404cc9 100644 --- a/components/style/selectors.rs +++ b/components/style/selectors.rs @@ -52,10 +52,10 @@ pub enum Combinator { #[deriving(Eq, PartialEq, Clone, Hash)] pub enum SimpleSelector { - IDSelector(Atom), - ClassSelector(Atom), - LocalNameSelector(LocalName), - NamespaceSelector(Namespace), + ID(Atom), + Class(Atom), + LocalName(LocalName), + Namespace(Namespace), // Attribute selectors AttrExists(AttrSelector), // [foo] @@ -162,11 +162,11 @@ fn compute_specificity(mut selector: &CompoundSelector, specificity: &mut Specificity) { for simple_selector in simple_selectors.iter() { match simple_selector { - &SimpleSelector::LocalNameSelector(..) => + &SimpleSelector::LocalName(..) => specificity.element_selectors += 1, - &SimpleSelector::IDSelector(..) => + &SimpleSelector::ID(..) => specificity.id_selectors += 1, - &SimpleSelector::ClassSelector(..) | + &SimpleSelector::Class(..) | &SimpleSelector::AttrExists(..) | &SimpleSelector::AttrEqual(..) | &SimpleSelector::AttrIncludes(..) | @@ -190,7 +190,7 @@ fn compute_specificity(mut selector: &CompoundSelector, &SimpleSelector::OnlyOfType | &SimpleSelector::ServoNonzeroBorder => specificity.class_like_selectors += 1, - &SimpleSelector::NamespaceSelector(..) => (), + &SimpleSelector::Namespace(..) => (), &SimpleSelector::Negation(ref negated) => simple_selectors_specificity(negated.as_slice(), specificity), } @@ -218,13 +218,13 @@ fn parse_type_selector<I: Iterator<ComponentValue>>( let mut simple_selectors = vec!(); match namespace { NamespaceConstraint::Specific(ns) => { - simple_selectors.push(SimpleSelector::NamespaceSelector(ns)) + simple_selectors.push(SimpleSelector::Namespace(ns)) }, NamespaceConstraint::Any => (), } match local_name { Some(name) => { - simple_selectors.push(SimpleSelector::LocalNameSelector(LocalName { + simple_selectors.push(SimpleSelector::LocalName(LocalName { name: Atom::from_slice(name.as_slice()), lower_name: Atom::from_slice(name.into_ascii_lower().as_slice()) })) @@ -539,14 +539,14 @@ fn parse_one_simple_selector<I>(context: &ParserContext, match iter.peek() { Some(&IDHash(_)) => match iter.next() { Some(IDHash(id)) => Ok(Some(SimpleSelectorParseResult::SimpleSelector( - SimpleSelector::IDSelector(Atom::from_slice(id.as_slice()))))), + SimpleSelector::ID(Atom::from_slice(id.as_slice()))))), _ => panic!("Implementation error, this should not happen."), }, Some(&Delim('.')) => { iter.next(); match iter.next() { Some(Ident(class)) => Ok(Some(SimpleSelectorParseResult::SimpleSelector( - SimpleSelector::ClassSelector(Atom::from_slice(class.as_slice()))))), + SimpleSelector::Class(Atom::from_slice(class.as_slice()))))), _ => Err(()), } } @@ -672,8 +672,6 @@ mod tests { use selector_matching::StylesheetOrigin; use string_cache::Atom; use super::*; - use super::SimpleSelector::*; - use super::PseudoElement::*; fn parse(input: &str) -> Result<Vec<Selector>, ()> { parse_ns(input, &NamespaceMap::new()) @@ -695,7 +693,7 @@ mod tests { assert!(parse("") == Err(())) assert!(parse("EeÉ") == Ok(vec!(Selector { compound_selectors: Arc::new(CompoundSelector { - simple_selectors: vec!(SimpleSelector::LocalNameSelector(LocalName { + simple_selectors: vec!(SimpleSelector::LocalName(LocalName { name: Atom::from_slice("EeÉ"), lower_name: Atom::from_slice("eeÉ") })), next: None, @@ -705,7 +703,7 @@ mod tests { }))) assert!(parse(".foo") == Ok(vec!(Selector { compound_selectors: Arc::new(CompoundSelector { - simple_selectors: vec!(SimpleSelector::ClassSelector(Atom::from_slice("foo"))), + simple_selectors: vec!(SimpleSelector::Class(Atom::from_slice("foo"))), next: None, }), pseudo_element: None, @@ -713,7 +711,7 @@ mod tests { }))) assert!(parse("#bar") == Ok(vec!(Selector { compound_selectors: Arc::new(CompoundSelector { - simple_selectors: vec!(SimpleSelector::IDSelector(Atom::from_slice("bar"))), + simple_selectors: vec!(SimpleSelector::ID(Atom::from_slice("bar"))), next: None, }), pseudo_element: None, @@ -721,11 +719,11 @@ mod tests { }))) assert!(parse("e.foo#bar") == Ok(vec!(Selector { compound_selectors: Arc::new(CompoundSelector { - simple_selectors: vec!(SimpleSelector::LocalNameSelector(LocalName { + simple_selectors: vec!(SimpleSelector::LocalName(LocalName { name: Atom::from_slice("e"), lower_name: Atom::from_slice("e") }), - SimpleSelector::ClassSelector(Atom::from_slice("foo")), - SimpleSelector::IDSelector(Atom::from_slice("bar"))), + SimpleSelector::Class(Atom::from_slice("foo")), + SimpleSelector::ID(Atom::from_slice("bar"))), next: None, }), pseudo_element: None, @@ -733,12 +731,12 @@ mod tests { }))) assert!(parse("e.foo #bar") == Ok(vec!(Selector { compound_selectors: Arc::new(CompoundSelector { - simple_selectors: vec!(IDSelector(Atom::from_slice("bar"))), + simple_selectors: vec!(SimpleSelector::ID(Atom::from_slice("bar"))), next: Some((box CompoundSelector { - simple_selectors: vec!(SimpleSelector::LocalNameSelector(LocalName { + simple_selectors: vec!(SimpleSelector::LocalName(LocalName { name: Atom::from_slice("e"), lower_name: Atom::from_slice("e") }), - SimpleSelector::ClassSelector(Atom::from_slice("foo"))), + SimpleSelector::Class(Atom::from_slice("foo"))), next: None, }, Combinator::Descendant)), }), @@ -750,7 +748,7 @@ mod tests { let mut namespaces = NamespaceMap::new(); assert!(parse_ns("[Foo]", &namespaces) == Ok(vec!(Selector { compound_selectors: Arc::new(CompoundSelector { - simple_selectors: vec!(AttrExists(AttrSelector { + simple_selectors: vec!(SimpleSelector::AttrExists(AttrSelector { name: Atom::from_slice("Foo"), lower_name: Atom::from_slice("foo"), namespace: NamespaceConstraint::Specific(ns!("")), @@ -765,7 +763,7 @@ mod tests { namespaces.default = Some(ns!(MathML)); assert!(parse_ns("[Foo]", &namespaces) == Ok(vec!(Selector { compound_selectors: Arc::new(CompoundSelector { - simple_selectors: vec!(AttrExists(AttrSelector { + simple_selectors: vec!(SimpleSelector::AttrExists(AttrSelector { name: Atom::from_slice("Foo"), lower_name: Atom::from_slice("foo"), namespace: NamespaceConstraint::Specific(ns!("")), @@ -779,8 +777,8 @@ mod tests { assert!(parse_ns("e", &namespaces) == Ok(vec!(Selector { compound_selectors: Arc::new(CompoundSelector { simple_selectors: vec!( - NamespaceSelector(ns!(MathML)), - LocalNameSelector(LocalName { + SimpleSelector::Namespace(ns!(MathML)), + SimpleSelector::LocalName(LocalName { name: Atom::from_slice("e"), lower_name: Atom::from_slice("e") }), ), @@ -795,20 +793,20 @@ mod tests { simple_selectors: vec!(), next: None, }), - pseudo_element: Some(Before), + pseudo_element: Some(PseudoElement::Before), specificity: specificity(0, 0, 1), }))) assert!(parse("div :after") == Ok(vec!(Selector { compound_selectors: Arc::new(CompoundSelector { simple_selectors: vec!(), next: Some((box CompoundSelector { - simple_selectors: vec!(LocalNameSelector(LocalName { + simple_selectors: vec!(SimpleSelector::LocalName(LocalName { name: atom!("div"), lower_name: atom!("div") })), next: None, }, Combinator::Descendant)), }), - pseudo_element: Some(After), + pseudo_element: Some(PseudoElement::After), specificity: specificity(0, 0, 2), }))) } |