| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2010 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 { | 68 { |
| 69 RefPtr<Element> titleElement = m_document->titleElement(); | 69 RefPtr<Element> titleElement = m_document->titleElement(); |
| 70 if (!titleElement | 70 if (!titleElement |
| 71 || titleElement->firstElementChild() | 71 || titleElement->firstElementChild() |
| 72 || m_firstEncoding != Latin1Encoding() | 72 || m_firstEncoding != Latin1Encoding() |
| 73 || !titleElement->textContent().containsOnlyLatin1()) | 73 || !titleElement->textContent().containsOnlyLatin1()) |
| 74 return; // Either we don't have a title yet or something bizzare as happ
ened and we give up. | 74 return; // Either we don't have a title yet or something bizzare as happ
ened and we give up. |
| 75 CString originalBytes = titleElement->textContent().latin1(); | 75 CString originalBytes = titleElement->textContent().latin1(); |
| 76 OwnPtr<TextCodec> codec = newTextCodec(m_document->decoder()->encoding()); | 76 OwnPtr<TextCodec> codec = newTextCodec(m_document->decoder()->encoding()); |
| 77 String correctlyDecodedTitle = codec->decode(originalBytes.data(), originalB
ytes.length(), true); | 77 String correctlyDecodedTitle = codec->decode(originalBytes.data(), originalB
ytes.length(), true); |
| 78 titleElement->setTextContent(correctlyDecodedTitle, IGNORE_EXCEPTION_STATE); | 78 titleElement->setTextContent(correctlyDecodedTitle, IGNORE_EXCEPTION); |
| 79 } | 79 } |
| 80 | 80 |
| 81 } | 81 } |
| 82 | 82 |
| 83 DecodedDataDocumentParser::DecodedDataDocumentParser(Document* document) | 83 DecodedDataDocumentParser::DecodedDataDocumentParser(Document* document) |
| 84 : DocumentParser(document) | 84 : DocumentParser(document) |
| 85 { | 85 { |
| 86 } | 86 } |
| 87 | 87 |
| 88 size_t DecodedDataDocumentParser::appendBytes(const char* data, size_t length) | 88 size_t DecodedDataDocumentParser::appendBytes(const char* data, size_t length) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 116 if (remainingData.isEmpty()) | 116 if (remainingData.isEmpty()) |
| 117 return 0; | 117 return 0; |
| 118 | 118 |
| 119 size_t consumedChars = remainingData.length(); | 119 size_t consumedChars = remainingData.length(); |
| 120 append(remainingData.releaseImpl()); | 120 append(remainingData.releaseImpl()); |
| 121 | 121 |
| 122 return consumedChars; | 122 return consumedChars; |
| 123 } | 123 } |
| 124 | 124 |
| 125 }; | 125 }; |
| OLD | NEW |