From f12e4b826f4989c9c0a2714457fbcf7ad71e534e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Thu, 28 Apr 2016 03:19:43 +0200 Subject: [PATCH] style: Add doc-comment about is_eagerly_cascaded_pseudo_element --- components/style/selector_impl.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/components/style/selector_impl.rs b/components/style/selector_impl.rs index 842f08ae33d..b7faff4c028 100644 --- a/components/style/selector_impl.rs +++ b/components/style/selector_impl.rs @@ -18,6 +18,24 @@ pub trait SelectorImplExt : SelectorImpl + Sized { fn each_pseudo_element(mut fun: F) where F: FnMut(::PseudoElement); + /// This function determines if a pseudo-element is eagerly cascaded or not. + /// + /// Eagerly cascaded pseudo-elements are "normal" pseudo-elements (i.e. + /// `::before` and `::after`). They inherit styles normally as another + /// selector would do. + /// + /// Non-eagerly cascaded ones skip the cascade process entirely, mostly as + /// an optimisation since they are private pseudo-elements (like + /// `::-servo-details-content`). This pseudo-elements are resolved on the + /// fly using global rules (rules of the form `*|*`), and applying them to + /// the parent style. + /// + /// If you're implementing a public selector that the end-user might + /// customize, then you probably need doing the whole cascading process and + /// return true in this function for that pseudo. + /// + /// But if you are implementing a private pseudo-element, please consider if + /// it might be possible to skip the cascade for it. fn is_eagerly_cascaded_pseudo_element(pseudo: &::PseudoElement) -> bool; #[inline]