From 5797165d7aaa31ec6e9cd18c5689eb0c1e066818 Mon Sep 17 00:00:00 2001 From: "eric@webkit.org" Date: Thu, 21 May 2009 12:50:30 +0000 Subject: [PATCH] 2009-05-21 Eric Seidel Reviewed by Alexey Proskuryakov. Rename DragController::dragOperation() to sourceDragOperation() for clarity Remove unused setDragOperation() There are two times DragOperation is used. The source specifies what drag operations it supports (in a mask) and the destination picks a subset of those as DragOperations it supports if a drop were to occur. I was confused when I first saw this accessor as to which it meant. It turns out that this is only used when WebKit starts a drag, and we keep it around so that we can provide this information to other Mac OS X applications when they ask. I've renamed the method for clarity so the next person in this code will be less confused. No functional changes, thus no tests. * page/DragController.h: (WebCore::DragController::sourceDragOperation): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@43967 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- WebCore/ChangeLog | 21 +++++++++++++++++++++ WebCore/page/DragController.cpp | 4 ++-- WebCore/page/DragController.h | 6 ++---- WebKit/mac/ChangeLog | 9 +++++++++ WebKit/mac/WebView/WebHTMLView.mm | 12 ++++++------ 5 files changed, 40 insertions(+), 12 deletions(-) diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index b59a7ec48d9..9ecce8d8b9e 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,24 @@ +2009-05-21 Eric Seidel + + Reviewed by Alexey Proskuryakov. + + Rename DragController::dragOperation() to sourceDragOperation() for clarity + Remove unused setDragOperation() + + There are two times DragOperation is used. The source specifies + what drag operations it supports (in a mask) and the destination + picks a subset of those as DragOperations it supports if a drop were + to occur. I was confused when I first saw this accessor as to which + it meant. It turns out that this is only used when WebKit starts a + drag, and we keep it around so that we can provide this information + to other Mac OS X applications when they ask. I've renamed the method + for clarity so the next person in this code will be less confused. + + No functional changes, thus no tests. + + * page/DragController.h: + (WebCore::DragController::sourceDragOperation): + 2009-05-21 Dan Bernstein Reviewed by Anders Carlsson. diff --git a/WebCore/page/DragController.cpp b/WebCore/page/DragController.cpp index fbbc9c6bc59..da3ace1ba01 100644 --- a/WebCore/page/DragController.cpp +++ b/WebCore/page/DragController.cpp @@ -82,7 +82,7 @@ DragController::DragController(Page* page, DragClient* client) , m_dragSourceAction(DragSourceActionNone) , m_didInitiateDrag(false) , m_isHandlingDrag(false) - , m_dragOperation(DragOperationNone) + , m_sourceDragOperation(DragOperationNone) { } @@ -605,7 +605,7 @@ bool DragController::startDrag(Frame* src, Clipboard* clipboard, DragOperation s IntPoint mouseDraggedPoint = src->view()->windowToContents(dragEvent.pos()); m_draggingImageURL = KURL(); - m_dragOperation = srcOp; + m_sourceDragOperation = srcOp; DragImageRef dragImage = 0; IntPoint dragLoc(0, 0); diff --git a/WebCore/page/DragController.h b/WebCore/page/DragController.h index 3beff5a8990..819ea35625f 100644 --- a/WebCore/page/DragController.h +++ b/WebCore/page/DragController.h @@ -64,8 +64,7 @@ namespace WebCore { bool didInitiateDrag() const { return m_didInitiateDrag; } void setIsHandlingDrag(bool handling) { m_isHandlingDrag = handling; } bool isHandlingDrag() const { return m_isHandlingDrag; } - void setDragOperation(DragOperation dragOp) { m_dragOperation = dragOp; } - DragOperation dragOperation() const { return m_dragOperation; } + DragOperation sourceDragOperation() const { return m_sourceDragOperation; } void setDraggingImageURL(const KURL& url) { m_draggingImageURL = url; } const KURL& draggingImageURL() const { return m_draggingImageURL; } void setDragInitiator(Document* initiator) { m_dragInitiator = initiator; m_didInitiateDrag = true; } @@ -120,10 +119,9 @@ namespace WebCore { DragSourceAction m_dragSourceAction; bool m_didInitiateDrag; bool m_isHandlingDrag; - DragOperation m_dragOperation; + DragOperation m_sourceDragOperation; // Set in startDrag when a drag starts from a mouse down within WebKit IntPoint m_dragOffset; KURL m_draggingImageURL; - }; } diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog index 0bd8ea2d67e..1b9f29a0e5a 100644 --- a/WebKit/mac/ChangeLog +++ b/WebKit/mac/ChangeLog @@ -1,3 +1,12 @@ +2009-05-21 Eric Seidel + + Reviewed by Alexey Proskuryakov. + + Rename DragController::dragOperation() to sourceDragOperation() for clarity + + * WebView/WebHTMLView.mm: + (-[WebHTMLView draggingSourceOperationMaskForLocal:]): + 2009-05-21 Dan Bernstein Reviewed by Anders Carlsson. diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm index 4cf59ba3e12..5330242e5bd 100644 --- a/WebKit/mac/WebView/WebHTMLView.mm +++ b/WebKit/mac/WebView/WebHTMLView.mm @@ -3471,15 +3471,15 @@ done: { ASSERT(![self _webView] || [self _isTopHTMLView]); - Page *page = core([self _webView]); - + Page* page = core([self _webView]); if (!page) return NSDragOperationNone; - - if (page->dragController()->dragOperation() == DragOperationNone) + + // FIXME: Why do we override the source provided operation here? Why not in DragController::startDrag + if (page->dragController()->sourceDragOperation() == DragOperationNone) return NSDragOperationGeneric | NSDragOperationCopy; - - return (NSDragOperation)page->dragController()->dragOperation(); + + return (NSDragOperation)page->dragController()->sourceDragOperation(); } - (void)draggedImage:(NSImage *)image movedTo:(NSPoint)screenLoc -- GitLab