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

Side by Side Diff: Source/core/html/parser/HTMLParserIdioms.h

Issue 141143007: Revert of Revert "Moved text decoding to the parser thread" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 11 months 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 12 matching lines...) Expand all
23 */ 23 */
24 24
25 #ifndef HTMLParserIdioms_h 25 #ifndef HTMLParserIdioms_h
26 #define HTMLParserIdioms_h 26 #define HTMLParserIdioms_h
27 27
28 #include "core/dom/QualifiedName.h" 28 #include "core/dom/QualifiedName.h"
29 #include "platform/Decimal.h" 29 #include "platform/Decimal.h"
30 #include "wtf/Forward.h" 30 #include "wtf/Forward.h"
31 #include "wtf/text/WTFString.h" 31 #include "wtf/text/WTFString.h"
32 32
33 namespace WTF {
34 class TextEncoding;
35 }
36
33 namespace WebCore { 37 namespace WebCore {
34 38
35 // Space characters as defined by the HTML specification. 39 // Space characters as defined by the HTML specification.
36 bool isHTMLSpace(UChar); 40 bool isHTMLSpace(UChar);
37 bool isHTMLLineBreak(UChar); 41 bool isHTMLLineBreak(UChar);
38 bool isNotHTMLSpace(UChar); 42 bool isNotHTMLSpace(UChar);
39 43
40 // Strip leading and trailing whitespace as defined by the HTML specification. 44 // Strip leading and trailing whitespace as defined by the HTML specification.
41 String stripLeadingAndTrailingHTMLSpaces(const String&); 45 String stripLeadingAndTrailingHTMLSpaces(const String&);
42 template<size_t inlineCapacity> 46 template<size_t inlineCapacity>
(...skipping 11 matching lines...) Expand all
54 // The double* parameter may be 0 to check if the string can be parsed without g etting the result. 58 // The double* parameter may be 0 to check if the string can be parsed without g etting the result.
55 Decimal parseToDecimalForNumberType(const String&, const Decimal& fallbackValue = Decimal::nan()); 59 Decimal parseToDecimalForNumberType(const String&, const Decimal& fallbackValue = Decimal::nan());
56 double parseToDoubleForNumberType(const String&, double fallbackValue = std::num eric_limits<double>::quiet_NaN()); 60 double parseToDoubleForNumberType(const String&, double fallbackValue = std::num eric_limits<double>::quiet_NaN());
57 61
58 // http://www.whatwg.org/specs/web-apps/current-work/#rules-for-parsing-integers 62 // http://www.whatwg.org/specs/web-apps/current-work/#rules-for-parsing-integers
59 bool parseHTMLInteger(const String&, int&); 63 bool parseHTMLInteger(const String&, int&);
60 64
61 // http://www.whatwg.org/specs/web-apps/current-work/#rules-for-parsing-non-nega tive-integers 65 // http://www.whatwg.org/specs/web-apps/current-work/#rules-for-parsing-non-nega tive-integers
62 bool parseHTMLNonNegativeInteger(const String&, unsigned int&); 66 bool parseHTMLNonNegativeInteger(const String&, unsigned int&);
63 67
68 typedef Vector<pair<String, String> > HTMLAttributeList;
69 // The returned encoding might not be valid.
70 WTF::TextEncoding encodingFromMetaAttributes(const HTMLAttributeList&);
71
64 // Inline implementations of some of the functions declared above. 72 // Inline implementations of some of the functions declared above.
65 73
66 template<typename CharType> 74 template<typename CharType>
67 inline bool isHTMLSpace(CharType character) 75 inline bool isHTMLSpace(CharType character)
68 { 76 {
69 // Histogram from Apple's page load test combined with some ad hoc browsing some other test suites. 77 // Histogram from Apple's page load test combined with some ad hoc browsing some other test suites.
70 // 78 //
71 // 82%: 216330 non-space characters, all > U+0020 79 // 82%: 216330 non-space characters, all > U+0020
72 // 11%: 30017 plain space characters, U+0020 80 // 11%: 30017 plain space characters, U+0020
73 // 5%: 12099 newline characters, U+000A 81 // 5%: 12099 newline characters, U+000A
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 else if (width == Force8Bit) 126 else if (width == Force8Bit)
119 string = String::make8BitFrom16BitSource(vector); 127 string = String::make8BitFrom16BitSource(vector);
120 else 128 else
121 string = String(vector); 129 string = String(vector);
122 130
123 return string; 131 return string;
124 } 132 }
125 133
126 } 134 }
127 #endif 135 #endif
OLDNEW
« no previous file with comments | « Source/core/html/parser/HTMLMetaCharsetParser.cpp ('k') | Source/core/html/parser/HTMLParserIdioms.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698