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

Unified Diff: Source/core/scripts/make_style_shorthands.py

Issue 22610005: Implement runtime feature support for CSS Shorthands (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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 | Source/core/scripts/templates/StylePropertyShorthand.cpp.tmpl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/scripts/make_style_shorthands.py
diff --git a/Source/core/scripts/make_style_shorthands.py b/Source/core/scripts/make_style_shorthands.py
index db5d1880e61962098d58283f14eae65e094cc2f2..c73de2fc7adb30edcf2963118c210e95129bc40d 100644
--- a/Source/core/scripts/make_style_shorthands.py
+++ b/Source/core/scripts/make_style_shorthands.py
@@ -40,6 +40,7 @@ class StylePropertyShorthandWriter(in_generator.Writer):
defaults = {
'longhands': "",
+ 'runtimeEnabledShorthand': None,
}
def __init__(self, in_files, enabled_conditions):
@@ -61,6 +62,9 @@ class StylePropertyShorthandWriter(in_generator.Writer):
longhand = self._create_css_property_name_enum_value(longhand)
property["camel_case_longhands"].append(longhand)
self._longhand_dictionary[longhand].append(property)
+ if property["runtimeEnabledShorthand"] is not None:
+ lowerFirstConditional = self._lower_first(property["runtimeEnabledShorthand"])
+ property["runtime_conditional_getter"] = "%sEnabled" % lowerFirstConditional
self._properties = dict((property["property_id"], property) for property in self._properties)
# FIXME: some of these might be better in a utils file
@@ -70,6 +74,11 @@ class StylePropertyShorthandWriter(in_generator.Writer):
def _create_css_property_name_enum_value(self, property_name):
return "CSSProperty" + property_name
+ def _lower_first(self, string):
+ lowered = string[0].lower() + string[1:]
+ lowered = lowered.replace("cSS", "css")
+ return lowered
+
@template_expander.use_jinja("StylePropertyShorthand.cpp.tmpl")
def generate_style_property_shorthand_cpp(self):
return {
« no previous file with comments | « no previous file | Source/core/scripts/templates/StylePropertyShorthand.cpp.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698