Reset SelectorCheckingContext.elementStyle for :ancestor matching.

SelectorCheckingContext.elementStyle is used to store the RenderStyle for
the element we are currently computing styles for. It is among other things
used for setting flags on the RenderStyle if we may match :hover,
:first-child, or some other pseudo classes. When we go past a combinator
during matching, we set the elementStyle to null to tell we are not
currently looking at the target element for the selector matching.

The :ancestor pseudo is a special case in the sense that it will select
styles for the shadow host element, but its sub-selectors may actually match
ancestor elements of the host element, behaving as if we had a descendant
combinator. This CL resets elementStyle to 0 when matching ancestors of a
shadow host for the :ancestor pseudo class in order to set flags for :hover,
:first-child, etc on the correct RenderStyle objects.

R=dglazkov@chromium.org
BUG=353503

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

git-svn-id: svn://svn.chromium.org/blink/trunk@169491 bbb929c8-8fbe-4397-9dbb-9b2b20218538
3 files changed
tree: 28e1c35b8ece4f346b5c2af66c67b203f5364296
  1. third_party/