OLD | NEW |
1 /* | 1 /* |
2 Copyright (C) 1999 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1999 Lars Knoll (knoll@mpi-hd.mpg.de) |
3 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All | 3 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All |
4 rights reserved. | 4 rights reserved. |
5 Copyright (C) 2005, 2006, 2007 Alexey Proskuryakov (ap@nypop.com) | 5 Copyright (C) 2005, 2006, 2007 Alexey Proskuryakov (ap@nypop.com) |
6 | 6 |
7 This library is free software; you can redistribute it and/or | 7 This library is free software; you can redistribute it and/or |
8 modify it under the terms of the GNU Library General Public | 8 modify it under the terms of the GNU Library General Public |
9 License as published by the Free Software Foundation; either | 9 License as published by the Free Software Foundation; either |
10 version 2 of the License, or (at your option) any later version. | 10 version 2 of the License, or (at your option) any later version. |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 static WTF::TextEncoding FindTextEncoding(const char* encoding_name, | 112 static WTF::TextEncoding FindTextEncoding(const char* encoding_name, |
113 int length) { | 113 int length) { |
114 Vector<char, 64> buffer(length + 1); | 114 Vector<char, 64> buffer(length + 1); |
115 memcpy(buffer.Data(), encoding_name, length); | 115 memcpy(buffer.Data(), encoding_name, length); |
116 buffer[length] = '\0'; | 116 buffer[length] = '\0'; |
117 return buffer.Data(); | 117 return buffer.Data(); |
118 } | 118 } |
119 | 119 |
120 TextResourceDecoder::ContentType TextResourceDecoder::DetermineContentType( | 120 TextResourceDecoder::ContentType TextResourceDecoder::DetermineContentType( |
121 const String& mime_type) { | 121 const String& mime_type) { |
122 if (EqualIgnoringCase(mime_type, "text/css")) | 122 if (DeprecatedEqualIgnoringCase(mime_type, "text/css")) |
123 return kCSSContent; | 123 return kCSSContent; |
124 if (EqualIgnoringCase(mime_type, "text/html")) | 124 if (DeprecatedEqualIgnoringCase(mime_type, "text/html")) |
125 return kHTMLContent; | 125 return kHTMLContent; |
126 if (DOMImplementation::IsXMLMIMEType(mime_type)) | 126 if (DOMImplementation::IsXMLMIMEType(mime_type)) |
127 return kXMLContent; | 127 return kXMLContent; |
128 return kPlainTextContent; | 128 return kPlainTextContent; |
129 } | 129 } |
130 | 130 |
131 const WTF::TextEncoding& TextResourceDecoder::DefaultEncoding( | 131 const WTF::TextEncoding& TextResourceDecoder::DefaultEncoding( |
132 ContentType content_type, | 132 ContentType content_type, |
133 const WTF::TextEncoding& specified_default_encoding) { | 133 const WTF::TextEncoding& specified_default_encoding) { |
134 // Despite 8.5 "Text/xml with Omitted Charset" of RFC 3023, we assume UTF-8 | 134 // Despite 8.5 "Text/xml with Omitted Charset" of RFC 3023, we assume UTF-8 |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 String result = codec_->Decode( | 514 String result = codec_->Decode( |
515 buffer_.Data(), buffer_.size(), WTF::kFetchEOF, | 515 buffer_.Data(), buffer_.size(), WTF::kFetchEOF, |
516 content_type_ == kXMLContent && !use_lenient_xml_decoding_, saw_error_); | 516 content_type_ == kXMLContent && !use_lenient_xml_decoding_, saw_error_); |
517 buffer_.Clear(); | 517 buffer_.Clear(); |
518 codec_.reset(); | 518 codec_.reset(); |
519 checked_for_bom_ = false; // Skip BOM again when re-decoding. | 519 checked_for_bom_ = false; // Skip BOM again when re-decoding. |
520 return result; | 520 return result; |
521 } | 521 } |
522 | 522 |
523 } // namespace blink | 523 } // namespace blink |
OLD | NEW |