Page MenuHomePhabricator

Bug 1497389 - Add a fast path for querySelector{,All} when we have classes or tags in the rightmost compound.
ClosedPublic

Authored by emilio on Oct 21 2018, 9:54 AM.

Details

Reviewers
heycam
Group Reviewers
Restricted Project
Commits
Restricted Diffusion Commit
rMOZILLACENTRAL7a6abfe37ce5: Bug 1497389 - Add a fast path for querySelector{,All} when we have classes or…
Bugzilla Bug ID
1497389
Summary

Before this patch we were only optimizing the case of a single selector, which
is fine, but not enough to catch ones like .foo .bar or so.

This patch allows us to optimize classes and tags in the rightmost compound,
while keeping the current optimization for #id selectors.

Need to profile this, but code-wise should be ready for review.

Diff Detail

Repository
rMOZILLACENTRAL mozilla-central
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

emilio created this revision.Oct 21 2018, 9:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 21 2018, 9:54 AM
phab-bot changed the visibility from "Custom Policy" to "Public (No Login Required)".Oct 21 2018, 9:54 AM
phab-bot changed the edit policy from "Custom Policy" to "Restricted Project (Project)".
phab-bot removed a project: Restricted Project.
emilio requested review of this revision.Oct 21 2018, 9:54 AM
heycam accepted this revision.Oct 28 2018, 11:27 PM
heycam added a subscriber: heycam.
heycam added inline comments.
servo/components/style/dom_apis.rs
390–398

Since it's a bit more complicated now, can you add to the comment here to describe all the cases that query_selector_fast handles?

502–504

Can you add a comment here saying why we prefer to look at a class rather than a local name, if both are present?

534–535

Nit: maybe s/or such/that we could handle/, since IDs are the only thing that make us return above, but there are still some ID cases where we return Err above.

This revision is now accepted and ready to land.Oct 28 2018, 11:27 PM
emilio marked 3 inline comments as done.Oct 29 2018, 12:03 PM
emilio updated this revision to Diff 29040.Oct 29 2018, 12:04 PM

Address comments.

This revision was automatically updated to reflect the committed changes.