mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #16655 - servo:jdm-patch-1, r=emilio
Fix broken unit tests These are tests that only get run on TravisCI, apparently, so they were broken bybe0139ff3c
and32c624e585
without anybody noticing. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16655) <!-- Reviewable:end -->
This commit is contained in:
commit
3905b5af18
6 changed files with 53 additions and 28 deletions
|
@ -14,6 +14,8 @@ license = "MPL-2.0"
|
|||
[lib]
|
||||
name = "selectors"
|
||||
path = "lib.rs"
|
||||
# https://github.com/servo/servo/issues/16710
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
bitflags = "0.7"
|
||||
|
|
|
@ -431,8 +431,11 @@ fn combinator_to_restyle_hint(combinator: Option<Combinator>) -> RestyleHint {
|
|||
|
||||
#[derive(Debug)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
struct Sensitivities {
|
||||
/// The aspects of an selector which are sensitive.
|
||||
pub struct Sensitivities {
|
||||
/// The states which are sensitive.
|
||||
pub states: ElementState,
|
||||
/// Whether attributes are sensitive.
|
||||
pub attrs: bool,
|
||||
}
|
||||
|
||||
|
@ -469,11 +472,13 @@ impl Sensitivities {
|
|||
/// change may have on the style of elements in the document.
|
||||
#[derive(Debug)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
struct Dependency {
|
||||
pub struct Dependency {
|
||||
#[cfg_attr(feature = "servo", ignore_heap_size_of = "Arc")]
|
||||
selector: SelectorInner<SelectorImpl>,
|
||||
hint: RestyleHint,
|
||||
sensitivities: Sensitivities,
|
||||
/// The hint associated with this dependency.
|
||||
pub hint: RestyleHint,
|
||||
/// The sensitivities associated with this dependency.
|
||||
pub sensitivities: Sensitivities,
|
||||
}
|
||||
|
||||
|
||||
|
@ -681,27 +686,9 @@ impl DependencySet {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(all(test, feature = "servo"))]
|
||||
fn smoke_restyle_hints() {
|
||||
use cssparser::Parser;
|
||||
use selector_parser::SelectorParser;
|
||||
use stylesheets::{Origin, Namespaces};
|
||||
let namespaces = Namespaces::default();
|
||||
let parser = SelectorParser {
|
||||
stylesheet_origin: Origin::Author,
|
||||
namespaces: &namespaces,
|
||||
};
|
||||
|
||||
let mut dependencies = DependencySet::new();
|
||||
|
||||
let mut p = Parser::new(":not(:active) ~ label");
|
||||
let selector = ComplexSelector::parse(&parser, &mut p).unwrap();
|
||||
dependencies.note_selector(&selector);
|
||||
assert_eq!(dependencies.len(), 1);
|
||||
assert_eq!(dependencies.state_deps.len(), 1);
|
||||
assert!(!dependencies.state_deps[0].sensitivities.states.is_empty());
|
||||
assert!(dependencies.state_deps[0].hint.contains(RESTYLE_LATER_SIBLINGS));
|
||||
|
||||
/// Get the dependencies affected by state.
|
||||
pub fn get_state_deps(&self) -> &[Dependency] {
|
||||
&self.state_deps
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue