Index: Source/core/dom/Document.cpp |
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
index 9dfe1b6aff51b606a7eef0ba47b3a8d2309763d5..93b036cc92d24640730ccf72803e5317819c2a52 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(); |
@@ -1104,14 +1104,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()); |
abarth-chromium
2013/08/23 21:58:01
This used to be able to return the null string. D
|
} |
String Document::defaultCharset() const |
@@ -1126,6 +1124,7 @@ void Document::setCharset(const String& charset) |
if (!decoder()) |
return; |
decoder()->setEncoding(charset, TextResourceDecoder::UserChosenEncoding); |
+ m_encoding = m_decoder->encoding(); |
} |
void Document::setContentLanguage(const String& language) |
@@ -3939,6 +3938,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 |