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

@ -239,7 +239,7 @@ pub(crate) fn handle_get_stylesheet_style(
let styles = (0..list.Length())
.filter_map(move |i| {
let rule = list.Item(i)?;
let rule = list.Item(i, can_gc)?;
let style = rule.downcast::<CSSStyleRule>()?;
if *selector != *style.SelectorText() {
return None;
@ -270,6 +270,7 @@ pub(crate) fn handle_get_selectors(
pipeline: PipelineId,
node_id: String,
reply: IpcSender<Option<Vec<(String, usize)>>>,
can_gc: CanGc,
) {
let msg = (|| {
let node = find_node_by_unique_id(documents, pipeline, &node_id)?;
@ -285,7 +286,7 @@ pub(crate) fn handle_get_selectors(
let elem = node.downcast::<Element>()?;
Some((0..list.Length()).filter_map(move |j| {
let rule = list.Item(j)?;
let rule = list.Item(j, can_gc)?;
let style = rule.downcast::<CSSStyleRule>()?;
let selector = style.SelectorText();
elem.Matches(selector.clone()).ok()?.then_some(())?;