script: Feature-gate all crown support. (#35055)

* script: Feature-gate all crown support.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Use cfg(crown) instead of a cargo feature.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2025-01-18 16:36:15 -05:00 committed by GitHub
parent 1bd34a5781
commit 875e387004
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
223 changed files with 442 additions and 417 deletions

View file

@ -1833,7 +1833,7 @@ impl Node {
Node::new_(NodeFlags::empty(), Some(doc))
}
#[allow(crown::unrooted_must_root)]
#[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new_document_node() -> Node {
Node::new_(
NodeFlags::IS_IN_A_DOCUMENT_TREE | NodeFlags::IS_CONNECTED,
@ -1841,7 +1841,7 @@ impl Node {
)
}
#[allow(crown::unrooted_must_root)]
#[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn new_(flags: NodeFlags, doc: Option<&Document>) -> Node {
Node {
eventtarget: EventTarget::new_inherited(),
@ -3355,7 +3355,7 @@ pub(crate) trait NodeTraits {
fn containing_shadow_root(&self) -> Option<DomRoot<ShadowRoot>>;
/// Get the stylesheet owner for this node: either the [`Document`] or the [`ShadowRoot`]
/// of the node.
#[allow(crown::unrooted_must_root)]
#[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn stylesheet_list_owner(&self) -> StyleSheetListOwner;
}
@ -3376,7 +3376,7 @@ impl<T: DerivedFrom<Node> + DomObject> NodeTraits for T {
Node::containing_shadow_root(self.upcast())
}
#[allow(crown::unrooted_must_root)]
#[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn stylesheet_list_owner(&self) -> StyleSheetListOwner {
self.containing_shadow_root()
.map(|shadow_root| StyleSheetListOwner::ShadowRoot(Dom::from_ref(&*shadow_root)))