| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 : m_encoding(encoding), | 61 : m_encoding(encoding), |
| 62 m_codec(newTextCodec(encoding)), | 62 m_codec(newTextCodec(encoding)), |
| 63 m_fatal(fatal), | 63 m_fatal(fatal), |
| 64 m_ignoreBOM(ignoreBOM), | 64 m_ignoreBOM(ignoreBOM), |
| 65 m_bomSeen(false) {} | 65 m_bomSeen(false) {} |
| 66 | 66 |
| 67 TextDecoder::~TextDecoder() {} | 67 TextDecoder::~TextDecoder() {} |
| 68 | 68 |
| 69 String TextDecoder::encoding() const { | 69 String TextDecoder::encoding() const { |
| 70 String name = String(m_encoding.name()).lower(); | 70 String name = String(m_encoding.name()).lower(); |
| 71 // Where possible, encoding aliases should be handled by changes to Chromium's
ICU or Blink's WTF. | 71 // Where possible, encoding aliases should be handled by changes to Chromium's |
| 72 // The same codec is used, but WTF maintains a different name/identity for the
se. | 72 // ICU or Blink's WTF. The same codec is used, but WTF maintains a different |
| 73 // name/identity for these. |
| 73 if (name == "iso-8859-1" || name == "us-ascii") | 74 if (name == "iso-8859-1" || name == "us-ascii") |
| 74 return "windows-1252"; | 75 return "windows-1252"; |
| 75 return name; | 76 return name; |
| 76 } | 77 } |
| 77 | 78 |
| 78 String TextDecoder::decode(const BufferSource& input, | 79 String TextDecoder::decode(const BufferSource& input, |
| 79 const TextDecodeOptions& options, | 80 const TextDecodeOptions& options, |
| 80 ExceptionState& exceptionState) { | 81 ExceptionState& exceptionState) { |
| 81 ASSERT(!input.isNull()); | 82 ASSERT(!input.isNull()); |
| 82 if (input.isArrayBufferView()) { | 83 if (input.isArrayBufferView()) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 120 |
| 120 return s; | 121 return s; |
| 121 } | 122 } |
| 122 | 123 |
| 123 String TextDecoder::decode(ExceptionState& exceptionState) { | 124 String TextDecoder::decode(ExceptionState& exceptionState) { |
| 124 TextDecodeOptions options; | 125 TextDecodeOptions options; |
| 125 return decode(nullptr, 0, options, exceptionState); | 126 return decode(nullptr, 0, options, exceptionState); |
| 126 } | 127 } |
| 127 | 128 |
| 128 } // namespace blink | 129 } // namespace blink |
| OLD | NEW |