aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/selectors/Cargo.toml2
-rw-r--r--components/style/restyle_hints.rs39
2 files changed, 15 insertions, 26 deletions
diff --git a/components/selectors/Cargo.toml b/components/selectors/Cargo.toml
index 9e5e9df6f35..22ee4e526c2 100644
--- a/components/selectors/Cargo.toml
+++ b/components/selectors/Cargo.toml
@@ -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"
diff --git a/components/style/restyle_hints.rs b/components/style/restyle_hints.rs
index 193b7e82a9d..0e7dcd19adc 100644
--- a/components/style/restyle_hints.rs
+++ b/components/style/restyle_hints.rs
@@ -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
+ }
}