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