OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2009, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Google Inc. | 3 * Copyright (C) 2008 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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 bool smartDelete = innerFrame->editor().smartInsertDeleteEnabled(); | 500 bool smartDelete = innerFrame->editor().smartInsertDeleteEnabled(); |
501 bool smartInsert = smartDelete && innerFrame->selection()->granulari
ty() == WordGranularity && dragData->canSmartReplace(); | 501 bool smartInsert = smartDelete && innerFrame->selection()->granulari
ty() == WordGranularity && dragData->canSmartReplace(); |
502 applyCommand(MoveSelectionCommand::create(fragment, dragCaret.base()
, smartInsert, smartDelete)); | 502 applyCommand(MoveSelectionCommand::create(fragment, dragCaret.base()
, smartInsert, smartDelete)); |
503 } else { | 503 } else { |
504 if (setSelectionToDragCaret(innerFrame.get(), dragCaret, range, poin
t)) { | 504 if (setSelectionToDragCaret(innerFrame.get(), dragCaret, range, poin
t)) { |
505 ReplaceSelectionCommand::CommandOptions options = ReplaceSelecti
onCommand::SelectReplacement | ReplaceSelectionCommand::PreventNesting; | 505 ReplaceSelectionCommand::CommandOptions options = ReplaceSelecti
onCommand::SelectReplacement | ReplaceSelectionCommand::PreventNesting; |
506 if (dragData->canSmartReplace()) | 506 if (dragData->canSmartReplace()) |
507 options |= ReplaceSelectionCommand::SmartReplace; | 507 options |= ReplaceSelectionCommand::SmartReplace; |
508 if (chosePlainText) | 508 if (chosePlainText) |
509 options |= ReplaceSelectionCommand::MatchStyle; | 509 options |= ReplaceSelectionCommand::MatchStyle; |
510 applyCommand(ReplaceSelectionCommand::create(m_documentUnderMous
e.get(), fragment, options)); | 510 ASSERT(m_documentUnderMouse); |
| 511 applyCommand(ReplaceSelectionCommand::create(*m_documentUnderMou
se.get(), fragment, options)); |
511 } | 512 } |
512 } | 513 } |
513 } else { | 514 } else { |
514 String text = dragData->asPlainText(innerFrame.get()); | 515 String text = dragData->asPlainText(innerFrame.get()); |
515 if (text.isEmpty() || !innerFrame->editor().shouldInsertText(text, range
.get(), EditorInsertActionDropped)) { | 516 if (text.isEmpty() || !innerFrame->editor().shouldInsertText(text, range
.get(), EditorInsertActionDropped)) { |
516 return false; | 517 return false; |
517 } | 518 } |
518 | 519 |
519 if (setSelectionToDragCaret(innerFrame.get(), dragCaret, range, point)) | 520 if (setSelectionToDragCaret(innerFrame.get(), dragCaret, range, point))
{ |
520 applyCommand(ReplaceSelectionCommand::create(m_documentUnderMouse.ge
t(), createFragmentFromText(range.get(), text), ReplaceSelectionCommand::Select
Replacement | ReplaceSelectionCommand::MatchStyle | ReplaceSelectionCommand::Pre
ventNesting)); | 521 ASSERT(m_documentUnderMouse); |
| 522 applyCommand(ReplaceSelectionCommand::create(*m_documentUnderMouse.g
et(), createFragmentFromText(range.get(), text), ReplaceSelectionCommand::Selec
tReplacement | ReplaceSelectionCommand::MatchStyle | ReplaceSelectionCommand::Pr
eventNesting)); |
| 523 } |
521 } | 524 } |
522 | 525 |
523 if (rootEditableElement) { | 526 if (rootEditableElement) { |
524 if (Frame* frame = rootEditableElement->document().frame()) | 527 if (Frame* frame = rootEditableElement->document().frame()) |
525 frame->eventHandler()->updateDragStateAfterEditDragIfNeeded(rootEdit
ableElement.get()); | 528 frame->eventHandler()->updateDragStateAfterEditDragIfNeeded(rootEdit
ableElement.get()); |
526 } | 529 } |
527 | 530 |
528 return true; | 531 return true; |
529 } | 532 } |
530 | 533 |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 return false; | 925 return false; |
923 #endif | 926 #endif |
924 } | 927 } |
925 | 928 |
926 void DragController::cleanupAfterSystemDrag() | 929 void DragController::cleanupAfterSystemDrag() |
927 { | 930 { |
928 } | 931 } |
929 | 932 |
930 } // namespace WebCore | 933 } // namespace WebCore |
931 | 934 |
OLD | NEW |