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 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. |
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 case NumberToken: | 155 case NumberToken: |
156 case PercentageToken: | 156 case PercentageToken: |
157 if (!std::isfinite(token.numericValue())) { | 157 if (!std::isfinite(token.numericValue())) { |
158 destroyAndClear(); | 158 destroyAndClear(); |
159 return; | 159 return; |
160 } | 160 } |
161 value.setFromNumber(token.numericValue(), token.unitType()); | 161 value.setFromNumber(token.numericValue(), token.unitType()); |
162 value.isInt = (token.numericValueType() == IntegerValueType); | 162 value.isInt = (token.numericValueType() == IntegerValueType); |
163 break; | 163 break; |
164 case HashToken: | 164 case HashToken: |
165 // FIXME: Move this logic to the property parser | |
166 // This check prevents us from allowing #red and similar | |
167 for (size_t i = 0; i < token.value().length(); ++i) { | |
168 if (!isASCIIHexDigit(token.value()[i])) { | |
169 destroyAndClear(); | |
170 return; | |
171 } | |
172 } | |
173 // fallthrough | |
174 case StringToken: | 165 case StringToken: |
175 case UnicodeRangeToken: | 166 case UnicodeRangeToken: |
176 case UrlToken: { | 167 case UrlToken: { |
177 value.id = CSSValueInvalid; | 168 value.id = CSSValueInvalid; |
178 value.isInt = false; | 169 value.isInt = false; |
179 if (token.type() == HashToken) | 170 if (token.type() == HashToken) |
180 value.unit = CSSParserValue::HexColor; | 171 value.unit = CSSParserValue::HexColor; |
181 else if (token.type() == StringToken) | 172 else if (token.type() == StringToken) |
182 value.unit = CSSPrimitiveValue::CSS_STRING; | 173 value.unit = CSSPrimitiveValue::CSS_STRING; |
183 else if (token.type() == UnicodeRangeToken) | 174 else if (token.type() == UnicodeRangeToken) |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 bool CSSParserSelector::hasHostPseudoSelector() const | 352 bool CSSParserSelector::hasHostPseudoSelector() const |
362 { | 353 { |
363 for (CSSParserSelector* selector = const_cast<CSSParserSelector*>(this); sel
ector; selector = selector->tagHistory()) { | 354 for (CSSParserSelector* selector = const_cast<CSSParserSelector*>(this); sel
ector; selector = selector->tagHistory()) { |
364 if (selector->pseudoType() == CSSSelector::PseudoHost || selector->pseud
oType() == CSSSelector::PseudoHostContext) | 355 if (selector->pseudoType() == CSSSelector::PseudoHost || selector->pseud
oType() == CSSSelector::PseudoHostContext) |
365 return true; | 356 return true; |
366 } | 357 } |
367 return false; | 358 return false; |
368 } | 359 } |
369 | 360 |
370 } // namespace blink | 361 } // namespace blink |
OLD | NEW |