style: Make input[type=number] pseudo-elements accessible to chrome.

Bug: 1433389
Reviewed-by: jwatt
MozReview-Commit-ID: 2ycajPYd3CV
This commit is contained in:
Emilio Cobos Álvarez 2018-01-26 14:13:14 +01:00
parent f2df3052d9
commit b76bbdf501
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 62 additions and 28 deletions

View file

@ -114,7 +114,7 @@ impl PseudoElement {
% if pseudo.is_tree_pseudo_element():
0,
% elif pseudo.is_anon_box():
structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY,
structs::CSS_PSEUDO_ELEMENT_ENABLED_IN_UA_SHEETS,
% else:
structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_${pseudo.original_ident},
% endif
@ -224,19 +224,24 @@ impl PseudoElement {
///
/// Returns `None` if the pseudo-element is not recognised.
#[inline]
pub fn from_slice(s: &str, in_ua_stylesheet: bool) -> Option<Self> {
#[allow(unused_imports)] use std::ascii::AsciiExt;
pub fn from_slice(name: &str) -> Option<Self> {
// We don't need to support tree pseudos because functional
// pseudo-elements needs arguments, and thus should be created
// via other methods.
% for pseudo in SIMPLE_PSEUDOS:
if in_ua_stylesheet || ${pseudo_element_variant(pseudo)}.exposed_in_non_ua_sheets() {
if s.eq_ignore_ascii_case("${pseudo.value[1:]}") {
return Some(${pseudo_element_variant(pseudo)});
match_ignore_ascii_case! { name,
% for pseudo in SIMPLE_PSEUDOS:
"${pseudo.value[1:]}" => {
return Some(${pseudo_element_variant(pseudo)})
}
% endfor
_ => {
// FIXME: -moz-tree check should probably be
// ascii-case-insensitive.
if name.starts_with("-moz-tree-") {
return PseudoElement::tree_pseudo_element(name, Box::new([]))
}
}
% endfor
}
None
}