Don't add to siblingRules for features left of ::slotted.

Like for ::content distributed elements in shadow dom v0, slotted
elements do not share style if they are assigned/distributed to
different slots. Hence, we don't need to add rules to siblingRules when
the combinators or simple selectors are left of the ::slotted pseudo.

We need to add "::slotted(:nth-child(odd)" to siblingRules, but not
".a + ::slotted(.b)" nor ":nth-of-type(3)::slotted(*)".

Similarly, nothing left of :host or :host-context will ever match, so
we can treat those the same way. Selectors like "div + :host" or
":only-child:host-context(.a)" will never match. There is nothing in
the CSS Scoping spec which says they're invalid, hence they're not
dropped.

There was a bug in https://codereview.chromium.org/1683923003/ which
made us detect adjacent combinators before we had noticed the ::content
following it. The detection of sibling dependent pseudo classes like
:emtpy, :nth-child, etc and adjacent combinators have therefore been
split in this CL so that we handle the simple selectors in a compound
before we handle the combinator. Corresponding unit tests have been
added.

R=kochi@chromium.org,hayato@chromium.org

Review URL: https://codereview.chromium.org/1695393002

Cr-Commit-Position: refs/heads/master@{#375531}
3 files changed