style: Add simple parsing and matching support for :has

Parsing is behind a config value `layout.css.has-selectors.enabled`. This
change does not support p:has(> a) combinators, but will handle them
gracefully, just not matching on them.

Differential Revision: https://phabricator.services.mozilla.com/D149515
This commit is contained in:
Tiaan Louw 2022-06-20 08:53:02 +00:00 committed by Martin Robinson
parent dcdf9f33d5
commit 3d0cf4dbf9
8 changed files with 85 additions and 10 deletions

View file

@ -695,7 +695,9 @@ where
Component::Slotted(ref selector) | Component::Host(Some(ref selector)) => {
selector.size_of(ops)
},
Component::Is(ref list) | Component::Where(ref list) => list.size_of(ops),
Component::Is(ref list) |
Component::Where(ref list) |
Component::Has(ref list) => list.size_of(ops),
Component::PseudoElement(ref pseudo) => (*pseudo).size_of(ops),
Component::Combinator(..) |
Component::ExplicitAnyNamespace |