Propagate CanGc arguments through callers in constructors (#35541)

Signed-off-by: Auguste Baum <auguste.apple@gmail.com>
This commit is contained in:
Auguste Baum 2025-02-20 17:17:45 +01:00 committed by GitHub
parent 5465bfc2af
commit 863d2ce871
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
260 changed files with 986 additions and 603 deletions

View file

@ -25,6 +25,7 @@ use crate::dom::cssstylerule::CSSStyleRule;
use crate::dom::cssstylesheet::CSSStyleSheet;
use crate::dom::csssupportsrule::CSSSupportsRule;
use crate::dom::window::Window;
use crate::script_runtime::CanGc;
#[dom_struct]
pub(crate) struct CSSRule {
@ -82,38 +83,65 @@ impl CSSRule {
) -> DomRoot<CSSRule> {
// be sure to update the match in as_specific when this is updated
match rule {
StyleCssRule::Import(s) => {
DomRoot::upcast(CSSImportRule::new(window, parent_stylesheet, s))
},
StyleCssRule::Style(s) => {
DomRoot::upcast(CSSStyleRule::new(window, parent_stylesheet, s))
},
StyleCssRule::FontFace(s) => {
DomRoot::upcast(CSSFontFaceRule::new(window, parent_stylesheet, s))
},
StyleCssRule::Import(s) => DomRoot::upcast(CSSImportRule::new(
window,
parent_stylesheet,
s,
CanGc::note(),
)),
StyleCssRule::Style(s) => DomRoot::upcast(CSSStyleRule::new(
window,
parent_stylesheet,
s,
CanGc::note(),
)),
StyleCssRule::FontFace(s) => DomRoot::upcast(CSSFontFaceRule::new(
window,
parent_stylesheet,
s,
CanGc::note(),
)),
StyleCssRule::FontFeatureValues(_) => unimplemented!(),
StyleCssRule::CounterStyle(_) => unimplemented!(),
StyleCssRule::Keyframes(s) => {
DomRoot::upcast(CSSKeyframesRule::new(window, parent_stylesheet, s))
},
StyleCssRule::Media(s) => {
DomRoot::upcast(CSSMediaRule::new(window, parent_stylesheet, s))
},
StyleCssRule::Namespace(s) => {
DomRoot::upcast(CSSNamespaceRule::new(window, parent_stylesheet, s))
},
StyleCssRule::Supports(s) => {
DomRoot::upcast(CSSSupportsRule::new(window, parent_stylesheet, s))
},
StyleCssRule::Keyframes(s) => DomRoot::upcast(CSSKeyframesRule::new(
window,
parent_stylesheet,
s,
CanGc::note(),
)),
StyleCssRule::Media(s) => DomRoot::upcast(CSSMediaRule::new(
window,
parent_stylesheet,
s,
CanGc::note(),
)),
StyleCssRule::Namespace(s) => DomRoot::upcast(CSSNamespaceRule::new(
window,
parent_stylesheet,
s,
CanGc::note(),
)),
StyleCssRule::Supports(s) => DomRoot::upcast(CSSSupportsRule::new(
window,
parent_stylesheet,
s,
CanGc::note(),
)),
StyleCssRule::Page(_) => unreachable!(),
StyleCssRule::Container(_) => unimplemented!(), // TODO
StyleCssRule::Document(_) => unimplemented!(), // TODO
StyleCssRule::LayerBlock(s) => {
DomRoot::upcast(CSSLayerBlockRule::new(window, parent_stylesheet, s))
},
StyleCssRule::LayerStatement(s) => {
DomRoot::upcast(CSSLayerStatementRule::new(window, parent_stylesheet, s))
},
StyleCssRule::LayerBlock(s) => DomRoot::upcast(CSSLayerBlockRule::new(
window,
parent_stylesheet,
s,
CanGc::note(),
)),
StyleCssRule::LayerStatement(s) => DomRoot::upcast(CSSLayerStatementRule::new(
window,
parent_stylesheet,
s,
CanGc::note(),
)),
StyleCssRule::FontPaletteValues(_) => unimplemented!(), // TODO
StyleCssRule::Property(_) => unimplemented!(), // TODO
StyleCssRule::Margin(_) => unimplemented!(), // TODO