summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnome.org>2022-11-28 17:27:27 -0600
committerFederico Mena Quintero <federico@gnome.org>2022-11-28 17:27:27 -0600
commit0ddd65b2a32e5fcb8d38f6af1ef172f488960826 (patch)
tree0a301eced0c399b948664411effe28c88411d8a3
parent11c619563b77474fe8db2d8b86246656c04d0414 (diff)
downloadlibrsvg-wip-update-cssparser.tar.gz
WIP: update cssparser to 0.29wip-update-cssparser
This is not easily possible until the selectors crate makes a release; selectors-0.23 still uses cssparser 0.28. (It has already been updated to cssparser 0.29; it's just that selectors hasn't made a release with that yet.) See https://github.com/servo/servo/issues/29105
-rw-r--r--Cargo.toml2
-rw-r--r--src/css.rs26
2 files changed, 14 insertions, 14 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 9fab5bfa..3f3060fa 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -57,7 +57,7 @@ cast = "0.3.0"
chrono = "0.4.0" # rsvg-convert
clap = { version = "4.0.17", features = ["cargo", "derive"] } # rsvg-convert
clap_complete = "4.0.5" # rsvg-convert
-cssparser = "0.28.0"
+cssparser = "0.29.6"
data-url = "0.1"
encoding = "0.2.33"
float-cmp = "0.9.0"
diff --git a/src/css.rs b/src/css.rs
index 10ac8243..f850e264 100644
--- a/src/css.rs
+++ b/src/css.rs
@@ -74,7 +74,7 @@
//! matches by specificity and apply the result to each element.
use cssparser::{
- self, match_ignore_ascii_case, parse_important, AtRuleParser, AtRuleType, BasicParseErrorKind,
+ self, match_ignore_ascii_case, parse_important, AtRuleParser, BasicParseErrorKind,
CowRcStr, DeclarationListParser, DeclarationParser, Parser, ParserInput, ParserState,
QualifiedRuleParser, RuleListParser, SourceLocation, ToCss, _cssparser_internal_to_lowercase,
};
@@ -142,8 +142,7 @@ impl<'i> DeclarationParser<'i> for DeclParser {
// implementation in the future, although this may require keeping track of the
// CSS parsing state like Servo does.
impl<'i> AtRuleParser<'i> for DeclParser {
- type PreludeBlock = ();
- type PreludeNoBlock = ();
+ type Prelude = ();
type AtRule = Declaration;
type Error = ValueErrorKind;
}
@@ -302,8 +301,7 @@ impl<'i> QualifiedRuleParser<'i> for RuleParser {
//
// This only handles the `@import` at-rule.
impl<'i> AtRuleParser<'i> for RuleParser {
- type PreludeBlock = ();
- type PreludeNoBlock = AtRulePrelude;
+ type Prelude = AtRulePrelude;
type AtRule = Rule;
type Error = ParseErrorKind<'i>;
@@ -312,15 +310,15 @@ impl<'i> AtRuleParser<'i> for RuleParser {
&mut self,
name: CowRcStr<'i>,
input: &mut Parser<'i, 't>,
- ) -> Result<
- AtRuleType<Self::PreludeNoBlock, Self::PreludeBlock>,
- cssparser::ParseError<'i, Self::Error>,
- > {
- match_ignore_ascii_case! { &name,
+ ) -> Result<Self::Prelude, cssparser::ParseError<'i, Self::Error>,> {
+ match_ignore_ascii_case! {
+ &name,
+
+ // FIXME: at the moment we ignore media queries
+
"import" => {
- // FIXME: at the moment we ignore media queries
let url = input.expect_url_or_string()?.as_ref().to_owned();
- Ok(AtRuleType::WithoutBlock(AtRulePrelude::Import(url)))
+ Ok(AtRulePrelude::Import(url))
},
_ => Err(input.new_error(BasicParseErrorKind::AtRuleInvalid(name))),
@@ -329,12 +327,14 @@ impl<'i> AtRuleParser<'i> for RuleParser {
fn rule_without_block(
&mut self,
- prelude: Self::PreludeNoBlock,
+ prelude: Self::Prelude,
_start: &ParserState,
) -> Self::AtRule {
let AtRulePrelude::Import(url) = prelude;
Rule::AtRule(AtRule::Import(url))
}
+
+ // When we implement at-rules with blocks, implement the trait's parse_block() method here.
}
/// Dummy type required by the SelectorImpl trait.