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

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

Issue 482753002: Use StringBuilder::appendLiteral() / StringBuilder::append(char) when possible (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 { 311 {
312 if (node()) 312 if (node())
313 return blink::plainText(rangeOfContents(node()).get()); 313 return blink::plainText(rangeOfContents(node()).get());
314 314
315 // FIXME: this is just a stopgap until TextIterator is adapted to support ge nerated text. 315 // FIXME: this is just a stopgap until TextIterator is adapted to support ge nerated text.
316 StringBuilder plainTextBuilder; 316 StringBuilder plainTextBuilder;
317 for (InlineTextBox* textBox = firstTextBox(); textBox; textBox = textBox->ne xtTextBox()) { 317 for (InlineTextBox* textBox = firstTextBox(); textBox; textBox = textBox->ne xtTextBox()) {
318 String text = m_text.substring(textBox->start(), textBox->len()).simplif yWhiteSpace(WTF::DoNotStripWhiteSpace); 318 String text = m_text.substring(textBox->start(), textBox->len()).simplif yWhiteSpace(WTF::DoNotStripWhiteSpace);
319 plainTextBuilder.append(text); 319 plainTextBuilder.append(text);
320 if (textBox->nextTextBox() && textBox->nextTextBox()->start() > textBox- >end() && text.length() && !text.right(1).containsOnlyWhitespace()) 320 if (textBox->nextTextBox() && textBox->nextTextBox()->start() > textBox- >end() && text.length() && !text.right(1).containsOnlyWhitespace())
321 plainTextBuilder.append(" "); 321 plainTextBuilder.append(' ');
322 } 322 }
323 return plainTextBuilder.toString(); 323 return plainTextBuilder.toString();
324 } 324 }
325 325
326 void RenderText::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumu latedOffset) const 326 void RenderText::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumu latedOffset) const
327 { 327 {
328 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) 328 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox())
329 rects.append(enclosingIntRect(FloatRect(accumulatedOffset + box->topLeft (), box->size()))); 329 rects.append(enclosingIntRect(FloatRect(accumulatedOffset + box->topLeft (), box->size())));
330 } 330 }
331 331
(...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after
1872 } 1872 }
1873 secureTextTimer->restartWithNewText(lastTypedCharacterOffset); 1873 secureTextTimer->restartWithNewText(lastTypedCharacterOffset);
1874 } 1874 }
1875 1875
1876 PassRefPtr<AbstractInlineTextBox> RenderText::firstAbstractInlineTextBox() 1876 PassRefPtr<AbstractInlineTextBox> RenderText::firstAbstractInlineTextBox()
1877 { 1877 {
1878 return AbstractInlineTextBox::getOrCreate(this, m_firstTextBox); 1878 return AbstractInlineTextBox::getOrCreate(this, m_firstTextBox);
1879 } 1879 }
1880 1880
1881 } // namespace blink 1881 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/GraphicsContextAnnotator.cpp ('k') | Source/core/svg/SVGPathStringBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698