OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Daniel Bates (dbates@intudata.com). All Rights Reserved. | 2 * Copyright (C) 2011 Daniel Bates (dbates@intudata.com). All Rights Reserved. |
3 * Copyright (c) 2012 Google, inc. All Rights Reserved. | 3 * Copyright (c) 2012 Google, inc. All Rights Reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 12 matching lines...) Expand all Loading... |
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
25 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 */ | 28 */ |
29 | 29 |
30 #ifndef DecodeEscapeSequences_h | 30 #ifndef DecodeEscapeSequences_h |
31 #define DecodeEscapeSequences_h | 31 #define DecodeEscapeSequences_h |
32 | 32 |
33 #include "wtf/ASCIICType.h" | 33 #include "platform/wtf/ASCIICType.h" |
34 #include "wtf/Allocator.h" | 34 #include "platform/wtf/Allocator.h" |
35 #include "wtf/Assertions.h" | 35 #include "platform/wtf/Assertions.h" |
36 #include "wtf/text/StringBuilder.h" | 36 #include "platform/wtf/text/StringBuilder.h" |
37 #include "wtf/text/TextEncoding.h" | 37 #include "platform/wtf/text/TextEncoding.h" |
38 | 38 |
39 namespace blink { | 39 namespace blink { |
40 | 40 |
41 // See | 41 // See |
42 // <http://en.wikipedia.org/wiki/Percent-encoding#Non-standard_implementations>. | 42 // <http://en.wikipedia.org/wiki/Percent-encoding#Non-standard_implementations>. |
43 struct Unicode16BitEscapeSequence { | 43 struct Unicode16BitEscapeSequence { |
44 STATIC_ONLY(Unicode16BitEscapeSequence); | 44 STATIC_ONLY(Unicode16BitEscapeSequence); |
45 enum { sequenceSize = 6 }; // e.g. %u26C4 | 45 enum { sequenceSize = 6 }; // e.g. %u26C4 |
46 static size_t findInString(const String& string, size_t startPosition) { | 46 static size_t findInString(const String& string, size_t startPosition) { |
47 return string.find("%u", startPosition); | 47 return string.find("%u", startPosition); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 result.append(decoded); | 181 result.append(decoded); |
182 decodedPosition = encodedRunEnd; | 182 decodedPosition = encodedRunEnd; |
183 } | 183 } |
184 result.append(string, decodedPosition, length - decodedPosition); | 184 result.append(string, decodedPosition, length - decodedPosition); |
185 return result.toString(); | 185 return result.toString(); |
186 } | 186 } |
187 | 187 |
188 } // namespace blink | 188 } // namespace blink |
189 | 189 |
190 #endif // DecodeEscapeSequences_h | 190 #endif // DecodeEscapeSequences_h |
OLD | NEW |