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
......
......@@ -1641,10 +1641,20 @@
A70023FD0B02BEAB00170215 /* MimeTypeRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A70023FB0B02BEAB00170215 /* MimeTypeRegistry.cpp */; };
A70023FE0B02BEAB00170215 /* MimeTypeRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = A70023FC0B02BEAB00170215 /* MimeTypeRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
A70024000B02BECC00170215 /* MimeTypeRegistryMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A70023FF0B02BECC00170215 /* MimeTypeRegistryMac.mm */; };
A718760E0B2A120100A16ECE /* DragActions.h in Headers */ = {isa = PBXBuildFile; fileRef = A718760D0B2A120100A16ECE /* DragActions.h */; settings = {ATTRIBUTES = (Private, ); }; };
A71878900B2D04AC00A16ECE /* DragControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */; };
A7352C190B1BB89D00A986D0 /* RenderSVGBlock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7352C170B1BB89D00A986D0 /* RenderSVGBlock.cpp */; };
A7352C1A0B1BB89D00A986D0 /* RenderSVGBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = A7352C180B1BB89D00A986D0 /* RenderSVGBlock.h */; };
A7638A970995965D0007E14F /* SVGFEDisplacementMapElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A7638A950995965D0007E14F /* SVGFEDisplacementMapElement.h */; };
A7638A980995965D0007E14F /* SVGFEDisplacementMapElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7638A960995965D0007E14F /* SVGFEDisplacementMapElement.cpp */; };
A784941B0B5FE507001E237A /* Clipboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A784941A0B5FE507001E237A /* Clipboard.cpp */; };
A795463E0B5C4C80007B438F /* DragDataMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A795463D0B5C4C80007B438F /* DragDataMac.mm */; };
A79546430B5C4CB4007B438F /* DragData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A79546420B5C4CB4007B438F /* DragData.cpp */; };
A7B6E69F0B291A9600D0529F /* DragData.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B6E69D0B291A9600D0529F /* DragData.h */; settings = {ATTRIBUTES = (Private, ); }; };
A7CA595D0B27BD9E00FA021D /* DragController.h in Headers */ = {isa = PBXBuildFile; fileRef = A7CA595B0B27BD9E00FA021D /* DragController.h */; settings = {ATTRIBUTES = (Private, ); }; };
A7CA595E0B27BD9E00FA021D /* DragController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7CA595C0B27BD9E00FA021D /* DragController.cpp */; };
A7CA59630B27C1F200FA021D /* DragClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A7CA59620B27C1F200FA021D /* DragClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
A7D3C5240B576B4B002CA450 /* PasteboardHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D3C5230B576B4B002CA450 /* PasteboardHelper.h */; settings = {ATTRIBUTES = (Private, ); }; };
A80CEBAC0B60FC49007637C1 /* SVGMPathElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A80CEBAA0B60FC49007637C1 /* SVGMPathElement.h */; };
A80CEBAD0B60FC49007637C1 /* SVGMPathElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A80CEBAB0B60FC49007637C1 /* SVGMPathElement.cpp */; };
A80E6CE40A1989CA007FB8C5 /* CSSValueList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A80E6CBA0A1989CA007FB8C5 /* CSSValueList.cpp */; };
......@@ -4627,10 +4637,20 @@
A70023FB0B02BEAB00170215 /* MimeTypeRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MimeTypeRegistry.cpp; sourceTree = "<group>"; };
A70023FC0B02BEAB00170215 /* MimeTypeRegistry.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MimeTypeRegistry.h; sourceTree = "<group>"; };
A70023FF0B02BECC00170215 /* MimeTypeRegistryMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = MimeTypeRegistryMac.mm; sourceTree = "<group>"; };
A718760D0B2A120100A16ECE /* DragActions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragActions.h; sourceTree = "<group>"; };
A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DragControllerMac.mm; sourceTree = "<group>"; };
A7352C170B1BB89D00A986D0 /* RenderSVGBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGBlock.cpp; sourceTree = "<group>"; };
A7352C180B1BB89D00A986D0 /* RenderSVGBlock.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderSVGBlock.h; sourceTree = "<group>"; };
A7638A950995965D0007E14F /* SVGFEDisplacementMapElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGFEDisplacementMapElement.h; sourceTree = "<group>"; };
A7638A960995965D0007E14F /* SVGFEDisplacementMapElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFEDisplacementMapElement.cpp; sourceTree = "<group>"; };
A784941A0B5FE507001E237A /* Clipboard.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Clipboard.cpp; sourceTree = "<group>"; };
A795463D0B5C4C80007B438F /* DragDataMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DragDataMac.mm; sourceTree = "<group>"; };
A79546420B5C4CB4007B438F /* DragData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DragData.cpp; sourceTree = "<group>"; };
A7B6E69D0B291A9600D0529F /* DragData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragData.h; sourceTree = "<group>"; };
A7CA595B0B27BD9E00FA021D /* DragController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragController.h; sourceTree = "<group>"; };
A7CA595C0B27BD9E00FA021D /* DragController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DragController.cpp; sourceTree = "<group>"; };
A7CA59620B27C1F200FA021D /* DragClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragClient.h; sourceTree = "<group>"; };
A7D3C5230B576B4B002CA450 /* PasteboardHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PasteboardHelper.h; sourceTree = "<group>"; };
A80CEBAA0B60FC49007637C1 /* SVGMPathElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMPathElement.h; sourceTree = "<group>"; };
A80CEBAB0B60FC49007637C1 /* SVGMPathElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGMPathElement.cpp; sourceTree = "<group>"; };
A80E6CBA0A1989CA007FB8C5 /* CSSValueList.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSSValueList.cpp; sourceTree = "<group>"; };
......@@ -6745,6 +6765,7 @@
6582A14809999D6C00BEEB6D /* mac */ = {
isa = PBXGroup;
children = (
A795463D0B5C4C80007B438F /* DragDataMac.mm */,
06027CB20B1CC03D00884B2D /* ContextMenuItemMac.mm */,
65A640F00533BB1F0085E777 /* BlockExceptions.h */,
65F80697054D9F86008BF776 /* BlockExceptions.mm */,
......@@ -6805,6 +6826,7 @@
BC6DADF90A19602B00E5CD14 /* WebFontCache.mm */,
935C477209AC4D7700A6AAB4 /* WheelEventMac.mm */,
9380F47709A11ACC001FDB34 /* WidgetMac.mm */,
A7D3C5230B576B4B002CA450 /* PasteboardHelper.h */,
);
path = mac;
sourceTree = "<group>";
......@@ -6844,6 +6866,10 @@
93E22A720AF5E94C00D48324 /* PageState.h */,
65D1C1C909932B22000CB324 /* Plugin.h */,
F587863A02DE3A1401EA4122 /* Settings.h */,
A7CA595B0B27BD9E00FA021D /* DragController.h */,
A7CA595C0B27BD9E00FA021D /* DragController.cpp */,
A7CA59620B27C1F200FA021D /* DragClient.h */,
A718760D0B2A120100A16ECE /* DragActions.h */,
14C9A5E90B3D105F005A0232 /* Settings.cpp */,
);
path = page;
......@@ -7854,6 +7880,7 @@
isa = PBXGroup;
children = (
93C09A7E0B064EEF005ABD4D /* EventHandlerMac.mm */,
A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */,
65BF023B0974819000C43196 /* FrameMac.h */,
65BF023C0974819000C43196 /* FrameMac.mm */,
654EC60F097778F500DAB52C /* WebCoreFrameBridge.h */,
......@@ -8982,6 +9009,7 @@
F58786C202DE3B8601EA4122 /* DeprecatedValueList.h */,
F587853C02DE375901EA4122 /* DeprecatedValueListImpl.cpp */,
F587853B02DE375901EA4122 /* DeprecatedValueListImpl.h */,
A7B6E69D0B291A9600D0529F /* DragData.h */,
934FE9E40B5CA539003E4A73 /* FileChooser.cpp */,
066C772A0AB603B700238CC4 /* FileChooser.h */,
BC6D6DD009AF906600F59759 /* Font.cpp */,
......@@ -9066,6 +9094,7 @@
9380F47109A11AB4001FDB34 /* Widget.cpp */,
9380F47209A11AB4001FDB34 /* Widget.h */,
93B780C909B3B7FE00690162 /* WidgetClient.h */,
A79546420B5C4CB4007B438F /* DragData.cpp */,
);
path = platform;
sourceTree = "<group>";
......@@ -9403,6 +9432,7 @@
F523D32402DE4478018635CA /* dom */ = {
isa = PBXGroup;
children = (
A784941A0B5FE507001E237A /* Clipboard.cpp */,
BC3B364705C9D5E200E42902 /* AtomicStringList.h */,
A8C4A7FC09D563270003AC8D /* Attr.cpp */,
A8C4A7FB09D563270003AC8D /* Attr.h */,
......@@ -9560,6 +9590,11 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
A7D3C5240B576B4B002CA450 /* PasteboardHelper.h in Headers */,
A718760E0B2A120100A16ECE /* DragActions.h in Headers */,
A7B6E69F0B291A9600D0529F /* DragData.h in Headers */,
A7CA595D0B27BD9E00FA021D /* DragController.h in Headers */,
A7CA59630B27C1F200FA021D /* DragClient.h in Headers */,
1A3178930B20A81600316987 /* SubresourceLoaderClient.h in Headers */,
93F198E608245E59001E9ABC /* HTMLElement.h in Headers */,
93F198E508245E59001E9ABC /* HTMLDocument.h in Headers */,
......@@ -11056,6 +11091,7 @@
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
knownRegions = (
English,
......@@ -11070,6 +11106,7 @@
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
projectRoot = "";
shouldCheckCompatibility = 1;
targets = (
93F198A508245E59001E9ABC /* WebCore */,
DD041FBE09D9DDBE0010AF2A /* Derived Sources */,
......@@ -12320,10 +12357,12 @@
B2310B760B1F46A200D55D87 /* CgSupport.cpp in Sources */,
B2310B780B1F46A300D55D87 /* RenderPathCg.cpp in Sources */,
B2ED97710B1F55CE00257D0F /* GraphicsContextCG.cpp in Sources */,
A7CA595E0B27BD9E00FA021D /* DragController.cpp in Sources */,
B277B4040B22F37C0004BEC6 /* GraphicsContextMac.mm in Sources */,
ED501DC60B249F2900AE18D9 /* EditorMac.mm in Sources */,
93354A3C0B24F8C9003F6DEA /* UIEventWithKeyState.cpp in Sources */,
E1D8E31A0B29E3B600F4BAF6 /* HTTPParsers.cpp in Sources */,
A71878900B2D04AC00A16ECE /* DragControllerMac.mm in Sources */,
BC18C5D10B2A886F0018461D /* TextBreakIteratorICU.cpp in Sources */,
AA4C3A760B2B1679002334A2 /* StyleElement.cpp in Sources */,
93E2425F0B2B509500C732A1 /* HTMLFrameOwnerElement.cpp in Sources */,
......@@ -12351,6 +12390,8 @@
510F735F0B56C08800A3002A /* AuthenticationChallenge.cpp in Sources */,
510F73610B56C08800A3002A /* Credential.cpp in Sources */,
510F73630B56C08800A3002A /* ProtectionSpace.cpp in Sources */,
A795463E0B5C4C80007B438F /* DragDataMac.mm in Sources */,
A79546430B5C4CB4007B438F /* DragData.cpp in Sources */,
B2CB92420B5BD966009BAA78 /* JSSVGElementInstance.cpp in Sources */,
B2CB92460B5BD97B009BAA78 /* JSSVGElementInstanceList.cpp in Sources */,
B2CB92620B5BDA02009BAA78 /* DOMSVGElementInstance.mm in Sources */,
......@@ -12358,6 +12399,7 @@
B2F273F20B5BFAC50068C956 /* SVGElementInstance.cpp in Sources */,
B2F273F30B5BFAC80068C956 /* SVGElementInstanceList.cpp in Sources */,
1A2A68230B5BEDE70002A480 /* ProgressTracker.cpp in Sources */,
A784941B0B5FE507001E237A /* Clipboard.cpp in Sources */,
934FE9E50B5CA539003E4A73 /* FileChooser.cpp in Sources */,
A80CEBAD0B60FC49007637C1 /* SVGMPathElement.cpp in Sources */,
E1E6EEA40B628DA8005F2F70 /* JSHTMLSelectElement.cpp in Sources */,
......@@ -12406,6 +12448,7 @@
HEADER_SEARCH_PATHS_QUOTED_1 = "\"${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore\"";
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
LINKER_DISPLAYS_MANGLED_NAMES = YES;
OTHER_LDFLAGS = (
"-sub_library",
libobjc,
/*
* 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*);