Part 2 of removing PlatformString.h, remove PlatformString.h
[WebKit-https.git] / Source / WebCore / platform / chromium / ClipboardUtilitiesChromium.cpp
index c8f9035..d2c0e12 100644 (file)
 
 #include "KURL.h"
 #include "Pasteboard.h"
-#include "PlatformString.h"
+
+#include <public/WebClipboard.h>
+#include <wtf/text/StringBuilder.h>
+#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
-PasteboardPrivate::ClipboardBuffer currentPasteboardBuffer()
+WebKit::WebClipboard::Buffer currentPasteboardBuffer()
 {
     return Pasteboard::generalPasteboard()->isSelectionMode() ?
-        PasteboardPrivate::SelectionBuffer :
-        PasteboardPrivate::StandardBuffer;
+        WebKit::WebClipboard::BufferSelection :
+        WebKit::WebClipboard::BufferStandard;
 }
 
 #if OS(WINDOWS)
 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;
+    DEFINE_STATIC_LOCAL(String, windowsNewline, (ASCIILiteral("\r\n")));
+    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