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

Unified Diff: Source/WebCore/platform/chromium/ClipboardUtilitiesChromium.cpp

Issue 10626020: Merge 120850 - Regression(r116408): Ctrl-A (select all) on large text file hangs the tab with high … (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/platform/chromium/ClipboardUtilitiesChromium.cpp
===================================================================
--- Source/WebCore/platform/chromium/ClipboardUtilitiesChromium.cpp (revision 121034)
+++ Source/WebCore/platform/chromium/ClipboardUtilitiesChromium.cpp (working copy)
@@ -36,6 +36,7 @@
#include "PlatformString.h"
#include <public/WebClipboard.h>
+#include <wtf/text/StringBuilder.h>
namespace WebCore {
@@ -50,19 +51,14 @@
void replaceNewlinesWithWindowsStyleNewlines(String& str)
{
DEFINE_STATIC_LOCAL(String, windowsNewline, ("\r\n"));
- const static unsigned windowsNewlineLength = windowsNewline.length();
-
- unsigned index = 0;
- unsigned strLength = str.length();
- while (index < strLength) {
- if (str[index] != '\n' || (index > 0 && str[index - 1] == '\r')) {
- ++index;
- continue;
- }
- str.replace(index, 1, windowsNewline);
- strLength = str.length();
- index += windowsNewlineLength;
+ StringBuilder result;
+ for (unsigned index = 0; index < str.length(); ++index) {
+ if (str[index] != '\n' || (index > 0 && str[index - 1] == '\r'))
+ result.append(str[index]);
+ else
+ result.append(windowsNewline);
}
+ str = result.toString();
}
#endif
« no previous file with comments | « no previous file | Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698