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

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

Issue 1106443002: Fix serialization of alias_for properties (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@p7
Patch Set: Created 5 years, 8 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 | « LayoutTests/transitions/transitions-parsing-expected.txt ('k') | Source/core/css/CSSPrimitiveValue.cpp » ('j') | 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 772e9797190cfe3deb3f409dfd23f8ffff26b3f1..e5237c94c67b672baa6718b0993db74389924aa9 100755
--- a/Source/build/scripts/make_css_property_names.py
+++ b/Source/build/scripts/make_css_property_names.py
@@ -115,23 +115,16 @@ const Property* findProperty(register const char* str, register unsigned int len
const char* getPropertyName(CSSPropertyID id)
{
- if (id < firstCSSProperty)
- return 0;
+ ASSERT(id >= firstCSSProperty && id <= lastUnresolvedCSSProperty);
int index = id - firstCSSProperty;
- if (index >= numCSSProperties)
- return 0;
return propertyNameStringsPool + propertyNameStringsOffsets[index];
}
const AtomicString& getPropertyNameAtomicString(CSSPropertyID id)
{
- if (id < firstCSSProperty)
- return nullAtom;
+ ASSERT(id >= firstCSSProperty && id <= lastUnresolvedCSSProperty);
int index = id - firstCSSProperty;
- if (index >= numCSSProperties)
- return nullAtom;
-
- static AtomicString* propertyStrings = new AtomicString[numCSSProperties]; // Intentionally never destroyed.
+ static AtomicString* propertyStrings = new AtomicString[lastUnresolvedCSSProperty]; // Intentionally never destroyed.
AtomicString& propertyString = propertyStrings[index];
if (propertyString.isNull()) {
const char* propertyName = propertyNameStringsPool + propertyNameStringsOffsets[index];
@@ -197,20 +190,25 @@ class CSSPropertyNamesWriter(css_properties.CSSProperties):
}
def generate_implementation(self):
+ enum_value_to_name = {property['enum_value']: property['name'] for property in self._properties_including_aliases}
property_offsets = []
+ property_names = []
current_offset = 0
- for property in self._properties_including_aliases:
+ for enum_value in range(1, max(enum_value_to_name) + 1):
property_offsets.append(current_offset)
- current_offset += len(property["name"]) + 1
+ if enum_value in enum_value_to_name:
+ name = enum_value_to_name[enum_value]
+ property_names.append(name)
+ current_offset += len(name) + 1
css_name_and_enum_pairs = [(property['name'], property['property_id']) for property in self._properties_including_aliases]
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_including_aliases)),
- '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)),
+ 'property_name_strings': '\n'.join(' "%s\\0"' % name for name in property_names),
+ 'property_name_offsets': '\n'.join(' %d,' % offset for offset in property_offsets),
+ 'property_to_enum_map': '\n'.join('%s, %s' % property for property in css_name_and_enum_pairs),
}
# 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 | « LayoutTests/transitions/transitions-parsing-expected.txt ('k') | Source/core/css/CSSPrimitiveValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698