OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
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 CSSQuadValue_h | 21 #ifndef CSSQuadValue_h |
22 #define CSSQuadValue_h | 22 #define CSSQuadValue_h |
23 | 23 |
24 #include "core/CoreExport.h" | 24 #include "core/CoreExport.h" |
25 #include "core/css/CSSPrimitiveValue.h" | |
26 #include "core/css/CSSValue.h" | 25 #include "core/css/CSSValue.h" |
27 #include "wtf/RefPtr.h" | 26 #include "wtf/RefPtr.h" |
28 | 27 |
29 namespace blink { | 28 namespace blink { |
30 | 29 |
31 class CORE_EXPORT CSSQuadValue : public CSSValue { | 30 class CORE_EXPORT CSSQuadValue : public CSSValue { |
32 public: | 31 public: |
33 enum TypeForSerialization { | 32 enum TypeForSerialization { |
34 SerializeAsRect, | 33 SerializeAsRect, |
35 SerializeAsQuad | 34 SerializeAsQuad |
36 }; | 35 }; |
37 | 36 |
38 static CSSQuadValue* create(CSSPrimitiveValue* top, CSSPrimitiveValue* right
, CSSPrimitiveValue* bottom, CSSPrimitiveValue* left, TypeForSerialization seria
lizationType) | 37 static CSSQuadValue* create(CSSValue* top, CSSValue* right, CSSValue* bottom
, CSSValue* left, TypeForSerialization serializationType) |
39 { | 38 { |
40 return new CSSQuadValue(top, right, bottom, left, serializationType); | 39 return new CSSQuadValue(top, right, bottom, left, serializationType); |
41 } | 40 } |
42 | 41 |
43 CSSPrimitiveValue* top() const { return m_top.get(); } | 42 CSSValue* top() const { return m_top.get(); } |
44 CSSPrimitiveValue* right() const { return m_right.get(); } | 43 CSSValue* right() const { return m_right.get(); } |
45 CSSPrimitiveValue* bottom() const { return m_bottom.get(); } | 44 CSSValue* bottom() const { return m_bottom.get(); } |
46 CSSPrimitiveValue* left() const { return m_left.get(); } | 45 CSSValue* left() const { return m_left.get(); } |
47 | 46 |
48 TypeForSerialization serializationType() { return m_serializationType; } | 47 TypeForSerialization serializationType() { return m_serializationType; } |
49 | 48 |
50 String customCSSText() const; | 49 String customCSSText() const; |
51 | 50 |
52 bool equals(const CSSQuadValue& other) const | 51 bool equals(const CSSQuadValue& other) const |
53 { | 52 { |
54 return compareCSSValuePtr(m_top, other.m_top) | 53 return compareCSSValuePtr(m_top, other.m_top) |
55 && compareCSSValuePtr(m_right, other.m_right) | 54 && compareCSSValuePtr(m_right, other.m_right) |
56 && compareCSSValuePtr(m_left, other.m_left) | 55 && compareCSSValuePtr(m_left, other.m_left) |
57 && compareCSSValuePtr(m_bottom, other.m_bottom); | 56 && compareCSSValuePtr(m_bottom, other.m_bottom); |
58 } | 57 } |
59 | 58 |
60 DECLARE_TRACE_AFTER_DISPATCH(); | 59 DECLARE_TRACE_AFTER_DISPATCH(); |
61 | 60 |
62 protected: | 61 protected: |
63 CSSQuadValue(CSSPrimitiveValue* top, CSSPrimitiveValue* right, CSSPrimitiveV
alue* bottom, CSSPrimitiveValue* left, TypeForSerialization serializationType) | 62 CSSQuadValue(CSSValue* top, CSSValue* right, CSSValue* bottom, CSSValue* lef
t, TypeForSerialization serializationType) |
64 : CSSValue(QuadClass) | 63 : CSSValue(QuadClass) |
65 , m_serializationType(serializationType) | 64 , m_serializationType(serializationType) |
66 , m_top(top) | 65 , m_top(top) |
67 , m_right(right) | 66 , m_right(right) |
68 , m_bottom(bottom) | 67 , m_bottom(bottom) |
69 , m_left(left) { } | 68 , m_left(left) { } |
70 | 69 |
71 private: | 70 private: |
72 TypeForSerialization m_serializationType; | 71 TypeForSerialization m_serializationType; |
73 Member<CSSPrimitiveValue> m_top; | 72 Member<CSSValue> m_top; |
74 Member<CSSPrimitiveValue> m_right; | 73 Member<CSSValue> m_right; |
75 Member<CSSPrimitiveValue> m_bottom; | 74 Member<CSSValue> m_bottom; |
76 Member<CSSPrimitiveValue> m_left; | 75 Member<CSSValue> m_left; |
77 }; | 76 }; |
78 | 77 |
79 DEFINE_CSS_VALUE_TYPE_CASTS(CSSQuadValue, isQuadValue()); | 78 DEFINE_CSS_VALUE_TYPE_CASTS(CSSQuadValue, isQuadValue()); |
80 | 79 |
81 } // namespace blink | 80 } // namespace blink |
82 | 81 |
83 #endif // CSSQuadValue_h | 82 #endif // CSSQuadValue_h |
OLD | NEW |