OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 // 1. Let c be the code unit in S at index i. | 577 // 1. Let c be the code unit in S at index i. |
578 UChar c = s[i]; | 578 UChar c = s[i]; |
579 // 2. Depending on the value of c: | 579 // 2. Depending on the value of c: |
580 if (U16_IS_SINGLE(c)) { | 580 if (U16_IS_SINGLE(c)) { |
581 // c < 0xD800 or c > 0xDFFF | 581 // c < 0xD800 or c > 0xDFFF |
582 // Append to U the Unicode character with code point c. | 582 // Append to U the Unicode character with code point c. |
583 u.append(c); | 583 u.append(c); |
584 } else if (U16_IS_TRAIL(c)) { | 584 } else if (U16_IS_TRAIL(c)) { |
585 // 0xDC00 <= c <= 0xDFFF | 585 // 0xDC00 <= c <= 0xDFFF |
586 // Append to U a U+FFFD REPLACEMENT CHARACTER. | 586 // Append to U a U+FFFD REPLACEMENT CHARACTER. |
587 u.append(WTF::Unicode::replacementCharacter); | 587 u.append(replacementCharacter); |
588 } else { | 588 } else { |
589 // 0xD800 <= c <= 0xDBFF | 589 // 0xD800 <= c <= 0xDBFF |
590 ASSERT(U16_IS_LEAD(c)); | 590 ASSERT(U16_IS_LEAD(c)); |
591 if (i == n - 1) { | 591 if (i == n - 1) { |
592 // 1. If i = n-1, then append to U a U+FFFD REPLACEMENT CHARACTE
R. | 592 // 1. If i = n-1, then append to U a U+FFFD REPLACEMENT CHARACTE
R. |
593 u.append(WTF::Unicode::replacementCharacter); | 593 u.append(replacementCharacter); |
594 } else { | 594 } else { |
595 // 2. Otherwise, i < n-1: | 595 // 2. Otherwise, i < n-1: |
596 ASSERT(i < n - 1); | 596 ASSERT(i < n - 1); |
597 // ....1. Let d be the code unit in S at index i+1. | 597 // ....1. Let d be the code unit in S at index i+1. |
598 UChar d = s[i + 1]; | 598 UChar d = s[i + 1]; |
599 if (U16_IS_TRAIL(d)) { | 599 if (U16_IS_TRAIL(d)) { |
600 // 2. If 0xDC00 <= d <= 0xDFFF, then: | 600 // 2. If 0xDC00 <= d <= 0xDFFF, then: |
601 // ..1. Let a be c & 0x3FF. | 601 // ..1. Let a be c & 0x3FF. |
602 // ..2. Let b be d & 0x3FF. | 602 // ..2. Let b be d & 0x3FF. |
603 // ..3. Append to U the Unicode character with code point 2^
16+2^10*a+b. | 603 // ..3. Append to U the Unicode character with code point 2^
16+2^10*a+b. |
604 u.append(U16_GET_SUPPLEMENTARY(c, d)); | 604 u.append(U16_GET_SUPPLEMENTARY(c, d)); |
605 // Blink: This is equivalent to u.append(c); u.append(d); | 605 // Blink: This is equivalent to u.append(c); u.append(d); |
606 ++i; | 606 ++i; |
607 } else { | 607 } else { |
608 // 3. Otherwise, d < 0xDC00 or d > 0xDFFF. Append to U a U+F
FFD REPLACEMENT CHARACTER. | 608 // 3. Otherwise, d < 0xDC00 or d > 0xDFFF. Append to U a U+F
FFD REPLACEMENT CHARACTER. |
609 u.append(WTF::Unicode::replacementCharacter); | 609 u.append(replacementCharacter); |
610 } | 610 } |
611 } | 611 } |
612 } | 612 } |
613 // 3. Set i to i+1. | 613 // 3. Set i to i+1. |
614 ++i; | 614 ++i; |
615 } | 615 } |
616 | 616 |
617 // 6. Return U. | 617 // 6. Return U. |
618 ASSERT(u.length() == string.length()); | 618 ASSERT(u.length() == string.length()); |
619 return u.toString(); | 619 return u.toString(); |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 v8::Local<v8::Value> data = info.Data(); | 990 v8::Local<v8::Value> data = info.Data(); |
991 ASSERT(data->IsExternal()); | 991 ASSERT(data->IsExternal()); |
992 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre
ationContext()); | 992 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre
ationContext()); |
993 if (!perContextData) | 993 if (!perContextData) |
994 return; | 994 return; |
995 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u
nwrap(data))); | 995 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u
nwrap(data))); |
996 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 996 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
997 } | 997 } |
998 | 998 |
999 } // namespace blink | 999 } // namespace blink |
OLD | NEW |