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

Unified Diff: Source/WebCore/platform/win/ClipboardUtilitiesWin.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 | « Source/WebCore/platform/chromium/ClipboardUtilitiesChromium.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp
===================================================================
--- Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp (revision 121034)
+++ Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp (working copy)
@@ -35,6 +35,7 @@
#include <wininet.h> // for INTERNET_MAX_URL_LENGTH
#include <wtf/StringExtras.h>
#include <wtf/text/CString.h>
+#include <wtf/text/StringBuilder.h>
#include <wtf/text/WTFString.h>
#if USE(CF)
@@ -299,19 +300,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();
}
void replaceNBSPWithSpace(String& str)
« no previous file with comments | « Source/WebCore/platform/chromium/ClipboardUtilitiesChromium.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698