mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Store args of tree pseudo-elements as Atom.
This commit is contained in:
parent
89c1892b30
commit
a2182f8dc3
3 changed files with 20 additions and 20 deletions
|
@ -140,29 +140,29 @@ pub enum PseudoElement {
|
||||||
/// :-moz-ruby-text-container
|
/// :-moz-ruby-text-container
|
||||||
RubyTextContainer,
|
RubyTextContainer,
|
||||||
/// :-moz-tree-column
|
/// :-moz-tree-column
|
||||||
MozTreeColumn(Box<[String]>),
|
MozTreeColumn(Box<[Atom]>),
|
||||||
/// :-moz-tree-row
|
/// :-moz-tree-row
|
||||||
MozTreeRow(Box<[String]>),
|
MozTreeRow(Box<[Atom]>),
|
||||||
/// :-moz-tree-separator
|
/// :-moz-tree-separator
|
||||||
MozTreeSeparator(Box<[String]>),
|
MozTreeSeparator(Box<[Atom]>),
|
||||||
/// :-moz-tree-cell
|
/// :-moz-tree-cell
|
||||||
MozTreeCell(Box<[String]>),
|
MozTreeCell(Box<[Atom]>),
|
||||||
/// :-moz-tree-indentation
|
/// :-moz-tree-indentation
|
||||||
MozTreeIndentation(Box<[String]>),
|
MozTreeIndentation(Box<[Atom]>),
|
||||||
/// :-moz-tree-line
|
/// :-moz-tree-line
|
||||||
MozTreeLine(Box<[String]>),
|
MozTreeLine(Box<[Atom]>),
|
||||||
/// :-moz-tree-twisty
|
/// :-moz-tree-twisty
|
||||||
MozTreeTwisty(Box<[String]>),
|
MozTreeTwisty(Box<[Atom]>),
|
||||||
/// :-moz-tree-image
|
/// :-moz-tree-image
|
||||||
MozTreeImage(Box<[String]>),
|
MozTreeImage(Box<[Atom]>),
|
||||||
/// :-moz-tree-cell-text
|
/// :-moz-tree-cell-text
|
||||||
MozTreeCellText(Box<[String]>),
|
MozTreeCellText(Box<[Atom]>),
|
||||||
/// :-moz-tree-checkbox
|
/// :-moz-tree-checkbox
|
||||||
MozTreeCheckbox(Box<[String]>),
|
MozTreeCheckbox(Box<[Atom]>),
|
||||||
/// :-moz-tree-progressmeter
|
/// :-moz-tree-progressmeter
|
||||||
MozTreeProgressmeter(Box<[String]>),
|
MozTreeProgressmeter(Box<[Atom]>),
|
||||||
/// :-moz-tree-drop-feedback
|
/// :-moz-tree-drop-feedback
|
||||||
MozTreeDropFeedback(Box<[String]>),
|
MozTreeDropFeedback(Box<[Atom]>),
|
||||||
/// :-moz-svg-marker-anon-child
|
/// :-moz-svg-marker-anon-child
|
||||||
MozSVGMarkerAnonChild,
|
MozSVGMarkerAnonChild,
|
||||||
/// :-moz-svg-outer-svg-anon-child
|
/// :-moz-svg-outer-svg-anon-child
|
||||||
|
@ -1636,7 +1636,7 @@ None
|
||||||
///
|
///
|
||||||
/// Returns `None` if the pseudo-element is not recognized.
|
/// Returns `None` if the pseudo-element is not recognized.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn tree_pseudo_element(name: &str, args: Box<[String]>) -> Option<Self> {
|
pub fn tree_pseudo_element(name: &str, args: Box<[Atom]>) -> Option<Self> {
|
||||||
use std::ascii::AsciiExt;
|
use std::ascii::AsciiExt;
|
||||||
debug_assert!(name.starts_with("-moz-tree-"));
|
debug_assert!(name.starts_with("-moz-tree-"));
|
||||||
let tree_part = &name[10..];
|
let tree_part = &name[10..];
|
||||||
|
@ -1784,10 +1784,10 @@ impl ToCss for PseudoElement {
|
||||||
dest.write_char('(')?;
|
dest.write_char('(')?;
|
||||||
let mut iter = args.iter();
|
let mut iter = args.iter();
|
||||||
if let Some(first) = iter.next() {
|
if let Some(first) = iter.next() {
|
||||||
serialize_identifier(first, dest)?;
|
serialize_identifier(&first.to_string(), dest)?;
|
||||||
for item in iter {
|
for item in iter {
|
||||||
dest.write_str(", ")?;
|
dest.write_str(", ")?;
|
||||||
serialize_identifier(item, dest)?;
|
serialize_identifier(&item.to_string(), dest)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dest.write_char(')')
|
dest.write_char(')')
|
||||||
|
|
|
@ -8,7 +8,7 @@ pub enum PseudoElement {
|
||||||
% for pseudo in PSEUDOS:
|
% for pseudo in PSEUDOS:
|
||||||
/// ${pseudo.value}
|
/// ${pseudo.value}
|
||||||
% if pseudo.is_tree_pseudo_element():
|
% if pseudo.is_tree_pseudo_element():
|
||||||
${pseudo.capitalized()}(Box<[String]>),
|
${pseudo.capitalized()}(Box<[Atom]>),
|
||||||
% else:
|
% else:
|
||||||
${pseudo.capitalized()},
|
${pseudo.capitalized()},
|
||||||
% endif
|
% endif
|
||||||
|
@ -207,7 +207,7 @@ impl PseudoElement {
|
||||||
///
|
///
|
||||||
/// Returns `None` if the pseudo-element is not recognized.
|
/// Returns `None` if the pseudo-element is not recognized.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn tree_pseudo_element(name: &str, args: Box<[String]>) -> Option<Self> {
|
pub fn tree_pseudo_element(name: &str, args: Box<[Atom]>) -> Option<Self> {
|
||||||
use std::ascii::AsciiExt;
|
use std::ascii::AsciiExt;
|
||||||
debug_assert!(name.starts_with("-moz-tree-"));
|
debug_assert!(name.starts_with("-moz-tree-"));
|
||||||
let tree_part = &name[10..];
|
let tree_part = &name[10..];
|
||||||
|
@ -234,10 +234,10 @@ impl ToCss for PseudoElement {
|
||||||
dest.write_char('(')?;
|
dest.write_char('(')?;
|
||||||
let mut iter = args.iter();
|
let mut iter = args.iter();
|
||||||
if let Some(first) = iter.next() {
|
if let Some(first) = iter.next() {
|
||||||
serialize_identifier(first, dest)?;
|
serialize_identifier(&first.to_string(), dest)?;
|
||||||
for item in iter {
|
for item in iter {
|
||||||
dest.write_str(", ")?;
|
dest.write_str(", ")?;
|
||||||
serialize_identifier(item, dest)?;
|
serialize_identifier(&item.to_string(), dest)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dest.write_char(')')
|
dest.write_char(')')
|
||||||
|
|
|
@ -392,7 +392,7 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
|
||||||
loop {
|
loop {
|
||||||
let location = parser.current_source_location();
|
let location = parser.current_source_location();
|
||||||
match parser.next() {
|
match parser.next() {
|
||||||
Ok(&Token::Ident(ref ident)) => args.push(ident.as_ref().to_owned()),
|
Ok(&Token::Ident(ref ident)) => args.push(Atom::from(ident.as_ref())),
|
||||||
Ok(&Token::Comma) => {},
|
Ok(&Token::Comma) => {},
|
||||||
Ok(t) => return Err(location.new_unexpected_token_error(t.clone())),
|
Ok(t) => return Err(location.new_unexpected_token_error(t.clone())),
|
||||||
Err(BasicParseError { kind: BasicParseErrorKind::EndOfInput, .. }) => break,
|
Err(BasicParseError { kind: BasicParseErrorKind::EndOfInput, .. }) => break,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue