Move selectors size_of tests to Stylo tests

This commit is contained in:
Simon Sapin 2018-01-12 15:09:24 +01:00
parent 5d920df460
commit 7d1dc7286a
8 changed files with 8 additions and 124 deletions

View file

@ -17,7 +17,6 @@ name = "selectors"
path = "lib.rs"
[features]
gecko_like_types = []
bench = []
[dependencies]
@ -31,8 +30,5 @@ precomputed-hash = "0.1"
servo_arc = { version = "0.1", path = "../servo_arc" }
smallvec = "0.6"
[dev-dependencies]
size_of_test = {path = "../size_of_test"}
[build-dependencies]
phf_codegen = "0.7.18"

View file

@ -1,28 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! These types need to have the same size and alignment as the respectively corresponding
//! types in components/style/gecko/selector_parser.rs
#[derive(Clone, Debug, Eq, PartialEq)]
#[allow(dead_code)]
pub enum PseudoClass {
Bare,
String(Box<[u16]>),
Dir(Box<()>),
MozAny(Box<[()]>),
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum PseudoElement {
A,
B,
Tree(Box<[String]>),
}
#[derive(Clone, Debug, Default, Eq, PartialEq)]
pub struct Atom(usize);
#[derive(Clone, Eq, PartialEq)]
pub struct Impl;

View file

@ -12,7 +12,6 @@
extern crate fnv;
extern crate phf;
extern crate precomputed_hash;
#[cfg(test)] #[macro_use] extern crate size_of_test;
extern crate servo_arc;
extern crate smallvec;
@ -23,8 +22,6 @@ pub mod context;
pub mod matching;
mod nth_index_cache;
pub mod parser;
#[cfg(test)] mod size_of_tests;
#[cfg(any(test, feature = "gecko_like_types"))] pub mod gecko_like_types;
pub mod sink;
mod tree;
pub mod visitor;

View file

@ -1,69 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cssparser::ToCss;
use gecko_like_types;
use gecko_like_types::*;
use parser;
use parser::*;
use std::fmt;
use visitor::SelectorVisitor;
size_of_test!(size_of_selector, Selector<Impl>, 8);
size_of_test!(size_of_pseudo_element, gecko_like_types::PseudoElement, 24);
size_of_test!(size_of_component, Component<Impl>, 32);
size_of_test!(size_of_pseudo_class, PseudoClass, 24);
impl parser::PseudoElement for gecko_like_types::PseudoElement {
type Impl = Impl;
}
// Boilerplate
impl SelectorImpl for Impl {
type ExtraMatchingData = u64;
type AttrValue = Atom;
type Identifier = Atom;
type ClassName = Atom;
type LocalName = Atom;
type NamespaceUrl = Atom;
type NamespacePrefix = Atom;
type BorrowedLocalName = Atom;
type BorrowedNamespaceUrl = Atom;
type NonTSPseudoClass = PseudoClass;
type PseudoElement = gecko_like_types::PseudoElement;
#[inline]
fn is_active_or_hover(_pseudo_class: &Self::NonTSPseudoClass) -> bool {
unimplemented!()
}
}
impl SelectorMethods for PseudoClass {
type Impl = Impl;
fn visit<V>(&self, _visitor: &mut V) -> bool
where V: SelectorVisitor<Impl = Self::Impl> { unimplemented!() }
}
impl ToCss for PseudoClass {
fn to_css<W>(&self, _: &mut W) -> fmt::Result where W: fmt::Write { unimplemented!() }
}
impl ToCss for gecko_like_types::PseudoElement {
fn to_css<W>(&self, _: &mut W) -> fmt::Result where W: fmt::Write { unimplemented!() }
}
impl fmt::Display for Atom {
fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result { unimplemented!() }
}
impl From<String> for Atom {
fn from(_: String) -> Self { unimplemented!() }
}
impl<'a> From<&'a str> for Atom {
fn from(_: &'a str) -> Self { unimplemented!() }
}