OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 3 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
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, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } | 70 } |
71 } | 71 } |
72 | 72 |
73 void clear() | 73 void clear() |
74 { | 74 { |
75 m_data.characters8 = 0; | 75 m_data.characters8 = 0; |
76 m_length = 0; | 76 m_length = 0; |
77 m_is8Bit = true; | 77 m_is8Bit = true; |
78 } | 78 } |
79 | 79 |
80 void trimTrailingWhitespace(); | |
81 | |
82 bool is8Bit() const { return m_is8Bit; } | 80 bool is8Bit() const { return m_is8Bit; } |
83 const LChar* characters8() const { ASSERT(is8Bit()); return m_data.character
s8; } | 81 const LChar* characters8() const { ASSERT(is8Bit()); return m_data.character
s8; } |
84 const UChar* characters16() const { ASSERT(!is8Bit()); return m_data.charact
ers16; } | 82 const UChar* characters16() const { ASSERT(!is8Bit()); return m_data.charact
ers16; } |
85 template <typename CharacterType> | 83 template <typename CharacterType> |
86 const CharacterType* characters() const; | 84 const CharacterType* characters() const; |
87 | 85 |
88 unsigned length() const { return m_length; } | 86 unsigned length() const { return m_length; } |
89 void setLength(unsigned length) { m_length = length; } | 87 void setLength(unsigned length) { m_length = length; } |
90 | 88 |
91 UChar operator[](unsigned i) const | 89 UChar operator[](unsigned i) const |
(...skipping 22 matching lines...) Expand all Loading... |
114 bool startsWithIgnoringCase(const char* str, size_t strLength) const | 112 bool startsWithIgnoringCase(const char* str, size_t strLength) const |
115 { | 113 { |
116 if (length() < strLength) | 114 if (length() < strLength) |
117 return false; | 115 return false; |
118 return is8Bit() ? WTF::equalIgnoringCase(str, characters8(), strLength)
: WTF::equalIgnoringCase(str, characters16(), strLength); | 116 return is8Bit() ? WTF::equalIgnoringCase(str, characters8(), strLength)
: WTF::equalIgnoringCase(str, characters16(), strLength); |
119 } | 117 } |
120 | 118 |
121 operator String() const { return is8Bit() ? String(m_data.characters8, m_len
gth) : StringImpl::create8BitIfPossible(m_data.characters16, m_length); } | 119 operator String() const { return is8Bit() ? String(m_data.characters8, m_len
gth) : StringImpl::create8BitIfPossible(m_data.characters16, m_length); } |
122 operator AtomicString() const { return is8Bit() ? AtomicString(m_data.charac
ters8, m_length) : AtomicString(m_data.characters16, m_length); } | 120 operator AtomicString() const { return is8Bit() ? AtomicString(m_data.charac
ters8, m_length) : AtomicString(m_data.characters16, m_length); } |
123 | 121 |
124 AtomicString atomicSubstring(unsigned position, unsigned length) const; | |
125 | |
126 bool isFunction() const { return length() > 0 && (*this)[length() - 1] == '(
'; } | 122 bool isFunction() const { return length() > 0 && (*this)[length() - 1] == '(
'; } |
127 | 123 |
128 union { | 124 union { |
129 const LChar* characters8; | 125 const LChar* characters8; |
130 const UChar* characters16; | 126 const UChar* characters16; |
131 } m_data; | 127 } m_data; |
132 unsigned m_length; | 128 unsigned m_length; |
133 bool m_is8Bit; | 129 bool m_is8Bit; |
134 }; | 130 }; |
135 | 131 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 WTF_MAKE_FAST_ALLOCATED; | 166 WTF_MAKE_FAST_ALLOCATED; |
171 public: | 167 public: |
172 CSSParserValueList() | 168 CSSParserValueList() |
173 : m_current(0) | 169 : m_current(0) |
174 { | 170 { |
175 } | 171 } |
176 ~CSSParserValueList(); | 172 ~CSSParserValueList(); |
177 | 173 |
178 void addValue(const CSSParserValue&); | 174 void addValue(const CSSParserValue&); |
179 void insertValueAt(unsigned, const CSSParserValue&); | 175 void insertValueAt(unsigned, const CSSParserValue&); |
180 void deleteValueAt(unsigned); | |
181 void stealValues(CSSParserValueList&); | 176 void stealValues(CSSParserValueList&); |
182 | 177 |
183 unsigned size() const { return m_values.size(); } | 178 unsigned size() const { return m_values.size(); } |
184 unsigned currentIndex() { return m_current; } | 179 unsigned currentIndex() { return m_current; } |
185 CSSParserValue* current() { return m_current < m_values.size() ? &m_values[m
_current] : 0; } | 180 CSSParserValue* current() { return m_current < m_values.size() ? &m_values[m
_current] : 0; } |
186 CSSParserValue* next() { ++m_current; return current(); } | 181 CSSParserValue* next() { ++m_current; return current(); } |
187 CSSParserValue* previous() | 182 CSSParserValue* previous() |
188 { | 183 { |
189 if (!m_current) | 184 if (!m_current) |
190 return 0; | 185 return 0; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 inline void CSSParserValue::setFromValueList(PassOwnPtr<CSSParserValueList> valu
eList) | 278 inline void CSSParserValue::setFromValueList(PassOwnPtr<CSSParserValueList> valu
eList) |
284 { | 279 { |
285 id = CSSValueInvalid; | 280 id = CSSValueInvalid; |
286 this->valueList = valueList.leakPtr(); | 281 this->valueList = valueList.leakPtr(); |
287 unit = ValueList; | 282 unit = ValueList; |
288 } | 283 } |
289 | 284 |
290 } | 285 } |
291 | 286 |
292 #endif | 287 #endif |
OLD | NEW |