mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Remove CSSRule::Charset
`@charset` rules are not reflected in CSSOM.
This commit is contained in:
parent
c4f34e9019
commit
a5a3a74262
1 changed files with 6 additions and 11 deletions
|
@ -64,7 +64,9 @@ pub struct UserAgentStylesheets {
|
|||
#[derive(Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum CSSRule {
|
||||
Charset(String),
|
||||
// No Charset here, CSSCharsetRule has been removed from CSSOM
|
||||
// https://drafts.csswg.org/cssom/#changes-from-5-december-2013
|
||||
|
||||
Namespace {
|
||||
/// `None` for the default Namespace
|
||||
prefix: Option<Atom>,
|
||||
|
@ -423,16 +425,6 @@ impl<'a> AtRuleParser for TopLevelRuleParser<'a> {
|
|||
fn parse_prelude(&self, name: &str, input: &mut Parser)
|
||||
-> Result<AtRuleType<AtRulePrelude, CSSRule>, ()> {
|
||||
match_ignore_ascii_case! { name,
|
||||
"charset" => {
|
||||
if self.state.get() <= State::Start {
|
||||
// Valid @charset rules are just ignored
|
||||
self.state.set(State::Imports);
|
||||
let charset = try!(input.expect_string()).into_owned();
|
||||
return Ok(AtRuleType::WithoutBlock(CSSRule::Charset(charset)))
|
||||
} else {
|
||||
return Err(()) // "@charset must be the first rule"
|
||||
}
|
||||
},
|
||||
"import" => {
|
||||
if self.state.get() <= State::Imports {
|
||||
self.state.set(State::Imports);
|
||||
|
@ -456,6 +448,9 @@ impl<'a> AtRuleParser for TopLevelRuleParser<'a> {
|
|||
return Err(()) // "@namespace must be before any rule but @charset and @import"
|
||||
}
|
||||
},
|
||||
// @charset is removed by rust-cssparser if it’s the first rule in the stylesheet
|
||||
// anything left is invalid.
|
||||
"charset" => return Err(()), // (insert appropriate error message)
|
||||
_ => {}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue