mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Add NonTSPseudoClass::is_internal function
This commit is contained in:
parent
fa27ac0544
commit
0399f359c1
1 changed files with 26 additions and 1 deletions
|
@ -178,6 +178,27 @@ impl ToCss for NonTSPseudoClass {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl NonTSPseudoClass {
|
impl NonTSPseudoClass {
|
||||||
|
/// A pseudo-class is internal if it can only be used inside
|
||||||
|
/// user agent style sheets.
|
||||||
|
pub fn is_internal(&self) -> bool {
|
||||||
|
use self::NonTSPseudoClass::*;
|
||||||
|
match *self {
|
||||||
|
AnyLink |
|
||||||
|
Link |
|
||||||
|
Visited |
|
||||||
|
Active |
|
||||||
|
Focus |
|
||||||
|
Fullscreen |
|
||||||
|
Hover |
|
||||||
|
Enabled |
|
||||||
|
Disabled |
|
||||||
|
Checked |
|
||||||
|
Indeterminate |
|
||||||
|
ReadWrite |
|
||||||
|
ReadOnly => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Get the state flag associated with a pseudo-class, if any.
|
/// Get the state flag associated with a pseudo-class, if any.
|
||||||
pub fn state_flag(&self) -> ElementState {
|
pub fn state_flag(&self) -> ElementState {
|
||||||
use element_state::*;
|
use element_state::*;
|
||||||
|
@ -269,7 +290,11 @@ impl<'a> ::selectors::Parser for SelectorParser<'a> {
|
||||||
_ => return Err(())
|
_ => return Err(())
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(pseudo_class)
|
if !pseudo_class.is_internal() || self.in_user_agent_stylesheet() {
|
||||||
|
Ok(pseudo_class)
|
||||||
|
} else {
|
||||||
|
Err(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_pseudo_element(&self, name: Cow<str>) -> Result<PseudoElement, ()> {
|
fn parse_pseudo_element(&self, name: Cow<str>) -> Result<PseudoElement, ()> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue