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 "CSSPropertyNames.h" | 24 #include "CSSPropertyNames.h" |
25 #include "core/css/CSSValue.h" | 25 #include "core/css/CSSValue.h" |
26 #include "core/platform/text/TextDirection.h" | 26 #include "core/platform/text/TextDirection.h" |
27 #include "core/platform/text/WritingMode.h" | 27 #include "core/platform/text/WritingMode.h" |
28 #include "core/rendering/style/RenderStyleConstants.h" | 28 #include "core/rendering/style/RenderStyleConstants.h" |
29 #include <wtf/PassRefPtr.h> | 29 #include "wtf/PassRefPtr.h" |
30 #include <wtf/RefPtr.h> | 30 #include "wtf/RefPtr.h" |
31 | 31 |
32 namespace WebCore { | 32 namespace WebCore { |
33 | 33 |
34 union StylePropertyMetadata { | 34 struct StylePropertyMetadata { |
35 StylePropertyMetadata(CSSPropertyID propertyID, CSSPropertyID shorthandID, b
ool important, bool implicit, bool inherited) | 35 StylePropertyMetadata(CSSPropertyID propertyID, bool isSetFromShorthand, int
indexInShorthandsVector, bool important, bool implicit, bool inherited) |
36 : m_propertyID(propertyID) | 36 : m_propertyID(propertyID) |
37 , m_shorthandID(shorthandID) | 37 , m_isSetFromShorthand(isSetFromShorthand) |
| 38 , m_indexInShorthandsVector(indexInShorthandsVector) |
38 , m_important(important) | 39 , m_important(important) |
39 , m_implicit(implicit) | 40 , m_implicit(implicit) |
40 , m_inherited(inherited) | 41 , m_inherited(inherited) |
41 { | 42 { |
42 } | 43 } |
43 | 44 |
44 unsigned m_bits; | 45 CSSPropertyID shorthandID() const; |
45 struct { | 46 |
46 unsigned m_propertyID : 14; | 47 unsigned m_propertyID : 10; |
47 unsigned m_shorthandID : 14; // If this property was set as part of a sh
orthand, gives the shorthand. | 48 unsigned m_isSetFromShorthand : 1; |
48 unsigned m_important : 1; | 49 unsigned m_indexInShorthandsVector : 2; // If this property was set as part
of an ambiguous shorthand, gives the index in the shorthands vector. |
49 unsigned m_implicit : 1; // Whether or not the property was set implicit
ly as the result of a shorthand. | 50 unsigned m_important : 1; |
50 unsigned m_inherited : 1; | 51 unsigned m_implicit : 1; // Whether or not the property was set implicitly a
s the result of a shorthand. |
51 }; | 52 unsigned m_inherited : 1; |
52 }; | 53 }; |
53 | 54 |
54 class CSSProperty { | 55 class CSSProperty { |
55 public: | 56 public: |
56 CSSProperty(CSSPropertyID propertyID, PassRefPtr<CSSValue> value, bool impor
tant = false, CSSPropertyID shorthandID = CSSPropertyInvalid, bool implicit = fa
lse) | 57 CSSProperty(CSSPropertyID propertyID, PassRefPtr<CSSValue> value, bool impor
tant = false, bool isSetFromShorthand = false, int indexInShorthandsVector = 0,
bool implicit = false) |
57 : m_metadata(propertyID, shorthandID, important, implicit, isInheritedPr
operty(propertyID)) | 58 : m_metadata(propertyID, isSetFromShorthand, indexInShorthandsVector, im
portant, implicit, isInheritedProperty(propertyID)) |
58 , m_value(value) | 59 , m_value(value) |
59 { | 60 { |
60 ASSERT((propertyID == CSSPropertyVariable) == (m_value && m_value->isVariabl
eValue())); | 61 ASSERT((propertyID == CSSPropertyVariable) == (m_value && m_value->isVariabl
eValue())); |
61 } | 62 } |
62 | 63 |
63 // FIXME: Remove this. | 64 // FIXME: Remove this. |
64 CSSProperty(StylePropertyMetadata metadata, CSSValue* value) | 65 CSSProperty(StylePropertyMetadata metadata, CSSValue* value) |
65 : m_metadata(metadata) | 66 : m_metadata(metadata) |
66 , m_value(value) | 67 , m_value(value) |
67 { | 68 { |
68 ASSERT((metadata.m_propertyID == CSSPropertyVariable) == (m_value && m_value
->isVariableValue())); | 69 ASSERT((metadata.m_propertyID == CSSPropertyVariable) == (m_value && m_value
->isVariableValue())); |
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 CSSPropertyID shorthandID() const { return static_cast<CSSPropertyID>(m_meta
data.m_shorthandID); } | 73 bool isSetFromShorthand() const { return m_metadata.m_isSetFromShorthand; }; |
| 74 CSSPropertyID shorthandID() const { return m_metadata.shorthandID(); }; |
73 bool isImportant() const { return m_metadata.m_important; } | 75 bool isImportant() const { return m_metadata.m_important; } |
74 | 76 |
75 CSSValue* value() const { return m_value.get(); } | 77 CSSValue* value() const { return m_value.get(); } |
76 | 78 |
77 void wrapValueInCommaSeparatedList(); | 79 void wrapValueInCommaSeparatedList(); |
78 | 80 |
79 static CSSPropertyID resolveDirectionAwareProperty(CSSPropertyID, TextDirect
ion, WritingMode); | 81 static CSSPropertyID resolveDirectionAwareProperty(CSSPropertyID, TextDirect
ion, WritingMode); |
80 static bool isInheritedProperty(CSSPropertyID); | 82 static bool isInheritedProperty(CSSPropertyID); |
81 | 83 |
82 void reportMemoryUsage(MemoryObjectInfo*) const; | 84 void reportMemoryUsage(MemoryObjectInfo*) const; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 } // namespace WebCore | 135 } // namespace WebCore |
134 | 136 |
135 namespace WTF { | 137 namespace WTF { |
136 template <> struct VectorTraits<WebCore::CSSProperty> : VectorTraitsBase<false,
WebCore::CSSProperty> { | 138 template <> struct VectorTraits<WebCore::CSSProperty> : VectorTraitsBase<false,
WebCore::CSSProperty> { |
137 static const bool canInitializeWithMemset = true; | 139 static const bool canInitializeWithMemset = true; |
138 static const bool canMoveWithMemcpy = true; | 140 static const bool canMoveWithMemcpy = true; |
139 }; | 141 }; |
140 } | 142 } |
141 | 143 |
142 #endif // CSSProperty_h | 144 #endif // CSSProperty_h |
OLD | NEW |