Filter out non-applying properties when cascading style for ::first-letter/::first-line/::placeholder. r=emilio

Part 3 of the fix for Gecko bug 1382786 <https://bugzilla.mozilla.org/show_bug.cgi?id=1382786>.
This commit is contained in:
Boris Zbarsky 2017-07-21 14:16:06 -04:00
parent 592a96fc06
commit 86b3b6a32f
3 changed files with 41 additions and 0 deletions

View file

@ -10,6 +10,8 @@
use cssparser::{ToCss, serialize_identifier};
use gecko_bindings::structs::{self, CSSPseudoElementType};
use properties::{PropertyFlags, APPLIES_TO_FIRST_LETTER, APPLIES_TO_FIRST_LINE};
use properties::APPLIES_TO_PLACEHOLDER;
use selector_parser::{NonTSPseudoClass, PseudoElementCascadeType, SelectorImpl};
use std::fmt;
use string_cache::Atom;
@ -119,4 +121,15 @@ impl PseudoElement {
_ => self.clone(),
}
}
/// Property flag that properties must have to apply to this pseudo-element.
#[inline]
pub fn property_restriction(&self) -> Option<PropertyFlags> {
match *self {
PseudoElement::FirstLetter => Some(APPLIES_TO_FIRST_LETTER),
PseudoElement::FirstLine => Some(APPLIES_TO_FIRST_LINE),
PseudoElement::Placeholder => Some(APPLIES_TO_PLACEHOLDER),
_ => None,
}
}
}