Commit 3d81d65f authored by eric@webkit.org's avatar eric@webkit.org

2009-05-21 Eric Seidel <eric@webkit.org>

        Reviewed by Alexey Proskuryakov.

        Clean up DragController
        https://bugs.webkit.org/show_bug.cgi?id=25926

        I renamed m_document to m_documentUnderMouse to better document what it does
        I could call it m_lastDocumentUnderMouse to be most-accurate, but this seemed
        long enough.

        I also saw copy/paste code involving clearing the selection when moving out of
        one document and into another.  I moved that code into a function called
        mouseMovedIntoDocument.

        I also got rid of a couple needless null-checks after confirming via source
        inspection they were not ever possible.
        In Mac WebKit it's not possible to have a Page that doesn't have a mainFrame()
        I left an ASSERT(m_page->mainFrame()) in case some other port ever violates this.
        It's also not possible to return a document from documentAtPoint that is not
        in a frame (as such a document would not be rendered).

        No functional changes, thus no tests.

        * page/DragController.cpp:
        (WebCore::DragController::DragController):
        (WebCore::DragController::dragIsMove):
        (WebCore::DragController::dragExited):
        (WebCore::DragController::performDrag):
        (WebCore::DragController::mouseMovedIntoDocument):
        (WebCore::DragController::dragEnteredOrUpdated):
        (WebCore::DragController::tryDocumentDrag):
        (WebCore::DragController::operationForLoad):
        (WebCore::DragController::concludeEditDrag):
        (WebCore::DragController::canProcessDrag):
        (WebCore::DragController::tryDHTMLDrag):
        (WebCore::DragController::placeDragCaret):
        * page/DragController.h:
        (WebCore::DragController::documentUnderMouse):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@43968 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 5797165d
2009-05-21 Eric Seidel <eric@webkit.org>
Reviewed by Alexey Proskuryakov.
Clean up DragController
https://bugs.webkit.org/show_bug.cgi?id=25926
I renamed m_document to m_documentUnderMouse to better document what it does
I could call it m_lastDocumentUnderMouse to be most-accurate, but this seemed
long enough.
I also saw copy/paste code involving clearing the selection when moving out of
one document and into another. I moved that code into a function called
mouseMovedIntoDocument.
I also got rid of a couple needless null-checks after confirming via source
inspection they were not ever possible.
In Mac WebKit it's not possible to have a Page that doesn't have a mainFrame()
I left an ASSERT(m_page->mainFrame()) in case some other port ever violates this.
It's also not possible to return a document from documentAtPoint that is not
in a frame (as such a document would not be rendered).
No functional changes, thus no tests.
* page/DragController.cpp:
(WebCore::DragController::DragController):
(WebCore::DragController::dragIsMove):
(WebCore::DragController::dragExited):
(WebCore::DragController::performDrag):
(WebCore::DragController::mouseMovedIntoDocument):
(WebCore::DragController::dragEnteredOrUpdated):
(WebCore::DragController::tryDocumentDrag):
(WebCore::DragController::operationForLoad):
(WebCore::DragController::concludeEditDrag):
(WebCore::DragController::canProcessDrag):
(WebCore::DragController::tryDHTMLDrag):
(WebCore::DragController::placeDragCaret):
* page/DragController.h:
(WebCore::DragController::documentUnderMouse):
2009-05-21 Eric Seidel <eric@webkit.org>
Reviewed by Alexey Proskuryakov.
This diff is collapsed.
......@@ -73,7 +73,7 @@ namespace WebCore {
const IntPoint& dragOffset() const { return m_dragOffset; }
DragSourceAction dragSourceAction() const { return m_dragSourceAction; }
Document* document() const { return m_document; }
Document* documentUnderMouse() const { return m_documentUnderMouse; }
DragDestinationAction dragDestinationAction() const { return m_dragDestinationAction; }
DragSourceAction delegateDragSourceAction(const IntPoint& pagePoint);
......@@ -103,6 +103,8 @@ namespace WebCore {
bool dragIsMove(SelectionController*);
bool isCopyKeyDown();
void mouseMovedIntoDocument(Document*);
IntRect selectionDraggingRect(Frame*);
bool doDrag(Frame* src, Clipboard* clipboard, DragImageRef dragImage, const KURL& linkURL, const KURL& imageURL, Node* node, IntPoint& dragLoc, IntPoint& dragImageOffset);
void doImageDrag(Element*, const IntPoint&, const IntRect&, Clipboard*, Frame*, IntPoint&);
......@@ -112,7 +114,7 @@ namespace WebCore {
Page* m_page;
DragClient* m_client;
Document* m_document; // The document the mouse was last dragged over.
Document* m_documentUnderMouse; // The document the mouse was last dragged over.
Document* m_dragInitiator; // The Document (if any) that initiated the drag.
DragDestinationAction m_dragDestinationAction;
......
......@@ -51,11 +51,11 @@ DragOperation DragController::dragOperation(DragData* dragData)
ASSERT(dragData);
if ([NSApp modalWindow] || !dragData->containsURL())
return DragOperationNone;
if (!m_document || ![[m_page->mainFrame()->view()->getOuterView() window] attachedSheet]
if (!m_documentUnderMouse || ![[m_page->mainFrame()->view()->getOuterView() window] attachedSheet]
&& [dragData->platformData() draggingSource] != m_page->mainFrame()->view()->getOuterView())
return DragOperationCopy;
return DragOperationNone;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment