зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #19534 - style: Simplify naming and signatures of single-colon pseudo stuff (from emilio:naming-is-a-bit-hard-but-not-that-hard); r=nox
Also drop a few FIXMEs while at it, since they look bogus. Source-Repo: https://github.com/servo/servo Source-Revision: 051eb6bcb9204ecab1c1481a275a09fd50bf0467 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 049f90ddd1ae37e05adec201fbaa6f876cbdddfe
This commit is contained in:
Родитель
158a96884b
Коммит
342c95966f
|
@ -127,7 +127,7 @@ pub trait Parser<'i> {
|
|||
|
||||
/// Whether the name is a pseudo-element that can be specified with
|
||||
/// the single colon syntax in addition to the double-colon syntax.
|
||||
fn is_pseudo_element_allows_single_colon(name: &CowRcStr<'i>) -> bool {
|
||||
fn pseudo_element_allows_single_colon(name: &str) -> bool {
|
||||
is_css2_pseudo_element(name)
|
||||
}
|
||||
|
||||
|
@ -1701,7 +1701,7 @@ where
|
|||
/// Returns whether the name corresponds to a CSS2 pseudo-element that
|
||||
/// can be specified with the single colon syntax (in addition to the
|
||||
/// double-colon syntax, which can be used for all pseudo-elements).
|
||||
pub fn is_css2_pseudo_element<'i>(name: &CowRcStr<'i>) -> bool {
|
||||
pub fn is_css2_pseudo_element(name: &str) -> bool {
|
||||
// ** Do not add to this list! **
|
||||
match_ignore_ascii_case! { name,
|
||||
"before" | "after" | "first-line" | "first-letter" => true,
|
||||
|
@ -1760,7 +1760,7 @@ where
|
|||
)),
|
||||
};
|
||||
let is_pseudo_element = !is_single_colon ||
|
||||
P::is_pseudo_element_allows_single_colon(&name);
|
||||
P::pseudo_element_allows_single_colon(&name);
|
||||
if is_pseudo_element {
|
||||
let pseudo_element = if is_functional {
|
||||
input.parse_nested_block(|input| {
|
||||
|
|
|
@ -333,9 +333,10 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
|
|||
type Impl = SelectorImpl;
|
||||
type Error = StyleParseErrorKind<'i>;
|
||||
|
||||
fn is_pseudo_element_allows_single_colon(name: &CowRcStr<'i>) -> bool {
|
||||
fn pseudo_element_allows_single_colon(name: &str) -> bool {
|
||||
// FIXME: -moz-tree check should probably be ascii-case-insensitive.
|
||||
::selectors::parser::is_css2_pseudo_element(name) ||
|
||||
name.starts_with("-moz-tree-") // tree pseudo-elements
|
||||
name.starts_with("-moz-tree-")
|
||||
}
|
||||
|
||||
fn parse_non_ts_pseudo_class(
|
||||
|
@ -431,6 +432,8 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
|
|||
) -> Result<PseudoElement, ParseError<'i>> {
|
||||
PseudoElement::from_slice(&name, self.in_user_agent_stylesheet())
|
||||
.or_else(|| {
|
||||
// FIXME: -moz-tree check should probably be
|
||||
// ascii-case-insensitive.
|
||||
if name.starts_with("-moz-tree-") {
|
||||
PseudoElement::tree_pseudo_element(&name, Box::new([]))
|
||||
} else {
|
||||
|
@ -445,9 +448,10 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
|
|||
name: CowRcStr<'i>,
|
||||
parser: &mut Parser<'i, 't>,
|
||||
) -> Result<PseudoElement, ParseError<'i>> {
|
||||
// FIXME: -moz-tree check should probably be ascii-case-insensitive.
|
||||
if name.starts_with("-moz-tree-") {
|
||||
// Tree pseudo-elements can have zero or more arguments,
|
||||
// separated by either comma or space.
|
||||
// Tree pseudo-elements can have zero or more arguments, separated
|
||||
// by either comma or space.
|
||||
let mut args = Vec::new();
|
||||
loop {
|
||||
let location = parser.current_source_location();
|
||||
|
|
Загрузка…
Ссылка в новой задаче