mirror of
https://github.com/servo/servo.git
synced 2025-06-25 01:24:37 +01:00
auto merge of #2483 : zwarich/servo/remove-10683-workaround, r=jdm
This commit is contained in:
commit
10d9bad973
5 changed files with 12 additions and 37 deletions
|
@ -267,9 +267,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLIFrameElement> {
|
||||||
if "sandbox" == name {
|
if "sandbox" == name {
|
||||||
let mut modes = AllowNothing as u8;
|
let mut modes = AllowNothing as u8;
|
||||||
for word in value.split(' ') {
|
for word in value.split(' ') {
|
||||||
// FIXME: Workaround for https://github.com/mozilla/rust/issues/10683
|
modes |= match word.to_ascii_lower().as_slice() {
|
||||||
let word_lower = word.to_ascii_lower();
|
|
||||||
modes |= match word_lower.as_slice() {
|
|
||||||
"allow-same-origin" => AllowSameOrigin,
|
"allow-same-origin" => AllowSameOrigin,
|
||||||
"allow-forms" => AllowForms,
|
"allow-forms" => AllowForms,
|
||||||
"allow-pointer-lock" => AllowPointerLock,
|
"allow-pointer-lock" => AllowPointerLock,
|
||||||
|
|
|
@ -54,9 +54,7 @@ pub mod specified {
|
||||||
Length::parse_internal(input, /* negative_ok = */ false)
|
Length::parse_internal(input, /* negative_ok = */ false)
|
||||||
}
|
}
|
||||||
pub fn parse_dimension(value: CSSFloat, unit: &str) -> Option<Length> {
|
pub fn parse_dimension(value: CSSFloat, unit: &str) -> Option<Length> {
|
||||||
// FIXME: Workaround for https://github.com/mozilla/rust/issues/10683
|
match unit.to_ascii_lower().as_slice() {
|
||||||
let unit_lower = unit.to_ascii_lower();
|
|
||||||
match unit_lower.as_slice() {
|
|
||||||
"px" => Some(Length::from_px(value)),
|
"px" => Some(Length::from_px(value)),
|
||||||
"in" => Some(Au_(Au((value * AU_PER_IN) as i32))),
|
"in" => Some(Au_(Au((value * AU_PER_IN) as i32))),
|
||||||
"cm" => Some(Au_(Au((value * AU_PER_CM) as i32))),
|
"cm" => Some(Au_(Au((value * AU_PER_CM) as i32))),
|
||||||
|
|
|
@ -83,9 +83,7 @@ pub fn parse_media_query_list(input: &[ComponentValue]) -> MediaQueryList {
|
||||||
loop {
|
loop {
|
||||||
let mq = match next {
|
let mq = match next {
|
||||||
Some(&Ident(ref value)) => {
|
Some(&Ident(ref value)) => {
|
||||||
// FIXME: Workaround for https://github.com/mozilla/rust/issues/10683
|
match value.as_slice().to_ascii_lower().as_slice() {
|
||||||
let value_lower = value.as_slice().to_ascii_lower();
|
|
||||||
match value_lower.as_slice() {
|
|
||||||
"screen" => Some(MediaQuery{ media_type: MediaType(Screen) }),
|
"screen" => Some(MediaQuery{ media_type: MediaType(Screen) }),
|
||||||
"print" => Some(MediaQuery{ media_type: MediaType(Print) }),
|
"print" => Some(MediaQuery{ media_type: MediaType(Print) }),
|
||||||
"all" => Some(MediaQuery{ media_type: All }),
|
"all" => Some(MediaQuery{ media_type: All }),
|
||||||
|
|
|
@ -237,9 +237,7 @@ pub mod longhands {
|
||||||
-> Option<specified::Length> {
|
-> Option<specified::Length> {
|
||||||
match component_value {
|
match component_value {
|
||||||
&Ident(ref value) => {
|
&Ident(ref value) => {
|
||||||
// FIXME: Workaround for https://github.com/mozilla/rust/issues/10683
|
match value.to_owned().to_ascii_lower().as_slice() {
|
||||||
let value_lower = value.to_owned().to_ascii_lower();
|
|
||||||
match value_lower.as_slice() {
|
|
||||||
"thin" => Some(specified::Length::from_px(1.)),
|
"thin" => Some(specified::Length::from_px(1.)),
|
||||||
"medium" => Some(specified::Length::from_px(3.)),
|
"medium" => Some(specified::Length::from_px(3.)),
|
||||||
"thick" => Some(specified::Length::from_px(5.)),
|
"thick" => Some(specified::Length::from_px(5.)),
|
||||||
|
@ -462,9 +460,7 @@ pub mod longhands {
|
||||||
-> Option<SpecifiedValue> {
|
-> Option<SpecifiedValue> {
|
||||||
match input {
|
match input {
|
||||||
&Ident(ref value) => {
|
&Ident(ref value) => {
|
||||||
// FIXME: Workaround for https://github.com/mozilla/rust/issues/10683
|
match value.to_owned().to_ascii_lower().as_slice() {
|
||||||
let value_lower = value.to_owned().to_ascii_lower();
|
|
||||||
match value_lower.as_slice() {
|
|
||||||
% for keyword in vertical_align_keywords:
|
% for keyword in vertical_align_keywords:
|
||||||
"${keyword}" => Some(Specified_${to_rust_ident(keyword)}),
|
"${keyword}" => Some(Specified_${to_rust_ident(keyword)}),
|
||||||
% endfor
|
% endfor
|
||||||
|
@ -539,10 +535,7 @@ pub mod longhands {
|
||||||
pub fn parse(input: &[ComponentValue], _base_url: &Url) -> Option<SpecifiedValue> {
|
pub fn parse(input: &[ComponentValue], _base_url: &Url) -> Option<SpecifiedValue> {
|
||||||
match one_component_value(input) {
|
match one_component_value(input) {
|
||||||
Some(&Ident(ref keyword)) => {
|
Some(&Ident(ref keyword)) => {
|
||||||
// FIXME: Workaround for https://github.com/mozilla/rust/issues/10683
|
match keyword.to_owned().to_ascii_lower().as_slice() {
|
||||||
let keyword_lower = keyword.to_owned().to_ascii_lower();
|
|
||||||
match keyword_lower.as_slice() {
|
|
||||||
|
|
||||||
"normal" => return Some(normal),
|
"normal" => return Some(normal),
|
||||||
"none" => return Some(none),
|
"none" => return Some(none),
|
||||||
_ => ()
|
_ => ()
|
||||||
|
@ -735,9 +728,7 @@ pub mod longhands {
|
||||||
// TODO: avoid copying strings?
|
// TODO: avoid copying strings?
|
||||||
Some(&String(ref value)) => add!(FamilyName(value.to_owned()), break 'outer),
|
Some(&String(ref value)) => add!(FamilyName(value.to_owned()), break 'outer),
|
||||||
Some(&Ident(ref value)) => {
|
Some(&Ident(ref value)) => {
|
||||||
// FIXME: Workaround for https://github.com/mozilla/rust/issues/10683
|
match value.to_owned().to_ascii_lower().as_slice() {
|
||||||
let value_lower = value.to_owned().to_ascii_lower();
|
|
||||||
match value_lower.as_slice() {
|
|
||||||
// "serif" => add!(Serif, break 'outer),
|
// "serif" => add!(Serif, break 'outer),
|
||||||
// "sans-serif" => add!(SansSerif, break 'outer),
|
// "sans-serif" => add!(SansSerif, break 'outer),
|
||||||
// "cursive" => add!(Cursive, break 'outer),
|
// "cursive" => add!(Cursive, break 'outer),
|
||||||
|
@ -787,9 +778,7 @@ pub mod longhands {
|
||||||
-> Option<SpecifiedValue> {
|
-> Option<SpecifiedValue> {
|
||||||
match input {
|
match input {
|
||||||
&Ident(ref value) => {
|
&Ident(ref value) => {
|
||||||
// FIXME: Workaround for https://github.com/mozilla/rust/issues/10683
|
match value.to_owned().to_ascii_lower().as_slice() {
|
||||||
let value_lower = value.to_owned().to_ascii_lower();
|
|
||||||
match value_lower.as_slice() {
|
|
||||||
"bold" => Some(SpecifiedWeight700),
|
"bold" => Some(SpecifiedWeight700),
|
||||||
"normal" => Some(SpecifiedWeight400),
|
"normal" => Some(SpecifiedWeight400),
|
||||||
"bolder" => Some(Bolder),
|
"bolder" => Some(Bolder),
|
||||||
|
|
|
@ -329,9 +329,7 @@ fn parse_one_simple_selector(iter: &mut Iter, namespaces: &NamespaceMap, inside_
|
||||||
match iter.next() {
|
match iter.next() {
|
||||||
Some(Ident(name)) => match parse_simple_pseudo_class(name.as_slice()) {
|
Some(Ident(name)) => match parse_simple_pseudo_class(name.as_slice()) {
|
||||||
None => {
|
None => {
|
||||||
// FIXME: Workaround for https://github.com/mozilla/rust/issues/10683
|
match name.as_slice().to_ascii_lower().as_slice() {
|
||||||
let name_lower = name.as_slice().to_ascii_lower();
|
|
||||||
match name_lower.as_slice() {
|
|
||||||
// Supported CSS 2.1 pseudo-elements only.
|
// Supported CSS 2.1 pseudo-elements only.
|
||||||
// ** Do not add to this list! **
|
// ** Do not add to this list! **
|
||||||
"before" => PseudoElementResult(Before),
|
"before" => PseudoElementResult(Before),
|
||||||
|
@ -475,9 +473,7 @@ fn parse_attribute_selector(content: Vec<ComponentValue>, namespaces: &Namespace
|
||||||
|
|
||||||
|
|
||||||
fn parse_simple_pseudo_class(name: &str) -> Option<SimpleSelector> {
|
fn parse_simple_pseudo_class(name: &str) -> Option<SimpleSelector> {
|
||||||
// FIXME: Workaround for https://github.com/mozilla/rust/issues/10683
|
match name.to_ascii_lower().as_slice() {
|
||||||
let name_lower = name.to_ascii_lower();
|
|
||||||
match name_lower.as_slice() {
|
|
||||||
"any-link" => Some(AnyLink),
|
"any-link" => Some(AnyLink),
|
||||||
"link" => Some(Link),
|
"link" => Some(Link),
|
||||||
"visited" => Some(Visited),
|
"visited" => Some(Visited),
|
||||||
|
@ -498,9 +494,7 @@ fn parse_simple_pseudo_class(name: &str) -> Option<SimpleSelector> {
|
||||||
fn parse_functional_pseudo_class(name: StrBuf, arguments: Vec<ComponentValue>,
|
fn parse_functional_pseudo_class(name: StrBuf, arguments: Vec<ComponentValue>,
|
||||||
namespaces: &NamespaceMap, inside_negation: bool)
|
namespaces: &NamespaceMap, inside_negation: bool)
|
||||||
-> Option<SimpleSelector> {
|
-> Option<SimpleSelector> {
|
||||||
// FIXME: Workaround for https://github.com/mozilla/rust/issues/10683
|
match name.as_slice().to_ascii_lower().as_slice() {
|
||||||
let name_lower = name.as_slice().to_ascii_lower();
|
|
||||||
match name_lower.as_slice() {
|
|
||||||
// "lang" => parse_lang(arguments),
|
// "lang" => parse_lang(arguments),
|
||||||
"nth-child" => parse_nth(arguments.as_slice()).map(|(a, b)| NthChild(a, b)),
|
"nth-child" => parse_nth(arguments.as_slice()).map(|(a, b)| NthChild(a, b)),
|
||||||
"nth-last-child" => parse_nth(arguments.as_slice()).map(|(a, b)| NthLastChild(a, b)),
|
"nth-last-child" => parse_nth(arguments.as_slice()).map(|(a, b)| NthLastChild(a, b)),
|
||||||
|
@ -513,9 +507,7 @@ fn parse_functional_pseudo_class(name: StrBuf, arguments: Vec<ComponentValue>,
|
||||||
|
|
||||||
|
|
||||||
fn parse_pseudo_element(name: StrBuf) -> Option<PseudoElement> {
|
fn parse_pseudo_element(name: StrBuf) -> Option<PseudoElement> {
|
||||||
// FIXME: Workaround for https://github.com/mozilla/rust/issues/10683
|
match name.as_slice().to_ascii_lower().as_slice() {
|
||||||
let name_lower = name.as_slice().to_ascii_lower();
|
|
||||||
match name_lower.as_slice() {
|
|
||||||
// All supported pseudo-elements
|
// All supported pseudo-elements
|
||||||
"before" => Some(Before),
|
"before" => Some(Before),
|
||||||
"after" => Some(After),
|
"after" => Some(After),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue