|
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.
https://groups.google.com/a/chromium.org/forum/?fromgroups#!topic/blink-dev/Wc71ungGdn4
https://tabatkins.github.io/specs/css-apply-rule/
BUG= 586974
Committed: https://crrev.com/39709d9f02fcb5c6b746e773b6c48b8e6855819e
Cr-Commit-Position: refs/heads/master@{#378108}
Total comments: 1
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+784 lines, -22 lines) |
Patch |
|
A |
third_party/WebKit/LayoutTests/fast/css/atapply/at-apply-basic.html
|
View
|
|
1 chunk |
+22 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/fast/css/atapply/at-apply-cascade.html
|
View
|
|
1 chunk |
+24 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/fast/css/atapply/at-apply-cascade-multiple-rules.html
|
View
|
|
1 chunk |
+29 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/fast/css/atapply/at-apply-cascade-trick.html
|
View
|
|
1 chunk |
+39 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/fast/css/atapply/at-apply-cascade-trick-2.html
|
View
|
1
2
3
4
5
|
1 chunk |
+38 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/fast/css/atapply/at-apply-cascade-trick-2-expected.txt
|
View
|
1
2
3
4
5
6
7
|
1 chunk |
+4 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/fast/css/atapply/at-apply-cssom-apis.html
|
View
|
|
1 chunk |
+26 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/fast/css/atapply/at-apply-in-inline-style.html
|
View
|
|
1 chunk |
+21 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/fast/css/atapply/at-apply-in-regular-property.html
|
View
|
1
|
1 chunk |
+24 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/fast/css/atapply/at-apply-in-regular-property-expected.txt
|
View
|
1
|
1 chunk |
+4 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/fast/css/atapply/at-apply-inherited-variable.html
|
View
|
|
1 chunk |
+26 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/fast/css/atapply/at-apply-invalid-cycles.html
|
View
|
|
1 chunk |
+32 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/fast/css/atapply/at-apply-invalid-nesting.html
|
View
|
|
1 chunk |
+27 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/fast/css/atapply/at-apply-invalid-syntax.html
|
View
|
|
1 chunk |
+47 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/fast/css/atapply/at-apply-nested.html
|
View
|
|
1 chunk |
+27 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/fast/css/atapply/at-apply-override-custom-property.html
|
View
|
1
2
3
|
1 chunk |
+30 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/fast/css/atapply/at-apply-override-custom-property-expected.txt
|
View
|
|
1 chunk |
+4 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/fast/css/atapply/at-apply-override-self.html
|
View
|
|
1 chunk |
+25 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/fast/css/atapply/at-apply-override-self-expected.txt
|
View
|
|
1 chunk |
+4 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/fast/css/atapply/at-apply-recursive.html
|
View
|
|
1 chunk |
+23 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/fast/css/atapply/at-apply-shorthands.html
|
View
|
|
1 chunk |
+20 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/fast/css/atapply/at-apply-variable-references.html
|
View
|
|
1 chunk |
+24 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/fast/css/atapply/at-apply-whitespace.html
|
View
|
|
1 chunk |
+22 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/fast/css/atapply/custom-property-set-syntax.html
|
View
|
|
1 chunk |
+17 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/fast/css/atapply/multiple-at-apply-rules.html
|
View
|
|
1 chunk |
+26 lines, -0 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/build/scripts/css_properties.py
|
View
|
|
1 chunk |
+4 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/build/scripts/make_css_property_names.py
|
View
|
|
2 chunks |
+4 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/build/scripts/templates/CSSPropertyMetadata.cpp.tmpl
|
View
|
|
1 chunk |
+12 lines, -12 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/css/CSSVariableData.h
|
View
|
|
4 chunks |
+9 lines, -0 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/css/CSSVariableData.cpp
|
View
|
|
2 chunks |
+12 lines, -0 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/css/PropertySetCSSStyleDeclaration.cpp
|
View
|
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/css/StylePropertySerializer.cpp
|
View
|
|
2 chunks |
+14 lines, -0 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/css/parser/CSSAtRuleID.h
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/css/parser/CSSAtRuleID.cpp
|
View
|
|
2 chunks |
+6 lines, -0 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/css/parser/CSSParser.h
|
View
|
|
2 chunks |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/css/parser/CSSParser.cpp
|
View
|
|
1 chunk |
+5 lines, -0 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/css/parser/CSSParserImpl.h
|
View
|
1
2
3
4
5
6
|
3 chunks |
+5 lines, -0 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp
|
View
|
1
2
3
4
5
6
|
6 chunks |
+46 lines, -3 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/css/parser/CSSVariableParser.cpp
|
View
|
1
2
3
4
5
6
|
1 chunk |
+7 lines, -0 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.h
|
View
|
|
1 chunk |
+3 lines, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp
|
View
|
1
2
3
4
5
6
|
3 chunks |
+37 lines, -0 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/css/resolver/StyleResolver.h
|
View
|
1
2
3
4
5
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
|
View
|
1
2
3
4
5
|
2 chunks |
+24 lines, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/frame/UseCounter.h
|
View
|
1
2
3
4
5
6
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/frame/UseCounter.cpp
|
View
|
|
2 chunks |
+2 lines, -1 line |
1 comment
|
Download
|
|
M |
third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in
|
View
|
1
2
3
4
5
6
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
Total messages: 26 (17 generated)
|