OLD | NEW |
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 void Pasteboard::setSelectionMode(bool selectionMode) | 75 void Pasteboard::setSelectionMode(bool selectionMode) |
76 { | 76 { |
77 m_selectionMode = selectionMode; | 77 m_selectionMode = selectionMode; |
78 } | 78 } |
79 | 79 |
80 void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete,
const String& text) | 80 void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete,
const String& text) |
81 { | 81 { |
82 String html = createMarkup(selectedRange, 0, AnnotateForInterchange, false,
ResolveNonLocalURLs); | 82 String html = createMarkup(selectedRange, 0, AnnotateForInterchange, false,
ResolveNonLocalURLs); |
83 KURL url = selectedRange->startContainer()->document().url(); | 83 KURL url = selectedRange->startContainer()->document().url(); |
84 String plainText = text; | 84 String plainText = text; |
85 #if OS(WINDOWS) | 85 #if OS(WIN) |
86 replaceNewlinesWithWindowsStyleNewlines(plainText); | 86 replaceNewlinesWithWindowsStyleNewlines(plainText); |
87 #endif | 87 #endif |
88 replaceNBSPWithSpace(plainText); | 88 replaceNBSPWithSpace(plainText); |
89 | 89 |
90 WebKit::Platform::current()->clipboard()->writeHTML(html, url, plainText, ca
nSmartCopyOrDelete); | 90 WebKit::Platform::current()->clipboard()->writeHTML(html, url, plainText, ca
nSmartCopyOrDelete); |
91 } | 91 } |
92 | 92 |
93 void Pasteboard::writePlainText(const String& text, SmartReplaceOption) | 93 void Pasteboard::writePlainText(const String& text, SmartReplaceOption) |
94 { | 94 { |
95 // FIXME: add support for smart replace | 95 // FIXME: add support for smart replace |
96 #if OS(WINDOWS) | 96 #if OS(WIN) |
97 String plainText(text); | 97 String plainText(text); |
98 replaceNewlinesWithWindowsStyleNewlines(plainText); | 98 replaceNewlinesWithWindowsStyleNewlines(plainText); |
99 WebKit::Platform::current()->clipboard()->writePlainText(plainText); | 99 WebKit::Platform::current()->clipboard()->writePlainText(plainText); |
100 #else | 100 #else |
101 WebKit::Platform::current()->clipboard()->writePlainText(text); | 101 WebKit::Platform::current()->clipboard()->writePlainText(text); |
102 #endif | 102 #endif |
103 } | 103 } |
104 | 104 |
105 void Pasteboard::writeURL(const KURL& url, const String& titleStr) | 105 void Pasteboard::writeURL(const KURL& url, const String& titleStr) |
106 { | 106 { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 chosePlainText = true; | 186 chosePlainText = true; |
187 if (RefPtr<DocumentFragment> fragment = createFragmentFromText(conte
xt.get(), markup)) | 187 if (RefPtr<DocumentFragment> fragment = createFragmentFromText(conte
xt.get(), markup)) |
188 return fragment.release(); | 188 return fragment.release(); |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 return 0; | 192 return 0; |
193 } | 193 } |
194 | 194 |
195 } // namespace WebCore | 195 } // namespace WebCore |
OLD | NEW |