OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 | 4 |
5 #ifndef CSSPropertyPriority_h | 5 #ifndef CSSPropertyPriority_h |
6 #define CSSPropertyPriority_h | 6 #define CSSPropertyPriority_h |
7 | 7 |
8 #include "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
| 9 #include "wtf/Allocator.h" |
9 | 10 |
10 namespace blink { | 11 namespace blink { |
11 | 12 |
12 // The values of high priority properties affect the values of low priority | 13 // The values of high priority properties affect the values of low priority |
13 // properties. For example, the value of the high priority property 'font-size' | 14 // properties. For example, the value of the high priority property 'font-size' |
14 // decides the pixel value of low priority properties with 'em' units. | 15 // decides the pixel value of low priority properties with 'em' units. |
15 | 16 |
16 enum CSSPropertyPriority { | 17 enum CSSPropertyPriority { |
17 HighPropertyPriority, | 18 HighPropertyPriority, |
18 LowPropertyPriority | 19 LowPropertyPriority |
19 }; | 20 }; |
20 | 21 |
21 template <CSSPropertyPriority priority> | 22 template <CSSPropertyPriority priority> |
22 class CSSPropertyPriorityData { | 23 class CSSPropertyPriorityData { |
| 24 STATIC_ONLY(CSSPropertyPriorityData); |
23 public: | 25 public: |
24 static inline CSSPropertyID first(); | 26 static inline CSSPropertyID first(); |
25 static inline CSSPropertyID last(); | 27 static inline CSSPropertyID last(); |
26 static inline bool propertyHasPriority(CSSPropertyID prop) | 28 static inline bool propertyHasPriority(CSSPropertyID prop) |
27 { | 29 { |
28 return first() <= prop && prop <= last(); | 30 return first() <= prop && prop <= last(); |
29 } | 31 } |
30 }; | 32 }; |
31 | 33 |
32 template<> | 34 template<> |
(...skipping 20 matching lines...) Expand all Loading... |
53 | 55 |
54 template<> | 56 template<> |
55 inline CSSPropertyID CSSPropertyPriorityData<LowPropertyPriority>::last() | 57 inline CSSPropertyID CSSPropertyPriorityData<LowPropertyPriority>::last() |
56 { | 58 { |
57 return static_cast<CSSPropertyID>(lastCSSProperty); | 59 return static_cast<CSSPropertyID>(lastCSSProperty); |
58 } | 60 } |
59 | 61 |
60 } // namespace blink | 62 } // namespace blink |
61 | 63 |
62 #endif // CSSPropertyPriority_h | 64 #endif // CSSPropertyPriority_h |
OLD | NEW |