Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1120 { | 1120 { |
| 1121 // TextEncoding::name() returns a char*, no need to allocate a new | 1121 // TextEncoding::name() returns a char*, no need to allocate a new |
| 1122 // String for it each time. | 1122 // String for it each time. |
| 1123 // FIXME: We should fix TextEncoding to speak AtomicString anyway. | 1123 // FIXME: We should fix TextEncoding to speak AtomicString anyway. |
| 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(); |
|
philipj_slow
2015/06/15 15:31:38
Is it possible that defaultTextEncodingName() is a
Habib Virji
2015/06/15 16:14:55
Yes it is null string, with your below code snippe
| |
| 1131 return String(); | 1131 return String("UTF-8"); |
|
philipj_slow
2015/06/15 15:31:38
It seems a bit strange return "UTF-8" here if that
Habib Virji
2015/06/15 16:14:55
|document.implementation.createHTMLDocument('').de
philipj_slow
2015/06/16 22:05:57
This case is tricky, I'm unsure what to do. It's s
| |
| 1132 } | 1132 } |
| 1133 | 1133 |
| 1134 void Document::setContentLanguage(const AtomicString& language) | 1134 void Document::setContentLanguage(const AtomicString& language) |
| 1135 { | 1135 { |
| 1136 if (m_contentLanguage == language) | 1136 if (m_contentLanguage == language) |
| 1137 return; | 1137 return; |
| 1138 m_contentLanguage = language; | 1138 m_contentLanguage = language; |
| 1139 | 1139 |
| 1140 // Document's style depends on the content language. | 1140 // Document's style depends on the content language. |
| 1141 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create( StyleChangeReason::Language)); | 1141 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create( StyleChangeReason::Language)); |
| (...skipping 3067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4209 && encoding() != newData.encoding() | 4209 && encoding() != newData.encoding() |
| 4210 && !ElementTraversal::firstWithin(*m_titleElement) | 4210 && !ElementTraversal::firstWithin(*m_titleElement) |
| 4211 && encoding() == Latin1Encoding() | 4211 && encoding() == Latin1Encoding() |
| 4212 && m_titleElement->textContent().containsOnlyLatin1()) { | 4212 && m_titleElement->textContent().containsOnlyLatin1()) { |
| 4213 | 4213 |
| 4214 CString originalBytes = m_titleElement->textContent().latin1(); | 4214 CString originalBytes = m_titleElement->textContent().latin1(); |
| 4215 OwnPtr<TextCodec> codec = newTextCodec(newData.encoding()); | 4215 OwnPtr<TextCodec> codec = newTextCodec(newData.encoding()); |
| 4216 String correctlyDecodedTitle = codec->decode(originalBytes.data(), origi nalBytes.length(), DataEOF); | 4216 String correctlyDecodedTitle = codec->decode(originalBytes.data(), origi nalBytes.length(), DataEOF); |
| 4217 m_titleElement->setTextContent(correctlyDecodedTitle); | 4217 m_titleElement->setTextContent(correctlyDecodedTitle); |
| 4218 } | 4218 } |
| 4219 | 4219 if (!newData.encoding().name()) { |
| 4220 m_encodingData = newData; | 4220 m_encodingData = DocumentEncodingData(); |
|
philipj_slow
2015/06/15 15:31:38
Is this code path reachable? Is there a test that
Habib Virji
2015/06/15 16:14:55
With the change in DocumentEncoderData it should n
philipj_slow
2015/06/16 22:05:57
OK, so would an ASSERT(newData.encoding().isValid(
| |
| 4221 } else { | |
| 4222 m_encodingData = newData; | |
| 4223 } | |
| 4221 | 4224 |
| 4222 // FIXME: Should be removed as part of https://code.google.com/p/chromium/is sues/detail?id=319643 | 4225 // FIXME: Should be removed as part of https://code.google.com/p/chromium/is sues/detail?id=319643 |
| 4223 bool shouldUseVisualOrdering = m_encodingData.encoding().usesVisualOrdering( ); | 4226 bool shouldUseVisualOrdering = m_encodingData.encoding().usesVisualOrdering( ); |
| 4224 if (shouldUseVisualOrdering != m_visuallyOrdered) { | 4227 if (shouldUseVisualOrdering != m_visuallyOrdered) { |
| 4225 m_visuallyOrdered = shouldUseVisualOrdering; | 4228 m_visuallyOrdered = shouldUseVisualOrdering; |
| 4226 // FIXME: How is possible to not have a layoutObject here? | 4229 // FIXME: How is possible to not have a layoutObject here? |
| 4227 if (layoutView()) | 4230 if (layoutView()) |
| 4228 layoutView()->mutableStyleRef().setRTLOrdering(m_visuallyOrdered ? V isualOrder : LogicalOrder); | 4231 layoutView()->mutableStyleRef().setRTLOrdering(m_visuallyOrdered ? V isualOrder : LogicalOrder); |
| 4229 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::cre ate(StyleChangeReason::VisuallyOrdered)); | 4232 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::cre ate(StyleChangeReason::VisuallyOrdered)); |
| 4230 } | 4233 } |
| (...skipping 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5738 #ifndef NDEBUG | 5741 #ifndef NDEBUG |
| 5739 using namespace blink; | 5742 using namespace blink; |
| 5740 void showLiveDocumentInstances() | 5743 void showLiveDocumentInstances() |
| 5741 { | 5744 { |
| 5742 WeakDocumentSet& set = liveDocumentSet(); | 5745 WeakDocumentSet& set = liveDocumentSet(); |
| 5743 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5746 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 5744 for (Document* document : set) | 5747 for (Document* document : set) |
| 5745 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); | 5748 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); |
| 5746 } | 5749 } |
| 5747 #endif | 5750 #endif |
| OLD | NEW |