| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 value = sign * charactersToIntStrict(digits.characters16(), digits.lengt
h(), &ok); | 200 value = sign * charactersToIntStrict(digits.characters16(), digits.lengt
h(), &ok); |
| 201 return ok; | 201 return ok; |
| 202 } | 202 } |
| 203 | 203 |
| 204 // http://www.whatwg.org/specs/web-apps/current-work/#rules-for-parsing-integers | 204 // http://www.whatwg.org/specs/web-apps/current-work/#rules-for-parsing-integers |
| 205 bool parseHTMLInteger(const String& input, int& value) | 205 bool parseHTMLInteger(const String& input, int& value) |
| 206 { | 206 { |
| 207 // Step 1 | 207 // Step 1 |
| 208 // Step 2 | 208 // Step 2 |
| 209 unsigned length = input.length(); | 209 unsigned length = input.length(); |
| 210 if (!length || input.is8Bit()) { | 210 if (length && input.is8Bit()) { |
| 211 const LChar* start = input.characters8(); | 211 const LChar* start = input.characters8(); |
| 212 return parseHTMLIntegerInternal(start, start + length, value); | 212 return parseHTMLIntegerInternal(start, start + length, value); |
| 213 } | 213 } |
| 214 | 214 |
| 215 const UChar* start = input.characters16(); | 215 const UChar* start = input.bloatedCharacters(); |
| 216 return parseHTMLIntegerInternal(start, start + length, value); | 216 return parseHTMLIntegerInternal(start, start + length, value); |
| 217 } | 217 } |
| 218 | 218 |
| 219 template <typename CharacterType> | 219 template <typename CharacterType> |
| 220 static bool parseHTMLNonNegativeIntegerInternal(const CharacterType* position, c
onst CharacterType* end, unsigned& value) | 220 static bool parseHTMLNonNegativeIntegerInternal(const CharacterType* position, c
onst CharacterType* end, unsigned& value) |
| 221 { | 221 { |
| 222 // Step 3 | 222 // Step 3 |
| 223 while (position < end) { | 223 while (position < end) { |
| 224 if (!isHTMLSpace(*position)) | 224 if (!isHTMLSpace(*position)) |
| 225 break; | 225 break; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 { | 290 { |
| 291 return threadSafeEqual(a.localName().impl(), b.localName().impl()); | 291 return threadSafeEqual(a.localName().impl(), b.localName().impl()); |
| 292 } | 292 } |
| 293 | 293 |
| 294 bool threadSafeMatch(const HTMLIdentifier& localName, const QualifiedName& qName
) | 294 bool threadSafeMatch(const HTMLIdentifier& localName, const QualifiedName& qName
) |
| 295 { | 295 { |
| 296 return threadSafeEqual(localName.asStringImpl(), qName.localName().impl()); | 296 return threadSafeEqual(localName.asStringImpl(), qName.localName().impl()); |
| 297 } | 297 } |
| 298 | 298 |
| 299 } | 299 } |
| OLD | NEW |