mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
ol[type=…] and li[type=…] preshints need to be case-sensitive
This commit is contained in:
parent
853b688d0b
commit
7149a6a29d
7 changed files with 53 additions and 19 deletions
|
@ -2451,6 +2451,11 @@ impl<'a> ::selectors::Element for Root<Element> {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
NonTSPseudoClass::ServoCaseSensitiveTypeAttr(ref expected_value) => {
|
||||||
|
self.get_attribute(&ns!(), &local_name!("type"))
|
||||||
|
.map_or(false, |attr| attr.value().eq(expected_value))
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME(#15746): This is wrong, we need to instead use extended filtering as per RFC4647
|
// FIXME(#15746): This is wrong, we need to instead use extended filtering as per RFC4647
|
||||||
// https://tools.ietf.org/html/rfc4647#section-3.3.2
|
// https://tools.ietf.org/html/rfc4647#section-3.3.2
|
||||||
NonTSPseudoClass::Lang(ref lang) => extended_filtering(&*self.get_lang(), &*lang),
|
NonTSPseudoClass::Lang(ref lang) => extended_filtering(&*self.get_lang(), &*lang),
|
||||||
|
|
|
@ -706,7 +706,10 @@ impl<'le> ::selectors::Element for ServoLayoutElement<'le> {
|
||||||
_ => true,
|
_ => true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
NonTSPseudoClass::ServoCaseSensitiveTypeAttr(ref expected_value) => {
|
||||||
|
self.get_attr_enum(&ns!(), &local_name!("type"))
|
||||||
|
.map_or(false, |attr| attr == expected_value)
|
||||||
|
}
|
||||||
NonTSPseudoClass::ReadOnly =>
|
NonTSPseudoClass::ReadOnly =>
|
||||||
!self.element.get_state_for_layout().contains(pseudo_class.state_flag()),
|
!self.element.get_state_for_layout().contains(pseudo_class.state_flag()),
|
||||||
|
|
||||||
|
|
|
@ -379,6 +379,15 @@ impl ::std::ops::Deref for AttrValue {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl PartialEq<Atom> for AttrValue {
|
||||||
|
fn eq(&self, other: &Atom) -> bool {
|
||||||
|
match *self {
|
||||||
|
AttrValue::Atom(ref value) => value == other,
|
||||||
|
_ => other == &**self,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#rules-for-parsing-non-zero-dimension-values
|
/// https://html.spec.whatwg.org/multipage/#rules-for-parsing-non-zero-dimension-values
|
||||||
pub fn parse_nonzero_length(value: &str) -> LengthOrPercentageOrAuto {
|
pub fn parse_nonzero_length(value: &str) -> LengthOrPercentageOrAuto {
|
||||||
match parse_length(value) {
|
match parse_length(value) {
|
||||||
|
|
|
@ -175,6 +175,7 @@ pub enum NonTSPseudoClass {
|
||||||
ReadWrite,
|
ReadWrite,
|
||||||
ReadOnly,
|
ReadOnly,
|
||||||
ServoNonZeroBorder,
|
ServoNonZeroBorder,
|
||||||
|
ServoCaseSensitiveTypeAttr(Atom),
|
||||||
Target,
|
Target,
|
||||||
Visited,
|
Visited,
|
||||||
}
|
}
|
||||||
|
@ -182,10 +183,18 @@ pub enum NonTSPseudoClass {
|
||||||
impl ToCss for NonTSPseudoClass {
|
impl ToCss for NonTSPseudoClass {
|
||||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||||
use self::NonTSPseudoClass::*;
|
use self::NonTSPseudoClass::*;
|
||||||
if let Lang(ref lang) = *self {
|
match *self {
|
||||||
|
Lang(ref lang) => {
|
||||||
dest.write_str(":lang(")?;
|
dest.write_str(":lang(")?;
|
||||||
serialize_identifier(lang, dest)?;
|
serialize_identifier(lang, dest)?;
|
||||||
return dest.write_str(")");
|
return dest.write_str(")")
|
||||||
|
}
|
||||||
|
ServoCaseSensitiveTypeAttr(ref value) => {
|
||||||
|
dest.write_str(":-servo-case-sensitive-type-attr(")?;
|
||||||
|
serialize_identifier(value, dest)?;
|
||||||
|
return dest.write_str(")")
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
dest.write_str(match *self {
|
dest.write_str(match *self {
|
||||||
|
@ -198,7 +207,6 @@ impl ToCss for NonTSPseudoClass {
|
||||||
Fullscreen => ":fullscreen",
|
Fullscreen => ":fullscreen",
|
||||||
Hover => ":hover",
|
Hover => ":hover",
|
||||||
Indeterminate => ":indeterminate",
|
Indeterminate => ":indeterminate",
|
||||||
Lang(_) => unreachable!(),
|
|
||||||
Link => ":link",
|
Link => ":link",
|
||||||
PlaceholderShown => ":placeholder-shown",
|
PlaceholderShown => ":placeholder-shown",
|
||||||
ReadWrite => ":read-write",
|
ReadWrite => ":read-write",
|
||||||
|
@ -206,6 +214,8 @@ impl ToCss for NonTSPseudoClass {
|
||||||
ServoNonZeroBorder => ":-servo-nonzero-border",
|
ServoNonZeroBorder => ":-servo-nonzero-border",
|
||||||
Target => ":target",
|
Target => ":target",
|
||||||
Visited => ":visited",
|
Visited => ":visited",
|
||||||
|
Lang(_) |
|
||||||
|
ServoCaseSensitiveTypeAttr(_) => unreachable!(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -244,7 +254,8 @@ impl NonTSPseudoClass {
|
||||||
Lang(_) |
|
Lang(_) |
|
||||||
Link |
|
Link |
|
||||||
Visited |
|
Visited |
|
||||||
ServoNonZeroBorder => ElementState::empty(),
|
ServoNonZeroBorder |
|
||||||
|
ServoCaseSensitiveTypeAttr(_) => ElementState::empty(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,7 +324,15 @@ impl<'a> ::selectors::Parser for SelectorParser<'a> {
|
||||||
-> Result<NonTSPseudoClass, ()> {
|
-> Result<NonTSPseudoClass, ()> {
|
||||||
use self::NonTSPseudoClass::*;
|
use self::NonTSPseudoClass::*;
|
||||||
let pseudo_class = match_ignore_ascii_case!{ &name,
|
let pseudo_class = match_ignore_ascii_case!{ &name,
|
||||||
"lang" => Lang(String::from(try!(parser.expect_ident_or_string())).into_boxed_str()),
|
"lang" => {
|
||||||
|
Lang(parser.expect_ident_or_string()?.into_owned().into_boxed_str())
|
||||||
|
}
|
||||||
|
"-servo-case-sensitive-type-attr" => {
|
||||||
|
if !self.in_user_agent_stylesheet() {
|
||||||
|
return Err(());
|
||||||
|
}
|
||||||
|
ServoCaseSensitiveTypeAttr(Atom::from(parser.expect_ident()?))
|
||||||
|
}
|
||||||
_ => return Err(())
|
_ => return Err(())
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,15 @@ br[clear=right i] { clear: right; }
|
||||||
br[clear=all i], br[clear=both i] { clear: both; }
|
br[clear=all i], br[clear=both i] { clear: both; }
|
||||||
|
|
||||||
|
|
||||||
ol[type=1], li[type=1] { list-style-type: decimal; }
|
ol[type="1"], li[type="1"] { list-style-type: decimal; }
|
||||||
ol[type=a], li[type=a] { list-style-type: lower-alpha; }
|
ol:-servo-case-sensitive-type-attr(a),
|
||||||
ol[type=A], li[type=A] { list-style-type: upper-alpha; }
|
li:-servo-case-sensitive-type-attr(a) { list-style-type: lower-alpha; }
|
||||||
ol[type=i], li[type=i] { list-style-type: lower-roman; }
|
ol:-servo-case-sensitive-type-attr(A),
|
||||||
ol[type=I], li[type=I] { list-style-type: upper-roman; }
|
li:-servo-case-sensitive-type-attr(A) { list-style-type: upper-alpha; }
|
||||||
|
ol:-servo-case-sensitive-type-attr(i),
|
||||||
|
li:-servo-case-sensitive-type-attr(i) { list-style-type: lower-roman; }
|
||||||
|
ol:-servo-case-sensitive-type-attr(I),
|
||||||
|
li:-servo-case-sensitive-type-attr(I) { list-style-type: upper-roman; }
|
||||||
ul[type=none i], li[type=none i] { list-style-type: none; }
|
ul[type=none i], li[type=none i] { list-style-type: none; }
|
||||||
ul[type=disc i], li[type=disc i] { list-style-type: disc; }
|
ul[type=disc i], li[type=disc i] { list-style-type: disc; }
|
||||||
ul[type=circle i], li[type=circle i] { list-style-type: circle; }
|
ul[type=circle i], li[type=circle i] { list-style-type: circle; }
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
[li-type-supported-xhtml.xhtml]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[li-type-supported.html]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
Loading…
Add table
Add a link
Reference in a new issue