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

Unified Diff: Source/build/scripts/make_css_property_names.py

Issue 880983009: Fix isInternalProperty when there are no internal properties (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/build/scripts/make_css_property_names.py
diff --git a/Source/build/scripts/make_css_property_names.py b/Source/build/scripts/make_css_property_names.py
index 530a1878d5a24714f3ef10880b785a7fa5a5908c..555e16ab876c9e8ddf87e9cd9e91a1c5ec9911b5 100755
--- a/Source/build/scripts/make_css_property_names.py
+++ b/Source/build/scripts/make_css_property_names.py
@@ -164,12 +164,7 @@ String getJSPropertyName(CSSPropertyID id)
bool isInternalProperty(CSSPropertyID id)
{
- switch (id) {
- %(internal_properties)s
- return true;
- default:
- return false;
- }
+ %(internal_properties)s
}
} // namespace blink
@@ -210,13 +205,25 @@ class CSSPropertyNamesWriter(css_properties.CSSProperties):
for name, aliased_name in self._aliases.items():
css_name_and_enum_pairs.append((name, css_properties.css_name_to_enum(aliased_name)))
+ internal_properties = ""
+ internal_properties = '\n'.join("case %s:" % property_id for property_id, property in self._properties.items() if property['is_internal'])
+ if internal_properties:
+ internal_properties = "switch (id) {\n " +\
+ internal_properties +\
+ "\n return true;" +\
+ "\n default:" +\
+ "\n return false;" +\
+ "\n }\n"
+ else:
+ internal_properties = "return false;"
+
gperf_input = GPERF_TEMPLATE % {
'license': license.license_for_generated_cpp(),
'class_name': self.class_name,
'property_name_strings': '\n'.join(map(lambda property: ' "%(name)s\\0"' % property, self._properties_list)),
'property_name_offsets': '\n'.join(map(lambda offset: ' %d,' % offset, property_offsets)),
'property_to_enum_map': '\n'.join(map(lambda property: '%s, %s' % property, css_name_and_enum_pairs)),
- 'internal_properties': '\n'.join("case %s:" % property_id for property_id, property in self._properties.items() if property['is_internal']),
+ 'internal_properties': internal_properties,
}
# FIXME: If we could depend on Python 2.7, we would use subprocess.check_output
gperf_args = [self.gperf_path, '--key-positions=*', '-P', '-n']
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698