Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 #include "core/css/properties/CSSPropertyDescriptor.h" | 4 #include "core/css/properties/CSSPropertyDescriptor.h" |
| 5 | 5 |
| 6 {% for api_class in api_classes %} | 6 {% for api_class in api_classes %} |
| 7 #include "core/css/properties/{{api_class.classname}}.h" | 7 #include "core/css/properties/{{api_class.classname}}.h" |
| 8 {% endfor %} | 8 {% endfor %} |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 // CSSPropertyDescriptors for all valid properties. | 23 // CSSPropertyDescriptors for all valid properties. |
| 24 {% for api_class in api_classes %} | 24 {% for api_class in api_classes %} |
| 25 { | 25 { |
| 26 {% for valid_api_method in valid_api_methods %} | 26 {% for valid_api_method in valid_api_methods %} |
| 27 {% if valid_api_method in api_class.api_methods %} | 27 {% if valid_api_method in api_class.api_methods %} |
| 28 {{ api_class.classname }}:: {{ valid_api_method }}, | 28 {{ api_class.classname }}:: {{ valid_api_method }}, |
| 29 {% else %} | 29 {% else %} |
| 30 nullptr, | 30 nullptr, |
| 31 {% endif %} | 31 {% endif %} |
| 32 {% endfor %} | 32 {% endfor %} |
| 33 }, | |
|
sashab
2017/02/01 18:21:45
Why did you remove this line? :)
| |
| 34 {% endfor %} | 33 {% endfor %} |
| 35 }; | 34 }; |
| 36 | 35 |
| 37 const CSSPropertyDescriptor& CSSPropertyDescriptor::get(CSSPropertyID id) { | 36 const CSSPropertyDescriptor& CSSPropertyDescriptor::get(CSSPropertyID id) { |
| 38 // TODO(aazzam): We are currently using hard-coded indexes for | 37 // TODO(aazzam): We are currently using hard-coded indexes for |
| 39 // cssPropertyDescriptor since we have only implemented a few properties. | 38 // cssPropertyDescriptor since we have only implemented a few properties. |
| 40 // Later, generate this switch statement, or alternatively return | 39 // Later, generate this switch statement, or alternatively return |
| 41 // cssPropertyDescriptors[id], and generate the cssPropertyDescriptors array | 40 // cssPropertyDescriptors[id], and generate the cssPropertyDescriptors array |
| 42 // to hold invalid descriptors for methods which haven't been implemented yet. | 41 // to hold invalid descriptors for methods which haven't been implemented yet. |
| 43 switch (id) { | 42 switch (id) { |
| 44 {% for api_class in api_classes %} | 43 {% for api_class in api_classes %} |
| 45 {% for property_id in api_class.property_ids %} | 44 {% for property_id in api_class.property_ids %} |
| 46 case {{property_id}}: | 45 case {{property_id}}: |
| 47 {% endfor %} | 46 {% endfor %} |
| 48 return cssPropertyDescriptors[{{api_class.index}}]; | 47 return cssPropertyDescriptors[{{api_class.index}}]; |
| 49 {% endfor %} | 48 {% endfor %} |
| 50 default: | 49 default: |
| 51 return cssPropertyDescriptors[0]; | 50 return cssPropertyDescriptors[0]; |
| 52 } | 51 } |
| 53 } | 52 } |
| 54 | 53 |
| 55 } // namespace blink | 54 } // namespace blink |
| OLD | NEW |