Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Issue 1645433002: Basic implementation of @apply (Closed)

Created:
4 years, 10 months ago by Timothy Loh
Modified:
4 years, 9 months ago
CC:
darktears, apavlov+blink_chromium.org, blink-reviews, blink-reviews-css, blink-reviews-style_chromium.org, chromium-reviews, dglazkov+blink, kinuko+watch, rwlbuis
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

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}

Patch Set 1 : #

Patch Set 2 : a couple more tests #

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : #

Patch Set 6 : #

Patch Set 7 : rebase #

Patch Set 8 : fix expted.txt for failing test #

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

Messages

Total messages: 26 (17 generated)
Timothy Loh
Should be ready for a first look. I just realized we probably allow some weird ...
4 years, 10 months ago (2016-02-23 00:50:36 UTC) #11
dstockwell
lgtm
4 years, 9 months ago (2016-02-25 23:27:12 UTC) #12
Timothy Loh
+noel for platform OWNERS (I touched RuntimeEnabledFeatures.in)
4 years, 9 months ago (2016-02-25 23:45:33 UTC) #14
Timothy Loh
haraken, could you have a look for RuntimeEnabledFeatures.in? thanks!
4 years, 9 months ago (2016-02-26 04:12:59 UTC) #16
haraken
On 2016/02/26 04:12:59, Timothy Loh wrote: > haraken, could you have a look for RuntimeEnabledFeatures.in? ...
4 years, 9 months ago (2016-02-26 08:31:04 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1645433002/240001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1645433002/240001
4 years, 9 months ago (2016-02-27 02:36:27 UTC) #20
commit-bot: I haz the power
Committed patchset #8 (id:240001)
4 years, 9 months ago (2016-02-27 03:53:14 UTC) #22
commit-bot: I haz the power
Patchset 8 (id:??) landed as https://crrev.com/39709d9f02fcb5c6b746e773b6c48b8e6855819e Cr-Commit-Position: refs/heads/master@{#378108}
4 years, 9 months ago (2016-02-27 03:54:48 UTC) #24
drott
4 years, 9 months ago (2016-03-17 07:38:44 UTC) #26
Message was sent while issue was closed.
https://codereview.chromium.org/1645433002/diff/240001/third_party/WebKit/Sou...
File third_party/WebKit/Source/core/frame/UseCounter.cpp (right):

https://codereview.chromium.org/1645433002/diff/240001/third_party/WebKit/Sou...
third_party/WebKit/Source/core/frame/UseCounter.cpp:572: // 3. Run the
update_use_counter_css.py script in
Could you run this to update the histograms.xml file?

Powered by Google App Engine
This is Rietveld 408576698