2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
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.
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.
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.
25 #include "TextDirection.h"
26 #include <wtf/PassRefPtr.h>
27 #include <wtf/RefPtr.h>
31 class CSSProperty : public FastAllocBase {
33 CSSProperty(int propID, PassRefPtr<CSSValue> value, bool important = false, int shorthandID = 0, bool implicit = false)
35 , m_shorthandID(shorthandID)
36 , m_important(important)
37 , m_implicit(implicit)
42 CSSProperty& operator=(const CSSProperty& other)
45 m_shorthandID = other.m_shorthandID;
46 m_important = other.m_important;
47 m_implicit = other.m_implicit;
48 m_value = other.m_value;
52 int id() const { return m_id; }
53 int shorthandID() const { return m_shorthandID; }
55 bool isImportant() const { return m_important; }
56 bool isImplicit() const { return m_implicit; }
58 CSSValue* value() const { return m_value.get(); }
60 String cssText() const;
62 static int resolveDirectionAwareProperty(int propertyID, TextDirection);
64 friend bool operator==(const CSSProperty&, const CSSProperty&);
66 // Make sure the following fits in 4 bytes. Really.
68 int m_shorthandID : 15; // If this property was set as part of a shorthand, gives the shorthand.
70 bool m_implicit : 1; // Whether or not the property was set implicitly as the result of a shorthand.
72 RefPtr<CSSValue> m_value;
75 } // namespace WebCore
78 // Properties in Vector can be initialized with memset and moved using memcpy.
79 template<> struct VectorTraits<WebCore::CSSProperty> : SimpleClassVectorTraits { };
82 #endif // CSSProperty_h