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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 { | 166 { |
167 chosePlainText = false; | 167 chosePlainText = false; |
168 WebKit::WebClipboard::Buffer buffer = m_selectionMode ? WebKit::WebClipboard
::BufferSelection : WebKit::WebClipboard::BufferStandard; | 168 WebKit::WebClipboard::Buffer buffer = m_selectionMode ? WebKit::WebClipboard
::BufferSelection : WebKit::WebClipboard::BufferStandard; |
169 | 169 |
170 if (WebKit::Platform::current()->clipboard()->isFormatAvailable(WebKit::WebC
lipboard::FormatHTML, buffer)) { | 170 if (WebKit::Platform::current()->clipboard()->isFormatAvailable(WebKit::WebC
lipboard::FormatHTML, buffer)) { |
171 unsigned fragmentStart = 0; | 171 unsigned fragmentStart = 0; |
172 unsigned fragmentEnd = 0; | 172 unsigned fragmentEnd = 0; |
173 WebKit::WebURL url; | 173 WebKit::WebURL url; |
174 WebKit::WebString markup = WebKit::Platform::current()->clipboard()->rea
dHTML(buffer, &url, &fragmentStart, &fragmentEnd); | 174 WebKit::WebString markup = WebKit::Platform::current()->clipboard()->rea
dHTML(buffer, &url, &fragmentStart, &fragmentEnd); |
175 if (!markup.isEmpty()) { | 175 if (!markup.isEmpty()) { |
176 if (RefPtr<DocumentFragment> fragment = createFragmentFromMarkupWith
Context(frame->document(), markup, fragmentStart, fragmentEnd, KURL(url), Disall
owScriptingAndPluginContent)) | 176 ASSERT(frame->document()); |
| 177 if (RefPtr<DocumentFragment> fragment = createFragmentFromMarkupWith
Context(*frame->document(), markup, fragmentStart, fragmentEnd, KURL(url), Disal
lowScriptingAndPluginContent)) |
177 return fragment.release(); | 178 return fragment.release(); |
178 } | 179 } |
179 } | 180 } |
180 | 181 |
181 if (allowPlainText) { | 182 if (allowPlainText) { |
182 String markup = WebKit::Platform::current()->clipboard()->readPlainText(
buffer); | 183 String markup = WebKit::Platform::current()->clipboard()->readPlainText(
buffer); |
183 if (!markup.isEmpty()) { | 184 if (!markup.isEmpty()) { |
184 chosePlainText = true; | 185 chosePlainText = true; |
185 if (RefPtr<DocumentFragment> fragment = createFragmentFromText(conte
xt.get(), markup)) | 186 if (RefPtr<DocumentFragment> fragment = createFragmentFromText(conte
xt.get(), markup)) |
186 return fragment.release(); | 187 return fragment.release(); |
187 } | 188 } |
188 } | 189 } |
189 | 190 |
190 return 0; | 191 return 0; |
191 } | 192 } |
192 | 193 |
193 } // namespace WebCore | 194 } // namespace WebCore |
OLD | NEW |