Consider pseudo classes as matching for shared style rejection.

The user action pseudo classes rely on affectedBy bits to be correctly
set on ComputedStyle in order to recalculate style for such changes
later on. If two elements may otherwise share style, but will have the
affectedBy bits set differently, they may not share style.

Example:

  <style>[attr]:hover {}</style>
  <div></div>
  <div attr></div>

The second div may share style with the first one when none of them is
hovered. However, matching the selector against the first div will fail
on the attribute selector before we try to match :hover, hence the flag
for affectedByHover will not be set. If we share that ComputedStyle
object with the second div, hovering the second div later will have no
effect.

Instead we always match :hover/:active/:focus/:-webkit-drag when
matching rules for style sharing (attribute and sibling rules). That
will lead to the attribute selector in the example above to match which
will cause style sharing to be rejected for the second div.

R=meade@chromium.org
BUG=639561

Review-Url: https://codereview.chromium.org/2272683002
Cr-Commit-Position: refs/heads/master@{#414221}
6 files changed