style: Add a test for the size of a Dependency.

This commit is contained in:
Emilio Cobos Álvarez 2017-07-13 04:32:13 +02:00
parent 445b8fb3e8
commit e3b5a1dcb0
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
2 changed files with 6 additions and 3 deletions

View file

@ -2,8 +2,11 @@
* 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 style::invalidation::element::invalidation_map::Dependency;
use style::properties;
size_of_test!(test_size_of_dependency, Dependency, 16);
size_of_test!(test_size_of_property_declaration, properties::PropertyDeclaration, 32);
// This is huge, but we allocate it on the stack and then never move it,

View file

@ -5,8 +5,8 @@
use cssparser::SourceLocation;
use euclid::TypedSize2D;
use html5ever::LocalName;
use selectors::parser::{AncestorHashes, Selector};
use selectors::parser::LocalName as LocalNameSelector;
use selectors::parser::Selector;
use servo_atoms::Atom;
use style::context::QuirksMode;
use style::media_queries::{Device, MediaType};
@ -45,7 +45,7 @@ fn get_mock_rules(css_selectors: &[&str]) -> (Vec<Vec<Rule>>, SharedRwLock) {
let guard = shared_lock.read();
let rule = locked.read_with(&guard);
rule.selectors.0.iter().map(|s| {
Rule::new(s.selector.clone(), s.hashes.clone(), locked.clone(), i as u32)
Rule::new(s.clone(), AncestorHashes::new(s), locked.clone(), i as u32)
}).collect()
}).collect(), shared_lock)
}
@ -68,7 +68,7 @@ fn parse_selectors(selectors: &[&str]) -> Vec<Selector<SelectorImpl>> {
.map(|x| SelectorParser::parse_author_origin_no_namespace(x).unwrap().0
.into_iter()
.nth(0)
.unwrap().selector)
.unwrap())
.collect()
}