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

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

Issue 1096963002: Make UseCounters work on aliased properties (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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 | « Source/build/scripts/css_properties.py ('k') | Source/build/scripts/templates/CSSPropertyMetadata.cpp.tmpl » ('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 48a98970bba254353942ced67baeddd1f7bf9ff4..772e9797190cfe3deb3f409dfd23f8ffff26b3f1 100755
--- a/Source/build/scripts/make_css_property_names.py
+++ b/Source/build/scripts/make_css_property_names.py
@@ -34,6 +34,7 @@ enum CSSPropertyID {
const int firstCSSProperty = %(first_property_id)s;
const int numCSSProperties = %(properties_count)s;
const int lastCSSProperty = %(last_property_id)d;
+const int lastUnresolvedCSSProperty = %(last_unresolved_property_id)d;
const size_t maxCSSPropertyNameLength = %(max_name_length)d;
const char* getPropertyName(CSSPropertyID);
@@ -47,14 +48,21 @@ inline CSSPropertyID convertToCSSPropertyID(int value)
return static_cast<CSSPropertyID>(value);
}
+inline CSSPropertyID resolveCSSPropertyID(CSSPropertyID id)
+{
+ return convertToCSSPropertyID(id & ~512);
+}
+
+inline bool isPropertyAlias(CSSPropertyID id) { return id & 512; }
+
} // namespace blink
namespace WTF {
template<> struct DefaultHash<blink::CSSPropertyID> { typedef IntHash<unsigned> Hash; };
template<> struct HashTraits<blink::CSSPropertyID> : GenericHashTraits<blink::CSSPropertyID> {
static const bool emptyValueIsZero = true;
- static void constructDeletedValue(blink::CSSPropertyID& slot, bool) { slot = static_cast<blink::CSSPropertyID>(blink::lastCSSProperty + 1); }
- static bool isDeletedValue(blink::CSSPropertyID value) { return value == (blink::lastCSSProperty + 1); }
+ static void constructDeletedValue(blink::CSSPropertyID& slot, bool) { slot = static_cast<blink::CSSPropertyID>(blink::lastUnresolvedCSSProperty + 1); }
+ static bool isDeletedValue(blink::CSSPropertyID value) { return value == (blink::lastUnresolvedCSSProperty + 1); }
};
}
@@ -180,28 +188,27 @@ class CSSPropertyNamesWriter(css_properties.CSSProperties):
return HEADER_TEMPLATE % {
'license': license.license_for_generated_cpp(),
'class_name': self.class_name,
- 'property_enums': "\n".join(map(self._enum_declaration, self._properties_list)),
+ 'property_enums': "\n".join(map(self._enum_declaration, self._properties_including_aliases)),
'first_property_id': self._first_enum_value,
'properties_count': len(self._properties),
'last_property_id': self._first_enum_value + len(self._properties) - 1,
+ 'last_unresolved_property_id': max(property["enum_value"] for property in self._properties_including_aliases),
'max_name_length': max(map(len, self._properties)),
}
def generate_implementation(self):
property_offsets = []
current_offset = 0
- for property in self._properties_list:
+ for property in self._properties_including_aliases:
property_offsets.append(current_offset)
current_offset += len(property["name"]) + 1
- css_name_and_enum_pairs = [(property['name'], property_id) for property_id, property in self._properties.items()]
- for name, aliased_name in self._aliases.items():
- css_name_and_enum_pairs.append((name, css_properties.css_name_to_enum(aliased_name)))
+ 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_list)),
+ '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)),
}
« no previous file with comments | « Source/build/scripts/css_properties.py ('k') | Source/build/scripts/templates/CSSPropertyMetadata.cpp.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698