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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 return false; | 367 return false; |
368 | 368 |
369 HTMLInputElement* elementAsFileInput = asFileInput(element); | 369 HTMLInputElement* elementAsFileInput = asFileInput(element); |
370 if (m_fileInputElementUnderMouse != elementAsFileInput) { | 370 if (m_fileInputElementUnderMouse != elementAsFileInput) { |
371 if (m_fileInputElementUnderMouse) | 371 if (m_fileInputElementUnderMouse) |
372 m_fileInputElementUnderMouse->setCanReceiveDroppedFiles(false); | 372 m_fileInputElementUnderMouse->setCanReceiveDroppedFiles(false); |
373 m_fileInputElementUnderMouse = elementAsFileInput; | 373 m_fileInputElementUnderMouse = elementAsFileInput; |
374 } | 374 } |
375 | 375 |
376 if (!m_fileInputElementUnderMouse) | 376 if (!m_fileInputElementUnderMouse) |
377 m_page->dragCaretController().setCaretPosition(m_documentUnderMouse-
>frame()->visiblePositionForPoint(point)); | 377 m_page->dragCaretController().setCaretPosition(m_documentUnderMouse-
>frame()->positionForPoint(point)); |
378 | 378 |
379 LocalFrame* innerFrame = element->document().frame(); | 379 LocalFrame* innerFrame = element->document().frame(); |
380 dragSession.operation = dragIsMove(innerFrame->selection(), dragData) ?
DragOperationMove : DragOperationCopy; | 380 dragSession.operation = dragIsMove(innerFrame->selection(), dragData) ?
DragOperationMove : DragOperationCopy; |
381 dragSession.mouseIsOverFileInput = m_fileInputElementUnderMouse; | 381 dragSession.mouseIsOverFileInput = m_fileInputElementUnderMouse; |
382 dragSession.numberOfItemsToBeAccepted = 0; | 382 dragSession.numberOfItemsToBeAccepted = 0; |
383 | 383 |
384 Vector<String> paths; | 384 Vector<String> paths; |
385 dragData->asFilePaths(paths); | 385 dragData->asFilePaths(paths); |
386 const unsigned numberOfFiles = paths.size(); | 386 const unsigned numberOfFiles = paths.size(); |
387 if (m_fileInputElementUnderMouse) { | 387 if (m_fileInputElementUnderMouse) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 | 421 |
422 if (doc && (m_didInitiateDrag || doc->isPluginDocument() || doc->hasEditable
Style())) | 422 if (doc && (m_didInitiateDrag || doc->isPluginDocument() || doc->hasEditable
Style())) |
423 return DragOperationNone; | 423 return DragOperationNone; |
424 return dragOperation(dragData); | 424 return dragOperation(dragData); |
425 } | 425 } |
426 | 426 |
427 static bool setSelectionToDragCaret(LocalFrame* frame, VisibleSelection& dragCar
et, RefPtrWillBeRawPtr<Range>& range, const IntPoint& point) | 427 static bool setSelectionToDragCaret(LocalFrame* frame, VisibleSelection& dragCar
et, RefPtrWillBeRawPtr<Range>& range, const IntPoint& point) |
428 { | 428 { |
429 frame->selection().setSelection(dragCaret); | 429 frame->selection().setSelection(dragCaret); |
430 if (frame->selection().isNone()) { | 430 if (frame->selection().isNone()) { |
431 dragCaret = VisibleSelection(frame->visiblePositionForPoint(point)); | 431 dragCaret = VisibleSelection(frame->positionForPoint(point)); |
432 frame->selection().setSelection(dragCaret); | 432 frame->selection().setSelection(dragCaret); |
433 range = dragCaret.toNormalizedRange(); | 433 range = dragCaret.toNormalizedRange(); |
434 } | 434 } |
435 return !frame->selection().isNone() && frame->selection().isContentEditable(
); | 435 return !frame->selection().isNone() && frame->selection().isContentEditable(
); |
436 } | 436 } |
437 | 437 |
438 bool DragController::dispatchTextInputEventFor(LocalFrame* innerFrame, DragData*
dragData) | 438 bool DragController::dispatchTextInputEventFor(LocalFrame* innerFrame, DragData*
dragData) |
439 { | 439 { |
440 ASSERT(m_page->dragCaretController().hasCaret()); | 440 ASSERT(m_page->dragCaretController().hasCaret()); |
441 String text = m_page->dragCaretController().isContentRichlyEditable() ? "" :
dragData->asPlainText(); | 441 String text = m_page->dragCaretController().isContentRichlyEditable() ? "" :
dragData->asPlainText(); |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 | 958 |
959 DEFINE_TRACE(DragController) | 959 DEFINE_TRACE(DragController) |
960 { | 960 { |
961 visitor->trace(m_page); | 961 visitor->trace(m_page); |
962 visitor->trace(m_documentUnderMouse); | 962 visitor->trace(m_documentUnderMouse); |
963 visitor->trace(m_dragInitiator); | 963 visitor->trace(m_dragInitiator); |
964 visitor->trace(m_fileInputElementUnderMouse); | 964 visitor->trace(m_fileInputElementUnderMouse); |
965 } | 965 } |
966 | 966 |
967 } // namespace blink | 967 } // namespace blink |
OLD | NEW |