| OLD | NEW |
| 1 {% from 'macros.tmpl' import license, print_if %} |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 2 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 4 #include "core/css/properties/CSSPropertyDescriptor.h" | 5 #include "core/css/properties/CSSPropertyDescriptor.h" |
| 5 | 6 |
| 6 {% for api_class in api_classes %} | 7 {% for api_class in api_classes %} |
| 7 #include "core/css/properties/{{api_class.classname}}.h" | 8 #include "core/css/properties/{{api_class.classname}}.h" |
| 8 {% endfor %} | 9 {% endfor %} |
| 9 | 10 |
| 10 namespace blink { | 11 namespace blink { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 }; | 39 }; |
| 39 | 40 |
| 40 {% for api_method_name in ordered_api_method_names %} | 41 {% for api_method_name in ordered_api_method_names %} |
| 41 static_assert(cssPropertyDescriptors[INVALID_DESCRIPTOR_INDEX].{{api_method_name
}} == nullptr, | 42 static_assert(cssPropertyDescriptors[INVALID_DESCRIPTOR_INDEX].{{api_method_name
}} == nullptr, |
| 42 "Invalid CSSPropertyDescriptor contains non-nullptr member"); | 43 "Invalid CSSPropertyDescriptor contains non-nullptr member"); |
| 43 {% endfor %} | 44 {% endfor %} |
| 44 | 45 |
| 45 // Lookup table mapping CSSPropertyID to index in the cssPropertyDescriptors | 46 // Lookup table mapping CSSPropertyID to index in the cssPropertyDescriptors |
| 46 // table | 47 // table |
| 47 static size_t CSSDescriptorIndices[] = { | 48 static size_t CSSDescriptorIndices[] = { |
| 48 {% for id in descriptor_indices %} | 49 {% for item in descriptor_indices %} |
| 49 {{id}}, | 50 {{descriptor_indices[item].id}},{{print_if(descriptor_indices[item].api != No
ne, ' // ' ~ descriptor_indices[item].api)}} |
| 50 {% endfor %} | 51 {% endfor %} |
| 51 }; | 52 }; |
| 52 | 53 |
| 53 const CSSPropertyDescriptor& CSSPropertyDescriptor::Get(CSSPropertyID id) { | 54 const CSSPropertyDescriptor& CSSPropertyDescriptor::Get(CSSPropertyID id) { |
| 54 return cssPropertyDescriptors[CSSDescriptorIndices[id]]; | 55 return cssPropertyDescriptors[CSSDescriptorIndices[id]]; |
| 55 } | 56 } |
| 56 | 57 |
| 57 } // namespace blink | 58 } // namespace blink |
| OLD | NEW |