| Index: Source/core/dom/Document.cpp
|
| diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
|
| index 3a9216003d3c4c679c0e648ce5703314be7db56b..c3e1c948ef2c195d21358091521a24d27b57a8d9 100644
|
| --- a/Source/core/dom/Document.cpp
|
| +++ b/Source/core/dom/Document.cpp
|
| @@ -536,7 +536,7 @@ Document::~Document()
|
| if (this == topDocument())
|
| clearAXObjectCache();
|
|
|
| - m_decoder = 0;
|
| + setDecoder(PassRefPtr<TextResourceDecoder>());
|
|
|
| if (m_styleSheetList)
|
| m_styleSheetList->detachFromDocument();
|
| @@ -1109,14 +1109,12 @@ void Document::setReadyState(ReadyState readyState)
|
| dispatchEvent(Event::create(eventNames().readystatechangeEvent, false, false));
|
| }
|
|
|
| -String Document::encoding() const
|
| +String Document::encodingName() const
|
| {
|
| // TextEncoding::domName() returns a char*, no need to allocate a new
|
| // String for it each time.
|
| // FIXME: We should fix TextEncoding to speak AtomicString anyway.
|
| - if (TextResourceDecoder* d = decoder())
|
| - return AtomicString(d->encoding().domName());
|
| - return String();
|
| + return AtomicString(m_encoding.domName());
|
| }
|
|
|
| String Document::defaultCharset() const
|
| @@ -1131,6 +1129,7 @@ void Document::setCharset(const String& charset)
|
| if (!decoder())
|
| return;
|
| decoder()->setEncoding(charset, TextResourceDecoder::UserChosenEncoding);
|
| + setEncoding(m_decoder->encoding());
|
| }
|
|
|
| void Document::setContentLanguage(const String& language)
|
| @@ -3941,6 +3940,12 @@ bool Document::parseQualifiedName(const String& qualifiedName, String& prefix, S
|
| void Document::setDecoder(PassRefPtr<TextResourceDecoder> decoder)
|
| {
|
| m_decoder = decoder;
|
| + setEncoding(m_decoder ? m_decoder->encoding() : WTF::TextEncoding());
|
| +}
|
| +
|
| +void Document::setEncoding(const WTF::TextEncoding& encoding)
|
| +{
|
| + m_encoding = encoding;
|
| }
|
|
|
| KURL Document::completeURL(const String& url, const KURL& baseURLOverride) const
|
|
|