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

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..e2f481cb7ecea9b041513a1a2ba876d401a79feb 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': "",
+ 'runtimeConditional': None,
Julien - ping for review 2013/08/09 16:47:30 I would rename this to is 'runtimeEnabledShorthand
}
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["runtimeConditional"] is not None:
+ lowerFirstConditional = self._lower_first(property["runtimeConditional"])
+ 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,14 @@ 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")
+ lowered = lowered.replace("iME", "ime")
+ lowered = lowered.replace("hTML", "html")
+ lowered = lowered.replace("wOFF", "woff")
Julien - ping for review 2013/08/09 16:47:30 This seems like an overkill to list all these as w
+ 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