mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Upgrade cssparser to 0.15
This commit is contained in:
parent
66c130d55a
commit
b83afdedc8
42 changed files with 234 additions and 217 deletions
|
@ -8,7 +8,7 @@
|
|||
|
||||
use {Atom, Prefix, Namespace, LocalName, CaseSensitivityExt};
|
||||
use attr::{AttrIdentifier, AttrValue};
|
||||
use cssparser::{Parser as CssParser, ToCss, serialize_identifier};
|
||||
use cssparser::{Parser as CssParser, ToCss, serialize_identifier, CompactCowStr};
|
||||
use dom::{OpaqueNode, TElement, TNode};
|
||||
use element_state::ElementState;
|
||||
use fnv::FnvHashMap;
|
||||
|
@ -311,7 +311,7 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
|
|||
type Impl = SelectorImpl;
|
||||
type Error = StyleParseError<'i>;
|
||||
|
||||
fn parse_non_ts_pseudo_class(&self, name: Cow<'i, str>)
|
||||
fn parse_non_ts_pseudo_class(&self, name: CompactCowStr<'i>)
|
||||
-> Result<NonTSPseudoClass, ParseError<'i>> {
|
||||
use self::NonTSPseudoClass::*;
|
||||
let pseudo_class = match_ignore_ascii_case! { &name,
|
||||
|
@ -344,7 +344,7 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
|
|||
}
|
||||
|
||||
fn parse_non_ts_functional_pseudo_class<'t>(&self,
|
||||
name: Cow<'i, str>,
|
||||
name: CompactCowStr<'i>,
|
||||
parser: &mut CssParser<'i, 't>)
|
||||
-> Result<NonTSPseudoClass, ParseError<'i>> {
|
||||
use self::NonTSPseudoClass::*;
|
||||
|
@ -356,7 +356,7 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
|
|||
if !self.in_user_agent_stylesheet() {
|
||||
return Err(SelectorParseError::UnexpectedIdent(name.clone()).into());
|
||||
}
|
||||
ServoCaseSensitiveTypeAttr(Atom::from(parser.expect_ident()?))
|
||||
ServoCaseSensitiveTypeAttr(Atom::from(Cow::from(parser.expect_ident()?)))
|
||||
}
|
||||
_ => return Err(SelectorParseError::UnexpectedIdent(name.clone()).into())
|
||||
};
|
||||
|
@ -364,7 +364,7 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
|
|||
Ok(pseudo_class)
|
||||
}
|
||||
|
||||
fn parse_pseudo_element(&self, name: Cow<'i, str>) -> Result<PseudoElement, ParseError<'i>> {
|
||||
fn parse_pseudo_element(&self, name: CompactCowStr<'i>) -> Result<PseudoElement, ParseError<'i>> {
|
||||
use self::PseudoElement::*;
|
||||
let pseudo_element = match_ignore_ascii_case! { &name,
|
||||
"before" => Before,
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
use cssparser::CssStringWriter;
|
||||
use parser::ParserContext;
|
||||
use servo_url::ServoUrl;
|
||||
use std::borrow::Cow;
|
||||
use std::fmt::{self, Write};
|
||||
// Note: We use std::sync::Arc rather than stylearc::Arc here because the
|
||||
// nonzero optimization is important in keeping the size of SpecifiedUrl below
|
||||
|
@ -41,10 +40,10 @@ impl SpecifiedUrl {
|
|||
/// Try to parse a URL from a string value that is a valid CSS token for a
|
||||
/// URL. Never fails - the API is only fallible to be compatible with the
|
||||
/// gecko version.
|
||||
pub fn parse_from_string<'a>(url: Cow<'a, str>,
|
||||
pub fn parse_from_string<'a>(url: String,
|
||||
context: &ParserContext)
|
||||
-> Result<Self, ParseError<'a>> {
|
||||
let serialization = Arc::new(url.into_owned());
|
||||
let serialization = Arc::new(url);
|
||||
let resolved = context.url_data.join(&serialization).ok();
|
||||
Ok(SpecifiedUrl {
|
||||
original: Some(serialization),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue