Put RuleSets on their StyleSheetContents.

This makes adding/removing stylesheets much cheaper as we don't
have to create the RuleSets for the existing stylesheets. Also,
in the future when we do more caching of StyleSheetContents,
it means we'll do a lot less work on pages with repeated
stylesheets (e.g. as many web components pages have).

ScopedStyleResolver now holds on to a list of RuleSets, one per
StyleSheetContents. I'm not exactly sure what the
hasOnlyEmptyRuleSets call was supposed to do, but all the tests
pass without it.

Store the styleSheetIndex on MatchedRule so that we can properly
sort rules by their position in ElementRuleCollector::compareRules.

We need to treat stylesheets that have media queries specially
because the RuleSet is different depending on how media queries
evaluate. As such, we can't share StyleSheetContents with media
queries and we need to clear the RuleSet on the StyleSheetContents
whenever media queries might have changed.

Finally, StyleSheetContents::clearRuleSet needs to clear its 
RuleSet, and its parent stylesheet's ruleset since its rules
are merged into its parent's RuleSet. And, it needs to clear the
StyleResolver for all its client CSSStyleSheets since we need to
recreate all the data structures in StyleResolver (i.e. see
ScopedStyleResolver::addRulesFromSheet and what it adds to
StyleResolver).

fast/css/media-query-dynamic.html is a reduction out of acid3.html
that shows the case that needs the CSSComputedStyleDeclaration.cpp
change. We should create the styleResolver if we don't have one so
we can figure out if it has any viewport dependent media queries.
The old code was just buggy and wrong.

fast/dom/shadow/part-override-style-in-shadow-tree-expected.txt is 
a genuine regression, but :part is no longer a feature we plan to
ship. It will be removed shortly, so I'm just rebaselineing for now.

Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=162573

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

git-svn-id: svn://svn.chromium.org/blink/trunk@163040 bbb929c8-8fbe-4397-9dbb-9b2b20218538