Reviewed by Alice
In order for the drag and drop tests in Windows DRT to pass
we need to support smart cut and paste operations during
drag and drop on windows.
There is no layout test as drag and drop is still unsupported
on windows. Once supported smart drag/drop is tested by existing
tests
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@29597
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2008-01-17 Oliver Hunt <oliver@apple.com>
+
+ Support smart copy and paste during drag and drop
+
+ Reviewed by Alice
+
+ In order for the drag and drop tests in Windows DRT to pass
+ we need to support smart cut and paste operations during
+ drag and drop on windows.
+
+ There is no layout test as drag and drop is still unsupported
+ on windows. Once supported smart drag/drop is tested by existing
+ tests
+
+ * platform/win/ClipboardUtilitiesWin.cpp:
+ (WebCore::smartPasteFormat):
+ * platform/win/ClipboardUtilitiesWin.h:
+ * platform/win/ClipboardWin.cpp:
+ (WebCore::ClipboardWin::writeRange):
+ * platform/win/DragDataWin.cpp:
+
2008-01-17 Oliver Hunt <oliver@apple.com>
Reviewed by Anders.
return &htmlFormat;
}
+FORMATETC* smartPasteFormat()
+{
+ static UINT cf = RegisterClipboardFormat(L"WebKit Smart Paste Format");
+ static FORMATETC htmlFormat = {cf, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
+ return &htmlFormat;
+}
+
static bool urlFromPath(CFStringRef path, String& url)
{
if (!path)
FORMATETC* filenameFormat();
FORMATETC* htmlFormat();
FORMATETC* cfHDropFormat();
+FORMATETC* smartPasteFormat();
DeprecatedCString markupToCF_HTML(const String& markup, const String& srcURL);
String urlToMarkup(const KURL& url, const String& title);
#include "DeprecatedString.h"
#include "Document.h"
#include "DragData.h"
+#include "Editor.h"
#include "Element.h"
#include "EventHandler.h"
#include "Frame.h"
medium.hGlobal = createGlobalData(str);
if (medium.hGlobal && FAILED(m_writableDataObject->SetData(plainTextWFormat(), &medium, TRUE)))
::GlobalFree(medium.hGlobal);
+
+ medium.hGlobal = 0;
+ if (frame->editor()->canSmartCopyOrDelete())
+ m_writableDataObject->SetData(smartPasteFormat(), &medium, TRUE);
}
bool ClipboardWin::hasData()
bool DragData::canSmartReplace() const
{
- return false;
+ return SUCCEEDED(m_platformDragData->QueryGetData(smartPasteFormat()));
}
bool DragData::containsCompatibleContent() const