[css-nesting] Fix crash when bucketing '&' within pseudo-element
FindBestRuleSetAndAdd currently relies on the return value of
ExtractBestSelectorValues to place shadow-crossing selectors
in the right buckets. For rules like '::placeholder { & {} }',
this return value is nullptr, since the relation of '&' is kSubSelector,
yet the extracted "selector values" would otherwise suggest
some pseudo element with a kUAShadow relation. FindBestRuleSetAndAdd
is not equipped to handle this discrepancy.
Ideally ExtractBestSelectorValues would not return a CSSSelector*
in the way it does, since it's too easy to neglect "forwarded"
extraction (for :is(), :where(), etc) when acting on that return
value. However, this is a complicated refactor, so for now just
avoid adding the offending selectors to the RuleSet at all.
Fixed: 380107557
Change-Id: Id0cb4978b6f167c0137a45e31835f3f92e082986
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6038941
Commit-Queue: Anders Hartvoll Ruud andruud@chromium.org
Reviewed-by: David Baron dbaron@chromium.org
Cr-Commit-Position: refs/heads/main@{#1388775}