Commit e71315c1 authored by oliver's avatar oliver

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

        Reviewed by Adam.
WebKit:
        Migrated drag state and logic to WebCore, removed superfluous methods

        * ChangeLog:
        * WebCoreSupport/WebDragClient.h:
        * WebCoreSupport/WebDragClient.mm:
        (WebDragClient::dragSourceActionMaskForPoint):
        * WebCoreSupport/WebFrameBridge.mm:
           allowDHTMLDrag move to WebCore::EventHandler
        * WebView/WebHTMLView.mm:
        (-[WebHTMLView _startDraggingImage:at:operation:event:sourceIsDHTML:DHTMLWroteData:]):
        (-[WebHTMLView draggedImage:movedTo:]):
        (-[WebHTMLView draggedImage:endedAt:operation:]):
          dragOffset and dragSourecAction is now stored in WebCore::DragController
          migrated _delegateDragSourceActionMask to WebCore::DragController
        * WebView/WebHTMLViewInternal.h:
          Removed dragOffset declaration, migrated to WebCore::DragController
        * WebView/WebView.mm:
          removed unnecessary method, _loadingDragOperationForDraggingInfo                       

WebKitQt:       
        Reviewed by Adam.

        Stub for new DragClient method

        * WebCoreSupport/DragClientQt.cpp:
        (WebCore::DragClientQt::dragSourceActionMaskForPoint):
        * WebCoreSupport/DragClientQt.h:                  

WebCore:
        Reviewed by Adam.

        Migrated more drag logic and state to WebCore
                                              
        * page/DragClient.h:       

        * page/DragController.cpp:
        (WebCore::DragController::delegateDragSourceAction):
          New forwarding method for the UI delegate
        * page/DragController.h:
        (WebCore::DragController::dragOffset):
          Now store the drag offset -- the offset of the cursor relative to the drag image)
          in DragController
        * page/EventHandler.cpp:
        (WebCore::EventHandler::allowDHTMLDrag):
          Moved from WebFrameBridge
        * page/EventHandler.h:
        * page/mac/EventHandlerMac.mm:
        (WebCore::EventHandler::eventMayStartDrag):
        (WebCore::EventHandler::handleDrag):                  
          EventHandlerMac now uses EventHandler::allowDHTMLDrag rather than the 
          implementation in WebFrameBridge
        * page/mac/WebCoreFrameBridge.h:
          removed definition of allowDHTMLDrag from WebFrameBridge
        * platform/graphics/svg/SVGImageEmptyClients.h:
        (WebCore::SVGEmptyDragClient::dragSourceActionMaskForPoint):
          Updated empty DragClient



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@19230 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent fd9f8312
2007-01-29 Oliver Hunt <oliver@apple.com>
Reviewed by Adam.
Migrated more drag logic and state to WebCore
* page/DragClient.h:
* page/DragController.cpp:
(WebCore::DragController::delegateDragSourceAction):
New forwarding method for the UI delegate
* page/DragController.h:
(WebCore::DragController::dragOffset):
Now store the drag offset -- the offset of the cursor relative to the drag image)
in DragController
* page/EventHandler.cpp:
(WebCore::EventHandler::allowDHTMLDrag):
Moved from WebFrameBridge
* page/EventHandler.h:
* page/mac/EventHandlerMac.mm:
(WebCore::EventHandler::eventMayStartDrag):
(WebCore::EventHandler::handleDrag):
EventHandlerMac now uses EventHandler::allowDHTMLDrag rather than the
implementation in WebFrameBridge
* page/mac/WebCoreFrameBridge.h:
removed definition of allowDHTMLDrag from WebFrameBridge
* platform/graphics/svg/SVGImageEmptyClients.h:
(WebCore::SVGEmptyDragClient::dragSourceActionMaskForPoint):
Updated empty DragClient
2007-01-29 Alexey Proskuryakov <ap@webkit.org> 2007-01-29 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin. Reviewed by Darin.
......
...@@ -39,6 +39,10 @@ namespace WebCore { ...@@ -39,6 +39,10 @@ namespace WebCore {
virtual void willPerformDragDestinationAction(DragDestinationAction, DragData*) = 0; virtual void willPerformDragDestinationAction(DragDestinationAction, DragData*) = 0;
virtual DragDestinationAction actionMaskForDrag(DragData*) = 0; virtual DragDestinationAction actionMaskForDrag(DragData*) = 0;
virtual void dragControllerDestroyed() = 0; virtual void dragControllerDestroyed() = 0;
//The UI delegate takes the point in view coordinates, however it is easier to pass
//window coordinates here
virtual DragSourceAction dragSourceActionMaskForPoint(const IntPoint& windowPoint) = 0;
virtual ~DragClient() {}; virtual ~DragClient() {};
}; };
......
...@@ -273,6 +273,12 @@ DragOperation DragController::tryDocumentDrag(DragData* dragData, DragDestinatio ...@@ -273,6 +273,12 @@ DragOperation DragController::tryDocumentDrag(DragData* dragData, DragDestinatio
m_page->dragCaretController()->clear(); m_page->dragCaretController()->clear();
return operation; return operation;
} }
DragSourceAction DragController::delegateDragSourceAction(const IntPoint& windowPoint)
{
m_dragSourceAction = m_client->dragSourceActionMaskForPoint(windowPoint);
return m_dragSourceAction;
}
DragOperation DragController::operationForLoad(DragData* dragData) DragOperation DragController::operationForLoad(DragData* dragData)
{ {
......
...@@ -63,13 +63,12 @@ namespace WebCore { ...@@ -63,13 +63,12 @@ namespace WebCore {
void setDragInitiator(Document* initiator) { m_dragInitiator = initiator; m_didInitiateDrag = true; } void setDragInitiator(Document* initiator) { m_dragInitiator = initiator; m_didInitiateDrag = true; }
Document* dragInitiator() const { return m_dragInitiator; } Document* dragInitiator() const { return m_dragInitiator; }
void setDragOffset(const IntPoint& offset) { m_dragOffset = offset; } void setDragOffset(const IntPoint& offset) { m_dragOffset = offset; }
IntPoint dragOffset() const { return m_dragOffset; } const IntPoint& dragOffset() const { return m_dragOffset; }
void setDragSourceAction(DragSourceAction action) { m_dragSourceAction = action; }
DragSourceAction dragSourceAction() const { return m_dragSourceAction; } DragSourceAction dragSourceAction() const { return m_dragSourceAction; }
Document* document() const { return m_document; } Document* document() const { return m_document; }
DragDestinationAction dragDestinationAction() const { return m_dragDestinationAction; } DragDestinationAction dragDestinationAction() const { return m_dragDestinationAction; }
DragSourceAction delegateDragSourceAction(const IntPoint& pagePoint);
void dragEnded() { m_dragInitiator = 0; m_didInitiateDrag = false; } void dragEnded() { m_dragInitiator = 0; m_didInitiateDrag = false; }
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "CachedImage.h" #include "CachedImage.h"
#include "Cursor.h" #include "Cursor.h"
#include "Document.h" #include "Document.h"
#include "DragController.h"
#include "Editor.h" #include "Editor.h"
#include "EventNames.h" #include "EventNames.h"
#include "FocusController.h" #include "FocusController.h"
...@@ -430,6 +431,18 @@ void EventHandler::setAutoscrollRenderer(RenderObject* renderer) ...@@ -430,6 +431,18 @@ void EventHandler::setAutoscrollRenderer(RenderObject* renderer)
m_autoscrollRenderer = renderer; m_autoscrollRenderer = renderer;
} }
void EventHandler::allowDHTMLDrag(bool& flagDHTML, bool& flagUA) const
{
if (!m_frame || !m_frame->document()) {
flagDHTML = false;
flagUA = false;
}
unsigned mask = m_frame->page()->dragController()->delegateDragSourceAction(m_frame->view()->contentsToWindow(m_mouseDownPos));
flagDHTML = (mask & DragSourceActionDHTML) != DragSourceActionNone;
flagUA = ((mask & DragSourceActionImage) || (mask & DragSourceActionLink) || (mask & DragSourceActionSelection));
}
HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool allowShadowContent) HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool allowShadowContent)
{ {
HitTestResult result(point); HitTestResult result(point);
......
...@@ -212,6 +212,8 @@ private: ...@@ -212,6 +212,8 @@ private:
bool passMouseDownEventToWidget(Widget*); bool passMouseDownEventToWidget(Widget*);
bool passWheelEventToWidget(Widget*); bool passWheelEventToWidget(Widget*);
void allowDHTMLDrag(bool& flagDHTML, bool& flagUA) const;
#if PLATFORM(MAC) #if PLATFORM(MAC)
KeyboardUIMode keyboardUIMode() const; KeyboardUIMode keyboardUIMode() const;
......
...@@ -350,8 +350,8 @@ bool EventHandler::eventMayStartDrag(NSEvent *event) const ...@@ -350,8 +350,8 @@ bool EventHandler::eventMayStartDrag(NSEvent *event) const
return false; return false;
} }
BOOL DHTMLFlag, UAFlag; bool DHTMLFlag, UAFlag;
[Mac(m_frame)->bridge() allowDHTMLDrag:&DHTMLFlag UADrag:&UAFlag]; allowDHTMLDrag(DHTMLFlag, UAFlag);
if (!DHTMLFlag && !UAFlag) { if (!DHTMLFlag && !UAFlag) {
return false; return false;
} }
...@@ -401,8 +401,8 @@ bool EventHandler::handleDrag(const MouseEventWithHitTestResults& event) ...@@ -401,8 +401,8 @@ bool EventHandler::handleDrag(const MouseEventWithHitTestResults& event)
// Careful that the drag starting logic stays in sync with eventMayStartDrag() // Careful that the drag starting logic stays in sync with eventMayStartDrag()
if (m_mouseDownMayStartDrag && !dragState().m_dragSrc) { if (m_mouseDownMayStartDrag && !dragState().m_dragSrc) {
BOOL tempFlag1, tempFlag2; bool tempFlag1, tempFlag2;
[Mac(m_frame)->bridge() allowDHTMLDrag:&tempFlag1 UADrag:&tempFlag2]; allowDHTMLDrag(tempFlag1, tempFlag2);
dragState().m_dragSrcMayBeDHTML = tempFlag1; dragState().m_dragSrcMayBeDHTML = tempFlag1;
dragState().m_dragSrcMayBeUA = tempFlag2; dragState().m_dragSrcMayBeUA = tempFlag2;
if (!dragState().m_dragSrcMayBeDHTML && !dragState().m_dragSrcMayBeUA) if (!dragState().m_dragSrcMayBeDHTML && !dragState().m_dragSrcMayBeUA)
......
...@@ -301,7 +301,6 @@ typedef enum ObjectElementType { ...@@ -301,7 +301,6 @@ typedef enum ObjectElementType {
- (NSString *)MIMETypeForPath:(NSString *)path; - (NSString *)MIMETypeForPath:(NSString *)path;
- (void)allowDHTMLDrag:(BOOL *)flagDHTML UADrag:(BOOL *)flagUA;
- (BOOL)startDraggingImage:(NSImage *)dragImage at:(NSPoint)dragLoc operation:(NSDragOperation)op event:(NSEvent *)event sourceIsDHTML:(BOOL)flag DHTMLWroteData:(BOOL)dhtmlWroteData; - (BOOL)startDraggingImage:(NSImage *)dragImage at:(NSPoint)dragLoc operation:(NSDragOperation)op event:(NSEvent *)event sourceIsDHTML:(BOOL)flag DHTMLWroteData:(BOOL)dhtmlWroteData;
- (BOOL)mayStartDragAtEventLocation:(NSPoint)location; - (BOOL)mayStartDragAtEventLocation:(NSPoint)location;
......
...@@ -345,6 +345,7 @@ public: ...@@ -345,6 +345,7 @@ public:
virtual ~SVGEmptyDragClient() {} virtual ~SVGEmptyDragClient() {}
virtual void willPerformDragDestinationAction(DragDestinationAction, DragData*) { } virtual void willPerformDragDestinationAction(DragDestinationAction, DragData*) { }
virtual DragDestinationAction actionMaskForDrag(DragData*) { return DragDestinationActionNone; } virtual DragDestinationAction actionMaskForDrag(DragData*) { return DragDestinationActionNone; }
virtual DragSourceAction dragSourceActionMaskForPoint(const IntPoint&) { return DragSourceActionNone; }
virtual void dragControllerDestroyed() { } virtual void dragControllerDestroyed() { }
}; };
......
2007-01-25 Oliver Hunt <oliver@apple.com>
Reviewed by Adam.
Migrated drag state and logic to WebCore, removed superfluous methods
* ChangeLog:
* WebCoreSupport/WebDragClient.h:
* WebCoreSupport/WebDragClient.mm:
(WebDragClient::dragSourceActionMaskForPoint):
* WebCoreSupport/WebFrameBridge.mm:
allowDHTMLDrag move to WebCore::EventHandler
* WebView/WebHTMLView.mm:
(-[WebHTMLView _startDraggingImage:at:operation:event:sourceIsDHTML:DHTMLWroteData:]):
(-[WebHTMLView draggedImage:movedTo:]):
(-[WebHTMLView draggedImage:endedAt:operation:]):
dragOffset and dragSourecAction is now stored in WebCore::DragController
migrated _delegateDragSourceActionMask to WebCore::DragController
* WebView/WebHTMLViewInternal.h:
Removed dragOffset declaration, migrated to WebCore::DragController
* WebView/WebView.mm:
removed unnecessary method, _loadingDragOperationForDraggingInfo
2007-01-29 Maciej Stachowiak <mjs@apple.com> 2007-01-29 Maciej Stachowiak <mjs@apple.com>
Reviewed by Mark. Reviewed by Mark.
......
...@@ -33,6 +33,7 @@ public: ...@@ -33,6 +33,7 @@ public:
virtual void willPerformDragDestinationAction(WebCore::DragDestinationAction, WebCore::DragData*); virtual void willPerformDragDestinationAction(WebCore::DragDestinationAction, WebCore::DragData*);
virtual WebCore::DragDestinationAction actionMaskForDrag(WebCore::DragData*); virtual WebCore::DragDestinationAction actionMaskForDrag(WebCore::DragData*);
virtual void dragControllerDestroyed(); virtual void dragControllerDestroyed();
virtual WebCore::DragSourceAction dragSourceActionMaskForPoint(const WebCore::IntPoint& windowPoint);
private: private:
WebView* m_webView; WebView* m_webView;
}; };
...@@ -45,6 +45,13 @@ void WebDragClient::willPerformDragDestinationAction(WebCore::DragDestinationAct ...@@ -45,6 +45,13 @@ void WebDragClient::willPerformDragDestinationAction(WebCore::DragDestinationAct
[[m_webView _UIDelegateForwarder] webView:m_webView willPerformDragDestinationAction:(WebDragDestinationAction)action forDraggingInfo:dragData->platformData()]; [[m_webView _UIDelegateForwarder] webView:m_webView willPerformDragDestinationAction:(WebDragDestinationAction)action forDraggingInfo:dragData->platformData()];
} }
WebCore::DragSourceAction WebDragClient::dragSourceActionMaskForPoint(const WebCore::IntPoint& windowPoint)
{
NSPoint viewPoint = [m_webView convertPoint:windowPoint fromView:nil];
return (WebCore::DragSourceAction)[[m_webView _UIDelegateForwarder] webView:m_webView dragSourceActionMaskForPoint:viewPoint];
}
void WebDragClient::dragControllerDestroyed() void WebDragClient::dragControllerDestroyed()
{ {
delete this; delete this;
......
...@@ -726,15 +726,6 @@ static BOOL loggedObjectCacheSize = NO; ...@@ -726,15 +726,6 @@ static BOOL loggedObjectCacheSize = NO;
return [type length] == 0 ? (NSString *)@"application/octet-stream" : type; return [type length] == 0 ? (NSString *)@"application/octet-stream" : type;
} }
- (void)allowDHTMLDrag:(BOOL *)flagDHTML UADrag:(BOOL *)flagUA
{
WebHTMLView *docView = (WebHTMLView *)[[_frame frameView] documentView];
ASSERT([docView isKindOfClass:[WebHTMLView class]]);
unsigned int mask = [docView _delegateDragSourceActionMask];
*flagDHTML = (mask & WebDragSourceActionDHTML) != 0;
*flagUA = ((mask & WebDragSourceActionImage) || (mask & WebDragSourceActionLink) || (mask & WebDragSourceActionSelection));
}
- (BOOL)startDraggingImage:(NSImage *)dragImage at:(NSPoint)dragLoc operation:(NSDragOperation)op - (BOOL)startDraggingImage:(NSImage *)dragImage at:(NSPoint)dragLoc operation:(NSDragOperation)op
event:(NSEvent *)event sourceIsDHTML:(BOOL)flag DHTMLWroteData:(BOOL)dhtmlWroteData event:(NSEvent *)event sourceIsDHTML:(BOOL)flag DHTMLWroteData:(BOOL)dhtmlWroteData
{ {
......
...@@ -1345,7 +1345,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) ...@@ -1345,7 +1345,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
dragLoc = NSMakePoint(mouseDraggedPoint.x - wcDragLoc.x, mouseDraggedPoint.y + wcDragLoc.y); dragLoc = NSMakePoint(mouseDraggedPoint.x - wcDragLoc.x, mouseDraggedPoint.y + wcDragLoc.y);
else else
dragLoc = NSMakePoint(mouseDownPoint.x - wcDragLoc.x, mouseDownPoint.y + wcDragLoc.y); dragLoc = NSMakePoint(mouseDownPoint.x - wcDragLoc.x, mouseDownPoint.y + wcDragLoc.y);
_private->dragOffset = wcDragLoc; dragController->setDragOffset(IntPoint(wcDragLoc));
} }
WebView *webView = [self _webView]; WebView *webView = [self _webView];
...@@ -1383,14 +1383,16 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) ...@@ -1383,14 +1383,16 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
source:self]; source:self];
} }
[[webView _UIDelegateForwarder] webView:webView willPerformDragSourceAction:WebDragSourceActionImage fromPoint:mouseDownPoint withPasteboard:pasteboard]; [[webView _UIDelegateForwarder] webView:webView willPerformDragSourceAction:WebDragSourceActionImage fromPoint:mouseDownPoint withPasteboard:pasteboard];
if (dragImage == nil) if (dragImage == nil) {
NSPoint point = dragController->dragOffset();
[self _web_DragImageForElement:(DOMElement *)node [self _web_DragImageForElement:(DOMElement *)node
rect:[self convertRect:[[element objectForKey:WebElementImageRectKey] rectValue] fromView:innerHTMLView] rect:[self convertRect:[[element objectForKey:WebElementImageRectKey] rectValue] fromView:innerHTMLView]
event:_private->mouseDownEvent event:_private->mouseDownEvent
pasteboard:pasteboard pasteboard:pasteboard
source:source source:source
offset:&_private->dragOffset]; offset:&point];
else dragController->setDragOffset(IntPoint(point));
} else
[self dragImage:dragImage [self dragImage:dragImage
at:dragLoc at:dragLoc
offset:NSZeroSize offset:NSZeroSize
...@@ -1409,8 +1411,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) ...@@ -1409,8 +1411,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
dragImage = [self _dragImageForLinkElement:element]; dragImage = [self _dragImageForLinkElement:element];
NSSize offset = NSMakeSize([dragImage size].width / 2, -DRAG_LABEL_BORDER_Y); NSSize offset = NSMakeSize([dragImage size].width / 2, -DRAG_LABEL_BORDER_Y);
dragLoc = NSMakePoint(mouseDraggedPoint.x - offset.width, mouseDraggedPoint.y - offset.height); dragLoc = NSMakePoint(mouseDraggedPoint.x - offset.width, mouseDraggedPoint.y - offset.height);
_private->dragOffset.x = offset.width; dragController->setDragOffset(IntPoint(offset.width, -offset.height)); // height inverted because we are flipped
_private->dragOffset.y = -offset.height; // inverted because we are flipped
} }
// HACK: We should pass the mouseDown event instead of the mouseDragged! This hack gets rid of // HACK: We should pass the mouseDown event instead of the mouseDragged! This hack gets rid of
// a flash of the image at the mouseDown location when the drag starts. // a flash of the image at the mouseDown location when the drag starts.
...@@ -1429,8 +1430,8 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) ...@@ -1429,8 +1430,8 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
dragImage = [innerHTMLView _selectionDraggingImage]; dragImage = [innerHTMLView _selectionDraggingImage];
NSRect draggingRect = [self convertRect:[innerHTMLView _selectionDraggingRect] fromView:innerHTMLView]; NSRect draggingRect = [self convertRect:[innerHTMLView _selectionDraggingRect] fromView:innerHTMLView];
dragLoc = NSMakePoint(NSMinX(draggingRect), NSMaxY(draggingRect)); dragLoc = NSMakePoint(NSMinX(draggingRect), NSMaxY(draggingRect));
_private->dragOffset.x = mouseDownPoint.x - dragLoc.x; dragController->setDragOffset(IntPoint(mouseDownPoint.x - dragLoc.x,
_private->dragOffset.y = dragLoc.y - mouseDownPoint.y; // inverted because we are flipped dragLoc.y - mouseDownPoint.y)); // y inverted because we are flipped
} }
[self dragImage:dragImage [self dragImage:dragImage
at:dragLoc at:dragLoc
...@@ -1449,8 +1450,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) ...@@ -1449,8 +1450,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
dragImage = [[[NSImage alloc] initWithContentsOfFile:imagePath] autorelease]; dragImage = [[[NSImage alloc] initWithContentsOfFile:imagePath] autorelease];
NSSize imageSize = [dragImage size]; NSSize imageSize = [dragImage size];
dragLoc = NSMakePoint(mouseDownPoint.x - imageSize.width / 2, mouseDownPoint.y + imageSize.height / 2); dragLoc = NSMakePoint(mouseDownPoint.x - imageSize.width / 2, mouseDownPoint.y + imageSize.height / 2);
_private->dragOffset.x = imageSize.width / 2; dragController->setDragOffset(IntPoint(imageSize.width / 2, imageSize.height / 2));
_private->dragOffset.y = imageSize.height / 2;
} }
[self dragImage:dragImage [self dragImage:dragImage
at:dragLoc at:dragLoc
...@@ -2946,22 +2946,25 @@ done: ...@@ -2946,22 +2946,25 @@ done:
- (void)draggedImage:(NSImage *)image movedTo:(NSPoint)screenLoc - (void)draggedImage:(NSImage *)image movedTo:(NSPoint)screenLoc
{ {
ASSERT([self _isTopHTMLView]); ASSERT([self _isTopHTMLView]);
Page* page = core([self _webView]);
ASSERT(page);
DragController* dragController = page->dragController();
NSPoint windowImageLoc = [[self window] convertScreenToBase:screenLoc]; NSPoint windowImageLoc = [[self window] convertScreenToBase:screenLoc];
NSPoint windowMouseLoc = NSMakePoint(windowImageLoc.x + _private->dragOffset.x, windowImageLoc.y + _private->dragOffset.y); NSPoint windowMouseLoc = NSMakePoint(windowImageLoc.x + dragController->dragOffset().x(), windowImageLoc.y + dragController->dragOffset().y());
[[self _bridge] dragSourceMovedTo:windowMouseLoc]; [[self _bridge] dragSourceMovedTo:windowMouseLoc];
} }
- (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation - (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation
{ {
ASSERT(![self _webView] || [self _isTopHTMLView]); ASSERT(![self _webView] || [self _isTopHTMLView]);
Page* page = core([self _webView]);
ASSERT(page);
DragController* dragController = page->dragController();
NSPoint windowImageLoc = [[self window] convertScreenToBase:aPoint]; NSPoint windowImageLoc = [[self window] convertScreenToBase:aPoint];
NSPoint windowMouseLoc = NSMakePoint(windowImageLoc.x + _private->dragOffset.x, windowImageLoc.y + _private->dragOffset.y); NSPoint windowMouseLoc = NSMakePoint(windowImageLoc.x + dragController->dragOffset().x(), windowImageLoc.y + dragController->dragOffset().y());
[[self _bridge] dragSourceEndedAt:windowMouseLoc operation:operation]; [[self _bridge] dragSourceEndedAt:windowMouseLoc operation:operation];
Page *page = core([self _webView]); dragController->dragEnded();
ASSERT(page);
page->dragController()->dragEnded();
// Prevent queued mouseDragged events from coming after the drag and fake mouseUp event. // Prevent queued mouseDragged events from coming after the drag and fake mouseUp event.
_private->ignoringMouseDraggedEvents = YES; _private->ignoringMouseDraggedEvents = YES;
...@@ -4959,27 +4962,6 @@ static DOMRange *unionDOMRanges(DOMRange *a, DOMRange *b) ...@@ -4959,27 +4962,6 @@ static DOMRange *unionDOMRanges(DOMRange *a, DOMRange *b)
// not reflected in the font panel. Maybe someday this will change. // not reflected in the font panel. Maybe someday this will change.
} }
- (unsigned)_delegateDragSourceActionMask
{
ASSERT(_private->mouseDownEvent != nil);
WebHTMLView *topHTMLView = [self _topHTMLView];
if (self != topHTMLView) {
[topHTMLView _setMouseDownEvent:_private->mouseDownEvent];
unsigned result = [topHTMLView _delegateDragSourceActionMask];
[topHTMLView _setMouseDownEvent:nil];
return result;
}
WebView *webView = [self _webView];
NSPoint point = [webView convertPoint:[_private->mouseDownEvent locationInWindow] fromView:nil];
Page* page = core(webView);
if (!page)
return DragSourceActionNone;
DragSourceAction sourceAction = (DragSourceAction)[[webView _UIDelegateForwarder] webView:webView dragSourceActionMaskForPoint:point];
page->dragController()->setDragSourceAction(sourceAction);
return sourceAction;
}
- (BOOL)_canSmartCopyOrDelete - (BOOL)_canSmartCopyOrDelete
{ {
return [[self _webView] smartInsertDeleteEnabled] && [[self _bridge] selectionGranularity] == WordGranularity; return [[self _webView] smartInsertDeleteEnabled] && [[self _bridge] selectionGranularity] == WordGranularity;
......
...@@ -42,8 +42,6 @@ ...@@ -42,8 +42,6 @@
BOOL showsURLsInToolTips; BOOL showsURLsInToolTips;
BOOL ignoringMouseDraggedEvents; BOOL ignoringMouseDraggedEvents;
BOOL printing; BOOL printing;
// Offset from lower left corner of dragged image to mouse location (when we're the drag source)
NSPoint dragOffset;
id savedSubviews; id savedSubviews;
BOOL subviewsSetAside; BOOL subviewsSetAside;
...@@ -96,7 +94,6 @@ ...@@ -96,7 +94,6 @@
- (void)_formControlIsBecomingFirstResponder:(NSView *)formControl; - (void)_formControlIsBecomingFirstResponder:(NSView *)formControl;
- (void)_formControlIsResigningFirstResponder:(NSView *)formControl; - (void)_formControlIsResigningFirstResponder:(NSView *)formControl;
- (void)_updateFontPanel; - (void)_updateFontPanel;
- (unsigned int)_delegateDragSourceActionMask;
- (BOOL)_canSmartCopyOrDelete; - (BOOL)_canSmartCopyOrDelete;
- (BOOL)_textViewWasFirstResponderAtMouseDownTime:(NSTextView *)textView; - (BOOL)_textViewWasFirstResponderAtMouseDownTime:(NSTextView *)textView;
- (void)_pauseNullEventsForAllNetscapePlugins; - (void)_pauseNullEventsForAllNetscapePlugins;
......
...@@ -294,8 +294,6 @@ macro(yankAndSelect) \ ...@@ -294,8 +294,6 @@ macro(yankAndSelect) \
NSString *mediaStyle; NSString *mediaStyle;
unsigned int dragDestinationActionMask;
BOOL hasSpellCheckerDocumentTag; BOOL hasSpellCheckerDocumentTag;
WebNSInteger spellCheckerDocumentTag; WebNSInteger spellCheckerDocumentTag;
...@@ -2098,20 +2096,6 @@ NS_ENDHANDLER ...@@ -2098,20 +2096,6 @@ NS_ENDHANDLER
return [self _elementAtWindowPoint:[self convertPoint:point toView:nil]]; return [self _elementAtWindowPoint:[self convertPoint:point toView:nil]];
} }
- (NSDragOperation)_loadingDragOperationForDraggingInfo:(id <NSDraggingInfo>)draggingInfo
{
if (_private->dragDestinationActionMask & WebDragDestinationActionLoad) {
NSPoint windowPoint = [draggingInfo draggingLocation];
NSView *view = [self hitTest:[[self superview] convertPoint:windowPoint toView:nil]];
// Don't accept the drag over a plug-in since plug-ins may want to handle it.
if (![view isKindOfClass:[WebBaseNetscapePluginView class]] && !_private->editable && [self page]->dragController()->didInitiateDrag()) {
// If not editing or dragging, use _web_dragOperationForDraggingInfo to find a URL to load on the pasteboard.
return [self _web_dragOperationForDraggingInfo:draggingInfo];
}
}
return NSDragOperationNone;
}
// The following 2 internal NSView methods are called on the drag destination by make scrolling while dragging work. // The following 2 internal NSView methods are called on the drag destination by make scrolling while dragging work.
// Scrolling while dragging will only work if the drag destination is in a scroll view. The WebView is the drag destination. // Scrolling while dragging will only work if the drag destination is in a scroll view. The WebView is the drag destination.
// When dragging to a WebView, the document subview should scroll, but it doesn't because it is not the drag destination. // When dragging to a WebView, the document subview should scroll, but it doesn't because it is not the drag destination.
......
2007-01-25 Oliver Hunt <oliver@apple.com>
Reviewed by Adam.
Stub for new DragClient method
* WebCoreSupport/DragClientQt.cpp:
(WebCore::DragClientQt::dragSourceActionMaskForPoint):
* WebCoreSupport/DragClientQt.h:
2007-01-29 Maciej Stachowiak <mjs@apple.com> 2007-01-29 Maciej Stachowiak <mjs@apple.com>
Reviewed by Mark. Reviewed by Mark.
......
...@@ -42,6 +42,11 @@ void DragClientQt::dragControllerDestroyed() ...@@ -42,6 +42,11 @@ void DragClientQt::dragControllerDestroyed()
{ {
} }
DragSourceAction DragClientQt::dragSourceActionMaskForPoint(const IntPoint&)
{
return DragSourceActionAny;
}
} }
...@@ -33,6 +33,7 @@ public: ...@@ -33,6 +33,7 @@ public:
DragData*); DragData*);
virtual WebCore::DragDestinationAction actionMaskForDrag(DragData*); virtual WebCore::DragDestinationAction actionMaskForDrag(DragData*);
virtual void dragControllerDestroyed(); virtual void dragControllerDestroyed();
virtual DragSourceAction dragSourceActionMaskForPoint(const IntPoint&);
private: private:
}; };
......
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