mirror of
https://github.com/servo/servo.git
synced 2025-08-12 17:05:33 +01:00
style: Implement a more fine-grained invalidation method.
This commit also removes the old restyle_hints module and splits it into multiple modules under components/style/invalidation/element/. The basic approach is to walk down the tree using compound selectors as needed, in order to do as little selector-matching as possible. Bug: 1368240 MozReview-Commit-ID: 2YO8fKFygZI
This commit is contained in:
parent
fd10729941
commit
cb06375fe2
21 changed files with 1673 additions and 1486 deletions
|
@ -29,7 +29,6 @@ mod logical_geometry;
|
|||
mod media_queries;
|
||||
mod parsing;
|
||||
mod properties;
|
||||
mod restyle_hints;
|
||||
mod rule_tree;
|
||||
mod size_of;
|
||||
mod str;
|
||||
|
|
|
@ -1,30 +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 style::context::QuirksMode;
|
||||
|
||||
#[test]
|
||||
fn smoke_restyle_hints() {
|
||||
use cssparser::{Parser, ParserInput};
|
||||
use selectors::parser::SelectorList;
|
||||
use style::restyle_hints::DependencySet;
|
||||
use style::selector_parser::SelectorParser;
|
||||
use style::stylesheets::{Origin, Namespaces};
|
||||
let namespaces = Namespaces::default();
|
||||
let parser = SelectorParser {
|
||||
stylesheet_origin: Origin::Author,
|
||||
namespaces: &namespaces,
|
||||
};
|
||||
|
||||
let mut dependencies = DependencySet::new();
|
||||
|
||||
let mut input = ParserInput::new(":not(:active) ~ label");
|
||||
let mut p = Parser::new(&mut input);
|
||||
let selectors = SelectorList::parse(&parser, &mut p).unwrap();
|
||||
assert_eq!((selectors.0).len(), 1);
|
||||
|
||||
let selector = (selectors.0).first().unwrap();
|
||||
dependencies.note_selector(selector, QuirksMode::NoQuirks);
|
||||
assert_eq!(dependencies.len(), 1);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue