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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. | 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. |
10 * | 10 * |
(...skipping 10115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10126 unsigned length = string.length(); | 10126 unsigned length = string.length(); |
10127 | 10127 |
10128 if (!length) | 10128 if (!length) |
10129 return CSSPropertyInvalid; | 10129 return CSSPropertyInvalid; |
10130 if (length > maxCSSPropertyNameLength) | 10130 if (length > maxCSSPropertyNameLength) |
10131 return CSSPropertyInvalid; | 10131 return CSSPropertyInvalid; |
10132 | 10132 |
10133 return string.is8Bit() ? cssPropertyID(string.characters8(), length) : cssPr
opertyID(string.characters16(), length); | 10133 return string.is8Bit() ? cssPropertyID(string.characters8(), length) : cssPr
opertyID(string.characters16(), length); |
10134 } | 10134 } |
10135 | 10135 |
10136 template <typename CharacterType> | |
10137 static CSSValueID cssValueKeywordID(const CharacterType* valueKeyword, unsigned
length) | |
10138 { | |
10139 char buffer[maxCSSValueKeywordLength + 1]; // 1 for null character | |
10140 | |
10141 for (unsigned i = 0; i != length; ++i) { | |
10142 CharacterType c = valueKeyword[i]; | |
10143 if (c == 0 || c >= 0x7F) | |
10144 return CSSValueInvalid; // illegal character | |
10145 buffer[i] = WTF::toASCIILower(c); | |
10146 } | |
10147 buffer[length] = '\0'; | |
10148 | |
10149 const Value* hashTableEntry = findValue(buffer, length); | |
10150 return hashTableEntry ? static_cast<CSSValueID>(hashTableEntry->id) : CSSVal
ueInvalid; | |
10151 } | |
10152 | |
10153 CSSValueID cssValueKeywordID(const CSSParserString& string) | |
10154 { | |
10155 unsigned length = string.length(); | |
10156 if (!length) | |
10157 return CSSValueInvalid; | |
10158 if (length > maxCSSValueKeywordLength) | |
10159 return CSSValueInvalid; | |
10160 | |
10161 return string.is8Bit() ? cssValueKeywordID(string.characters8(), length) : c
ssValueKeywordID(string.characters16(), length); | |
10162 } | |
10163 | |
10164 bool isValidNthToken(const CSSParserString& token) | 10136 bool isValidNthToken(const CSSParserString& token) |
10165 { | 10137 { |
10166 // The tokenizer checks for the construct of an+b. | 10138 // The tokenizer checks for the construct of an+b. |
10167 // However, since the {ident} rule precedes the {nth} rule, some of those | 10139 // However, since the {ident} rule precedes the {nth} rule, some of those |
10168 // tokens are identified as string literal. Furthermore we need to accept | 10140 // tokens are identified as string literal. Furthermore we need to accept |
10169 // "odd" and "even" which does not match to an+b. | 10141 // "odd" and "even" which does not match to an+b. |
10170 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 10142 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
10171 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 10143 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
10172 } | 10144 } |
10173 | 10145 |
10174 } | 10146 } |
OLD | NEW |