Avoid style invalidation for empty sets.

Invalidation sets which are empty stems from selector features only found
in the rightmost compound selector, and can only cause invalidation of
elements for which they are scheduled. When adding these sets, just mark
the element with a LocalStyleChange and do not schedule a style
invalidation for them.

Similarly, mark with a SubtreeStyleChange and clear all scheduled
invalidation sets for an element which gets a wholeSubtreeInvalid set
scheduled.

This fixes two sub-optimal behaviors in the code.

1. We avoid running style invalidation, hence traversing the DOM tree an
   extra time, if we only have local/subtree changes scheduled.
2. We avoid traversing subtrees checking against an empty invalidation set
   that will never match.

Note that we will still have to run the style invalidation step to clear
style invalidation bits on elements if there were invalidation sets
scheduled prior to a SubtreeStyleChange that nuked the entry in the
m_pendingInvalidationMap.

Added missing check for m_customPseudoInvalid in isEmpty and resetting it
in setWholeSubtreeInvalid() was added.

Since rules of type ".x {}" will not lead to a style invalidation pass
anymore, ".x .dummy {}" type rules have been added to the inspector tests
when testing style invalidation tracking.

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

git-svn-id: svn://svn.chromium.org/blink/trunk@190680 bbb929c8-8fbe-4397-9dbb-9b2b20218538
8 files changed
tree: 14d1de84165e70b4fc8d5b720399bc3c3dfba8ac
  1. third_party/