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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 HTMLInputElement* elementAsFileInput = asFileInput(element); | 366 HTMLInputElement* elementAsFileInput = asFileInput(element); |
367 if (m_fileInputElementUnderMouse != elementAsFileInput) { | 367 if (m_fileInputElementUnderMouse != elementAsFileInput) { |
368 if (m_fileInputElementUnderMouse) | 368 if (m_fileInputElementUnderMouse) |
369 m_fileInputElementUnderMouse->setCanReceiveDroppedFiles(false); | 369 m_fileInputElementUnderMouse->setCanReceiveDroppedFiles(false); |
370 m_fileInputElementUnderMouse = elementAsFileInput; | 370 m_fileInputElementUnderMouse = elementAsFileInput; |
371 } | 371 } |
372 | 372 |
373 if (!m_fileInputElementUnderMouse) | 373 if (!m_fileInputElementUnderMouse) |
374 m_page->dragCaretController().setCaretPosition(m_documentUnderMouse-
>frame()->visiblePositionForPoint(point)); | 374 m_page->dragCaretController().setCaretPosition(m_documentUnderMouse-
>frame()->visiblePositionForPoint(point)); |
375 | 375 |
376 Frame* innerFrame = element->document()->frame(); | 376 Frame* innerFrame = element->document().frame(); |
377 dragSession.operation = dragIsMove(innerFrame->selection(), dragData) ?
DragOperationMove : DragOperationCopy; | 377 dragSession.operation = dragIsMove(innerFrame->selection(), dragData) ?
DragOperationMove : DragOperationCopy; |
378 dragSession.mouseIsOverFileInput = m_fileInputElementUnderMouse; | 378 dragSession.mouseIsOverFileInput = m_fileInputElementUnderMouse; |
379 dragSession.numberOfItemsToBeAccepted = 0; | 379 dragSession.numberOfItemsToBeAccepted = 0; |
380 | 380 |
381 unsigned numberOfFiles = dragData->numberOfFiles(); | 381 unsigned numberOfFiles = dragData->numberOfFiles(); |
382 if (m_fileInputElementUnderMouse) { | 382 if (m_fileInputElementUnderMouse) { |
383 if (m_fileInputElementUnderMouse->isDisabledFormControl()) | 383 if (m_fileInputElementUnderMouse->isDisabledFormControl()) |
384 dragSession.numberOfItemsToBeAccepted = 0; | 384 dragSession.numberOfItemsToBeAccepted = 0; |
385 else if (m_fileInputElementUnderMouse->multiple()) | 385 else if (m_fileInputElementUnderMouse->multiple()) |
386 dragSession.numberOfItemsToBeAccepted = numberOfFiles; | 386 dragSession.numberOfItemsToBeAccepted = numberOfFiles; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 String text = dragData->asPlainText(innerFrame.get()); | 514 String text = dragData->asPlainText(innerFrame.get()); |
515 if (text.isEmpty() || !innerFrame->editor().shouldInsertText(text, range
.get(), EditorInsertActionDropped)) { | 515 if (text.isEmpty() || !innerFrame->editor().shouldInsertText(text, range
.get(), EditorInsertActionDropped)) { |
516 return false; | 516 return false; |
517 } | 517 } |
518 | 518 |
519 if (setSelectionToDragCaret(innerFrame.get(), dragCaret, range, point)) | 519 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)); | 520 applyCommand(ReplaceSelectionCommand::create(m_documentUnderMouse.ge
t(), createFragmentFromText(range.get(), text), ReplaceSelectionCommand::Select
Replacement | ReplaceSelectionCommand::MatchStyle | ReplaceSelectionCommand::Pre
ventNesting)); |
521 } | 521 } |
522 | 522 |
523 if (rootEditableElement) { | 523 if (rootEditableElement) { |
524 if (Frame* frame = rootEditableElement->document()->frame()) | 524 if (Frame* frame = rootEditableElement->document().frame()) |
525 frame->eventHandler()->updateDragStateAfterEditDragIfNeeded(rootEdit
ableElement.get()); | 525 frame->eventHandler()->updateDragStateAfterEditDragIfNeeded(rootEdit
ableElement.get()); |
526 } | 526 } |
527 | 527 |
528 return true; | 528 return true; |
529 } | 529 } |
530 | 530 |
531 bool DragController::canProcessDrag(DragData* dragData) | 531 bool DragController::canProcessDrag(DragData* dragData) |
532 { | 532 { |
533 ASSERT(dragData); | 533 ASSERT(dragData); |
534 | 534 |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 return false; | 922 return false; |
923 #endif | 923 #endif |
924 } | 924 } |
925 | 925 |
926 void DragController::cleanupAfterSystemDrag() | 926 void DragController::cleanupAfterSystemDrag() |
927 { | 927 { |
928 } | 928 } |
929 | 929 |
930 } // namespace WebCore | 930 } // namespace WebCore |
931 | 931 |
OLD | NEW |