Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: Source/core/dom/Document.cpp

Issue 1145773003: Remove the Document.charset setter (making it readonly) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix webexposed tests Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/Document.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 return AtomicString(encoding().name()); 1124 return AtomicString(encoding().name());
1125 } 1125 }
1126 1126
1127 String Document::defaultCharset() const 1127 String Document::defaultCharset() const
1128 { 1128 {
1129 if (Settings* settings = this->settings()) 1129 if (Settings* settings = this->settings())
1130 return settings->defaultTextEncodingName(); 1130 return settings->defaultTextEncodingName();
1131 return String(); 1131 return String();
1132 } 1132 }
1133 1133
1134 void Document::setCharset(const String& charset)
1135 {
1136 UseCounter::countDeprecation(*this, UseCounter::DocumentSetCharset);
1137 if (DocumentLoader* documentLoader = loader())
1138 documentLoader->setUserChosenEncoding(charset);
1139 WTF::TextEncoding encoding(charset);
1140 // In case the encoding didn't exist, we keep the old one (helps some sites specifying invalid encodings).
1141 if (!encoding.isValid())
1142 return;
1143 DocumentEncodingData newEncodingData = m_encodingData;
1144 newEncodingData.setEncoding(encoding);
1145 setEncodingData(newEncodingData);
1146 }
1147
1148 void Document::setContentLanguage(const AtomicString& language) 1134 void Document::setContentLanguage(const AtomicString& language)
1149 { 1135 {
1150 if (m_contentLanguage == language) 1136 if (m_contentLanguage == language)
1151 return; 1137 return;
1152 m_contentLanguage = language; 1138 m_contentLanguage = language;
1153 1139
1154 // Document's style depends on the content language. 1140 // Document's style depends on the content language.
1155 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create( StyleChangeReason::Language)); 1141 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create( StyleChangeReason::Language));
1156 } 1142 }
1157 1143
(...skipping 4613 matching lines...) Expand 10 before | Expand all | Expand 10 after
5771 #ifndef NDEBUG 5757 #ifndef NDEBUG
5772 using namespace blink; 5758 using namespace blink;
5773 void showLiveDocumentInstances() 5759 void showLiveDocumentInstances()
5774 { 5760 {
5775 WeakDocumentSet& set = liveDocumentSet(); 5761 WeakDocumentSet& set = liveDocumentSet();
5776 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5762 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5777 for (Document* document : set) 5763 for (Document* document : set)
5778 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5764 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5779 } 5765 }
5780 #endif 5766 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/Document.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698