mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Implements :indeterminate pseudo-class
Addresses reviews
This commit is contained in:
parent
2d05ac537c
commit
504f968b20
14 changed files with 105 additions and 206 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue