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

Issue 2702173002: Generate mappings between CSSValueID and ComputedStyle enums. (Closed)

Created:
3 years, 10 months ago by shend
Modified:
3 years, 9 months ago
Reviewers:
meade_UTC10, Bugs Nash
CC:
darktears, apavlov+blink_chromium.org, blink-reviews, blink-reviews-css, chromium-reviews, dglazkov+blink, rwlbuis
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Generate mappings between CSSValueID and ComputedStyle enums. To convert between CSSValueIDs and ComputedStyle enums, we currently use handwritten switch statements. This patch generates, for every 'keyword' field in CSSProperties.json5, a pair of mapping functions that convert between a CSSValueID and the corresponding enum of the field. This makes it easier to add new CSS properties and reduces the risk of typos in the handwritten mapping functions. As we generate more CSS properties, we can remove more of the handwritten switch statements. For special cases that we can't generate (e.g. when the mapping is not bijective), we can overload/ specialize the mapping functions in C++. The generated mappings file CSSValueMappings.h is at: https://gist.github.com/anonymous/93e797f4e99c3e8aba829139f612abe0 The names for the mapping functions comes from: https://codereview.chromium.org/2366243002/ BUG=665272 Review-Url: https://codereview.chromium.org/2702173002 Cr-Commit-Position: refs/heads/master@{#453643} Committed: https://chromium.googlesource.com/chromium/src/+/5bf6de7534c19b51e66607786263b90deba99b26

Patch Set 1 #

Patch Set 2 : Generate more things #

Patch Set 3 : Do it properly #

Total comments: 1

Patch Set 4 : Forgot file #

Patch Set 5 : Forgot case #

Unified diffs Side-by-side diffs Delta from patch set Stats (+166 lines, -1091 lines) Patch
M third_party/WebKit/Source/build/scripts/make_computed_style_base.py View 1 2 5 chunks +29 lines, -8 lines 0 comments Download
A third_party/WebKit/Source/build/scripts/templates/CSSValueIDMappingsGenerated.h.tmpl View 1 2 3 1 chunk +53 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/BUILD.gn View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/css/BUILD.gn View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/css/CSSIdentifierValue.h View 1 2 3 chunks +9 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h View 1 2 14 chunks +2 lines, -1081 lines 0 comments Download
A third_party/WebKit/Source/core/css/CSSValueIDMappings.h View 1 2 3 4 1 chunk +70 lines, -0 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 25 (19 generated)
shend
Hi Bugs, PTAL :)
3 years, 10 months ago (2017-02-20 05:25:54 UTC) #2
Bugs Nash
On 2017/02/20 at 05:25:54, shend wrote: > Hi Bugs, PTAL :) lgtm with description suggestions ...
3 years, 10 months ago (2017-02-20 22:30:13 UTC) #6
shend
Thanks Bugs, I've also updated the CL to handle special cases better. Hi Eddy, PTAL ...
3 years, 10 months ago (2017-02-21 23:38:00 UTC) #10
meade_UTC10
lgtm \o/ https://codereview.chromium.org/2702173002/diff/40001/third_party/WebKit/Source/build/scripts/templates/CSSValueIDMappingsGenerated.h.tmpl File third_party/WebKit/Source/build/scripts/templates/CSSValueIDMappingsGenerated.h.tmpl (right): https://codereview.chromium.org/2702173002/diff/40001/third_party/WebKit/Source/build/scripts/templates/CSSValueIDMappingsGenerated.h.tmpl#newcode18 third_party/WebKit/Source/build/scripts/templates/CSSValueIDMappingsGenerated.h.tmpl:18: // TODO(shend): can we put these in ...
3 years, 10 months ago (2017-02-22 07:00:02 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2702173002/80001
3 years, 9 months ago (2017-02-28 18:05:50 UTC) #22
commit-bot: I haz the power
3 years, 9 months ago (2017-02-28 18:12:30 UTC) #25
Message was sent while issue was closed.
Committed patchset #5 (id:80001) as
https://chromium.googlesource.com/chromium/src/+/5bf6de7534c19b51e66607786263...

Powered by Google App Engine
This is Rietveld 408576698