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

Side by Side Diff: Source/core/scripts/templates/StylePropertyShorthand.cpp.tmpl

Issue 22546004: Remove .tmpl extension from Jinja templates in core 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2013 Intel Corporation. All rights reserved.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 */
21
22 #include "config.h"
23 #include "StylePropertyShorthand.h"
24
25 #include "wtf/HashMap.h"
26 #include "wtf/StdLibExtras.h"
27
28 namespace WebCore {
29
30 {%- for property_id, property in properties.items() %}
31
32 const StylePropertyShorthand& {{ property.camel_case_name }}Shorthand()
33 {
34 static const CSSPropertyID {{ property.camel_case_name }}Properties[] = {
35 {%- for longhand_id in property.camel_case_longhands %}
36 {{ longhand_id }},
37 {%- endfor %}
38 };
39 DEFINE_STATIC_LOCAL(StylePropertyShorthand, {{ property.camel_case_name }}Lo nghands, ({{ property_id }}, {{ property.camel_case_name }}Properties, WTF_ARRAY _LENGTH({{ property.camel_case_name }}Properties)));
40 return {{ property.camel_case_name }}Longhands;
41 }
42 {%- endfor %}
43
44 // Returns an empty list if the property is not a shorthand
45 const StylePropertyShorthand& shorthandForProperty(CSSPropertyID propertyID)
46 {
47 switch (propertyID) {
48 {%- for property_id, property in properties.items() %}
49 {%- if property.camel_case_name not in ["width", "height", "marker"] %}
50 case {{ property_id }}:
51 return {{ property.camel_case_name }}Shorthand();
52 {%- endif %}
53 {%- endfor %}
54 default: {
55 DEFINE_STATIC_LOCAL(StylePropertyShorthand, emptyShorthand, ());
56 return emptyShorthand;
57 }
58 }
59 }
60
61 typedef HashMap<CSSPropertyID, Vector<StylePropertyShorthand> > longhandsMap;
62 const Vector<StylePropertyShorthand> matchingShorthandsForLonghand(CSSPropertyID propertyID)
63 {
64 DEFINE_STATIC_LOCAL(longhandsMap, map, ());
65 if (map.isEmpty()) {
66 {%- for longhand_id, shorthands in longhands_dictionary.items() %}
67
68 Vector<StylePropertyShorthand, {{ shorthands|length }}> {{ longhand_id } }Shorthands;
69 {% for shorthand in shorthands -%}
70 {{ longhand_id }}Shorthands.uncheckedAppend({{ shorthand.camel_case_ name }}Shorthand());
71 {% endfor -%}
72 map.set({{ longhand_id }}, {{ longhand_id }}Shorthands);
73 {%- endfor %}
74 }
75 return map.get(propertyID);
76 }
77
78 } // namespace WebCore
79
OLDNEW
« no previous file with comments | « Source/core/scripts/templates/StylePropertyShorthand.cpp ('k') | Source/core/scripts/templates/StylePropertyShorthand.h.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698