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

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

Issue 23532016: Handle odd data lengths in UTF-16 decoder (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Simplify Created 6 years, 9 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
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 4089 matching lines...) Expand 10 before | Expand all | Expand 10 after
4100 // document's title so that the user doesn't see an incorrectly decoded titl e 4100 // document's title so that the user doesn't see an incorrectly decoded titl e
4101 // in the title bar. 4101 // in the title bar.
4102 if (m_titleElement 4102 if (m_titleElement
4103 && encoding() != newData.encoding() 4103 && encoding() != newData.encoding()
4104 && !ElementTraversal::firstWithin(*m_titleElement) 4104 && !ElementTraversal::firstWithin(*m_titleElement)
4105 && encoding() == Latin1Encoding() 4105 && encoding() == Latin1Encoding()
4106 && m_titleElement->textContent().containsOnlyLatin1()) { 4106 && m_titleElement->textContent().containsOnlyLatin1()) {
4107 4107
4108 CString originalBytes = m_titleElement->textContent().latin1(); 4108 CString originalBytes = m_titleElement->textContent().latin1();
4109 OwnPtr<TextCodec> codec = newTextCodec(newData.encoding()); 4109 OwnPtr<TextCodec> codec = newTextCodec(newData.encoding());
4110 String correctlyDecodedTitle = codec->decode(originalBytes.data(), origi nalBytes.length(), true); 4110 String correctlyDecodedTitle = codec->decode(originalBytes.data(), origi nalBytes.length(), DataEOF);
4111 m_titleElement->setTextContent(correctlyDecodedTitle); 4111 m_titleElement->setTextContent(correctlyDecodedTitle);
4112 } 4112 }
4113 4113
4114 m_encodingData = newData; 4114 m_encodingData = newData;
4115 4115
4116 // FIXME: Should be removed as part of https://code.google.com/p/chromium/is sues/detail?id=319643 4116 // FIXME: Should be removed as part of https://code.google.com/p/chromium/is sues/detail?id=319643
4117 bool shouldUseVisualOrdering = m_encodingData.encoding().usesVisualOrdering( ); 4117 bool shouldUseVisualOrdering = m_encodingData.encoding().usesVisualOrdering( );
4118 if (shouldUseVisualOrdering != m_visuallyOrdered) { 4118 if (shouldUseVisualOrdering != m_visuallyOrdered) {
4119 m_visuallyOrdered = shouldUseVisualOrdering; 4119 m_visuallyOrdered = shouldUseVisualOrdering;
4120 // FIXME: How is possible to not have a renderer here? 4120 // FIXME: How is possible to not have a renderer here?
(...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after
5434 void Document::defaultEventHandler(Event* event) 5434 void Document::defaultEventHandler(Event* event)
5435 { 5435 {
5436 if (frame() && frame()->remotePlatformLayer()) { 5436 if (frame() && frame()->remotePlatformLayer()) {
5437 frame()->chromeClient().forwardInputEvent(this, event); 5437 frame()->chromeClient().forwardInputEvent(this, event);
5438 return; 5438 return;
5439 } 5439 }
5440 Node::defaultEventHandler(event); 5440 Node::defaultEventHandler(event);
5441 } 5441 }
5442 5442
5443 } // namespace WebCore 5443 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/encoding/resources/char-decoding-utils.js ('k') | Source/core/html/parser/TextResourceDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698