Bug 1364412: Expose pseudo-element flags, and properly reject pseudos in non-UA sheets. r=bholley

MozReview-Commit-ID: KYC1ywfI7Lg
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
Emilio Cobos Álvarez 2017-05-15 16:19:24 +02:00
parent 5820e3ecac
commit 1e0edf4909
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
7 changed files with 742 additions and 332 deletions

View file

@ -9,7 +9,7 @@
//! need to update the checked-in files for Servo.
use cssparser::ToCss;
use gecko_bindings::structs::CSSPseudoElementType;
use gecko_bindings::structs::{self, CSSPseudoElementType};
use selector_parser::PseudoElementCascadeType;
use std::fmt;
use string_cache::Atom;
@ -61,6 +61,26 @@ impl PseudoElement {
pub fn is_lazy(&self) -> bool {
!self.is_eager() && !self.is_precomputed()
}
/// Whether this pseudo-element is web-exposed.
pub fn exposed_in_non_ua_sheets(&self) -> bool {
if self.is_anon_box() {
return false;
}
(self.flags() & structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY) == 0
}
/// Whether this pseudo-element supports user action selectors.
pub fn supports_user_action_state(&self) -> bool {
(self.flags() & structs::CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE) != 0
}
/// Whether this pseudo-element is precomputed.
#[inline]
pub fn is_precomputed(&self) -> bool {
self.is_anon_box()
}
}
impl ToCss for PseudoElement {