refactor: add CanGc as argument to methods in CSSKeyframeRule, CSSMediaRule, CSSRule (#35796)

Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
This commit is contained in:
Yerkebulan Tulibergenov 2025-03-05 00:39:11 -08:00 committed by GitHub
parent 78f7d525cc
commit 16aeeaec85
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 30 additions and 17 deletions

View file

@ -186,7 +186,7 @@ impl CSSRuleList {
}
}
pub(crate) fn item(&self, idx: u32) -> Option<DomRoot<CSSRule>> {
pub(crate) fn item(&self, idx: u32, can_gc: CanGc) -> Option<DomRoot<CSSRule>> {
self.dom_rules.borrow().get(idx as usize).map(|rule| {
rule.or_init(|| {
let parent_stylesheet = &self.parent_stylesheet;
@ -196,13 +196,13 @@ impl CSSRuleList {
self.global().as_window(),
parent_stylesheet,
rules.read_with(&guard).0[idx as usize].clone(),
CanGc::note(),
can_gc,
),
RulesSource::Keyframes(ref rules) => DomRoot::upcast(CSSKeyframeRule::new(
self.global().as_window(),
parent_stylesheet,
rules.read_with(&guard).keyframes[idx as usize].clone(),
CanGc::note(),
can_gc,
)),
}
})
@ -224,8 +224,8 @@ impl CSSRuleList {
impl CSSRuleListMethods<crate::DomTypeHolder> for CSSRuleList {
// https://drafts.csswg.org/cssom/#ref-for-dom-cssrulelist-item-1
fn Item(&self, idx: u32) -> Option<DomRoot<CSSRule>> {
self.item(idx)
fn Item(&self, idx: u32, can_gc: CanGc) -> Option<DomRoot<CSSRule>> {
self.item(idx, can_gc)
}
// https://drafts.csswg.org/cssom/#dom-cssrulelist-length
@ -234,7 +234,7 @@ impl CSSRuleListMethods<crate::DomTypeHolder> for CSSRuleList {
}
// check-tidy: no specs after this line
fn IndexedGetter(&self, index: u32) -> Option<DomRoot<CSSRule>> {
self.Item(index)
fn IndexedGetter(&self, index: u32, can_gc: CanGc) -> Option<DomRoot<CSSRule>> {
self.Item(index, can_gc)
}
}