mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Use CustomIdent in Symbol::Ident
The former code was not following the spec.
This commit is contained in:
parent
a71b5d5e16
commit
ad7adee882
5 changed files with 51 additions and 6 deletions
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
use Atom;
|
use Atom;
|
||||||
use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser};
|
use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser};
|
||||||
use cssparser::{Parser, Token, serialize_identifier, CowRcStr};
|
use cssparser::{Parser, Token, CowRcStr};
|
||||||
use error_reporting::{ContextualParseError, ParseErrorReporter};
|
use error_reporting::{ContextualParseError, ParseErrorReporter};
|
||||||
#[cfg(feature = "gecko")] use gecko::rules::CounterStyleDescriptors;
|
#[cfg(feature = "gecko")] use gecko::rules::CounterStyleDescriptors;
|
||||||
#[cfg(feature = "gecko")] use gecko_bindings::structs::{ nsCSSCounterDesc, nsCSSValue };
|
#[cfg(feature = "gecko")] use gecko_bindings::structs::{ nsCSSCounterDesc, nsCSSValue };
|
||||||
|
@ -395,8 +395,8 @@ impl ToCss for System {
|
||||||
pub enum Symbol {
|
pub enum Symbol {
|
||||||
/// <string>
|
/// <string>
|
||||||
String(String),
|
String(String),
|
||||||
/// <ident>
|
/// <custom-ident>
|
||||||
Ident(String),
|
Ident(CustomIdent),
|
||||||
// Not implemented:
|
// Not implemented:
|
||||||
// /// <image>
|
// /// <image>
|
||||||
// Image(Image),
|
// Image(Image),
|
||||||
|
@ -407,7 +407,11 @@ impl Parse for Symbol {
|
||||||
let location = input.current_source_location();
|
let location = input.current_source_location();
|
||||||
match *input.next()? {
|
match *input.next()? {
|
||||||
Token::QuotedString(ref s) => Ok(Symbol::String(s.as_ref().to_owned())),
|
Token::QuotedString(ref s) => Ok(Symbol::String(s.as_ref().to_owned())),
|
||||||
Token::Ident(ref s) => Ok(Symbol::Ident(s.as_ref().to_owned())),
|
Token::Ident(ref s) => {
|
||||||
|
Ok(Symbol::Ident(
|
||||||
|
CustomIdent::from_ident(location, s, &[])?,
|
||||||
|
))
|
||||||
|
}
|
||||||
ref t => Err(location.new_unexpected_token_error(t.clone())),
|
ref t => Err(location.new_unexpected_token_error(t.clone())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -420,7 +424,7 @@ impl ToCss for Symbol {
|
||||||
{
|
{
|
||||||
match *self {
|
match *self {
|
||||||
Symbol::String(ref s) => s.to_css(dest),
|
Symbol::String(ref s) => s.to_css(dest),
|
||||||
Symbol::Ident(ref s) => serialize_identifier(s, dest),
|
Symbol::Ident(ref s) => s.to_css(dest),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -313,7 +313,7 @@ impl ToNsCssValue for counter_style::Symbol {
|
||||||
fn convert(self, nscssvalue: &mut nsCSSValue) {
|
fn convert(self, nscssvalue: &mut nsCSSValue) {
|
||||||
match self {
|
match self {
|
||||||
counter_style::Symbol::String(s) => nscssvalue.set_string(&s),
|
counter_style::Symbol::String(s) => nscssvalue.set_string(&s),
|
||||||
counter_style::Symbol::Ident(s) => nscssvalue.set_ident(&s),
|
counter_style::Symbol::Ident(s) => nscssvalue.set_ident_from_atom(&s.0),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -106113,6 +106113,18 @@
|
||||||
{}
|
{}
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
"css/css-counter-styles/broken-symbols.htm": [
|
||||||
|
[
|
||||||
|
"/css/css-counter-styles/broken-symbols.htm",
|
||||||
|
[
|
||||||
|
[
|
||||||
|
"/css/css-counter-styles/broken-symbols-ref.htm",
|
||||||
|
"=="
|
||||||
|
]
|
||||||
|
],
|
||||||
|
{}
|
||||||
|
]
|
||||||
|
],
|
||||||
"css/css-display/display-contents-alignment-001.html": [
|
"css/css-display/display-contents-alignment-001.html": [
|
||||||
[
|
[
|
||||||
"/css/css-display/display-contents-alignment-001.html",
|
"/css/css-display/display-contents-alignment-001.html",
|
||||||
|
@ -237304,6 +237316,11 @@
|
||||||
{}
|
{}
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
"css/css-counter-styles/broken-symbols-ref.htm": [
|
||||||
|
[
|
||||||
|
{}
|
||||||
|
]
|
||||||
|
],
|
||||||
"css/css-display/OWNERS": [
|
"css/css-display/OWNERS": [
|
||||||
[
|
[
|
||||||
{}
|
{}
|
||||||
|
@ -484992,6 +485009,14 @@
|
||||||
"dbfaae0538c8cd1e759b59712f53cd17388e7c48",
|
"dbfaae0538c8cd1e759b59712f53cd17388e7c48",
|
||||||
"manual"
|
"manual"
|
||||||
],
|
],
|
||||||
|
"css/css-counter-styles/broken-symbols-ref.htm": [
|
||||||
|
"c794c4b6846212f4ed27e618cdd32a28b8ce013c",
|
||||||
|
"support"
|
||||||
|
],
|
||||||
|
"css/css-counter-styles/broken-symbols.htm": [
|
||||||
|
"23cb132e8efcdd1020e12c89c9d30a333708b72e",
|
||||||
|
"reftest"
|
||||||
|
],
|
||||||
"css/css-counter-styles/cambodian/css3-counter-styles-158.html": [
|
"css/css-counter-styles/cambodian/css3-counter-styles-158.html": [
|
||||||
"a334bd087e7a808567daeeae419a80466a377ef3",
|
"a334bd087e7a808567daeeae419a80466a377ef3",
|
||||||
"manual"
|
"manual"
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<ol><li>Should have "1." as bullet point.</ol>
|
|
@ -0,0 +1,13 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>CSS Test: invalid counter-style symbols</title>
|
||||||
|
<link rel="author" title="Anthony Ramine" href="mailto:n.oxyde@gmail.com">
|
||||||
|
<link rel="help" href="https://drafts.csswg.org/css-counter-styles-3/#typedef-symbol">
|
||||||
|
<link rel="match" href="broken-symbols-ref.htm">
|
||||||
|
<style type="text/css">
|
||||||
|
@counter-style a {
|
||||||
|
system: alphabetic;
|
||||||
|
symbols: ⓐ inherit;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<ol style="list-style-type: a"><li>Should have "1." as bullet point.</ol>
|
Loading…
Add table
Add a link
Reference in a new issue