Skip to content

Commit

Permalink
Bug 1728617 - Tweak at-rule parsing APIs to support cascade layers. r…
Browse files Browse the repository at this point in the history
…=boris

This needs servo/rust-cssparser#287 and a
cssparser update.

Differential Revision: https://phabricator.services.mozilla.com/D124216
  • Loading branch information
emilio committed Sep 3, 2021
1 parent fdb5761 commit 4b3dc20
Show file tree
Hide file tree
Showing 22 changed files with 92 additions and 138 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion servo/components/malloc_size_of/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ accountable-refcell = { version = "0.2.0", optional = true }
app_units = "0.7"
content-security-policy = { version = "0.4.0", features = ["serde"], optional = true }
crossbeam-channel = { version = "0.4", optional = true }
cssparser = "0.28"
cssparser = "0.29"
euclid = "0.22"
hashglobe = { path = "../hashglobe" }
hyper = { version = "0.12", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion servo/components/selectors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ bench = []
[dependencies]
bitflags = "1.0"
matches = "0.1"
cssparser = "0.28"
cssparser = "0.29"
derive_more = "0.99"
fxhash = "0.2"
log = "0.4"
Expand Down
2 changes: 1 addition & 1 deletion servo/components/style/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ arrayvec = "0.5"
atomic_refcell = "0.1"
bitflags = "1.0"
byteorder = "1.0"
cssparser = "0.28"
cssparser = "0.29"
derive_more = "0.99"
new_debug_unreachable = "1.0"
encoding_rs = {version = "0.8", optional = true}
Expand Down
3 changes: 1 addition & 2 deletions servo/components/style/counter_style/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ struct CounterStyleRuleParser<'a, 'b: 'a> {

/// Default methods reject all at rules.
impl<'a, 'b, 'i> AtRuleParser<'i> for CounterStyleRuleParser<'a, 'b> {
type PreludeNoBlock = ();
type PreludeBlock = ();
type Prelude = ();
type AtRule = ();
type Error = StyleParseErrorKind<'i>;
}
Expand Down
3 changes: 1 addition & 2 deletions servo/components/style/font_face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,7 @@ struct FontFaceRuleParser<'a, 'b: 'a> {

/// Default methods reject all at rules.
impl<'a, 'b, 'i> AtRuleParser<'i> for FontFaceRuleParser<'a, 'b> {
type PreludeNoBlock = ();
type PreludeBlock = ();
type Prelude = ();
type AtRule = ();
type Error = StyleParseErrorKind<'i>;
}
Expand Down
3 changes: 1 addition & 2 deletions servo/components/style/properties/declaration_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1320,8 +1320,7 @@ struct PropertyDeclarationParser<'a, 'b: 'a> {

/// Default methods reject all at rules.
impl<'a, 'b, 'i> AtRuleParser<'i> for PropertyDeclarationParser<'a, 'b> {
type PreludeNoBlock = ();
type PreludeBlock = ();
type Prelude = ();
type AtRule = Importance;
type Error = StyleParseErrorKind<'i>;
}
Expand Down
19 changes: 9 additions & 10 deletions servo/components/style/stylesheets/font_feature_values_rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::stylesheets::CssRuleType;
use crate::values::computed::font::FamilyName;
use crate::values::serialize_atom_identifier;
use crate::Atom;
use cssparser::{AtRuleParser, AtRuleType, BasicParseErrorKind, CowRcStr};
use cssparser::{AtRuleParser, BasicParseErrorKind, CowRcStr};
use cssparser::{DeclarationListParser, DeclarationParser, Parser};
use cssparser::{ParserState, QualifiedRuleParser, RuleListParser, SourceLocation, Token};
use std::fmt::{self, Write};
Expand Down Expand Up @@ -188,8 +188,7 @@ struct FFVDeclarationsParser<'a, 'b: 'a, T: 'a> {

/// Default methods reject all at rules.
impl<'a, 'b, 'i, T> AtRuleParser<'i> for FFVDeclarationsParser<'a, 'b, T> {
type PreludeNoBlock = ();
type PreludeBlock = ();
type Prelude = ();
type AtRule = ();
type Error = StyleParseErrorKind<'i>;
}
Expand Down Expand Up @@ -393,18 +392,18 @@ macro_rules! font_feature_values_blocks {
}

impl<'a, 'i> AtRuleParser<'i> for FontFeatureValuesRuleParser<'a> {
type PreludeNoBlock = ();
type PreludeBlock = BlockType;
type Prelude = BlockType;
type AtRule = ();
type Error = StyleParseErrorKind<'i>;

fn parse_prelude<'t>(&mut self,
name: CowRcStr<'i>,
input: &mut Parser<'i, 't>)
-> Result<AtRuleType<(), BlockType>, ParseError<'i>> {
fn parse_prelude<'t>(
&mut self,
name: CowRcStr<'i>,
input: &mut Parser<'i, 't>,
) -> Result<BlockType, ParseError<'i>> {
match_ignore_ascii_case! { &*name,
$(
$name => Ok(AtRuleType::WithBlock(BlockType::$ident_camel)),
$name => Ok(BlockType::$ident_camel),
)*
_ => Err(input.new_error(BasicParseErrorKind::AtRuleBodyInvalid)),
}
Expand Down
6 changes: 2 additions & 4 deletions servo/components/style/stylesheets/keyframes_rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,7 @@ pub fn parse_keyframe_list(
}

impl<'a, 'i> AtRuleParser<'i> for KeyframeListParser<'a> {
type PreludeNoBlock = ();
type PreludeBlock = ();
type Prelude = ();
type AtRule = Arc<Locked<Keyframe>>;
type Error = StyleParseErrorKind<'i>;
}
Expand Down Expand Up @@ -580,8 +579,7 @@ struct KeyframeDeclarationParser<'a, 'b: 'a> {

/// Default methods reject all at rules.
impl<'a, 'b, 'i> AtRuleParser<'i> for KeyframeDeclarationParser<'a, 'b> {
type PreludeNoBlock = ();
type PreludeBlock = ();
type Prelude = ();
type AtRule = ();
type Error = StyleParseErrorKind<'i>;
}
Expand Down
Loading

0 comments on commit 4b3dc20

Please sign in to comment.