Closed Bug 1893923 Opened 2 years ago Closed 2 years ago

Add ChromeOnly CSSStyleRule::querySelectorAll

Categories

(DevTools :: Inspector: Rules, task)

task

Tracking

(firefox127 fixed)

RESOLVED FIXED
127 Branch
Tracking Status
firefox127 --- fixed

People

(Reporter: nchevobbe, Assigned: nchevobbe)

References

Details

Attachments

(1 file)

This will take a root node, and will return the elements inside the root node that match the rule's selectors
This way, we won't have to serialize the rule (desugared) selectorText which can be expensive

For the selector highlighter, we were retrieving the desugared selector of each
displayed rule, and using the selector text in querySelectorAll to retrieve the
elements matching the rule.
This can be very expensive, especially for deeply nested rule, for a feature that
might not even be used.
This patch is adding a method which takes a root node, and will return the
elements inside the root node that match the rule's selectors.
We're only exposing the method that existed in glue.rs to get the SelectorList
of a given Rule, and call Servo_SelectorList_QueryAll with it to get our NodeList.

A test file is added to ensure this works as expected.

Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/dbd850873912 [devtools] Add ChromeOnly CSSStyleRule::querySelectorAll. r=layout-reviewers,emilio.
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 127 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: