DescriptionDon't add siblingRules with combinator left of ::content.
RuleFeatureSet::siblingRules are collected because we need to skip
style sharing between elements which do not match the same set of
sibling selectors. Style sharing only happens if two elements' parent
chain of computed styles are common. That means that descendants of
their common ancestor also need to share style.
Due to this check in SharedStyleFinder::canShareStyleWithElement:
if (!sharingCandidateDistributedToSameInsertionPoint(candidate))
return false;
Elements with distributed nodes in their ancestor chain need to be
distributed to the same insertion points in order to share style. That
is, two elements which may share style match the same insertion points
for all selectors containing the ::content pseudo. Which also means
that any sibling selectors left of any ::content pseudo will match the
same sibling combinations for all elements which may share style.
Hence, we don't need to reject style sharing based on selectors like:
.a + .b ::content .c
because the sharing would already be rejected because of insertion
point mismatch in the ancestor chain.
This CL skips adding rules to RuleFeatureSet::siblingRules if we have
seen a ::content combinator before we see any sibling selectors.
We currently rejecting style sharing for slots checking
isChildOfV1ShadowHost() in Element::supportsStyleSharing(), so we could
have skipped adding any of the ::slotted rules to siblingRules. I'm not
doing that here as that might change since ::slotted is work in
progress.
If continue to skip style sharing past different slots, this means we
will only need to consider siblingRules from the same TreeScope when
for Shadow DOM V1, which means we don't need a global set of
siblingRules.
R=kochi@chromium.org,hayato@chromium.org,esprehn@chromium.org
BUG=401359
Committed: https://crrev.com/87e6a478af25c7976849f5bc8cf88d16cdcd635c
Cr-Commit-Position: refs/heads/master@{#375454}
Patch Set 1 #
Total comments: 4
Patch Set 2 : Missing clear #
Messages
Total messages: 17 (4 generated)
|