| 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
|
|
|
|
|