| 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 { SerializeAsRect, SerializeAsQuad }; | 32 enum TypeForSerialization { SerializeAsRect, SerializeAsQuad }; |
| 34 | 33 |
| 35 static CSSQuadValue* create(CSSPrimitiveValue* top, | 34 static CSSQuadValue* create(CSSValue* top, |
| 36 CSSPrimitiveValue* right, | 35 CSSValue* right, |
| 37 CSSPrimitiveValue* bottom, | 36 CSSValue* bottom, |
| 38 CSSPrimitiveValue* left, | 37 CSSValue* left, |
| 39 TypeForSerialization serializationType) { | 38 TypeForSerialization serializationType) { |
| 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 return compareCSSValuePtr(m_top, other.m_top) && | 52 return compareCSSValuePtr(m_top, other.m_top) && |
| 54 compareCSSValuePtr(m_right, other.m_right) && | 53 compareCSSValuePtr(m_right, other.m_right) && |
| 55 compareCSSValuePtr(m_left, other.m_left) && | 54 compareCSSValuePtr(m_left, other.m_left) && |
| 56 compareCSSValuePtr(m_bottom, other.m_bottom); | 55 compareCSSValuePtr(m_bottom, other.m_bottom); |
| 57 } | 56 } |
| 58 | 57 |
| 59 DECLARE_TRACE_AFTER_DISPATCH(); | 58 DECLARE_TRACE_AFTER_DISPATCH(); |
| 60 | 59 |
| 61 protected: | 60 protected: |
| 62 CSSQuadValue(CSSPrimitiveValue* top, | 61 CSSQuadValue(CSSValue* top, |
| 63 CSSPrimitiveValue* right, | 62 CSSValue* right, |
| 64 CSSPrimitiveValue* bottom, | 63 CSSValue* bottom, |
| 65 CSSPrimitiveValue* left, | 64 CSSValue* left, |
| 66 TypeForSerialization serializationType) | 65 TypeForSerialization serializationType) |
| 67 : CSSValue(QuadClass), | 66 : CSSValue(QuadClass), |
| 68 m_serializationType(serializationType), | 67 m_serializationType(serializationType), |
| 69 m_top(top), | 68 m_top(top), |
| 70 m_right(right), | 69 m_right(right), |
| 71 m_bottom(bottom), | 70 m_bottom(bottom), |
| 72 m_left(left) {} | 71 m_left(left) {} |
| 73 | 72 |
| 74 private: | 73 private: |
| 75 TypeForSerialization m_serializationType; | 74 TypeForSerialization m_serializationType; |
| 76 Member<CSSPrimitiveValue> m_top; | 75 Member<CSSValue> m_top; |
| 77 Member<CSSPrimitiveValue> m_right; | 76 Member<CSSValue> m_right; |
| 78 Member<CSSPrimitiveValue> m_bottom; | 77 Member<CSSValue> m_bottom; |
| 79 Member<CSSPrimitiveValue> m_left; | 78 Member<CSSValue> m_left; |
| 80 }; | 79 }; |
| 81 | 80 |
| 82 DEFINE_CSS_VALUE_TYPE_CASTS(CSSQuadValue, isQuadValue()); | 81 DEFINE_CSS_VALUE_TYPE_CASTS(CSSQuadValue, isQuadValue()); |
| 83 | 82 |
| 84 } // namespace blink | 83 } // namespace blink |
| 85 | 84 |
| 86 #endif // CSSQuadValue_h | 85 #endif // CSSQuadValue_h |
| OLD | NEW |