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