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 Apple Computer, Inc. | 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
14 * | 14 * |
15 * You should have received a copy of the GNU Library General Public License | 15 * 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 | 16 * along with this library; see the file COPYING.LIB. If not, write to |
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
19 */ | 19 */ |
20 | 20 |
21 #ifndef CSSProperty_h | 21 #ifndef CSSProperty_h |
22 #define CSSProperty_h | 22 #define CSSProperty_h |
23 | 23 |
24 #include "core/CSSPropertyNames.h" | 24 #include "core/CSSPropertyNames.h" |
| 25 #include "core/css/CSSPropertyMetadata.h" |
25 #include "core/css/CSSValue.h" | 26 #include "core/css/CSSValue.h" |
26 #include "platform/RuntimeEnabledFeatures.h" | 27 #include "platform/RuntimeEnabledFeatures.h" |
27 #include "platform/text/TextDirection.h" | 28 #include "platform/text/TextDirection.h" |
28 #include "platform/text/WritingMode.h" | 29 #include "platform/text/WritingMode.h" |
29 #include "wtf/PassRefPtr.h" | 30 #include "wtf/PassRefPtr.h" |
30 #include "wtf/RefPtr.h" | 31 #include "wtf/RefPtr.h" |
31 | 32 |
32 namespace blink { | 33 namespace blink { |
33 | 34 |
34 struct StylePropertyMetadata { | 35 struct StylePropertyMetadata { |
(...skipping 14 matching lines...) Expand all Loading... |
49 uint16_t m_indexInShorthandsVector : 2; // If this property was set as part
of an ambiguous shorthand, gives the index in the shorthands vector. | 50 uint16_t m_indexInShorthandsVector : 2; // If this property was set as part
of an ambiguous shorthand, gives the index in the shorthands vector. |
50 uint16_t m_important : 1; | 51 uint16_t m_important : 1; |
51 uint16_t m_implicit : 1; // Whether or not the property was set implicitly a
s the result of a shorthand. | 52 uint16_t m_implicit : 1; // Whether or not the property was set implicitly a
s the result of a shorthand. |
52 uint16_t m_inherited : 1; | 53 uint16_t m_inherited : 1; |
53 }; | 54 }; |
54 | 55 |
55 class CSSProperty { | 56 class CSSProperty { |
56 ALLOW_ONLY_INLINE_ALLOCATION(); | 57 ALLOW_ONLY_INLINE_ALLOCATION(); |
57 public: | 58 public: |
58 CSSProperty(CSSPropertyID propertyID, PassRefPtrWillBeRawPtr<CSSValue> value
, bool important = false, bool isSetFromShorthand = false, int indexInShorthands
Vector = 0, bool implicit = false) | 59 CSSProperty(CSSPropertyID propertyID, PassRefPtrWillBeRawPtr<CSSValue> value
, bool important = false, bool isSetFromShorthand = false, int indexInShorthands
Vector = 0, bool implicit = false) |
59 : m_metadata(propertyID, isSetFromShorthand, indexInShorthandsVector, im
portant, implicit, isInheritedProperty(propertyID)) | 60 : m_metadata(propertyID, isSetFromShorthand, indexInShorthandsVector, im
portant, implicit, CSSPropertyMetadata::isInheritedProperty(propertyID)) |
60 , m_value(value) | 61 , m_value(value) |
61 { | 62 { |
62 } | 63 } |
63 | 64 |
64 // FIXME: Remove this. | 65 // FIXME: Remove this. |
65 CSSProperty(StylePropertyMetadata metadata, CSSValue* value) | 66 CSSProperty(StylePropertyMetadata metadata, CSSValue* value) |
66 : m_metadata(metadata) | 67 : m_metadata(metadata) |
67 , m_value(value) | 68 , m_value(value) |
68 { | 69 { |
69 } | 70 } |
70 | 71 |
71 CSSPropertyID id() const { return static_cast<CSSPropertyID>(m_metadata.m_pr
opertyID); } | 72 CSSPropertyID id() const { return static_cast<CSSPropertyID>(m_metadata.m_pr
opertyID); } |
72 bool isSetFromShorthand() const { return m_metadata.m_isSetFromShorthand; }; | 73 bool isSetFromShorthand() const { return m_metadata.m_isSetFromShorthand; }; |
73 CSSPropertyID shorthandID() const { return m_metadata.shorthandID(); }; | 74 CSSPropertyID shorthandID() const { return m_metadata.shorthandID(); }; |
74 bool isImportant() const { return m_metadata.m_important; } | 75 bool isImportant() const { return m_metadata.m_important; } |
75 | 76 |
76 CSSValue* value() const { return m_value.get(); } | 77 CSSValue* value() const { return m_value.get(); } |
77 | 78 |
78 void wrapValueInCommaSeparatedList(); | 79 void wrapValueInCommaSeparatedList(); |
79 | 80 |
80 static CSSPropertyID resolveDirectionAwareProperty(CSSPropertyID, TextDirect
ion, WritingMode); | 81 static CSSPropertyID resolveDirectionAwareProperty(CSSPropertyID, TextDirect
ion, WritingMode); |
81 static bool isInheritedProperty(CSSPropertyID); | |
82 static bool isAffectedByAllProperty(CSSPropertyID); | 82 static bool isAffectedByAllProperty(CSSPropertyID); |
83 | 83 |
84 const StylePropertyMetadata& metadata() const { return m_metadata; } | 84 const StylePropertyMetadata& metadata() const { return m_metadata; } |
85 | 85 |
86 void trace(Visitor* visitor) { visitor->trace(m_value); } | 86 void trace(Visitor* visitor) { visitor->trace(m_value); } |
87 | 87 |
88 private: | 88 private: |
89 StylePropertyMetadata m_metadata; | 89 StylePropertyMetadata m_metadata; |
90 RefPtrWillBeMember<CSSValue> m_value; | 90 RefPtrWillBeMember<CSSValue> m_value; |
91 }; | 91 }; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 } | 187 } |
188 ASSERT(propertyId != CSSPropertyInvalid); | 188 ASSERT(propertyId != CSSPropertyInvalid); |
189 return propertyId; | 189 return propertyId; |
190 } | 190 } |
191 | 191 |
192 } // namespace blink | 192 } // namespace blink |
193 | 193 |
194 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::CSSProperty); | 194 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::CSSProperty); |
195 | 195 |
196 #endif // CSSProperty_h | 196 #endif // CSSProperty_h |
OLD | NEW |