OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 } | 464 } |
465 | 465 |
466 // Returns whether caller should continue with "the default processing", which i
s the same as | 466 // Returns whether caller should continue with "the default processing", which i
s the same as |
467 // the event handler NOT setting the return value to false | 467 // the event handler NOT setting the return value to false |
468 bool Editor::dispatchCPPEvent(const AtomicString& eventType, DataTransferAccessP
olicy policy, PasteMode pasteMode) | 468 bool Editor::dispatchCPPEvent(const AtomicString& eventType, DataTransferAccessP
olicy policy, PasteMode pasteMode) |
469 { | 469 { |
470 Element* target = findEventTargetFromSelection(); | 470 Element* target = findEventTargetFromSelection(); |
471 if (!target) | 471 if (!target) |
472 return true; | 472 return true; |
473 | 473 |
474 RefPtrWillBeRawPtr<DataTransfer> dataTransfer = DataTransfer::create( | 474 DataTransfer* dataTransfer = DataTransfer::create( |
475 DataTransfer::CopyAndPaste, | 475 DataTransfer::CopyAndPaste, |
476 policy, | 476 policy, |
477 policy == DataTransferWritable | 477 policy == DataTransferWritable |
478 ? DataObject::create() | 478 ? DataObject::create() |
479 : DataObject::createFromPasteboard(pasteMode)); | 479 : DataObject::createFromPasteboard(pasteMode)); |
480 | 480 |
481 RefPtrWillBeRawPtr<Event> evt = ClipboardEvent::create(eventType, true, true
, dataTransfer); | 481 RefPtrWillBeRawPtr<Event> evt = ClipboardEvent::create(eventType, true, true
, dataTransfer); |
482 target->dispatchEvent(evt, IGNORE_EXCEPTION); | 482 target->dispatchEvent(evt, IGNORE_EXCEPTION); |
483 bool noDefaultProcessing = evt->defaultPrevented(); | 483 bool noDefaultProcessing = evt->defaultPrevented(); |
484 if (noDefaultProcessing && policy == DataTransferWritable) { | 484 if (noDefaultProcessing && policy == DataTransferWritable) |
485 RefPtrWillBeRawPtr<DataObject> dataObject = dataTransfer->dataObject(); | 485 Pasteboard::generalPasteboard()->writeDataObject(dataTransfer->dataObjec
t()); |
486 Pasteboard::generalPasteboard()->writeDataObject(dataObject.release()); | |
487 } | |
488 | 486 |
489 // invalidate clipboard here for security | 487 // invalidate clipboard here for security |
490 dataTransfer->setAccessPolicy(DataTransferNumb); | 488 dataTransfer->setAccessPolicy(DataTransferNumb); |
491 | 489 |
492 return !noDefaultProcessing; | 490 return !noDefaultProcessing; |
493 } | 491 } |
494 | 492 |
495 bool Editor::canSmartReplaceWithPasteboard(Pasteboard* pasteboard) | 493 bool Editor::canSmartReplaceWithPasteboard(Pasteboard* pasteboard) |
496 { | 494 { |
497 return smartInsertDeleteEnabled() && pasteboard->canSmartReplace(); | 495 return smartInsertDeleteEnabled() && pasteboard->canSmartReplace(); |
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1275 } | 1273 } |
1276 | 1274 |
1277 DEFINE_TRACE(Editor) | 1275 DEFINE_TRACE(Editor) |
1278 { | 1276 { |
1279 visitor->trace(m_frame); | 1277 visitor->trace(m_frame); |
1280 visitor->trace(m_lastEditCommand); | 1278 visitor->trace(m_lastEditCommand); |
1281 visitor->trace(m_mark); | 1279 visitor->trace(m_mark); |
1282 } | 1280 } |
1283 | 1281 |
1284 } // namespace blink | 1282 } // namespace blink |
OLD | NEW |