mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Don’t parse unspported values of content
This commit is contained in:
parent
82e274aec9
commit
4a4199c1d6
3 changed files with 13 additions and 5 deletions
|
@ -93,7 +93,6 @@ pub(super) enum NonReplacedContents {
|
|||
|
||||
pub(super) enum PseudoElementContentItem {
|
||||
Text(String),
|
||||
#[allow(dead_code)]
|
||||
Replaced(ReplacedContent),
|
||||
}
|
||||
|
||||
|
@ -347,7 +346,6 @@ where
|
|||
vec.push(PseudoElementContentItem::Replaced(replaced_content));
|
||||
}
|
||||
},
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
vec
|
||||
|
|
|
@ -129,7 +129,7 @@ type CounterStyleType = ListStyleType;
|
|||
#[cfg(feature = "gecko")]
|
||||
type CounterStyleType = CounterStyle;
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
#[cfg(feature = "servo-layout-2013")]
|
||||
#[inline]
|
||||
fn is_decimal(counter_type: &CounterStyleType) -> bool {
|
||||
*counter_type == ListStyleType::Decimal
|
||||
|
@ -191,9 +191,11 @@ pub enum GenericContentItem<ImageUrl> {
|
|||
/// Literal string content.
|
||||
String(crate::OwnedStr),
|
||||
/// `counter(name, style)`.
|
||||
#[cfg(any(feature = "gecko", feature = "servo-layout-2013"))]
|
||||
#[css(comma, function)]
|
||||
Counter(CustomIdent, #[css(skip_if = "is_decimal")] CounterStyleType),
|
||||
/// `counters(name, separator, style)`.
|
||||
#[cfg(any(feature = "gecko", feature = "servo-layout-2013"))]
|
||||
#[css(comma, function)]
|
||||
Counters(
|
||||
CustomIdent,
|
||||
|
@ -201,12 +203,16 @@ pub enum GenericContentItem<ImageUrl> {
|
|||
#[css(skip_if = "is_decimal")] CounterStyleType,
|
||||
),
|
||||
/// `open-quote`.
|
||||
#[cfg(any(feature = "gecko", feature = "servo-layout-2013"))]
|
||||
OpenQuote,
|
||||
/// `close-quote`.
|
||||
#[cfg(any(feature = "gecko", feature = "servo-layout-2013"))]
|
||||
CloseQuote,
|
||||
/// `no-open-quote`.
|
||||
#[cfg(any(feature = "gecko", feature = "servo-layout-2013"))]
|
||||
NoOpenQuote,
|
||||
/// `no-close-quote`.
|
||||
#[cfg(any(feature = "gecko", feature = "servo-layout-2013"))]
|
||||
NoCloseQuote,
|
||||
/// `-moz-alt-content`.
|
||||
#[cfg(feature = "gecko")]
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
//! Specified types for counter properties.
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
#[cfg(feature = "servo-layout-2013")]
|
||||
use crate::computed_values::list_style_type::T as ListStyleType;
|
||||
use crate::parser::{Parse, ParserContext};
|
||||
use crate::values::generics::counters as generics;
|
||||
|
@ -17,6 +17,7 @@ use crate::values::specified::Attr;
|
|||
use crate::values::specified::Integer;
|
||||
use crate::values::CustomIdent;
|
||||
use cssparser::{Parser, Token};
|
||||
#[cfg(feature = "servo-layout-2013")]
|
||||
use selectors::parser::SelectorParseErrorKind;
|
||||
use style_traits::{ParseError, StyleParseErrorKind};
|
||||
|
||||
|
@ -88,7 +89,7 @@ pub type Content = generics::GenericContent<SpecifiedImageUrl>;
|
|||
pub type ContentItem = generics::GenericContentItem<SpecifiedImageUrl>;
|
||||
|
||||
impl Content {
|
||||
#[cfg(feature = "servo")]
|
||||
#[cfg(feature = "servo-layout-2013")]
|
||||
fn parse_counter_style(_: &ParserContext, input: &mut Parser) -> ListStyleType {
|
||||
input
|
||||
.try_parse(|input| {
|
||||
|
@ -149,12 +150,14 @@ impl Parse for Content {
|
|||
},
|
||||
Ok(&Token::Function(ref name)) => {
|
||||
let result = match_ignore_ascii_case! { &name,
|
||||
#[cfg(any(feature = "gecko", feature = "servo-layout-2013"))]
|
||||
"counter" => input.parse_nested_block(|input| {
|
||||
let location = input.current_source_location();
|
||||
let name = CustomIdent::from_ident(location, input.expect_ident()?, &[])?;
|
||||
let style = Content::parse_counter_style(context, input);
|
||||
Ok(generics::ContentItem::Counter(name, style))
|
||||
}),
|
||||
#[cfg(any(feature = "gecko", feature = "servo-layout-2013"))]
|
||||
"counters" => input.parse_nested_block(|input| {
|
||||
let location = input.current_source_location();
|
||||
let name = CustomIdent::from_ident(location, input.expect_ident()?, &[])?;
|
||||
|
@ -176,6 +179,7 @@ impl Parse for Content {
|
|||
}?;
|
||||
content.push(result);
|
||||
},
|
||||
#[cfg(any(feature = "gecko", feature = "servo-layout-2013"))]
|
||||
Ok(&Token::Ident(ref ident)) => {
|
||||
content.push(match_ignore_ascii_case! { &ident,
|
||||
"open-quote" => generics::ContentItem::OpenQuote,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue