Commit aeffa297 authored by oliver's avatar oliver

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

        Reviewed by Adam.

        Added DragController to handled drag and drop state and control logic.
        Currently this only handles logic for Dragging and Dropping, and is 
        unable to initialise a drag itself.

        platform/DragData encapsulate the paltform Drag data (NSDraggingInfo on Mac, 
        QMimeType in Qt).  This provides methods to pull data out the drag data as a String, 
        a URL, a DocumentFragment (for rich content), or a Colour.

        * WebCore.exp:
        * WebCore.pro:
        * WebCore.xcodeproj/project.pbxproj:
        * dom/Clipboard.cpp: Added.
        (WebCore::Clipboard::setAccessPolicy):
        (WebCore::dragOpFromIEOp):
        (WebCore::IEOpFromDragOp):
        (WebCore::Clipboard::sourceOperation):
        (WebCore::Clipboard::destinationOperation):
        (WebCore::Clipboard::setSourceOperation):
        (WebCore::Clipboard::setDestinationOperation):
        (WebCore::Clipboard::setDropEffect):
        (WebCore::Clipboard::setEffectAllowed):
          move platform independent functions from ClipboardMac to Clipboard

        * dom/Clipboard.h:
        (WebCore::Clipboard::Clipboard):
        (WebCore::Clipboard::dropEffect):
        (WebCore::Clipboard::effectAllowed):
        (WebCore::Clipboard::policy):
          as above -- also removed virtual modifier from now 
          platform independent methods

        * editing/Editor.cpp:
        (WebCore::Editor::smartInsertDeleteEnabled): 
        (WebCore::Editor::shouldApplyStyle):
        * editing/Editor.h:
          adding calls through to EditorClient
         
        * page/DragActions.h: Added.
        (WebCore::):
          Replicates a number of NS* enums in the WebCore namespace

        * page/DragClient.h: Added.
        (WebCore::DragClient::~DragClient):
          Standard client interface for dragging UIDelegate

        * page/DragController.cpp: Added.
        (WebCore::createMouseEvent):
        (WebCore::DragController::DragController):
        (WebCore::DragController::~DragController):
        (WebCore::documentFragmentFromDragData):
        (WebCore::DragController::isMoveDrag):
        (WebCore::visiblePositionForPoint):
        (WebCore::DragController::cancelDrag):
        (WebCore::documentAtPoint):
        (WebCore::DragController::dragEntered):
        (WebCore::DragController::dragExited):
        (WebCore::DragController::dragUpdated):
        (WebCore::DragController::performDrag):
        (WebCore::DragController::dragEnteredOrUpdated):
        (WebCore::DragController::tryDocumentDrag):
        (WebCore::DragController::operationForLoad):
        (WebCore::DragController::concludeDrag):
        (WebCore::DragController::canProcessDrag):
        (WebCore::DragController::tryDHTMLDrag):
          Class to handle state and logic for dragging and dropping

        * page/DragController.h: Added.
        (WebCore::DragController::client):
        (WebCore::DragController::didInitiateDrag):
        (WebCore::DragController::isHandlingDrag):
        (WebCore::DragController::dragOperation):
        (WebCore::DragController::document):
        (WebCore::DragController::dragInitiator):
        (WebCore::DragController::dragDestinationAction):
        (WebCore::DragController::dragSourceAction):
        (WebCore::DragController::dragEnded):
        (WebCore::DragController::setIsHandlingDrag):
        (WebCore::DragController::setDidInitiateDrag):
        (WebCore::DragController::setDragOperation):
        (WebCore::DragController::setDragSourceAction):
        (WebCore::DragController::setDragInitiator):
          See above

        * page/Page.cpp:
        (WebCore::Page::Page):
          Update Page to have DragController

        * page/Page.h:
        (WebCore::Page::dragController):
          ditto

        * page/mac/DragControllerMac.mm: Added.
        (WebCore::DragController::isCopyKeyDown):
        (WebCore::DragController::dragOperation):
          Platform specific portions of the DragController

        * page/mac/EventHandlerMac.mm:
        (WebCore::EventHandler::handleDrag):
        (WebCore::EventHandler::dragSourceEndedAt):
          Convert from NSDragOperation to WebCore::DragOperation

        * page/mac/WebCoreFrameBridge.h:
        * page/mac/WebCoreFrameBridge.mm:
          Remove obsolete Drag functions

        * page/qt/DragControllerQt.cpp: Added.
        (WebCore::DragController::isCopyKeyDown):
        (WebCore::DragController::dragOperation):
          Basic stubs to maintain Qt  build

        * platform/DragData.cpp: Added.
        (WebCore::DragData::DragData):
        * platform/DragData.h: Added.
        (WebCore::DragData::clientPosition):
        (WebCore::DragData::globalPosition):
        (WebCore::DragData::platformData):
        (WebCore::DragData::draggingSourceOperationMask):
          DragData class to encapsulate platform drag data/event

        * platform/graphics/svg/SVGImage.cpp:
        (WebCore::SVGImage::setData):
          Addition of dummy DragClient

        * platform/graphics/svg/SVGImageEmptyClients.h:
        (WebCore::SVGEmptyDragClient::~SVGEmptyDragClient):
        (WebCore::SVGEmptyDragClient::willPerformDragDestinationAction):
        (WebCore::SVGEmptyDragClient::actionMaskForDrag):
        (WebCore::SVGEmptyDragClient::dragControllerDestroyed):
          ditto

        * platform/mac/ClipboardMac.h:
        * platform/mac/ClipboardMac.mm:
        (WebCore::ClipboardMac::ClipboardMac):
        (WebCore::ClipboardMac::clearData):
        (WebCore::ClipboardMac::clearAllData):
        (WebCore::ClipboardMac::getData):
        (WebCore::ClipboardMac::setData):
        (WebCore::ClipboardMac::types):
        (WebCore::ClipboardMac::setDragImage):
         Moving platform independent logic to Clipboard, and updating
         platform specific methods to use appropriate accessors rather than 
         directly manipulating data they no longer own

        * platform/mac/DragDataMac.mm: Added.
        (WebCore::DragData::DragData):
        (WebCore::DragData::canSmartReplace):
        (WebCore::DragData::containsColor):
        (WebCore::DragData::containsPlainText):
        (WebCore::DragData::asPlainText):
        (WebCore::DragData::asColor):
        (WebCore::DragData::createClipboard):
        (WebCore::imageExistsAtPaths):
        (WebCore::DragData::containsCompatibleContent):
        (WebCore::DragData::containsURL):
        (WebCore::DragData::asURL):
        (WebCore::DragData::asFragment):
          Mac implementations of DragData methods.  A number of these use
          a Helper class that accesses WebKit functionality.  That functionality 
          should be migrated to WebCore in the future.

        * platform/mac/PasteboardHelper.h: Added.
        (WebCore::PasteboardHelper::~PasteboardHelper):
          Temporary, and Mac only, helper class to access WebKit functionality 
          from WebCore

        * platform/qt/DragDataQt.cpp: Added.
        (WebCore::DragData::canSmartReplace):
        (WebCore::DragData::containsColor):
        (WebCore::DragData::containsPlainText):
        (WebCore::DragData::asPlainText):
        (WebCore::DragData::asColor):
        (WebCore::DragData::createClipboard):
        (WebCore::DragData::containsCompatibleContent):
        (WebCore::DragData::containsURL):
        (WebCore::DragData::asURL):
        (WebCore::DragData::asFragment):
         Basic stubs to maintain Qt build

        * rendering/HitTestResult.cpp:
        (WebCore::HitTestResult::HitTestResult):
         Correct HitTestResult copy contructor to copy localPoint


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@19039 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent fa8c5eca
2007-01-23 Oliver Hunt <oliver@apple.com>
Reviewed by Adam.
Added DragController to handled drag and drop state and control logic.
Currently this only handles logic for Dragging and Dropping, and is
unable to initialise a drag itself.
platform/DragData encapsulate the paltform Drag data (NSDraggingInfo on Mac,
QMimeType in Qt). This provides methods to pull data out the drag data as a String,
a URL, a DocumentFragment (for rich content), or a Colour.
* WebCore.exp:
* WebCore.pro:
* WebCore.xcodeproj/project.pbxproj:
* dom/Clipboard.cpp: Added.
(WebCore::Clipboard::setAccessPolicy):
(WebCore::dragOpFromIEOp):
(WebCore::IEOpFromDragOp):
(WebCore::Clipboard::sourceOperation):
(WebCore::Clipboard::destinationOperation):
(WebCore::Clipboard::setSourceOperation):
(WebCore::Clipboard::setDestinationOperation):
(WebCore::Clipboard::setDropEffect):
(WebCore::Clipboard::setEffectAllowed):
move platform independent functions from ClipboardMac to Clipboard
* dom/Clipboard.h:
(WebCore::Clipboard::Clipboard):
(WebCore::Clipboard::dropEffect):
(WebCore::Clipboard::effectAllowed):
(WebCore::Clipboard::policy):
as above -- also removed virtual modifier from now
platform independent methods
* editing/Editor.cpp:
(WebCore::Editor::smartInsertDeleteEnabled):
(WebCore::Editor::shouldApplyStyle):
* editing/Editor.h:
adding calls through to EditorClient
* page/DragActions.h: Added.
(WebCore::):
Replicates a number of NS* enums in the WebCore namespace
* page/DragClient.h: Added.
(WebCore::DragClient::~DragClient):
Standard client interface for dragging UIDelegate
* page/DragController.cpp: Added.
(WebCore::createMouseEvent):
(WebCore::DragController::DragController):
(WebCore::DragController::~DragController):
(WebCore::documentFragmentFromDragData):
(WebCore::DragController::isMoveDrag):
(WebCore::visiblePositionForPoint):
(WebCore::DragController::cancelDrag):
(WebCore::documentAtPoint):
(WebCore::DragController::dragEntered):
(WebCore::DragController::dragExited):
(WebCore::DragController::dragUpdated):
(WebCore::DragController::performDrag):
(WebCore::DragController::dragEnteredOrUpdated):
(WebCore::DragController::tryDocumentDrag):
(WebCore::DragController::operationForLoad):
(WebCore::DragController::concludeDrag):
(WebCore::DragController::canProcessDrag):
(WebCore::DragController::tryDHTMLDrag):
Class to handle state and logic for dragging and dropping
* page/DragController.h: Added.
(WebCore::DragController::client):
(WebCore::DragController::didInitiateDrag):
(WebCore::DragController::isHandlingDrag):
(WebCore::DragController::dragOperation):
(WebCore::DragController::document):
(WebCore::DragController::dragInitiator):
(WebCore::DragController::dragDestinationAction):
(WebCore::DragController::dragSourceAction):
(WebCore::DragController::dragEnded):
(WebCore::DragController::setIsHandlingDrag):
(WebCore::DragController::setDidInitiateDrag):
(WebCore::DragController::setDragOperation):
(WebCore::DragController::setDragSourceAction):
(WebCore::DragController::setDragInitiator):
See above
* page/Page.cpp:
(WebCore::Page::Page):
Update Page to have DragController
* page/Page.h:
(WebCore::Page::dragController):
ditto
* page/mac/DragControllerMac.mm: Added.
(WebCore::DragController::isCopyKeyDown):
(WebCore::DragController::dragOperation):
Platform specific portions of the DragController
* page/mac/EventHandlerMac.mm:
(WebCore::EventHandler::handleDrag):
(WebCore::EventHandler::dragSourceEndedAt):
Convert from NSDragOperation to WebCore::DragOperation
* page/mac/WebCoreFrameBridge.h:
* page/mac/WebCoreFrameBridge.mm:
Remove obsolete Drag functions
* page/qt/DragControllerQt.cpp: Added.
(WebCore::DragController::isCopyKeyDown):
(WebCore::DragController::dragOperation):
Basic stubs to maintain Qt build
* platform/DragData.cpp: Added.
(WebCore::DragData::DragData):
* platform/DragData.h: Added.
(WebCore::DragData::clientPosition):
(WebCore::DragData::globalPosition):
(WebCore::DragData::platformData):
(WebCore::DragData::draggingSourceOperationMask):
DragData class to encapsulate platform drag data/event
* platform/graphics/svg/SVGImage.cpp:
(WebCore::SVGImage::setData):
Addition of dummy DragClient
* platform/graphics/svg/SVGImageEmptyClients.h:
(WebCore::SVGEmptyDragClient::~SVGEmptyDragClient):
(WebCore::SVGEmptyDragClient::willPerformDragDestinationAction):
(WebCore::SVGEmptyDragClient::actionMaskForDrag):
(WebCore::SVGEmptyDragClient::dragControllerDestroyed):
ditto
* platform/mac/ClipboardMac.h:
* platform/mac/ClipboardMac.mm:
(WebCore::ClipboardMac::ClipboardMac):
(WebCore::ClipboardMac::clearData):
(WebCore::ClipboardMac::clearAllData):
(WebCore::ClipboardMac::getData):
(WebCore::ClipboardMac::setData):
(WebCore::ClipboardMac::types):
(WebCore::ClipboardMac::setDragImage):
Moving platform independent logic to Clipboard, and updating
platform specific methods to use appropriate accessors rather than
directly manipulating data they no longer own
* platform/mac/DragDataMac.mm: Added.
(WebCore::DragData::DragData):
(WebCore::DragData::canSmartReplace):
(WebCore::DragData::containsColor):
(WebCore::DragData::containsPlainText):
(WebCore::DragData::asPlainText):
(WebCore::DragData::asColor):
(WebCore::DragData::createClipboard):
(WebCore::imageExistsAtPaths):
(WebCore::DragData::containsCompatibleContent):
(WebCore::DragData::containsURL):
(WebCore::DragData::asURL):
(WebCore::DragData::asFragment):
Mac implementations of DragData methods. A number of these use
a Helper class that accesses WebKit functionality. That functionality
should be migrated to WebCore in the future.
* platform/mac/PasteboardHelper.h: Added.
(WebCore::PasteboardHelper::~PasteboardHelper):
Temporary, and Mac only, helper class to access WebKit functionality
from WebCore
* platform/qt/DragDataQt.cpp: Added.
(WebCore::DragData::canSmartReplace):
(WebCore::DragData::containsColor):
(WebCore::DragData::containsPlainText):
(WebCore::DragData::asPlainText):
(WebCore::DragData::asColor):
(WebCore::DragData::createClipboard):
(WebCore::DragData::containsCompatibleContent):
(WebCore::DragData::containsURL):
(WebCore::DragData::asURL):
(WebCore::DragData::asFragment):
Basic stubs to maintain Qt build
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::HitTestResult):
Correct HitTestResult copy contructor to copy localPoint
2007-01-22 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej.
......
......@@ -159,6 +159,7 @@ __ZN7WebCore11FrameLoader4loadERKNS_4KURLERKNS_6StringENS_13FrameLoadTypeES6_PNS
__ZN7WebCore11FrameLoader5clearEb
__ZN7WebCore11FrameLoader6reloadEv
__ZN7WebCore11FrameLoader7canLoadERKNS_4KURLERKNS_6StringERb
__ZN7WebCore11globalPointERK8_NSPointP8NSWindow
__ZN7WebCore11HistoryItem12addChildItemEN3WTF10PassRefPtrIS0_EE
__ZN7WebCore11HistoryItem12setURLStringERKNS_6StringE
__ZN7WebCore11HistoryItem12setViewStateEP11objc_object
......@@ -230,6 +231,10 @@ __ZN7WebCore14DocumentLoader32replaceRequestURLForAnchorScrollERKNS_4KURLE
__ZN7WebCore14DocumentLoader7requestEv
__ZN7WebCore14DocumentLoaderC2ERKNS_15ResourceRequestE
__ZN7WebCore14DocumentLoaderD2Ev
__ZN7WebCore14DragController10dragExitedEPNS_8DragDataE
__ZN7WebCore14DragController11dragEnteredEPNS_8DragDataE
__ZN7WebCore14DragController11dragUpdatedEPNS_8DragDataE
__ZN7WebCore14DragController11performDragEPNS_8DragDataE
__ZN7WebCore14ResourceHandle12releaseProxyEv
__ZN7WebCore14ResourceLoader14cancelledErrorEv
__ZN7WebCore15BackForwardList10removeItemEPNS_11HistoryItemE
......@@ -301,7 +306,7 @@ __ZN7WebCore4Page16setDefersLoadingEb
__ZN7WebCore4Page6goBackEv
__ZN7WebCore4Page8goToItemEPNS_11HistoryItemENS_13FrameLoadTypeE
__ZN7WebCore4Page9goForwardEv
__ZN7WebCore4PageC1EPNS_12ChromeClientEPNS_17ContextMenuClientEPNS_12EditorClientE
__ZN7WebCore4PageC1EPNS_12ChromeClientEPNS_17ContextMenuClientEPNS_12EditorClientEPNS_10DragClientE
__ZN7WebCore4PageD1Ev
__ZN7WebCore5Cache11setDisabledEb
__ZN7WebCore5Cache13getStatisticsEv
......@@ -351,6 +356,7 @@ __ZN7WebCore8Document11completeURLERKNS_16DeprecatedStringE
__ZN7WebCore8Document13removeMarkersENS_14DocumentMarker10MarkerTypeE
__ZN7WebCore8Document14setFocusedNodeEN3WTF10PassRefPtrINS_4NodeEEE
__ZN7WebCore8Document4bodyEv
__ZN7WebCore8DragDataC1EP11objc_objectRKNS_8IntPointES5_NS_13DragOperationEPNS_16PasteboardHelperE
__ZN7WebCore8FrameMac18windowScriptObjectEv
__ZN7WebCore8FrameMac20windowScriptNPObjectEv
__ZN7WebCore8FrameMac26dashboardRegionsDictionaryEv
......
......@@ -468,9 +468,11 @@ SOURCES += \
page/PageState.cpp \
page/ContextMenuController.cpp \
page/EventHandler.cpp \
page/DragController.cpp \
page/qt/EventHandlerQt.cpp \
page/qt/FrameQt.cpp \
page/qt/FrameQtClient.cpp \
page/qt/DragControllerQt.cpp \
xml/XPathUtil.cpp \
xml/XPathPredicate.cpp \
xml/XPathVariableReference.cpp \
......@@ -517,6 +519,7 @@ SOURCES += \
loader/qt/FrameLoaderQt.cpp \
loader/qt/DocumentLoaderQt.cpp \
platform/CString.cpp \
platform/DragData.cpp \
platform/AtomicString.cpp \
platform/Base64.cpp \
platform/graphics/AffineTransform.cpp \
......@@ -580,6 +583,7 @@ SOURCES += \
platform/qt/ContextMenuQt.cpp \
platform/qt/ContextMenuItemQt.cpp \
platform/qt/PasteboardQt.cpp \
platform/qt/DragDataQt.cpp \
platform/ContextMenu.cpp \
# platform/SearchPopupMenu.cpp \
platform/qt/SearchPopupMenuQt.cpp \
......@@ -680,6 +684,7 @@ SOURCES += \
../WebKitQt/WebCoreSupport/EditorClientQt.cpp \
../WebKitQt/WebCoreSupport/ChromeClientQt.cpp \
../WebKitQt/WebCoreSupport/ContextMenuClientQt.cpp \
../WebKitQt/WebCoreSupport/DragClientQt.cpp \
../WebKitQt/Api/qwebpage.cpp \
../WebKitQt/Api/qwebframe.cpp
......
This diff is collapsed.
/*
* Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "Clipboard.h"
namespace WebCore {
void Clipboard::setAccessPolicy(ClipboardAccessPolicy policy)
{
// once you go numb, can never go back
ASSERT(m_policy != ClipboardNumb || policy == ClipboardNumb);
m_policy = policy;
}
// These "conversion" methods are called by both WebCore and WebKit, and never make sense to JS, so we don't
// worry about security for these. They don't allow access to the pasteboard anyway.
static DragOperation dragOpFromIEOp(const String& op)
{
// yep, it's really just this fixed set
if (op == "none")
return DragOperationNone;
if (op == "copy")
return DragOperationCopy;
if (op == "link")
return DragOperationLink;
if (op == "move")
return DragOperationGeneric;
if (op == "copyLink")
return (DragOperation)(DragOperationCopy | DragOperationLink);
if (op == "copyMove")
return (DragOperation)(DragOperationCopy | DragOperationGeneric | DragOperationMove);
if (op == "linkMove")
return (DragOperation)(DragOperationLink | DragOperationGeneric | DragOperationMove);
if (op == "all")
return DragOperationEvery;
return DragOperationPrivate; // really a marker for "no conversion"
}
static String IEOpFromDragOp(DragOperation op)
{
bool moveSet = !!((DragOperationGeneric | DragOperationMove) & op);
if ((moveSet && (op & DragOperationCopy) && (op & DragOperationLink))
|| (op == DragOperationEvery))
return "all";
if (moveSet && (op & DragOperationCopy))
return "copyMove";
if (moveSet && (op & DragOperationLink))
return "linkMove";
if ((op & DragOperationCopy) && (op & DragOperationLink))
return "copyLink";
if (moveSet)
return "move";
if (op & DragOperationCopy)
return "copy";
if (op & DragOperationLink)
return "link";
return "none";
}
bool Clipboard::sourceOperation(DragOperation& op) const
{
if (m_effectAllowed.isNull())
return false;
op = dragOpFromIEOp(m_effectAllowed);
return true;
}
bool Clipboard::destinationOperation(DragOperation& op) const
{
if (m_dropEffect.isNull())
return false;
op = dragOpFromIEOp(m_dropEffect);
return true;
}
void Clipboard::setSourceOperation(DragOperation op)
{
m_effectAllowed = IEOpFromDragOp(op);
}
void Clipboard::setDestinationOperation(DragOperation op)
{
m_dropEffect = IEOpFromDragOp(op);
}
void Clipboard::setDropEffect(const String &effect)
{
if (m_policy == ClipboardReadable || m_policy == ClipboardTypesReadable) {
m_dropEffect = effect;
}
}
void Clipboard::setEffectAllowed(const String &effect)
{
if (m_policy == ClipboardWritable)
m_effectAllowed = effect;
}
}
......@@ -29,6 +29,7 @@
#include <wtf/HashSet.h>
#include "AtomicString.h"
#include "ClipboardAccessPolicy.h"
#include "DragActions.h"
#include "Node.h"
#include "Shared.h"
......@@ -40,15 +41,16 @@ namespace WebCore {
// State available during IE's events for drag and drop and copy/paste
class Clipboard : public Shared<Clipboard> {
public:
Clipboard(ClipboardAccessPolicy policy) : m_policy(policy) { }
virtual ~Clipboard() { }
// Is this operation a drag-drop or a copy-paste?
virtual bool isForDragging() const = 0;
virtual String dropEffect() const = 0;
virtual void setDropEffect(const String&) = 0;
virtual String effectAllowed() const = 0;
virtual void setEffectAllowed(const String&) = 0;
String dropEffect() const { return m_dropEffect; }
void setDropEffect(const String&);
String effectAllowed() const { return m_effectAllowed; }
void setEffectAllowed(const String&);
virtual void clearData(const String& type) = 0;
virtual void clearAllData() = 0;
......@@ -64,7 +66,20 @@ namespace WebCore {
virtual Node* dragImageElement() = 0;
virtual void setDragImageElement(Node*, const IntPoint&) = 0;
virtual void setAccessPolicy(ClipboardAccessPolicy) = 0;
void setAccessPolicy(ClipboardAccessPolicy);
bool sourceOperation(DragOperation&) const;
bool destinationOperation(DragOperation&) const;
void setSourceOperation(DragOperation);
void setDestinationOperation(DragOperation);
protected:
ClipboardAccessPolicy policy() const { return m_policy; }
private:
ClipboardAccessPolicy m_policy;
String m_dropEffect;
String m_effectAllowed;
};
} // namespace WebCore
......
......@@ -148,6 +148,13 @@ bool Editor::canDeleteRange(Range* range) const
return true;
}
bool Editor::smartInsertDeleteEnabled()
{
if (client())
return client()->smartInsertDeleteEnabled();
return false;
}
bool Editor::canSmartCopyOrDelete()
{
if (client())
......@@ -523,7 +530,12 @@ void Editor::applyStyle(CSSStyleDeclaration* style, EditAction editingAction)
break;
}
}
bool Editor::shouldApplyStyle(CSSStyleDeclaration* style, Range* range)
{
return client()->shouldApplyStyle(style, range);
}
void Editor::applyParagraphStyle(CSSStyleDeclaration* style, EditAction editingAction)
{
switch (m_frame->selectionController()->state()) {
......
......@@ -90,10 +90,12 @@ public:
void indent();
void outdent();
bool shouldInsertFragment(PassRefPtr<DocumentFragment> fragment, PassRefPtr<Range> replacingDOMRange, EditorInsertAction givenAction);
bool shouldInsertText(String, Range*, EditorInsertAction) const;
bool shouldShowDeleteInterface(HTMLElement*) const;
bool shouldDeleteRange(Range*) const;
bool shouldApplyStyle(CSSStyleDeclaration*, Range*);
void respondToChangedSelection(const Selection& oldSelection);
void respondToChangedContents(const Selection& endingSelection);
......@@ -170,6 +172,8 @@ public:
void toggleUnderline();
void setBaseWritingDirection(String);
bool smartInsertDeleteEnabled();
#if PLATFORM(MAC)
NSString* userVisibleString(NSURL*);
void setStartNewKillRingSequence(bool flag) { m_startNewKillRingSequence = flag; }
......@@ -190,7 +194,6 @@ private:
void pasteWithPasteboard(Pasteboard*, bool allowPlainText);
void replaceSelectionWithFragment(PassRefPtr<DocumentFragment> fragment, bool selectReplacement, bool smartReplace, bool matchStyle);
void replaceSelectionWithText(String text, bool selectReplacement, bool smartReplace);
bool shouldInsertFragment(PassRefPtr<DocumentFragment> fragment, PassRefPtr<Range> replacingDOMRange, EditorInsertAction givenAction);
void writeSelectionToPasteboard(Pasteboard*);
#if PLATFORM(MAC)
......
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef DragActions_h
#define DragActions_h
namespace WebCore {
// WebCoreDragDestinationAction should be kept in sync with WebDragDestinationAction
typedef enum {
DragDestinationActionNone = 0,
DragDestinationActionDHTML = 1,
DragDestinationActionEdit = 2,
DragDestinationActionLoad = 4,
DragDestinationActionAny = UINT_MAX
} DragDestinationAction;
// WebCoreDragSourceAction should be kept in sync with WebDragSourceAction
typedef enum {
DragSourceActionNone = 0,
DragSourceActionDHTML = 1,
DragSourceActionImage = 2,
DragSourceActionLink = 4,
DragSourceActionSelection = 8,
DragSourceActionAny = UINT_MAX
} DragSourceAction;
//matches NSDragOperation
typedef enum {
DragOperationNone = 0,
DragOperationCopy = 1,
DragOperationLink = 2,
DragOperationGeneric = 4,
DragOperationPrivate = 8,
DragOperationMove = 16,
DragOperationDelete = 32,
DragOperationEvery = UINT_MAX
} DragOperation;
}
#endif // !DragActions_h
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef DragClient_h
#define DragClient_h
#include "DragActions.h"
#include "IntPoint.h"
namespace WebCore {
class DragData;
class DragClient {
public:
virtual void willPerformDragDestinationAction(DragDestinationAction, DragData*) = 0;
virtual DragDestinationAction actionMaskForDrag(DragData*) = 0;
virtual void dragControllerDestroyed() = 0;
virtual ~DragClient() {};
};
}
#endif // !DragClient_h
This diff is collapsed.
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef DragController_h
#define DragController_h
#include "DragActions.h"
namespace WebCore {