Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLParserIdioms.cpp

Issue 2508033004: Reduce unnecessary usage of TextCaseSensitivity::TextCaseInsensitive. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 if (!length || input.is8Bit()) 342 if (!length || input.is8Bit())
343 return parseHTMLListOfFloatingPointNumbersInternal( 343 return parseHTMLListOfFloatingPointNumbersInternal(
344 input.characters8(), input.characters8() + length); 344 input.characters8(), input.characters8() + length);
345 return parseHTMLListOfFloatingPointNumbersInternal( 345 return parseHTMLListOfFloatingPointNumbersInternal(
346 input.characters16(), input.characters16() + length); 346 input.characters16(), input.characters16() + length);
347 } 347 }
348 348
349 static const char charsetString[] = "charset"; 349 static const char charsetString[] = "charset";
350 static const size_t charsetLength = sizeof("charset") - 1; 350 static const size_t charsetLength = sizeof("charset") - 1;
351 351
352 // https://html.spec.whatwg.org/multipage/infrastructure.html#extracting-charact er-encodings-from-meta-elements
352 String extractCharset(const String& value) { 353 String extractCharset(const String& value) {
353 size_t pos = 0; 354 size_t pos = 0;
354 unsigned length = value.length(); 355 unsigned length = value.length();
355 356
356 while (pos < length) { 357 while (pos < length) {
357 pos = value.find(charsetString, pos, TextCaseInsensitive); 358 pos = value.find(charsetString, pos, TextCaseASCIIInsensitive);
358 if (pos == kNotFound) 359 if (pos == kNotFound)
359 break; 360 break;
360 361
361 pos += charsetLength; 362 pos += charsetLength;
362 363
363 // Skip whitespace. 364 // Skip whitespace.
364 while (pos < length && value[pos] <= ' ') 365 while (pos < length && value[pos] <= ' ')
365 ++pos; 366 ++pos;
366 367
367 if (value[pos] != '=') 368 if (value[pos] != '=')
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 string = StringImpl::create8BitIfPossible(characters, size); 491 string = StringImpl::create8BitIfPossible(characters, size);
491 else if (width == Force8Bit) 492 else if (width == Force8Bit)
492 string = String::make8BitFrom16BitSource(characters, size); 493 string = String::make8BitFrom16BitSource(characters, size);
493 else 494 else
494 string = String(characters, size); 495 string = String(characters, size);
495 496
496 return string; 497 return string;
497 } 498 }
498 499
499 } // namespace blink 500 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698