Commit 83dc3539 authored by oliver's avatar oliver

2007-01-24 Oliver Hunt <oliver@apple.com>

        Reviewed by Adele.

        Fixes DragController to allow a null target Document.
        This is encountered in new tabs/windows that have not
        loaded any page (including about:blank)

        * page/DragController.cpp:
        (WebCore::documentAtPoint):
        (WebCore::DragController::tryDocumentDrag):
        (WebCore::DragController::operationForLoad):
        (WebCore::DragController::concludeDrag):
        * page/mac/DragControllerMac.mm:
        (WebCore::DragController::dragOperation):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@19084 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent fd1727b8
2007-01-24 Oliver Hunt <oliver@apple.com>
Reviewed by Adele.
Fixes DragController to allow a null target Document.
This is encountered in new tabs/windows that have not
loaded any page (including about:blank)
* page/DragController.cpp:
(WebCore::documentAtPoint):
(WebCore::DragController::tryDocumentDrag):
(WebCore::DragController::operationForLoad):
(WebCore::DragController::concludeDrag):
* page/mac/DragControllerMac.mm:
(WebCore::DragController::dragOperation):
2007-01-24 Sam Weinig <sam@webkit.org>
Reviewed by Mitz.
......
......@@ -144,7 +144,7 @@ void DragController::cancelDrag()
static Document* documentAtPoint(Frame* frame, const IntPoint& point)
{
if (!frame)
if (!frame || !frame->view())
return 0;
IntPoint pt = frame->view()->windowToContents(point);
......@@ -249,8 +249,8 @@ DragOperation DragController::tryDocumentDrag(DragData* dragData, DragDestinatio
operation = tryDHTMLDrag(dragData);
m_isHandlingDrag = operation != DragOperationNone;
FrameView *frameView = m_document->view();
if (!m_document || !frameView)
FrameView *frameView = 0;
if (!m_document || !(frameView = m_document->view()))
return operation;
......@@ -278,7 +278,7 @@ DragOperation DragController::operationForLoad(DragData* dragData)
{
ASSERT(dragData);
Document* doc = documentAtPoint(m_page->mainFrame(), dragData->clientPosition());
if (!doc || m_didInitiateDrag || doc->isPluginDocument() || (doc->frame() && doc->frame()->editor()->clientIsEditable()))
if (doc && (m_didInitiateDrag || doc->isPluginDocument() || (doc->frame() && doc->frame()->editor()->clientIsEditable())))
return DragOperationNone;
return dragOperation(dragData);
}
......@@ -287,8 +287,11 @@ bool DragController::concludeDrag(DragData* dragData, DragDestinationAction acti
{
ASSERT(dragData);
ASSERT(!m_isHandlingDrag);
ASSERT(actionMask & DragDestinationActionEdit);
if (!m_document)
return false;
IntPoint point = m_document->view()->windowToContents(dragData->clientPosition());
Element* element = m_document->elementFromPoint(point.x(), point.y());
ASSERT(element);
......
......@@ -41,10 +41,11 @@ bool DragController::isCopyKeyDown()
DragOperation DragController::dragOperation(DragData* dragData)
{
ASSERT(dragData);
if (![NSApp modalWindow]
&& ![[m_page->mainFrame()->view()->getOuterView() window] attachedSheet]
&& [dragData->platformData() draggingSource] != m_page->mainFrame()->view()->getOuterView()
&& dragData->containsURL())
if ([NSApp modalWindow] || !dragData->containsURL())
return DragOperationNone;
if (!m_document || ![[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