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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved. 2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "ClipboardUtilitiesChromium.h" 32 #include "ClipboardUtilitiesChromium.h"
33 33
34 #include "KURL.h" 34 #include "KURL.h"
35 #include "Pasteboard.h" 35 #include "Pasteboard.h"
36 #include "PlatformString.h" 36 #include "PlatformString.h"
37 37
38 #include <public/WebClipboard.h> 38 #include <public/WebClipboard.h>
39 #include <wtf/text/StringBuilder.h>
39 40
40 namespace WebCore { 41 namespace WebCore {
41 42
42 WebKit::WebClipboard::Buffer currentPasteboardBuffer() 43 WebKit::WebClipboard::Buffer currentPasteboardBuffer()
43 { 44 {
44 return Pasteboard::generalPasteboard()->isSelectionMode() ? 45 return Pasteboard::generalPasteboard()->isSelectionMode() ?
45 WebKit::WebClipboard::BufferSelection : 46 WebKit::WebClipboard::BufferSelection :
46 WebKit::WebClipboard::BufferStandard; 47 WebKit::WebClipboard::BufferStandard;
47 } 48 }
48 49
49 #if OS(WINDOWS) 50 #if OS(WINDOWS)
50 void replaceNewlinesWithWindowsStyleNewlines(String& str) 51 void replaceNewlinesWithWindowsStyleNewlines(String& str)
51 { 52 {
52 DEFINE_STATIC_LOCAL(String, windowsNewline, ("\r\n")); 53 DEFINE_STATIC_LOCAL(String, windowsNewline, ("\r\n"));
53 const static unsigned windowsNewlineLength = windowsNewline.length(); 54 StringBuilder result;
54 55 for (unsigned index = 0; index < str.length(); ++index) {
55 unsigned index = 0; 56 if (str[index] != '\n' || (index > 0 && str[index - 1] == '\r'))
56 unsigned strLength = str.length(); 57 result.append(str[index]);
57 while (index < strLength) { 58 else
58 if (str[index] != '\n' || (index > 0 && str[index - 1] == '\r')) { 59 result.append(windowsNewline);
59 ++index;
60 continue;
61 }
62 str.replace(index, 1, windowsNewline);
63 strLength = str.length();
64 index += windowsNewlineLength;
65 } 60 }
61 str = result.toString();
66 } 62 }
67 #endif 63 #endif
68 64
69 void replaceNBSPWithSpace(String& str) 65 void replaceNBSPWithSpace(String& str)
70 { 66 {
71 static const UChar NonBreakingSpaceCharacter = 0xA0; 67 static const UChar NonBreakingSpaceCharacter = 0xA0;
72 static const UChar SpaceCharacter = ' '; 68 static const UChar SpaceCharacter = ' ';
73 str.replace(NonBreakingSpaceCharacter, SpaceCharacter); 69 str.replace(NonBreakingSpaceCharacter, SpaceCharacter);
74 } 70 }
75 71
(...skipping 13 matching lines...) Expand all
89 if (line[0] == '#') 85 if (line[0] == '#')
90 continue; 86 continue;
91 KURL url = KURL(ParsedURLString, line); 87 KURL url = KURL(ParsedURLString, line);
92 if (url.isValid()) 88 if (url.isValid())
93 return url; 89 return url;
94 } 90 }
95 return String(); 91 return String();
96 } 92 }
97 93
98 } // namespace WebCore 94 } // namespace WebCore
OLDNEW
« 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