OSDN Git Service

am 3c54ece0: am 5dc34a85: activeDocumentLoader() causes crash in WebCoreFrameBridge.cpp
[android-x86/external-webkit.git] / WebCore / css / CSSParserValues.h
1 /*
2  * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
3  * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
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 CSSParserValues_h
22 #define CSSParserValues_h
23
24 #include "AtomicString.h"
25
26 namespace WebCore {
27
28 class CSSValue;
29
30 struct CSSParserString {
31     UChar* characters;
32     int length;
33
34     void lower();
35
36     operator String() const { return String(characters, length); }
37     operator AtomicString() const { return AtomicString(characters, length); }
38 };
39
40 struct CSSParserFunction;
41
42 struct CSSParserValue {
43     int id;
44     bool isInt;
45     union {
46         double fValue;
47         int iValue;
48         CSSParserString string;
49         CSSParserFunction* function;
50     };
51     enum {
52         Operator = 0x100000,
53         Function = 0x100001,
54         Q_EMS    = 0x100002
55     };
56     int unit;
57     
58     bool isVariable() const;
59     
60     PassRefPtr<CSSValue> createCSSValue();
61 };
62
63 class CSSParserValueList : public FastAllocBase {
64 public:
65     CSSParserValueList()
66         : m_current(0)
67         , m_variablesCount(0)
68     {
69     }
70     ~CSSParserValueList();
71     
72     void addValue(const CSSParserValue&);
73     void deleteValueAt(unsigned);
74
75     unsigned size() const { return m_values.size(); }
76     CSSParserValue* current() { return m_current < m_values.size() ? &m_values[m_current] : 0; }
77     CSSParserValue* next() { ++m_current; return current(); }
78
79     CSSParserValue* valueAt(unsigned i) { return i < m_values.size() ? &m_values[i] : 0; }
80         
81     void clear() { m_values.clear(); }
82
83     bool containsVariables() const { return m_variablesCount; }
84
85 private:
86     unsigned m_current;
87     unsigned m_variablesCount;
88     Vector<CSSParserValue, 4> m_values;
89 };
90
91 struct CSSParserFunction : FastAllocBase {
92     CSSParserString name;
93     CSSParserValueList* args;
94
95     ~CSSParserFunction() { delete args; }
96 };
97
98 }
99
100 #endif