Commit 5db11076 authored by bolsinga@apple.com's avatar bolsinga@apple.com

Add ENABLE(DRAG_SUPPORT)

https://bugs.webkit.org/show_bug.cgi?id=29233

Reviewed by David Kilzer.

JavaScriptCore:

* wtf/Platform.h:

WebCore:

No new tests. (No change in default behavior.)

* DerivedSources.make: Use new WebCore.DragSupport.exp file if ENABLE_DRAG_SUPPORT.
* WebCore.base.exp: Move Drag Support only exports to WebCore.DragSupport.exp.
* WebCore.xcodeproj/project.pbxproj: Add WebCore.DragSupport.exp.
* dom/Clipboard.h: Use ENABLE(DRAG_SUPPORT) where applicable.
* loader/EmptyClients.h: Ditto.
* page/DragController.cpp: Wrap entire file in ENABLE(DRAG_SUPPORT).
* page/EventHandler.cpp: Use ENABLE(DRAG_SUPPORT) where applicable.
(WebCore::EventHandler::EventHandler):
(WebCore::EventHandler::clear):
(WebCore::EventHandler::handleMousePressEvent):
(WebCore::EventHandler::handleMouseReleaseEvent):
(WebCore::EventHandler::handleMouseMoveEvent):
* page/EventHandler.h: Ditto.
* page/Page.cpp: Ditto.
(WebCore::Page::Page):
* page/Page.h: Ditto.
* page/mac/DragControllerMac.mm: Wrap entire file in ENABLE(DRAG_SUPPORT).
* page/mac/EventHandlerMac.mm: Use ENABLE(DRAG_SUPPORT) where applicable.
(WebCore::EventHandler::passSubframeEventToSubframe):
* platform/DragData.cpp: Wrap entire file in ENABLE(DRAG_SUPPORT).
* platform/DragImage.cpp: Wrap entire file in ENABLE(DRAG_SUPPORT).
* platform/mac/ClipboardMac.h: Use ENABLE(DRAG_SUPPORT) where applicable.
* platform/mac/ClipboardMac.mm: Ditto.
* platform/mac/DragDataMac.mm: Wrap entire file in ENABLE(DRAG_SUPPORT).
* platform/mac/DragImageMac.mm: Wrap entire file in ENABLE(DRAG_SUPPORT).
* rendering/RenderLayer.cpp: Use ENABLE(DRAG_SUPPORT) where applicable.
(WebCore::RenderLayer::autoscroll):
* rendering/RenderObject.cpp: Ditto.
* rendering/RenderObject.h: Ditto.
* svg/graphics/SVGImage.cpp: Ditto.
(WebCore::SVGImage::dataChanged):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48426 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 00a8a38b
2009-09-16 Greg Bolsinga <bolsinga@apple.com>
Add ENABLE(DRAG_SUPPORT)
https://bugs.webkit.org/show_bug.cgi?id=29233
Reviewed by David Kilzer.
* wtf/Platform.h:
2009-09-16 Kevin Ollivier <kevino@theolliviers.com>
waf build fix after flag was moved to correct place.
......
......@@ -410,6 +410,7 @@
#if PLATFORM(IPHONE)
#define WTF_PLATFORM_CF 1
#define WTF_USE_PTHREADS 1
#define ENABLE_DRAG_SUPPORT 0
#define ENABLE_FTPDIR 1
#define ENABLE_MAC_JAVA_BRIDGE 0
#define ENABLE_ICONDATABASE 0
......@@ -552,6 +553,10 @@
#define ENABLE_FTPDIR 1
#endif
#if !defined(ENABLE_DRAG_SUPPORT)
#define ENABLE_DRAG_SUPPORT 1
#endif
#if !defined(ENABLE_DASHBOARD_SUPPORT)
#define ENABLE_DASHBOARD_SUPPORT 0
#endif
......
2009-09-16 Greg Bolsinga <bolsinga@apple.com>
Add ENABLE(DRAG_SUPPORT)
https://bugs.webkit.org/show_bug.cgi?id=29233
Reviewed by David Kilzer.
No new tests. (No change in default behavior.)
* DerivedSources.make: Use new WebCore.DragSupport.exp file if ENABLE_DRAG_SUPPORT.
* WebCore.base.exp: Move Drag Support only exports to WebCore.DragSupport.exp.
* WebCore.xcodeproj/project.pbxproj: Add WebCore.DragSupport.exp.
* dom/Clipboard.h: Use ENABLE(DRAG_SUPPORT) where applicable.
* loader/EmptyClients.h: Ditto.
* page/DragController.cpp: Wrap entire file in ENABLE(DRAG_SUPPORT).
* page/EventHandler.cpp: Use ENABLE(DRAG_SUPPORT) where applicable.
(WebCore::EventHandler::EventHandler):
(WebCore::EventHandler::clear):
(WebCore::EventHandler::handleMousePressEvent):
(WebCore::EventHandler::handleMouseReleaseEvent):
(WebCore::EventHandler::handleMouseMoveEvent):
* page/EventHandler.h: Ditto.
* page/Page.cpp: Ditto.
(WebCore::Page::Page):
* page/Page.h: Ditto.
* page/mac/DragControllerMac.mm: Wrap entire file in ENABLE(DRAG_SUPPORT).
* page/mac/EventHandlerMac.mm: Use ENABLE(DRAG_SUPPORT) where applicable.
(WebCore::EventHandler::passSubframeEventToSubframe):
* platform/DragData.cpp: Wrap entire file in ENABLE(DRAG_SUPPORT).
* platform/DragImage.cpp: Wrap entire file in ENABLE(DRAG_SUPPORT).
* platform/mac/ClipboardMac.h: Use ENABLE(DRAG_SUPPORT) where applicable.
* platform/mac/ClipboardMac.mm: Ditto.
* platform/mac/DragDataMac.mm: Wrap entire file in ENABLE(DRAG_SUPPORT).
* platform/mac/DragImageMac.mm: Wrap entire file in ENABLE(DRAG_SUPPORT).
* rendering/RenderLayer.cpp: Use ENABLE(DRAG_SUPPORT) where applicable.
(WebCore::RenderLayer::autoscroll):
* rendering/RenderObject.cpp: Ditto.
* rendering/RenderObject.h: Ditto.
* svg/graphics/SVGImage.cpp: Ditto.
(WebCore::SVGImage::dataChanged):
2009-09-16 Kevin Ollivier <kevino@theolliviers.com>
wxMSW build fix after adding support for high resolution times in Win.
......@@ -464,6 +464,12 @@ ENABLE_DASHBOARD_SUPPORT = 0
endif
ifeq ($(shell gcc -E -P -dM -F $(BUILT_PRODUCTS_DIR) $(FRAMEWORK_FLAGS) WebCore/ForwardingHeaders/wtf/Platform.h | grep ENABLE_DRAG_SUPPORT | cut -d' ' -f3), 1)
ENABLE_DRAG_SUPPORT = 1
else
ENABLE_DRAG_SUPPORT = 0
endif
# CSS property names and value keywords
WEBCORE_CSS_PROPERTY_NAMES := $(WebCore)/css/CSSPropertyNames.in
......@@ -762,6 +768,10 @@ ifeq ($(ENABLE_DASHBOARD_SUPPORT), 1)
WEBCORE_EXPORT_DEPENDENCIES := $(WEBCORE_EXPORT_DEPENDENCIES) WebCore.DashboardSupport.exp
endif
ifeq ($(ENABLE_DRAG_SUPPORT), 1)
WEBCORE_EXPORT_DEPENDENCIES := $(WEBCORE_EXPORT_DEPENDENCIES) WebCore.DragSupport.exp
endif
ifeq ($(findstring 10.4,$(MACOSX_DEPLOYMENT_TARGET)), 10.4)
WEBCORE_EXPORT_DEPENDENCIES := $(WEBCORE_EXPORT_DEPENDENCIES) WebCore.Tiger.exp
endif
......
__ZN7WebCore12EventHandler17dragSourceEndedAtERKNS_18PlatformMouseEventENS_13DragOperationE
__ZN7WebCore12EventHandler17dragSourceMovedToERKNS_18PlatformMouseEventE
__ZN7WebCore12EventHandler17eventMayStartDragEP7NSEvent
__ZN7WebCore14DragController10dragExitedEPNS_8DragDataE
__ZN7WebCore14DragController11dragEnteredEPNS_8DragDataE
__ZN7WebCore14DragController11dragUpdatedEPNS_8DragDataE
__ZN7WebCore14DragController11performDragEPNS_8DragDataE
__ZN7WebCore14DragController14placeDragCaretERKNS_8IntPointE
__ZN7WebCore14DragController9dragEndedEv
__ZN7WebCore8DragDataC1EP11objc_objectRKNS_8IntPointES5_NS_13DragOperationEPNS_16PasteboardHelperE
......@@ -223,9 +223,6 @@ __ZN7WebCore12EventHandler12mouseDraggedEP7NSEvent
__ZN7WebCore12EventHandler14currentNSEventEv
__ZN7WebCore12EventHandler14scrollOverflowENS_15ScrollDirectionENS_17ScrollGranularityE
__ZN7WebCore12EventHandler15sendScrollEventEv
__ZN7WebCore12EventHandler17dragSourceEndedAtERKNS_18PlatformMouseEventENS_13DragOperationE
__ZN7WebCore12EventHandler17dragSourceMovedToERKNS_18PlatformMouseEventE
__ZN7WebCore12EventHandler17eventMayStartDragEP7NSEvent
__ZN7WebCore12EventHandler20handleTextInputEventERKNS_6StringEPNS_5EventEbb
__ZN7WebCore12EventHandler20hitTestResultAtPointERKNS_8IntPointEbbNS_17HitTestScrollbarsE
__ZN7WebCore12EventHandler20sendContextMenuEventEP7NSEvent
......@@ -301,12 +298,6 @@ __ZN7WebCore14DocumentLoader8setFrameEPNS_5FrameE
__ZN7WebCore14DocumentLoader8setTitleERKNS_6StringE
__ZN7WebCore14DocumentLoaderC2ERKNS_15ResourceRequestERKNS_14SubstituteDataE
__ZN7WebCore14DocumentLoaderD2Ev
__ZN7WebCore14DragController10dragExitedEPNS_8DragDataE
__ZN7WebCore14DragController11dragEnteredEPNS_8DragDataE
__ZN7WebCore14DragController11dragUpdatedEPNS_8DragDataE
__ZN7WebCore14DragController11performDragEPNS_8DragDataE
__ZN7WebCore14DragController14placeDragCaretERKNS_8IntPointE
__ZN7WebCore14DragController9dragEndedEv
__ZN7WebCore14ResourceHandle12releaseProxyEv
__ZN7WebCore14ResourceHandle20forceContentSniffingEv
__ZN7WebCore14ResourceLoader14cancelledErrorEv
......@@ -626,7 +617,6 @@ __ZN7WebCore8Document23renderedRectsForMarkersENS_14DocumentMarker10MarkerTypeE
__ZN7WebCore8Document24setShouldCreateRenderersEb
__ZN7WebCore8Document36updateLayoutIgnorePendingStylesheetsEv
__ZN7WebCore8Document4headEv
__ZN7WebCore8DragDataC1EP11objc_objectRKNS_8IntPointES5_NS_13DragOperationEPNS_16PasteboardHelperE
__ZN7WebCore8FormDataD1Ev
__ZN7WebCore8IntPointC1ERK8_NSPoint
__ZN7WebCore8PositionC1EN3WTF10PassRefPtrINS_4NodeEEEi
......
......@@ -9842,6 +9842,7 @@
FE80DA620E9C4703000D6F75 /* JSGeoposition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGeoposition.h; sourceTree = "<group>"; };
FE80DA6D0E9C472F000D6F75 /* JSPositionError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPositionError.cpp; sourceTree = "<group>"; };
FE80DA6E0E9C472F000D6F75 /* JSPositionError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPositionError.h; sourceTree = "<group>"; };
FEA4133F105D67AE0007236F /* WebCore.DragSupport.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = WebCore.DragSupport.exp; sourceTree = "<group>"; };
FEAB90100EA51B9C006348C3 /* GeolocationService.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeolocationService.cpp; sourceTree = "<group>"; };
FEAB90110EA51B9C006348C3 /* GeolocationService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationService.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
......@@ -10441,6 +10442,7 @@
children = (
F58EF58E02DFDFB7018635CA /* WebCore.base.exp */,
4491959D0FBE17D700D9F824 /* WebCore.DashboardSupport.exp */,
FEA4133F105D67AE0007236F /* WebCore.DragSupport.exp */,
4491959C0FBE17D700D9F824 /* WebCore.JNI.exp */,
4491959B0FBE17D700D9F824 /* WebCore.LP64.exp */,
4491959A0FBE17D700D9F824 /* WebCore.NPAPI.exp */,
......@@ -64,7 +64,9 @@ namespace WebCore {
virtual void setDragImageElement(Node*, const IntPoint&) = 0;
virtual DragImageRef createDragImage(IntPoint& dragLocation) const = 0;
#if ENABLE(DRAG_SUPPORT)
virtual void declareAndWriteDragImage(Element*, const KURL&, const String& title, Frame*) = 0;
#endif
virtual void writeURL(const KURL&, const String&, Frame*) = 0;
virtual void writeRange(Range*, Frame*) = 0;
......
......@@ -436,6 +436,7 @@ public:
#endif
};
#if ENABLE(DRAG_SUPPORT)
class EmptyDragClient : public DragClient {
public:
virtual ~EmptyDragClient() {}
......@@ -447,6 +448,7 @@ public:
virtual DragImageRef createDragImageForLink(KURL&, const String&, Frame*) { return 0; }
virtual void dragControllerDestroyed() { }
};
#endif // ENABLE(DRAG_SUPPORT)
class EmptyInspectorClient : public InspectorClient {
public:
......
......@@ -26,6 +26,7 @@
#include "config.h"
#include "DragController.h"
#if ENABLE(DRAG_SUPPORT)
#include "CSSStyleDeclaration.h"
#include "Clipboard.h"
#include "ClipboardAccessPolicy.h"
......@@ -785,3 +786,5 @@ void DragController::placeDragCaret(const IntPoint& windowPoint)
}
} // namespace WebCore
#endif // ENABLE(DRAG_SUPPORT)
......@@ -78,6 +78,7 @@ namespace WebCore {
using namespace HTMLNames;
#if ENABLE(DRAG_SUPPORT)
// The link drag hysteresis is much larger than the others because there
// needs to be enough space to cancel the link press without starting a link drag,
// and because dragging links is rare.
......@@ -85,6 +86,7 @@ const int LinkDragHysteresis = 40;
const int ImageDragHysteresis = 5;
const int TextDragHysteresis = 3;
const int GeneralDragHysteresis = 3;
#endif // ENABLE(DRAG_SUPPORT)
// Match key code of composition keydown event on windows.
// IE sends VK_PROCESSKEY which has value 229;
......@@ -136,7 +138,9 @@ EventHandler::EventHandler(Frame* frame)
, m_mousePressed(false)
, m_capturesDragging(false)
, m_mouseDownMayStartSelect(false)
#if ENABLE(DRAG_SUPPORT)
, m_mouseDownMayStartDrag(false)
#endif
, m_mouseDownWasSingleClickInSelection(false)
, m_beganSelectingText(false)
, m_panScrollInProgress(false)
......@@ -169,11 +173,13 @@ EventHandler::~EventHandler()
{
}
#if ENABLE(DRAG_SUPPORT)
EventHandler::EventHandlerDragState& EventHandler::dragState()
{
DEFINE_STATIC_LOCAL(EventHandlerDragState, state, ());
return state;
}
#endif // ENABLE(DRAG_SUPPORT)
void EventHandler::clear()
{
......@@ -190,7 +196,9 @@ void EventHandler::clear()
m_clickCount = 0;
m_clickNode = 0;
m_frameSetBeingResized = 0;
#if ENABLE(DRAG_SUPPORT)
m_dragTarget = 0;
#endif
m_currentMousePosition = IntPoint();
m_mousePressNode = 0;
m_mousePressed = false;
......@@ -344,8 +352,10 @@ bool EventHandler::handleMousePressEventSingleClick(const MouseEventWithHitTestR
bool EventHandler::handleMousePressEvent(const MouseEventWithHitTestResults& event)
{
#if ENABLE(DRAG_SUPPORT)
// Reset drag state.
dragState().m_dragSrc = 0;
#endif
if (ScrollView* scrollView = m_frame->view()) {
if (scrollView->isPointInScrollbarCorner(event.event().pos()))
......@@ -358,8 +368,10 @@ bool EventHandler::handleMousePressEvent(const MouseEventWithHitTestResults& eve
// so it's allowed to start a drag or selection.
m_mouseDownMayStartSelect = canMouseDownStartSelect(event.targetNode());
#if ENABLE(DRAG_SUPPORT)
// Careful that the drag starting logic stays in sync with eventMayStartDrag()
m_mouseDownMayStartDrag = singleClick;
#endif
m_mouseDownWasSingleClickInSelection = false;
......@@ -387,7 +399,9 @@ bool EventHandler::handleMousePressEvent(const MouseEventWithHitTestResults& eve
Node* innerNode = event.targetNode();
m_mousePressNode = innerNode;
#if ENABLE(DRAG_SUPPORT)
m_dragStartPos = event.event().pos();
#endif
bool swallowEvent = false;
m_frame->selection()->setCaretBlinkingSuspended(true);
......@@ -407,6 +421,7 @@ bool EventHandler::handleMousePressEvent(const MouseEventWithHitTestResults& eve
return swallowEvent;
}
#if ENABLE(DRAG_SUPPORT)
bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& event)
{
if (handleDrag(event))
......@@ -546,6 +561,7 @@ void EventHandler::updateSelectionForMouseDrag(Node* targetNode, const IntPoint&
m_frame->selection()->setSelection(newSelection);
}
}
#endif // ENABLE(DRAG_SUPPORT)
bool EventHandler::handleMouseUp(const MouseEventWithHitTestResults& event)
{
......@@ -573,7 +589,9 @@ bool EventHandler::handleMouseReleaseEvent(const MouseEventWithHitTestResults& e
m_frame->selection()->setCaretBlinkingSuspended(false);
m_mousePressed = false;
m_capturesDragging = false;
#if ENABLE(DRAG_SUPPORT)
m_mouseDownMayStartDrag = false;
#endif
m_mouseDownMayStartSelect = false;
m_mouseDownMayStartAutoscroll = false;
m_mouseDownWasInSubframe = false;
......@@ -585,7 +603,9 @@ bool EventHandler::handleMouseReleaseEvent(const MouseEventWithHitTestResults& e
// on the selection, the selection goes away. However, if we are
// editing, place the caret.
if (m_mouseDownWasSingleClickInSelection && !m_beganSelectingText
#if ENABLE(DRAG_SUPPORT)
&& m_dragStartPos == event.event().pos()
#endif
&& m_frame->selection()->isRange()
&& event.event().button() != RightButton) {
VisibleSelection newSelection;
......@@ -728,6 +748,7 @@ void EventHandler::setAutoscrollRenderer(RenderObject* renderer)
m_autoscrollRenderer = renderer;
}
#if ENABLE(DRAG_SUPPORT)
void EventHandler::allowDHTMLDrag(bool& flagDHTML, bool& flagUA) const
{
flagDHTML = false;
......@@ -748,6 +769,7 @@ void EventHandler::allowDHTMLDrag(bool& flagDHTML, bool& flagUA) const
flagDHTML = (mask & DragSourceActionDHTML) != DragSourceActionNone;
flagUA = ((mask & DragSourceActionImage) || (mask & DragSourceActionLink) || (mask & DragSourceActionSelection));
}
#endif // ENABLE(DRAG_SUPPORT)
HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool allowShadowContent, bool ignoreClipping, HitTestScrollbars testScrollbars)
{
......@@ -1104,7 +1126,9 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
m_capturesDragging = true;
m_currentMousePosition = mouseEvent.pos();
m_mouseDownTimestamp = mouseEvent.timestamp();
#if ENABLE(DRAG_SUPPORT)
m_mouseDownMayStartDrag = false;
#endif
m_mouseDownMayStartSelect = false;
m_mouseDownMayStartAutoscroll = false;
if (FrameView* view = m_frame->view())
......@@ -1380,8 +1404,10 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent, Hi
return true;
swallowEvent = dispatchMouseEvent(eventNames().mousemoveEvent, mev.targetNode(), false, 0, mouseEvent, true);
#if ENABLE(DRAG_SUPPORT)
if (!swallowEvent)
swallowEvent = handleMouseDraggedEvent(mev);
#endif // ENABLE(DRAG_SUPPORT)
return swallowEvent;
}
......@@ -1451,6 +1477,7 @@ bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent)
return swallowMouseUpEvent || swallowClickEvent || swallowMouseReleaseEvent;
}
#if ENABLE(DRAG_SUPPORT)
bool EventHandler::dispatchDragEvent(const AtomicString& eventType, Node* dragTarget, const PlatformMouseEvent& event, Clipboard* clipboard)
{
FrameView* view = m_frame->view();
......@@ -1558,6 +1585,7 @@ void EventHandler::clearDragState()
m_sendingEventToSubview = false;
#endif
}
#endif // ENABLE(DRAG_SUPPORT)
void EventHandler::setCapturingMouseEventsNode(PassRefPtr<Node> n)
{
......@@ -1864,6 +1892,7 @@ bool EventHandler::canMouseDownStartSelect(Node* node)
return true;
}
#if ENABLE(DRAG_SUPPORT)
bool EventHandler::canMouseDragExtendSelect(Node* node)
{
if (!node || !node->renderer())
......@@ -1876,6 +1905,7 @@ bool EventHandler::canMouseDragExtendSelect(Node* node)
return true;
}
#endif // ENABLE(DRAG_SUPPORT)
void EventHandler::setResizingFrameSet(HTMLFrameSetElement* frameSet)
{
......@@ -2092,6 +2122,7 @@ void EventHandler::defaultKeyboardEventHandler(KeyboardEvent* event)
}
}
#if ENABLE(DRAG_SUPPORT)
bool EventHandler::dragHysteresisExceeded(const FloatPoint& floatDragViewportLocation) const
{
IntPoint dragViewportLocation((int)floatDragViewportLocation.x(), (int)floatDragViewportLocation.y());
......@@ -2291,6 +2322,7 @@ cleanupDrag:
// No more default handling (like selection), whether we're past the hysteresis bounds or not
return true;
}
#endif // ENABLE(DRAG_SUPPORT)
bool EventHandler::handleTextInputEvent(const String& text, Event* underlyingEvent, bool isLineBreak, bool isBackTab)
{
......
......@@ -62,10 +62,12 @@ class SVGElementInstance;
class TextEvent;
class Widget;
#if ENABLE(DRAG_SUPPORT)
extern const int LinkDragHysteresis;
extern const int ImageDragHysteresis;
extern const int TextDragHysteresis;
extern const int GeneralDragHysteresis;
#endif // ENABLE(DRAG_SUPPORT)
enum HitTestScrollbars { ShouldHitTestScrollbars, DontHitTestScrollbars };
......@@ -76,7 +78,9 @@ public:
void clear();
#if ENABLE(DRAG_SUPPORT)
void updateSelectionForMouseDrag();
#endif
Node* mousePressNode() const;
void setMousePressNode(PassRefPtr<Node>);
......@@ -95,9 +99,11 @@ public:
void setCapturingMouseEventsNode(PassRefPtr<Node>);
#if ENABLE(DRAG_SUPPORT)
bool updateDragAndDrop(const PlatformMouseEvent&, Clipboard*);
void cancelDragAndDrop(const PlatformMouseEvent&, Clipboard*);
bool performDragAndDrop(const PlatformMouseEvent&, Clipboard*);
#endif
void scheduleHoverStateUpdate();
......@@ -115,7 +121,9 @@ public:
bool scrollRecursively(ScrollDirection, ScrollGranularity);
#if ENABLE(DRAG_SUPPORT)
bool shouldDragAutoNode(Node*, const IntPoint&) const; // -webkit-user-drag == auto
#endif
bool tabsToLinks(KeyboardEvent*) const;
bool tabsToAllControls(KeyboardEvent*) const;
......@@ -144,10 +152,12 @@ public:
bool isLineBreak = false, bool isBackTab = false);
void defaultTextInputEventHandler(TextEvent*);
#if ENABLE(DRAG_SUPPORT)
bool eventMayStartDrag(const PlatformMouseEvent&) const;
void dragSourceMovedTo(const PlatformMouseEvent&);
void dragSourceEndedAt(const PlatformMouseEvent&, DragOperation);
#endif
void focusDocumentView();
......@@ -177,6 +187,7 @@ public:
#endif
private:
#if ENABLE(DRAG_SUPPORT)
struct EventHandlerDragState {
RefPtr<Node> m_dragSrc; // element that may be a drag source, for the current mouse gesture
bool m_dragSrcIsLink;
......@@ -191,6 +202,7 @@ private:
static const double TextDragDelay;
PassRefPtr<Clipboard> createDraggingClipboard() const;
#endif // ENABLE(DRAG_SUPPORT)
bool eventActivatedView(const PlatformMouseEvent&) const;
void selectClosestWordFromMouseEvent(const MouseEventWithHitTestResults&);
......@@ -202,7 +214,9 @@ private:
bool handleMousePressEventSingleClick(const MouseEventWithHitTestResults&);
bool handleMousePressEventDoubleClick(const MouseEventWithHitTestResults&);
bool handleMousePressEventTripleClick(const MouseEventWithHitTestResults&);
#if ENABLE(DRAG_SUPPORT)
bool handleMouseDraggedEvent(const MouseEventWithHitTestResults&);
#endif
bool handleMouseReleaseEvent(const MouseEventWithHitTestResults&);
void handleKeyboardSelectionMovement(KeyboardEvent*);
......@@ -215,7 +229,9 @@ private:
void hoverTimerFired(Timer<EventHandler>*);
static bool canMouseDownStartSelect(Node*);
#if ENABLE(DRAG_SUPPORT)
static bool canMouseDragExtendSelect(Node*);
#endif
void handleAutoscroll(RenderObject*);
void startAutoscrollTimer();
......@@ -232,18 +248,22 @@ private:
MouseEventWithHitTestResults prepareMouseEvent(const HitTestRequest&, const PlatformMouseEvent&);
bool dispatchMouseEvent(const AtomicString& eventType, Node* target, bool cancelable, int clickCount, const PlatformMouseEvent&, bool setUnder);
#if ENABLE(DRAG_SUPPORT)
bool dispatchDragEvent(const AtomicString& eventType, Node* target, const PlatformMouseEvent&, Clipboard*);
void freeClipboard();
bool handleDrag(const MouseEventWithHitTestResults&);
#endif
bool handleMouseUp(const MouseEventWithHitTestResults&);
#if ENABLE(DRAG_SUPPORT)
void clearDragState();
bool dispatchDragSrcEvent(const AtomicString& eventType, const PlatformMouseEvent&);
bool dragHysteresisExceeded(const FloatPoint&) const;
bool dragHysteresisExceeded(const IntPoint&) const;
#endif // ENABLE(DRAG_SUPPORT)
bool passMousePressEventToSubframe(MouseEventWithHitTestResults&, Frame* subframe);
bool passMouseMoveEventToSubframe(MouseEventWithHitTestResults&, Frame* subframe, HitTestResult* hoveredNode = 0);
......@@ -262,16 +282,22 @@ private:
void defaultSpaceEventHandler(KeyboardEvent*);
void defaultTabEventHandler(KeyboardEvent*);
#if ENABLE(DRAG_SUPPORT)
void allowDHTMLDrag(bool& flagDHTML, bool& flagUA) const;
#endif
// The following are called at the beginning of handleMouseUp and handleDrag.
// If they return true it indicates that they have consumed the event.
bool eventLoopHandleMouseUp(const MouseEventWithHitTestResults&);
#if ENABLE(DRAG_SUPPORT)
bool eventLoopHandleMouseDragged(const MouseEventWithHitTestResults&);
#endif
bool invertSenseOfTabsToLinks(KeyboardEvent*) const;
#if ENABLE(DRAG_SUPPORT)
void updateSelectionForMouseDrag(Node* targetNode, const IntPoint& localPoint);
#endif
void updateLastScrollbarUnderMouse(Scrollbar*, bool);
......@@ -290,11 +316,15 @@ private:
RefPtr<Node> m_mousePressNode;
bool m_mouseDownMayStartSelect;
#if ENABLE(DRAG_SUPPORT)
bool m_mouseDownMayStartDrag;
#endif
bool m_mouseDownWasSingleClickInSelection;
bool m_beganSelectingText;
#if ENABLE(DRAG_SUPPORT)
IntPoint m_dragStartPos;
#endif
IntPoint m_panScrollStartPos;
bool m_panScrollInProgress;
......@@ -328,7 +358,9 @@ private:
int m_clickCount;
RefPtr<Node> m_clickNode;
#if ENABLE(DRAG_SUPPORT)
RefPtr<Node> m_dragTarget;
#endif
RefPtr<HTMLFrameSetElement> m_frameSetBeingResized;
......
......@@ -100,7 +100,9 @@ static void networkStateChanged()
Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, EditorClient* editorClient, DragClient* dragClient, InspectorClient* inspectorClient)
: m_chrome(new Chrome(this, chromeClient))
, m_dragCaretController(new SelectionController(0, true))
#if ENABLE(DRAG_SUPPORT)
, m_dragController(new DragController(this, dragClient))
#endif
, m_focusController(new FocusController(this))
, m_contextMenuController(new ContextMenuController(this, contextMenuClient))
, m_inspectorController(new InspectorController(this, inspectorClient))
......@@ -126,6 +128,9 @@ Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, Edi
, m_customHTMLTokenizerChunkSize(-1)
, m_canStartPlugins(true)
{
#if !ENABLE(DRAG_SUPPORT)
UNUSED_PARAM(dragClient);
#endif
if (!allPages) {
allPages = new HashSet<Page*>;
......
......@@ -125,7 +125,9 @@ namespace WebCore {
Chrome* chrome() const { return m_chrome.get(); }
SelectionController* dragCaretController() const { return m_dragCaretController.get(); }
#if ENABLE(DRAG_SUPPORT)
DragController* dragController() const { return m_dragController.get(); }
#endif
FocusController* focusController() const { return m_focusController.get(); }
ContextMenuController* contextMenuController() const { return m_contextMenuController.get(); }
InspectorController* inspectorController() const { return m_inspectorController.get(); }
......@@ -217,7 +219,9 @@ namespace WebCore {
OwnPtr<Chrome> m_chrome;
OwnPtr<SelectionController> m_dragCaretController;
#if ENABLE(DRAG_SUPPORT)
OwnPtr<DragController> m_dragController;
#endif
OwnPtr<FocusController> m_focusController;
OwnPtr<ContextMenuController> m_contextMenuController;
OwnPtr<InspectorController> m_inspectorController;
......
......@@ -26,6 +26,7 @@
#import "config.h"
#import "DragController.h"
#if ENABLE(DRAG_SUPPORT)
#import "DragData.h"
#import "Frame.h"
#import "FrameView.h"
......@@ -75,4 +76,6 @@ void DragController::cleanupAfterSystemDrag()
dragEnded();
}
}
} // namespace WebCore
#endif // ENABLE(DRAG_SUPPORT)
......@@ -60,7 +60,9 @@ static inline IMP method_setImplementation(Method m, IMP i)
namespace WebCore {
#if ENABLE(DRAG_SUPPORT)
const double EventHandler::TextDragDelay = 0.15;
#endif
static RetainPtr<NSEvent>& currentNSEventSlot()
{
......@@ -372,6 +374,7 @@ bool EventHandler::eventActivatedView(const PlatformMouseEvent& event) const
return m_activationEventNumber == event.eventNumber();
}
#if ENABLE(DRAG_SUPPORT)
bool EventHandler::eventLoopHandleMouseDragged(const MouseEventWithHitTestResults&)
{
NSView *view = mouseDownViewIfStillGood();
......@@ -399,6 +402,7 @@ PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const
[pasteboard declareTypes:[NSArray array] owner:nil];
return ClipboardMac::create(true, pasteboard, ClipboardWritable, m_frame);
}
#endif // ENABLE(DRAG_SUPPORT)
bool EventHandler::eventLoopHandleMouseUp(const MouseEventWithHitTestResults&)
{
......@@ -430,8 +434,10 @@ bool EventHandler::passSubframeEventToSubframe(MouseEventWithHitTestResults& eve
// layout tests.
if (!m_mouseDownWasInSubframe)
return false;
#if ENABLE(DRAG_SUPPORT)
if (subframe->page()->dragController()->didInitiateDrag())
return false;
#endif
case NSMouseMoved:
// Since we're passing in currentNSEvent() here, we can call
// handleMouseMoveEvent() directly, since the save/restore of
......@@ -718,6 +724,7 @@ bool EventHandler::sendContextMenuEvent(NSEvent *event)
return sendContextMenuEvent(PlatformMouseEvent(event, page->chrome()->platformWindow()));
}
#if ENABLE(DRAG_SUPPORT)
bool EventHandler::eventMayStartDrag(NSEvent *event)
{
Page* page = m_frame->page();
......@@ -725,5 +732,6 @@ bool EventHandler::eventMayStartDrag(NSEvent *event)
return false;
return eventMayStartDrag(PlatformMouseEvent(event, page->chrome()->platformWindow()));