aboutsummaryrefslogtreecommitdiffstats
path: root/components/style
diff options
context:
space:
mode:
Diffstat (limited to 'components/style')
-rw-r--r--components/style/node.rs1
-rw-r--r--components/style/selector_matching.rs8
-rw-r--r--components/style/selectors.rs4
3 files changed, 11 insertions, 2 deletions
diff --git a/components/style/node.rs b/components/style/node.rs
index a1c9a8071c4..48afb072c43 100644
--- a/components/style/node.rs
+++ b/components/style/node.rs
@@ -47,6 +47,7 @@ pub trait TElement<'a> : Copy {
fn get_disabled_state(self) -> bool;
fn get_enabled_state(self) -> bool;
fn get_checked_state(self) -> bool;
+ fn get_indeterminate_state(self) -> bool;
fn has_class(self, name: &Atom) -> bool;
fn has_nonzero_border(self) -> bool;
diff --git a/components/style/selector_matching.rs b/components/style/selector_matching.rs
index 5482745721f..091d6204886 100644
--- a/components/style/selector_matching.rs
+++ b/components/style/selector_matching.rs
@@ -23,7 +23,7 @@ use properties::{PropertyDeclaration, PropertyDeclarationBlock};
use selectors::{After, AnyLink, AttrDashMatch, AttrEqual};
use selectors::{AttrExists, AttrIncludes, AttrPrefixMatch};
use selectors::{AttrSubstringMatch, AttrSuffixMatch, Before, CaseInsensitive, CaseSensitive};
-use selectors::{Checked, Child, ClassSelector};
+use selectors::{Checked, Child, ClassSelector, Indeterminate};
use selectors::{CompoundSelector, Descendant, Disabled, Enabled, FirstChild, FirstOfType};
use selectors::{Hover, IDSelector, LastChild, LastOfType};
use selectors::{LaterSibling, LocalName, LocalNameSelector};
@@ -972,6 +972,12 @@ pub fn matches_simple_selector<'a,E,N>(selector: &SimpleSelector,
let elem = element.as_element();
elem.get_checked_state()
}
+ // https://html.spec.whatwg.org/multipage/scripting.html#selector-indeterminate
+ Indeterminate => {
+ *shareable = false;
+ let elem = element.as_element();
+ elem.get_indeterminate_state()
+ }
FirstChild => {
*shareable = false;
matches_first_child(element)
diff --git a/components/style/selectors.rs b/components/style/selectors.rs
index 1d72a530383..5217ea2828a 100644
--- a/components/style/selectors.rs
+++ b/components/style/selectors.rs
@@ -75,6 +75,7 @@ pub enum SimpleSelector {
Disabled,
Enabled,
Checked,
+ Indeterminate,
FirstChild, LastChild, OnlyChild,
// Empty,
Root,
@@ -167,7 +168,7 @@ fn compute_specificity(mut selector: &CompoundSelector,
| &AttrExists(..) | &AttrEqual(..) | &AttrIncludes(..) | &AttrDashMatch(..)
| &AttrPrefixMatch(..) | &AttrSubstringMatch(..) | &AttrSuffixMatch(..)
| &AnyLink | &Link | &Visited | &Hover | &Disabled | &Enabled
- | &FirstChild | &LastChild | &OnlyChild | &Root | &Checked
+ | &FirstChild | &LastChild | &OnlyChild | &Root | &Checked | &Indeterminate
// | &Empty | &Lang(*)
| &NthChild(..) | &NthLastChild(..)
| &NthOfType(..) | &NthLastOfType(..)
@@ -568,6 +569,7 @@ fn parse_simple_pseudo_class(context: &ParserContext, name: &str) -> Result<Simp
"disabled" => Ok(Disabled),
"enabled" => Ok(Enabled),
"checked" => Ok(Checked),
+ "indeterminate" => Ok(Indeterminate),
"first-child" => Ok(FirstChild),
"last-child" => Ok(LastChild),
"only-child" => Ok(OnlyChild),