| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 { | 324 { |
| 325 if (!m_dataObject) | 325 if (!m_dataObject) |
| 326 return; | 326 return; |
| 327 | 327 |
| 328 m_dataObject->setURLAndTitle(url, title); | 328 m_dataObject->setURLAndTitle(url, title); |
| 329 | 329 |
| 330 // Write the bytes in the image to the file format. | 330 // Write the bytes in the image to the file format. |
| 331 writeImageToDataObject(m_dataObject.get(), element, url); | 331 writeImageToDataObject(m_dataObject.get(), element, url); |
| 332 | 332 |
| 333 // Put img tag on the clipboard referencing the image | 333 // Put img tag on the clipboard referencing the image |
| 334 m_dataObject->setData(mimeTypeTextHTML, createMarkup(element, IncludeNode, 0
, ResolveAllURLs)); | 334 m_dataObject->setData(mimeTypeTextHTML, createMarkup(element, IncludeNode, R
esolveAllURLs)); |
| 335 } | 335 } |
| 336 | 336 |
| 337 void DataTransfer::writeURL(const KURL& url, const String& title) | 337 void DataTransfer::writeURL(const KURL& url, const String& title) |
| 338 { | 338 { |
| 339 if (!m_dataObject) | 339 if (!m_dataObject) |
| 340 return; | 340 return; |
| 341 ASSERT(!url.isEmpty()); | 341 ASSERT(!url.isEmpty()); |
| 342 | 342 |
| 343 m_dataObject->setURLAndTitle(url, title); | 343 m_dataObject->setURLAndTitle(url, title); |
| 344 | 344 |
| 345 // The URL can also be used as plain text. | 345 // The URL can also be used as plain text. |
| 346 m_dataObject->setData(mimeTypeTextPlain, url.string()); | 346 m_dataObject->setData(mimeTypeTextPlain, url.string()); |
| 347 | 347 |
| 348 // The URL can also be used as an HTML fragment. | 348 // The URL can also be used as an HTML fragment. |
| 349 m_dataObject->setHTMLAndBaseURL(urlToMarkup(url, title), url); | 349 m_dataObject->setHTMLAndBaseURL(urlToMarkup(url, title), url); |
| 350 } | 350 } |
| 351 | 351 |
| 352 void DataTransfer::writeRange(Range* selectedRange, LocalFrame* frame) | 352 void DataTransfer::writeRange(Range* selectedRange, LocalFrame* frame) |
| 353 { | 353 { |
| 354 ASSERT(selectedRange); | 354 ASSERT(selectedRange); |
| 355 if (!m_dataObject) | 355 if (!m_dataObject) |
| 356 return; | 356 return; |
| 357 | 357 |
| 358 m_dataObject->setHTMLAndBaseURL(createMarkup(selectedRange, 0, AnnotateForIn
terchange, false, ResolveNonLocalURLs), frame->document()->url()); | 358 m_dataObject->setHTMLAndBaseURL(createMarkup(selectedRange, AnnotateForInter
change, false, ResolveNonLocalURLs), frame->document()->url()); |
| 359 | 359 |
| 360 String str = frame->selectedTextForClipboard(); | 360 String str = frame->selectedTextForClipboard(); |
| 361 #if OS(WIN) | 361 #if OS(WIN) |
| 362 replaceNewlinesWithWindowsStyleNewlines(str); | 362 replaceNewlinesWithWindowsStyleNewlines(str); |
| 363 #endif | 363 #endif |
| 364 replaceNBSPWithSpace(str); | 364 replaceNBSPWithSpace(str); |
| 365 m_dataObject->setData(mimeTypeTextPlain, str); | 365 m_dataObject->setData(mimeTypeTextPlain, str); |
| 366 } | 366 } |
| 367 | 367 |
| 368 void DataTransfer::writePlainText(const String& text) | 368 void DataTransfer::writePlainText(const String& text) |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 } | 531 } |
| 532 } | 532 } |
| 533 | 533 |
| 534 void DataTransfer::trace(Visitor* visitor) | 534 void DataTransfer::trace(Visitor* visitor) |
| 535 { | 535 { |
| 536 visitor->trace(m_dataObject); | 536 visitor->trace(m_dataObject); |
| 537 visitor->trace(m_dragImageElement); | 537 visitor->trace(m_dragImageElement); |
| 538 } | 538 } |
| 539 | 539 |
| 540 } // namespace blink | 540 } // namespace blink |
| OLD | NEW |