Basic implementation of @apply

This patch adds an initial implementation of @apply. Aside from setting
custom properties from an @apply block, all the other features of @apply
should be implemented.

The implementation strategy is similar to CSS custom properties, in that
we have a special CSSPropertyID value (CSSPropertyApplyAtRule) and store
the rules in StylePropertySets alongside regular declarations.

CSSVariableData is now able to cache a StylePropertySet object so we can
avoid having to re-parse the custom property sets across multiple style
recalcs. Note that this only helps for custom properties with no var()
references or @apply rules, as otherwise we'd create a new object every
style recalc.

The CSSOM interface for @apply implemented here differs from the current
spec draft. Instead of exposing @apply rules by changing CSSStyleRule to
inherit CSSGroupingRule, we instead treat them as regular declarations.
This has some weirdness in that CSSStyleDeclaration.item(i) can return a
value "@apply", which getPropertyValue won't accept. We need to at some
point work out the best behaviors for interfacing with the CSSOM.

As discussed with shans@, we allow @apply rules inside custom properties
and have them resolved when we resolve variables. They behave similarly
to var() references, and also contribute to cycle detection.!topic/blink-dev/Wc71ungGdn4


Review URL:

Cr-Commit-Position: refs/heads/master@{#378108}
46 files changed