| 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. |
| 11 | 11 |
| 12 This library is distributed in the hope that it will be useful, | 12 This library is distributed in the hope that it will be useful, |
| 13 but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 Library General Public License for more details. | 15 Library General Public License for more details. |
| 16 | 16 |
| 17 You should have received a copy of the GNU Library General Public License | 17 You should have received a copy of the GNU Library General Public License |
| 18 along with this library; see the file COPYING.LIB. If not, write to | 18 along with this library; see the file COPYING.LIB. If not, write to |
| 19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 20 Boston, MA 02110-1301, USA. | 20 Boston, MA 02110-1301, USA. |
| 21 */ | 21 */ |
| 22 | 22 |
| 23 #include "core/html/parser/TextResourceDecoder.h" | 23 #include "core/html/parser/TextResourceDecoder.h" |
| 24 | 24 |
| 25 #include "core/HTMLNames.h" | 25 #include "core/HTMLNames.h" |
| 26 #include "core/dom/DOMImplementation.h" | 26 #include "core/dom/DOMImplementation.h" |
| 27 #include "core/html/parser/HTMLMetaCharsetParser.h" | 27 #include "core/html/parser/HTMLMetaCharsetParser.h" |
| 28 #include "platform/Language.h" | 28 #include "platform/Language.h" |
| 29 #include "platform/text/TextEncodingDetector.h" | 29 #include "platform/text/TextEncodingDetector.h" |
| 30 #include "wtf/StringExtras.h" | 30 #include "platform/wtf/StringExtras.h" |
| 31 #include "wtf/text/TextCodec.h" | 31 #include "platform/wtf/text/TextCodec.h" |
| 32 #include "wtf/text/TextEncodingRegistry.h" | 32 #include "platform/wtf/text/TextEncodingRegistry.h" |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 using namespace HTMLNames; | 36 using namespace HTMLNames; |
| 37 | 37 |
| 38 const int kMinimumLengthOfXMLDeclaration = 8; | 38 const int kMinimumLengthOfXMLDeclaration = 8; |
| 39 | 39 |
| 40 static inline bool BytesEqual(const char* p, | 40 static inline bool BytesEqual(const char* p, |
| 41 char b0, | 41 char b0, |
| 42 char b1, | 42 char b1, |
| (...skipping 471 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 |