diff --git a/components/style/gecko/pseudo_element.rs b/components/style/gecko/pseudo_element.rs index cf37567252c0..5b1cbfdf2a54 100644 --- a/components/style/gecko/pseudo_element.rs +++ b/components/style/gecko/pseudo_element.rs @@ -87,6 +87,12 @@ impl PseudoElement { *self == PseudoElement::FirstLetter } + /// Whether this pseudo-element is ::first-line. + #[inline] + pub fn is_first_line(&self) -> bool { + *self == PseudoElement::FirstLine + } + /// Whether this pseudo-element is ::-moz-fieldset-content. #[inline] pub fn is_fieldset_content(&self) -> bool { diff --git a/components/style/matching.rs b/components/style/matching.rs index eeb06259dd49..71ec40b79885 100644 --- a/components/style/matching.rs +++ b/components/style/matching.rs @@ -827,7 +827,7 @@ pub trait MatchMethods : TElement { return StyleDifference::new(RestyleDamage::empty(), StyleChange::Unchanged) } - if pseudo.map_or(false, |p| p.is_first_letter()) { + if pseudo.map_or(false, |p| p.is_first_letter() || p.is_first_line()) { // No one cares about this pseudo, and we've checked above that // we're not switching from a "cares" to a "doesn't care" state // or vice versa. diff --git a/components/style/servo/selector_parser.rs b/components/style/servo/selector_parser.rs index c88b4faa3ad9..95ef6b0169f5 100644 --- a/components/style/servo/selector_parser.rs +++ b/components/style/servo/selector_parser.rs @@ -42,6 +42,8 @@ pub enum PseudoElement { Selection, // If/when :first-letter is added, update is_first_letter accordingly. + // If/when :first-line is added, update is_first_line accordingly. + // If/when ::first-letter, ::first-line, or ::placeholder are added, adjust // our property_restriction implementation to do property filtering for // them. Also, make sure the UA sheet has the !important rules some of the @@ -125,6 +127,12 @@ impl PseudoElement { false } + /// Whether the current pseudo element is :first-line + #[inline] + pub fn is_first_line(&self) -> bool { + false + } + /// Whether this pseudo-element is eagerly-cascaded. #[inline] pub fn is_eager(&self) -> bool {