| 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 "sky/engine/wtf/ASCIICType.h" |
| 34 #include "wtf/Assertions.h" | 34 #include "sky/engine/wtf/Assertions.h" |
| 35 #include "wtf/text/StringBuilder.h" | 35 #include "sky/engine/wtf/text/StringBuilder.h" |
| 36 #include "wtf/text/TextEncoding.h" | 36 #include "sky/engine/wtf/text/TextEncoding.h" |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 // See <http://en.wikipedia.org/wiki/Percent-encoding#Non-standard_implementatio
ns>. | 40 // See <http://en.wikipedia.org/wiki/Percent-encoding#Non-standard_implementatio
ns>. |
| 41 struct Unicode16BitEscapeSequence { | 41 struct Unicode16BitEscapeSequence { |
| 42 enum { sequenceSize = 6 }; // e.g. %u26C4 | 42 enum { sequenceSize = 6 }; // e.g. %u26C4 |
| 43 static size_t findInString(const String& string, size_t startPosition) { ret
urn string.find("%u", startPosition); } | 43 static size_t findInString(const String& string, size_t startPosition) { ret
urn string.find("%u", startPosition); } |
| 44 static size_t findEndOfRun(const String& string, size_t startPosition, size_
t endPosition) | 44 static size_t findEndOfRun(const String& string, size_t startPosition, size_
t endPosition) |
| 45 { | 45 { |
| 46 size_t runEnd = startPosition; | 46 size_t runEnd = startPosition; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 result.append(decoded); | 149 result.append(decoded); |
| 150 decodedPosition = encodedRunEnd; | 150 decodedPosition = encodedRunEnd; |
| 151 } | 151 } |
| 152 result.append(string, decodedPosition, length - decodedPosition); | 152 result.append(string, decodedPosition, length - decodedPosition); |
| 153 return result.toString(); | 153 return result.toString(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 } // namespace blink | 156 } // namespace blink |
| 157 | 157 |
| 158 #endif // DecodeEscapeSequences_h | 158 #endif // DecodeEscapeSequences_h |
| OLD | NEW |