| 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, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
| 14 * | 14 * |
| 15 * You should have received a copy of the GNU Library General Public License | 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 | 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, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
| 19 */ | 19 */ |
| 20 | 20 |
| 21 #ifndef CSSParserValues_h | 21 #ifndef CSSParserValues_h |
| 22 #define CSSParserValues_h | 22 #define CSSParserValues_h |
| 23 | 23 |
| 24 #include "core/CSSValueKeywords.h" | 24 #include "core/CSSValueKeywords.h" |
| 25 #include "core/css/CSSPrimitiveValue.h" | 25 #include "core/css/CSSPrimitiveValue.h" |
| 26 #include "core/css/CSSSelector.h" | 26 #include "core/css/CSSSelector.h" |
| 27 #include "core/css/CSSValueList.h" | 27 #include "core/css/CSSValueList.h" |
| 28 #include "core/css/parser/CSSParserToken.h" |
| 28 #include "wtf/text/AtomicString.h" | 29 #include "wtf/text/AtomicString.h" |
| 29 #include "wtf/text/WTFString.h" | 30 #include "wtf/text/WTFString.h" |
| 30 | 31 |
| 31 namespace blink { | 32 namespace blink { |
| 32 | 33 |
| 33 class QualifiedName; | 34 class QualifiedName; |
| 34 | 35 |
| 35 struct CSSParserString { | 36 struct CSSParserString { |
| 36 void init(const LChar* characters, unsigned length) | 37 void init(const LChar* characters, unsigned length) |
| 37 { | 38 { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 }; | 150 }; |
| 150 enum { | 151 enum { |
| 151 Operator = 0x100000, | 152 Operator = 0x100000, |
| 152 Function = 0x100001, | 153 Function = 0x100001, |
| 153 ValueList = 0x100002, | 154 ValueList = 0x100002, |
| 154 Q_EMS = 0x100003, | 155 Q_EMS = 0x100003, |
| 155 }; | 156 }; |
| 156 int unit; | 157 int unit; |
| 157 | 158 |
| 158 inline void setFromNumber(double value, int unit = CSSPrimitiveValue::CSS_NU
MBER); | 159 inline void setFromNumber(double value, int unit = CSSPrimitiveValue::CSS_NU
MBER); |
| 160 inline void setFromOperator(UChar); |
| 159 inline void setFromFunction(CSSParserFunction*); | 161 inline void setFromFunction(CSSParserFunction*); |
| 160 inline void setFromValueList(PassOwnPtr<CSSParserValueList>); | 162 inline void setFromValueList(PassOwnPtr<CSSParserValueList>); |
| 161 }; | 163 }; |
| 162 | 164 |
| 163 class CSSParserValueList { | 165 class CSSParserValueList { |
| 164 WTF_MAKE_FAST_ALLOCATED; | 166 WTF_MAKE_FAST_ALLOCATED; |
| 165 public: | 167 public: |
| 166 CSSParserValueList() | 168 CSSParserValueList() |
| 167 : m_current(0) | 169 : m_current(0) |
| 168 { | 170 { |
| 169 } | 171 } |
| 172 CSSParserValueList(CSSParserTokenIterator start, CSSParserTokenIterator end)
; |
| 170 ~CSSParserValueList(); | 173 ~CSSParserValueList(); |
| 171 | 174 |
| 172 void addValue(const CSSParserValue&); | 175 void addValue(const CSSParserValue&); |
| 173 void insertValueAt(unsigned, const CSSParserValue&); | 176 void insertValueAt(unsigned, const CSSParserValue&); |
| 174 void stealValues(CSSParserValueList&); | 177 void stealValues(CSSParserValueList&); |
| 175 | 178 |
| 176 unsigned size() const { return m_values.size(); } | 179 unsigned size() const { return m_values.size(); } |
| 177 unsigned currentIndex() { return m_current; } | 180 unsigned currentIndex() { return m_current; } |
| 178 CSSParserValue* current() { return m_current < m_values.size() ? &m_values[m
_current] : 0; } | 181 CSSParserValue* current() { return m_current < m_values.size() ? &m_values[m
_current] : 0; } |
| 179 CSSParserValue* next() { ++m_current; return current(); } | 182 CSSParserValue* next() { ++m_current; return current(); } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 { | 263 { |
| 261 id = CSSValueInvalid; | 264 id = CSSValueInvalid; |
| 262 isInt = false; | 265 isInt = false; |
| 263 if (std::isfinite(value)) | 266 if (std::isfinite(value)) |
| 264 fValue = value; | 267 fValue = value; |
| 265 else | 268 else |
| 266 fValue = 0; | 269 fValue = 0; |
| 267 this->unit = unit; | 270 this->unit = unit; |
| 268 } | 271 } |
| 269 | 272 |
| 273 inline void CSSParserValue::setFromOperator(UChar c) |
| 274 { |
| 275 id = CSSValueInvalid; |
| 276 unit = Operator; |
| 277 iValue = c; |
| 278 isInt = false; |
| 279 } |
| 280 |
| 270 inline void CSSParserValue::setFromFunction(CSSParserFunction* function) | 281 inline void CSSParserValue::setFromFunction(CSSParserFunction* function) |
| 271 { | 282 { |
| 272 id = CSSValueInvalid; | 283 id = CSSValueInvalid; |
| 273 this->function = function; | 284 this->function = function; |
| 274 unit = Function; | 285 unit = Function; |
| 275 isInt = false; | 286 isInt = false; |
| 276 } | 287 } |
| 277 | 288 |
| 278 inline void CSSParserValue::setFromValueList(PassOwnPtr<CSSParserValueList> valu
eList) | 289 inline void CSSParserValue::setFromValueList(PassOwnPtr<CSSParserValueList> valu
eList) |
| 279 { | 290 { |
| 280 id = CSSValueInvalid; | 291 id = CSSValueInvalid; |
| 281 this->valueList = valueList.leakPtr(); | 292 this->valueList = valueList.leakPtr(); |
| 282 unit = ValueList; | 293 unit = ValueList; |
| 283 isInt = false; | 294 isInt = false; |
| 284 } | 295 } |
| 285 | 296 |
| 286 } | 297 } |
| 287 | 298 |
| 288 #endif | 299 #endif |
| OLD | NEW |