OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. |
| 4 * Copyright (C) 2013 Intel Corporation. All rights reserved. |
4 * | 5 * |
5 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
9 * | 10 * |
10 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Library General Public License for more details. | 14 * Library General Public License for more details. |
14 * | 15 * |
15 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
16 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
19 */ | 20 */ |
20 | 21 |
21 #ifndef StylePropertyShorthand_h | 22 #ifndef StylePropertyShorthand_h |
22 #define StylePropertyShorthand_h | 23 #define StylePropertyShorthand_h |
23 | 24 |
24 #include "CSSPropertyNames.h" | 25 #include "CSSPropertyNames.h" |
| 26 #include "wtf/Vector.h" |
25 | 27 |
26 namespace WebCore { | 28 namespace WebCore { |
27 | 29 |
28 class StylePropertyShorthand { | 30 class StylePropertyShorthand { |
29 WTF_MAKE_FAST_ALLOCATED; | 31 WTF_MAKE_FAST_ALLOCATED; |
30 public: | 32 public: |
31 StylePropertyShorthand() | 33 StylePropertyShorthand() |
32 : m_properties(0) | 34 : m_properties(0) |
33 , m_propertiesForInitialization(0) | 35 , m_propertiesForInitialization(0) |
34 , m_length(0) | 36 , m_length(0) |
| 37 , m_shorthandID(CSSPropertyInvalid) |
35 { | 38 { |
36 } | 39 } |
37 | 40 |
38 StylePropertyShorthand(const CSSPropertyID* properties, unsigned numProperti
es) | 41 StylePropertyShorthand(CSSPropertyID id, const CSSPropertyID* properties, un
signed numProperties) |
39 : m_properties(properties) | 42 : m_properties(properties) |
40 , m_propertiesForInitialization(0) | 43 , m_propertiesForInitialization(0) |
41 , m_length(numProperties) | 44 , m_length(numProperties) |
| 45 , m_shorthandID(id) |
42 { | 46 { |
43 } | 47 } |
44 | 48 |
45 StylePropertyShorthand(const CSSPropertyID* properties, const StylePropertyS
horthand** propertiesForInitialization, unsigned numProperties) | 49 StylePropertyShorthand(CSSPropertyID id, const CSSPropertyID* properties, co
nst StylePropertyShorthand** propertiesForInitialization, unsigned numProperties
) |
46 : m_properties(properties) | 50 : m_properties(properties) |
47 , m_propertiesForInitialization(propertiesForInitialization) | 51 , m_propertiesForInitialization(propertiesForInitialization) |
48 , m_length(numProperties) | 52 , m_length(numProperties) |
| 53 , m_shorthandID(id) |
49 { | 54 { |
50 } | 55 } |
51 | 56 |
52 const CSSPropertyID* properties() const { return m_properties; } | 57 const CSSPropertyID* properties() const { return m_properties; } |
53 const StylePropertyShorthand** propertiesForInitialization() const { return
m_propertiesForInitialization; } | 58 const StylePropertyShorthand** propertiesForInitialization() const { return
m_propertiesForInitialization; } |
54 unsigned length() const { return m_length; } | 59 unsigned length() const { return m_length; } |
| 60 CSSPropertyID id() const { return m_shorthandID; } |
55 | 61 |
56 private: | 62 private: |
57 const CSSPropertyID* m_properties; | 63 const CSSPropertyID* m_properties; |
58 const StylePropertyShorthand** m_propertiesForInitialization; | 64 const StylePropertyShorthand** m_propertiesForInitialization; |
59 unsigned m_length; | 65 unsigned m_length; |
| 66 CSSPropertyID m_shorthandID; |
60 }; | 67 }; |
61 | 68 |
62 const StylePropertyShorthand& backgroundShorthand(); | 69 const StylePropertyShorthand& backgroundShorthand(); |
63 const StylePropertyShorthand& backgroundPositionShorthand(); | 70 const StylePropertyShorthand& backgroundPositionShorthand(); |
64 const StylePropertyShorthand& backgroundRepeatShorthand(); | 71 const StylePropertyShorthand& backgroundRepeatShorthand(); |
65 const StylePropertyShorthand& borderShorthand(); | 72 const StylePropertyShorthand& borderShorthand(); |
66 const StylePropertyShorthand& borderAbridgedShorthand(); | 73 const StylePropertyShorthand& borderAbridgedShorthand(); |
67 const StylePropertyShorthand& borderBottomShorthand(); | 74 const StylePropertyShorthand& borderBottomShorthand(); |
68 const StylePropertyShorthand& borderColorShorthand(); | 75 const StylePropertyShorthand& borderColorShorthand(); |
69 const StylePropertyShorthand& borderImageShorthand(); | 76 const StylePropertyShorthand& borderImageShorthand(); |
(...skipping 27 matching lines...) Expand all Loading... |
97 const StylePropertyShorthand& webkitMarginCollapseShorthand(); | 104 const StylePropertyShorthand& webkitMarginCollapseShorthand(); |
98 const StylePropertyShorthand& webkitMarqueeShorthand(); | 105 const StylePropertyShorthand& webkitMarqueeShorthand(); |
99 const StylePropertyShorthand& webkitMaskShorthand(); | 106 const StylePropertyShorthand& webkitMaskShorthand(); |
100 const StylePropertyShorthand& webkitMaskPositionShorthand(); | 107 const StylePropertyShorthand& webkitMaskPositionShorthand(); |
101 const StylePropertyShorthand& webkitMaskRepeatShorthand(); | 108 const StylePropertyShorthand& webkitMaskRepeatShorthand(); |
102 const StylePropertyShorthand& webkitTextEmphasisShorthand(); | 109 const StylePropertyShorthand& webkitTextEmphasisShorthand(); |
103 const StylePropertyShorthand& webkitTextStrokeShorthand(); | 110 const StylePropertyShorthand& webkitTextStrokeShorthand(); |
104 const StylePropertyShorthand& webkitTransitionShorthand(); | 111 const StylePropertyShorthand& webkitTransitionShorthand(); |
105 const StylePropertyShorthand& webkitTransformOriginShorthand(); | 112 const StylePropertyShorthand& webkitTransformOriginShorthand(); |
106 | 113 |
107 // Returns an empty list if the property is not a shorthand | 114 // Returns an empty list if the property is not a shorthand. |
108 const StylePropertyShorthand& shorthandForProperty(CSSPropertyID); | 115 const StylePropertyShorthand& shorthandForProperty(CSSPropertyID); |
109 | 116 |
| 117 // Return the list of shorthands for a given longhand. |
| 118 const Vector<StylePropertyShorthand> matchingShorthandsForLonghand(CSSPropertyID
); |
| 119 unsigned indexOfShorthandForLonghand(CSSPropertyID, const Vector<StylePropertySh
orthand>&); |
| 120 |
110 bool isExpandedShorthand(CSSPropertyID); | 121 bool isExpandedShorthand(CSSPropertyID); |
111 | 122 |
112 } // namespace WebCore | 123 } // namespace WebCore |
113 | 124 |
114 #endif // StylePropertyShorthand_h | 125 #endif // StylePropertyShorthand_h |
OLD | NEW |