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

Side by Side Diff: Source/core/rendering/RenderText.cpp

Issue 22909053: Store the Document's encoding on the Document (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Dirk Mueller (mueller@kde.org) 3 * (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 return false; 179 return false;
180 } 180 }
181 181
182 bool RenderText::isWordBreak() const 182 bool RenderText::isWordBreak() const
183 { 183 {
184 return false; 184 return false;
185 } 185 }
186 186
187 void RenderText::updateNeedsTranscoding() 187 void RenderText::updateNeedsTranscoding()
188 { 188 {
189 const WTF::TextEncoding* encoding = document()->decoder() ? &document()->dec oder()->encoding() : 0; 189 const WTF::TextEncoding* encoding = document()->encoding().isValid() ? &docu ment()->encoding() : 0;
190 m_needsTranscoding = fontTranscoder().needsTranscoding(style()->font().fontD escription(), encoding); 190 m_needsTranscoding = fontTranscoder().needsTranscoding(style()->font().fontD escription(), encoding);
191 } 191 }
192 192
193 void RenderText::styleDidChange(StyleDifference diff, const RenderStyle* oldStyl e) 193 void RenderText::styleDidChange(StyleDifference diff, const RenderStyle* oldStyl e)
194 { 194 {
195 // There is no need to ever schedule repaints from a style change of a text run, since 195 // There is no need to ever schedule repaints from a style change of a text run, since
196 // we already did this for the parent of the text run. 196 // we already did this for the parent of the text run.
197 // We do have to schedule layouts, though, since a style change can force us to 197 // We do have to schedule layouts, though, since a style change can force us to
198 // need to relayout. 198 // need to relayout.
199 if (diff == StyleDifferenceLayout) { 199 if (diff == StyleDifferenceLayout) {
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 text.makeLower(); 1322 text.makeLower();
1323 break; 1323 break;
1324 } 1324 }
1325 } 1325 }
1326 1326
1327 void RenderText::setTextInternal(PassRefPtr<StringImpl> text) 1327 void RenderText::setTextInternal(PassRefPtr<StringImpl> text)
1328 { 1328 {
1329 ASSERT(text); 1329 ASSERT(text);
1330 m_text = text; 1330 m_text = text;
1331 if (m_needsTranscoding) { 1331 if (m_needsTranscoding) {
1332 const WTF::TextEncoding* encoding = document()->decoder() ? &document()- >decoder()->encoding() : 0; 1332 const WTF::TextEncoding* encoding = document()->encoding().isValid() ? & document()->encoding() : 0;
1333 fontTranscoder().convert(m_text, style()->font().fontDescription(), enco ding); 1333 fontTranscoder().convert(m_text, style()->font().fontDescription(), enco ding);
1334 } 1334 }
1335 ASSERT(m_text); 1335 ASSERT(m_text);
1336 1336
1337 if (style()) { 1337 if (style()) {
1338 applyTextTransform(style(), m_text, previousCharacter()); 1338 applyTextTransform(style(), m_text, previousCharacter());
1339 1339
1340 // We use the same characters here as for list markers. 1340 // We use the same characters here as for list markers.
1341 // See the listMarkerText function in RenderListMarker.cpp. 1341 // See the listMarkerText function in RenderListMarker.cpp.
1342 switch (style()->textSecurity()) { 1342 switch (style()->textSecurity()) {
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1857 1857
1858 SecureTextTimer* secureTextTimer = gSecureTextTimers->get(this); 1858 SecureTextTimer* secureTextTimer = gSecureTextTimers->get(this);
1859 if (!secureTextTimer) { 1859 if (!secureTextTimer) {
1860 secureTextTimer = new SecureTextTimer(this); 1860 secureTextTimer = new SecureTextTimer(this);
1861 gSecureTextTimers->add(this, secureTextTimer); 1861 gSecureTextTimers->add(this, secureTextTimer);
1862 } 1862 }
1863 secureTextTimer->restartWithNewText(lastTypedCharacterOffset); 1863 secureTextTimer->restartWithNewText(lastTypedCharacterOffset);
1864 } 1864 }
1865 1865
1866 } // namespace WebCore 1866 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698