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

Issue 2693933003: Move field-dependent code in ComputedStyleBase to Jinja macros. (Closed)

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

Description

Move field-dependent code in ComputedStyleBase to Jinja macros. When we're generating fields in ComputedStyleBase, there are cases where the generated code depends on the field template. For example, keyword fields may have different getters than platform type fields. Instead of doing if-else statements inside the template which makes it quite ugly, this patch moves that logic out into their own files as Jinja macros. Each file defines Jinja macros that specify how a field should be generated. This patch adds a 'keyword' template for enums, 'flag' template for bools, and 'monotonic_flag' for nonproperty flags that can't be set to false. Link to generated code: https://gist.github.com/anonymous/93f5d3907e3515d0b50adf0107f3000e Link to diff (see differences in 'initialUnique' and 'resetUnique'): https://www.diffchecker.com/mikllVbf BUG=628043 Review-Url: https://codereview.chromium.org/2693933003 Cr-Commit-Position: refs/heads/master@{#456095} Committed: https://chromium.googlesource.com/chromium/src/+/6ce2feb35c970fe7d9557c851c016c6d6c8b1d39

Patch Set 1 #

Patch Set 2 : Rebase #

Patch Set 3 : One member per field #

Patch Set 4 : Rebase #

Patch Set 5 : Add missing files #

Patch Set 6 : Rebase #

Patch Set 7 : Rebase #

Patch Set 8 : DRY #

Total comments: 1

Patch Set 9 : Add to build.gn #

Patch Set 10 : Rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+50 lines, -26 lines) Patch
M third_party/WebKit/Source/build/scripts/make_computed_style_base.py View 1 2 3 4 5 6 7 8 9 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/build/scripts/templates/ComputedStyleBase.h.tmpl View 1 2 3 4 5 6 7 8 9 3 chunks +9 lines, -24 lines 0 comments Download
A third_party/WebKit/Source/build/scripts/templates/fields/base.tmpl View 1 2 3 4 5 6 7 1 chunk +15 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/build/scripts/templates/fields/flag.tmpl View 1 2 3 4 5 6 7 1 chunk +4 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/build/scripts/templates/fields/keyword.tmpl View 1 2 3 4 5 6 7 8 9 1 chunk +5 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/build/scripts/templates/fields/monotonic_flag.tmpl View 1 2 3 4 1 chunk +8 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/BUILD.gn View 1 2 3 4 5 6 7 8 9 1 chunk +4 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/css/CSSProperties.json5 View 1 2 3 4 5 6 7 8 9 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 54 (31 generated)
shend
Hi Bugs, PTAL :)
3 years, 10 months ago (2017-02-16 06:49:22 UTC) #16
shend
On 2017/02/16 at 06:49:22, shend wrote: > Hi Bugs, PTAL :) Forgot to mention, I'm ...
3 years, 10 months ago (2017-02-16 21:50:07 UTC) #19
Bugs Nash
On 2017/02/16 at 21:50:07, shend wrote: > On 2017/02/16 at 06:49:22, shend wrote: > > ...
3 years, 10 months ago (2017-02-19 23:39:20 UTC) #20
Bugs Nash
This patch introduces some duplication of templated code, which could make it difficult to maintain. ...
3 years, 10 months ago (2017-02-19 23:39:46 UTC) #22
Bugs Nash
Forwarding this question to Eddy as Sasha is handing this project over to style team
3 years, 10 months ago (2017-02-20 00:22:43 UTC) #24
shend
On 2017/02/19 at 23:39:46, bugsnash wrote: > This patch introduces some duplication of templated code, ...
3 years, 10 months ago (2017-02-20 06:43:28 UTC) #25
shend
On 2017/02/20 at 06:43:28, shend wrote: > On 2017/02/19 at 23:39:46, bugsnash wrote: > > ...
3 years, 10 months ago (2017-02-20 07:03:29 UTC) #26
Bugs Nash
On 2017/02/20 at 07:03:29, shend wrote: > On 2017/02/20 at 06:43:28, shend wrote: > > ...
3 years, 10 months ago (2017-02-20 20:41:44 UTC) #27
shend
On 2017/02/20 at 20:41:44, bugsnash wrote: > On 2017/02/20 at 07:03:29, shend wrote: > > ...
3 years, 10 months ago (2017-02-22 03:29:49 UTC) #28
Bugs Nash
On 2017/02/22 at 03:29:49, shend wrote: > On 2017/02/20 at 20:41:44, bugsnash wrote: > > ...
3 years, 10 months ago (2017-02-23 00:08:55 UTC) #29
Bugs Nash
https://codereview.chromium.org/2693933003/diff/140001/third_party/WebKit/Source/build/scripts/templates/fields/keyword.tmpl File third_party/WebKit/Source/build/scripts/templates/fields/keyword.tmpl (right): https://codereview.chromium.org/2693933003/diff/140001/third_party/WebKit/Source/build/scripts/templates/fields/keyword.tmpl#newcode1 third_party/WebKit/Source/build/scripts/templates/fields/keyword.tmpl:1: {% import 'fields/base.tmpl' as base %} This template is ...
3 years, 10 months ago (2017-02-23 00:13:34 UTC) #30
shend
On 2017/02/23 at 00:08:55, bugsnash wrote: > On 2017/02/22 at 03:29:49, shend wrote: > > ...
3 years, 10 months ago (2017-02-23 00:17:19 UTC) #31
shend
On 2017/02/23 at 00:13:34, bugsnash wrote: > https://codereview.chromium.org/2693933003/diff/140001/third_party/WebKit/Source/build/scripts/templates/fields/keyword.tmpl > File third_party/WebKit/Source/build/scripts/templates/fields/keyword.tmpl (right): > > https://codereview.chromium.org/2693933003/diff/140001/third_party/WebKit/Source/build/scripts/templates/fields/keyword.tmpl#newcode1 ...
3 years, 10 months ago (2017-02-23 00:19:15 UTC) #32
Bugs Nash
On 2017/02/23 at 00:19:15, shend wrote: > On 2017/02/23 at 00:13:34, bugsnash wrote: > > ...
3 years, 10 months ago (2017-02-23 00:23:08 UTC) #33
shend
On 2017/02/23 at 00:23:08, bugsnash wrote: > On 2017/02/23 at 00:19:15, shend wrote: > > ...
3 years, 10 months ago (2017-02-23 00:27:15 UTC) #34
Bugs Nash
On 2017/02/23 at 00:27:15, shend wrote: > On 2017/02/23 at 00:23:08, bugsnash wrote: > > ...
3 years, 10 months ago (2017-02-23 00:36:27 UTC) #35
shend
On 2017/02/23 at 00:36:27, bugsnash wrote: > On 2017/02/23 at 00:27:15, shend wrote: > > ...
3 years, 10 months ago (2017-02-23 00:39:11 UTC) #36
Bugs Nash
On 2017/02/23 at 00:39:11, shend wrote: > On 2017/02/23 at 00:36:27, bugsnash wrote: > > ...
3 years, 10 months ago (2017-02-23 00:45:36 UTC) #37
shend
On 2017/02/23 at 00:45:36, bugsnash wrote: > On 2017/02/23 at 00:39:11, shend wrote: > > ...
3 years, 10 months ago (2017-02-23 00:53:19 UTC) #38
Bugs Nash
On 2017/02/23 at 00:53:19, shend wrote: > On 2017/02/23 at 00:45:36, bugsnash wrote: > > ...
3 years, 10 months ago (2017-02-23 01:01:21 UTC) #39
meade_UTC10
lgtm This seems good, but at first I thought you were generating C++ macros, lol. ...
3 years, 9 months ago (2017-03-01 06:34:15 UTC) #41
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/2693933003/180001
3 years, 9 months ago (2017-03-10 17:40:48 UTC) #51
commit-bot: I haz the power
3 years, 9 months ago (2017-03-10 17:46:19 UTC) #54
Message was sent while issue was closed.
Committed patchset #10 (id:180001) as
https://chromium.googlesource.com/chromium/src/+/6ce2feb35c970fe7d9557c851c01...

Powered by Google App Engine
This is Rietveld 408576698