diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
commit | 32761a6cee1d0dee366b885b7b9c777e67885688 (patch) | |
tree | d6bec92bebfb216f4126356e55518842c2f476a1 /Source/WebCore/loader/TextResourceDecoder.cpp | |
parent | a4e969f4965059196ca948db781e52f7cfebf19e (diff) | |
download | WebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz |
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/WebCore/loader/TextResourceDecoder.cpp')
-rw-r--r-- | Source/WebCore/loader/TextResourceDecoder.cpp | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/Source/WebCore/loader/TextResourceDecoder.cpp b/Source/WebCore/loader/TextResourceDecoder.cpp index 95d36e315..5105ae0bb 100644 --- a/Source/WebCore/loader/TextResourceDecoder.cpp +++ b/Source/WebCore/loader/TextResourceDecoder.cpp @@ -302,9 +302,9 @@ breakBreak: TextResourceDecoder::ContentType TextResourceDecoder::determineContentType(const String& mimeType) { - if (equalLettersIgnoringASCIICase(mimeType, "text/css")) + if (equalIgnoringCase(mimeType, "text/css")) return CSS; - if (equalLettersIgnoringASCIICase(mimeType, "text/html")) + if (equalIgnoringCase(mimeType, "text/html")) return HTML; if (DOMImplementation::isXMLMIMEType(mimeType)) return XML; @@ -326,7 +326,7 @@ TextResourceDecoder::TextResourceDecoder(const String& mimeType, const TextEncod : m_contentType(determineContentType(mimeType)) , m_encoding(defaultEncoding(m_contentType, specifiedDefaultEncoding)) , m_source(DefaultEncoding) - , m_hintEncoding(nullptr) + , m_hintEncoding(0) , m_checkedForBOM(false) , m_checkedForCSSCharset(false) , m_checkedForHeadCharset(false) @@ -355,15 +355,10 @@ void TextResourceDecoder::setEncoding(const TextEncoding& encoding, EncodingSour else m_encoding = encoding; - m_codec = nullptr; + m_codec.clear(); m_source = source; } -bool TextResourceDecoder::hasEqualEncodingForCharset(const String& charset) const -{ - return defaultEncoding(m_contentType, charset) == m_encoding; -} - // Returns the position of the encoding string. static int findXMLEncoding(const char* str, int len, int& encodingLength) { @@ -480,8 +475,6 @@ bool TextResourceDecoder::checkForCSSCharset(const char* data, size_t len, bool& int encodingNameLength = pos - dataStart; ++pos; - if (pos == dataEnd) - return false; if (*pos == ';') setEncoding(findTextEncoding(dataStart, encodingNameLength), EncodingFromCSSCharset); @@ -665,15 +658,9 @@ String TextResourceDecoder::flush() String result = m_codec->decode(m_buffer.data(), m_buffer.size(), true, m_contentType == XML && !m_useLenientXMLDecoding, m_sawError); m_buffer.clear(); - m_codec = nullptr; + m_codec.clear(); m_checkedForBOM = false; // Skip BOM again when re-decoding. return result; } -String TextResourceDecoder::decodeAndFlush(const char* data, size_t length) -{ - String decoded = decode(data, length); - return decoded + flush(); -} - } |