1 /* 2 * (C) 1999-2003 Lars Knoll (knoll (at) kde.org) 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 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 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21 #ifndef Pair_h 22 #define Pair_h 23 24 #include <wtf/RefCounted.h> 25 #include "CSSPrimitiveValue.h" 26 #include <wtf/PassRefPtr.h> 27 28 namespace WebCore { 29 30 // A primitive value representing a pair. This is useful for properties like border-radius, background-size/position, 31 // and border-spacing (all of which are space-separated sets of two values). At the moment we are only using it for 32 // border-radius and background-size, but (FIXME) border-spacing and background-position could be converted over to use 33 // it (eliminating some extra -webkit- internal properties). 34 class Pair : public RefCounted<Pair> { 35 public: 36 static PassRefPtr<Pair> create() 37 { 38 return adoptRef(new Pair); 39 } 40 static PassRefPtr<Pair> create(PassRefPtr<CSSPrimitiveValue> first, PassRefPtr<CSSPrimitiveValue> second) 41 { 42 return adoptRef(new Pair(first, second)); 43 } 44 virtual ~Pair() { } 45 46 CSSPrimitiveValue* first() const { return m_first.get(); } 47 CSSPrimitiveValue* second() const { return m_second.get(); } 48 49 void setFirst(PassRefPtr<CSSPrimitiveValue> first) { m_first = first; } 50 void setSecond(PassRefPtr<CSSPrimitiveValue> second) { m_second = second; } 51 52 private: 53 Pair() : m_first(0), m_second(0) { } 54 Pair(PassRefPtr<CSSPrimitiveValue> first, PassRefPtr<CSSPrimitiveValue> second) 55 : m_first(first), m_second(second) { } 56 57 RefPtr<CSSPrimitiveValue> m_first; 58 RefPtr<CSSPrimitiveValue> m_second; 59 }; 60 61 } // namespace 62 63 #endif 64