// Manual drag caret manipulation void DragController::placeDragCaret(const IntPoint& windowPoint) { mouseMovedIntoDocument(m_page->mainFrame()->documentAtPoint(windowPoint)); if (!m_documentUnderMouse) return; Frame* frame = m_documentUnderMouse->frame(); FrameView* frameView = frame->view(); if (!frameView) return; IntPoint framePoint = frameView->windowToContents(windowPoint); m_page->dragCaretController()->setCaretPosition(frame->visiblePositionForPoint(framePoint)); }
void DragController::dragExited(DragData* dragData) { ASSERT(dragData); Frame* mainFrame = m_page->mainFrame(); if (RefPtr<FrameView> v = mainFrame->view()) { ClipboardAccessPolicy policy = (!m_documentUnderMouse || m_documentUnderMouse->securityOrigin()->isLocal()) ? ClipboardReadable : ClipboardTypesReadable; RefPtr<Clipboard> clipboard = dragData->createClipboard(policy); clipboard->setSourceOperation(dragData->draggingSourceOperationMask()); mainFrame->eventHandler()->cancelDragAndDrop(createMouseEvent(dragData), clipboard.get()); clipboard->setAccessPolicy(ClipboardNumb); // invalidate clipboard here for security } mouseMovedIntoDocument(0); }
DragSession DragController::dragEnteredOrUpdated(DragData* dragData) { ASSERT(dragData); ASSERT(m_page->mainFrame()); // It is not possible in Mac WebKit to have a Page without a mainFrame() mouseMovedIntoDocument(m_page->mainFrame()->documentAtPoint(dragData->clientPosition())); m_dragDestinationAction = m_client->actionMaskForDrag(dragData); if (m_dragDestinationAction == DragDestinationActionNone) { cancelDrag(); // FIXME: Why not call mouseMovedIntoDocument(0)? return DragSession(); } DragSession dragSession; bool handledByDocument = tryDocumentDrag(dragData, m_dragDestinationAction, dragSession); if (!handledByDocument && (m_dragDestinationAction & DragDestinationActionLoad)) dragSession.operation = operationForLoad(dragData); return dragSession; }