| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008, 2009 Google Inc. | 3 * Copyright (C) 2008, 2009 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 | 435 |
| 436 void ClipboardChromium::writeRange(Range* selectedRange, Frame* frame) | 436 void ClipboardChromium::writeRange(Range* selectedRange, Frame* frame) |
| 437 { | 437 { |
| 438 ASSERT(selectedRange); | 438 ASSERT(selectedRange); |
| 439 if (!m_dataObject) | 439 if (!m_dataObject) |
| 440 return; | 440 return; |
| 441 | 441 |
| 442 m_dataObject->setHTMLAndBaseURL(createMarkup(selectedRange, 0, AnnotateForIn
terchange, false, ResolveNonLocalURLs), frame->document()->url()); | 442 m_dataObject->setHTMLAndBaseURL(createMarkup(selectedRange, 0, AnnotateForIn
terchange, false, ResolveNonLocalURLs), frame->document()->url()); |
| 443 | 443 |
| 444 String str = frame->selectedTextForClipboard(); | 444 String str = frame->selectedTextForClipboard(); |
| 445 #if OS(WINDOWS) | 445 #if OS(WIN) |
| 446 replaceNewlinesWithWindowsStyleNewlines(str); | 446 replaceNewlinesWithWindowsStyleNewlines(str); |
| 447 #endif | 447 #endif |
| 448 replaceNBSPWithSpace(str); | 448 replaceNBSPWithSpace(str); |
| 449 m_dataObject->setData(mimeTypeTextPlain, str); | 449 m_dataObject->setData(mimeTypeTextPlain, str); |
| 450 } | 450 } |
| 451 | 451 |
| 452 void ClipboardChromium::writePlainText(const String& text) | 452 void ClipboardChromium::writePlainText(const String& text) |
| 453 { | 453 { |
| 454 if (!m_dataObject) | 454 if (!m_dataObject) |
| 455 return; | 455 return; |
| 456 | 456 |
| 457 String str = text; | 457 String str = text; |
| 458 #if OS(WINDOWS) | 458 #if OS(WIN) |
| 459 replaceNewlinesWithWindowsStyleNewlines(str); | 459 replaceNewlinesWithWindowsStyleNewlines(str); |
| 460 #endif | 460 #endif |
| 461 replaceNBSPWithSpace(str); | 461 replaceNBSPWithSpace(str); |
| 462 | 462 |
| 463 m_dataObject->setData(mimeTypeTextPlain, str); | 463 m_dataObject->setData(mimeTypeTextPlain, str); |
| 464 } | 464 } |
| 465 | 465 |
| 466 bool ClipboardChromium::hasData() | 466 bool ClipboardChromium::hasData() |
| 467 { | 467 { |
| 468 ASSERT(isForDragAndDrop()); | 468 ASSERT(isForDragAndDrop()); |
| 469 | 469 |
| 470 return m_dataObject->length() > 0; | 470 return m_dataObject->length() > 0; |
| 471 } | 471 } |
| 472 | 472 |
| 473 PassRefPtr<DataTransferItemList> ClipboardChromium::items() | 473 PassRefPtr<DataTransferItemList> ClipboardChromium::items() |
| 474 { | 474 { |
| 475 // FIXME: According to the spec, we are supposed to return the same collecti
on of items each | 475 // FIXME: According to the spec, we are supposed to return the same collecti
on of items each |
| 476 // time. We now return a wrapper that always wraps the *same* set of items,
so JS shouldn't be | 476 // time. We now return a wrapper that always wraps the *same* set of items,
so JS shouldn't be |
| 477 // able to tell, but we probably still want to fix this. | 477 // able to tell, but we probably still want to fix this. |
| 478 return DataTransferItemListPolicyWrapper::create(this, m_dataObject); | 478 return DataTransferItemListPolicyWrapper::create(this, m_dataObject); |
| 479 } | 479 } |
| 480 | 480 |
| 481 } // namespace WebCore | 481 } // namespace WebCore |
| OLD | NEW |