style: Rework how precomputed pseudo stuff works, to avoid malloc/free churn.

This showed up in a few profiles, and was an easy improvement.

MozReview-Commit-ID: HVqATaSB2Ak
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
Emilio Cobos Álvarez 2017-08-07 12:16:50 +02:00
parent 48b7e6d27c
commit 64a96ce21c
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 50 additions and 67 deletions

View file

@ -222,16 +222,6 @@ fn test_insert() {
assert!(selector_map.class_hash.get(&Atom::from("foo"), QuirksMode::NoQuirks).is_none());
}
#[test]
fn test_get_universal_rules() {
thread_state::initialize(thread_state::LAYOUT);
let (map, _shared_lock) = get_mock_map(&["*|*", "#foo > *|*", "*|* > *|*", ".klass", "#id"]);
let decls = map.get_universal_rules(CascadeLevel::UserNormal);
assert_eq!(decls.len(), 1, "{:?}", decls);
}
fn mock_stylist() -> Stylist {
let device = Device::new(MediaType::Screen, TypedSize2D::new(0f32, 0f32), ScaleFactor::new(1.0));
Stylist::new(device, QuirksMode::NoQuirks)