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

Unified Diff: third_party/WebKit/Source/build/scripts/make_computed_style_base.py

Issue 2538493005: Added initial_keyword flag to CSSProperties.in (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/build/scripts/make_computed_style_base.py
diff --git a/third_party/WebKit/Source/build/scripts/make_computed_style_base.py b/third_party/WebKit/Source/build/scripts/make_computed_style_base.py
index c5ccc7a56f338be9948d70fa6cb13f9b04c83f57..0c901d9b4448764473f00c1e1f64d10de96bd7d8 100755
--- a/third_party/WebKit/Source/build/scripts/make_computed_style_base.py
+++ b/third_party/WebKit/Source/build/scripts/make_computed_style_base.py
@@ -11,6 +11,7 @@ import in_generator
import template_expander
import make_style_builder
+from name_utilities import camel_case
class ComputedStyleBaseWriter(make_style_builder.StyleBuilderWriter):
def __init__(self, in_file_path):
@@ -27,7 +28,7 @@ class ComputedStyleBaseWriter(make_style_builder.StyleBuilderWriter):
if property['keyword_only']:
enum_name = property['type_name']
# From the Blink style guide: Enum members should use InterCaps with an initial capital letter. [names-enum-members]
- enum_values = [k.title() for k in property['keywords']]
+ enum_values = [camel_case(k) for k in property['keywords']]
self._computed_enums[enum_name] = enum_values
# A list of fields
@@ -60,8 +61,11 @@ class ComputedStyleBaseWriter(make_style_builder.StyleBuilderWriter):
field_name = 'm_' + property_name_lower
bits_needed = math.log(len(property['keywords']), 2)
type_name = property['type_name']
- # For now, assume the default value is the first enum value.
- default_value = type_name + '::' + self._computed_enums[type_name][0]
+
+ assert len(property['initial_keyword']) == 1, \
+ ('MakeComputedStyleBase requires an initial keyword for keyword_only values, none specified '
+ 'for property %s' % property['name'])
napper 2016/12/01 02:10:02 'for property ' + property['name'] seems a bit cl
sashab 2016/12/01 02:35:21 Done
+ default_value = type_name + '::' + camel_case(property['initial_keyword'][0])
self._fields.append(Field(
name=field_name,

Powered by Google App Engine
This is Rietveld 408576698