Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (93842 => 93843)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2011-08-26 00:41:09 UTC (rev 93842)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2011-08-26 00:51:06 UTC (rev 93843)
@@ -79,15 +79,6 @@
#include <WebCore/WindowFeatures.h>
#include <stdio.h>
-#if PLATFORM(WIN)
-#include "WebDragSource.h"
-#include <WebCore/BitmapInfo.h>
-#include <WebCore/ClipboardUtilitiesWin.h>
-#include <WebCore/COMPtr.h>
-#include <WebCore/WCDataObject.h>
-#include <shlobj.h>
-#endif
-
#if PLATFORM(QT)
#include "ArgumentCodersQt.h"
#endif
@@ -737,44 +728,6 @@
process()->send(Messages::WebPage::ExecuteEditCommand(commandName), m_pageID);
}
-#if PLATFORM(WIN)
-IntRect WebPageProxy::firstRectForCharacterInSelectedRange(int characterPosition)
-{
- IntRect resultRect;
- process()->sendSync(Messages::WebPage::FirstRectForCharacterInSelectedRange(characterPosition), Messages::WebPage::FirstRectForCharacterInSelectedRange::Reply(resultRect), m_pageID);
- return resultRect;
-}
-
-String WebPageProxy::getSelectedText()
-{
- String text;
- process()->sendSync(Messages::WebPage::GetSelectedText(), Messages::WebPage::GetSelectedText::Reply(text), m_pageID);
- return text;
-}
-
-bool WebPageProxy::gestureWillBegin(const IntPoint& point)
-{
- bool canBeginPanning = false;
- process()->sendSync(Messages::WebPage::GestureWillBegin(point), Messages::WebPage::GestureWillBegin::Reply(canBeginPanning), m_pageID);
- return canBeginPanning;
-}
-
-void WebPageProxy::gestureDidScroll(const IntSize& size)
-{
- process()->send(Messages::WebPage::GestureDidScroll(size), m_pageID);
-}
-
-void WebPageProxy::gestureDidEnd()
-{
- process()->send(Messages::WebPage::GestureDidEnd(), m_pageID);
-}
-
-void WebPageProxy::setGestureReachedScrollingLimit(bool limitReached)
-{
- m_pageClient->setGestureReachedScrollingLimit(limitReached);
-}
-#endif
-
#if ENABLE(TILED_BACKING_STORE)
void WebPageProxy::setFixedVisibleContentRect(const IntRect& rect)
{
@@ -828,68 +781,6 @@
m_currentDragOperation = static_cast<DragOperation>(resultOperation);
}
-#if PLATFORM(WIN)
-
-void WebPageProxy::startDragDrop(const IntPoint& imageOrigin, const IntPoint& dragPoint, uint64_t okEffect, const HashMap<UINT, Vector<String> >& dataMap, uint64_t fileSize, const String& pathname, const SharedMemory::Handle& fileContentHandle, const IntSize& dragImageSize, const SharedMemory::Handle& dragImageHandle, bool isLinkDrag)
-{
- COMPtr<WCDataObject> dataObject;
- WCDataObject::createInstance(&dataObject, dataMap);
-
- if (fileSize) {
- RefPtr<SharedMemory> fileContentBuffer = SharedMemory::create(fileContentHandle, SharedMemory::ReadOnly);
- setFileDescriptorData(dataObject.get(), fileSize, pathname);
- setFileContentData(dataObject.get(), fileSize, fileContentBuffer->data());
- }
-
- RefPtr<SharedMemory> memoryBuffer = SharedMemory::create(dragImageHandle, SharedMemory::ReadOnly);
- if (!memoryBuffer)
- return;
-
- RefPtr<WebDragSource> source = WebDragSource::createInstance();
- if (!source)
- return;
-
- COMPtr<IDragSourceHelper> helper;
- if (FAILED(::CoCreateInstance(CLSID_DragDropHelper, 0, CLSCTX_INPROC_SERVER, IID_IDragSourceHelper, reinterpret_cast<LPVOID*>(&helper))))
- return;
-
- BitmapInfo bitmapInfo = BitmapInfo::create(dragImageSize);
- void* bits;
- OwnPtr<HBITMAP> hbmp = adoptPtr(::CreateDIBSection(0, &bitmapInfo, DIB_RGB_COLORS, &bits, 0, 0));
- memcpy(bits, memoryBuffer->data(), memoryBuffer->size());
-
- SHDRAGIMAGE sdi;
- sdi.sizeDragImage.cx = bitmapInfo.bmiHeader.biWidth;
- sdi.sizeDragImage.cy = bitmapInfo.bmiHeader.biHeight;
- sdi.crColorKey = 0xffffffff;
- sdi.hbmpDragImage = hbmp.leakPtr();
- sdi.ptOffset.x = dragPoint.x() - imageOrigin.x();
- sdi.ptOffset.y = dragPoint.y() - imageOrigin.y();
- if (isLinkDrag)
- sdi.ptOffset.y = bitmapInfo.bmiHeader.biHeight - sdi.ptOffset.y;
-
- helper->InitializeFromBitmap(&sdi, dataObject.get());
-
- DWORD effect = DROPEFFECT_NONE;
-
- DragOperation operation = DragOperationNone;
- if (::DoDragDrop(dataObject.get(), source.get(), okEffect, &effect) == DRAGDROP_S_DROP) {
- if (effect & DROPEFFECT_COPY)
- operation = DragOperationCopy;
- else if (effect & DROPEFFECT_LINK)
- operation = DragOperationLink;
- else if (effect & DROPEFFECT_MOVE)
- operation = DragOperationMove;
- }
- POINT globalPoint;
- ::GetCursorPos(&globalPoint);
- POINT localPoint = globalPoint;
- ::ScreenToClient(m_pageClient->nativeWindow(), &localPoint);
-
- dragEnded(localPoint, globalPoint, operation);
-}
-#endif
-
#if PLATFORM(QT)
void WebPageProxy::startDrag(const DragData& dragData, const ShareableBitmap::Handle& dragImageHandle)
{
@@ -2309,23 +2200,6 @@
#endif
}
-#if PLATFORM(WIN)
-void WebPageProxy::didChangeCompositionSelection(bool hasComposition)
-{
- m_pageClient->compositionSelectionChanged(hasComposition);
-}
-
-void WebPageProxy::confirmComposition(const String& compositionString)
-{
- process()->send(Messages::WebPage::ConfirmComposition(compositionString), m_pageID);
-}
-
-void WebPageProxy::setComposition(const String& compositionString, Vector<CompositionUnderline>& underlines, int cursorPosition)
-{
- process()->send(Messages::WebPage::SetComposition(compositionString, underlines, cursorPosition), m_pageID);
-}
-#endif
-
// Undo management
void WebPageProxy::registerEditCommandForUndo(uint64_t commandID, uint32_t editAction)
Modified: trunk/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp (93842 => 93843)
--- trunk/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp 2011-08-26 00:41:09 UTC (rev 93842)
+++ trunk/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp 2011-08-26 00:51:06 UTC (rev 93843)
@@ -27,12 +27,19 @@
#include "WebPageProxy.h"
#include "PageClient.h"
+#include "WebDragSource.h"
+#include "WebPageMessages.h"
#include "WebPopupMenuProxyWin.h"
+#include "WebProcessProxy.h"
#include "resource.h"
-#include <tchar.h>
+#include <WebCore/BitmapInfo.h>
+#include <WebCore/COMPtr.h>
+#include <WebCore/ClipboardUtilitiesWin.h>
#include <WebCore/SystemInfo.h>
+#include <WebCore/WCDataObject.h>
#include <WebCore/WebCoreInstanceHandle.h>
+#include <tchar.h>
#include <wtf/StdLibExtras.h>
#include <wtf/text/StringConcatenate.h>
@@ -80,4 +87,115 @@
m_pageClient->didInstallOrUninstallPageOverlay(didInstall);
}
+IntRect WebPageProxy::firstRectForCharacterInSelectedRange(int characterPosition)
+{
+ IntRect resultRect;
+ process()->sendSync(Messages::WebPage::FirstRectForCharacterInSelectedRange(characterPosition), Messages::WebPage::FirstRectForCharacterInSelectedRange::Reply(resultRect), m_pageID);
+ return resultRect;
+}
+
+String WebPageProxy::getSelectedText()
+{
+ String text;
+ process()->sendSync(Messages::WebPage::GetSelectedText(), Messages::WebPage::GetSelectedText::Reply(text), m_pageID);
+ return text;
+}
+
+bool WebPageProxy::gestureWillBegin(const IntPoint& point)
+{
+ bool canBeginPanning = false;
+ process()->sendSync(Messages::WebPage::GestureWillBegin(point), Messages::WebPage::GestureWillBegin::Reply(canBeginPanning), m_pageID);
+ return canBeginPanning;
+}
+
+void WebPageProxy::gestureDidScroll(const IntSize& size)
+{
+ process()->send(Messages::WebPage::GestureDidScroll(size), m_pageID);
+}
+
+void WebPageProxy::gestureDidEnd()
+{
+ process()->send(Messages::WebPage::GestureDidEnd(), m_pageID);
+}
+
+void WebPageProxy::setGestureReachedScrollingLimit(bool limitReached)
+{
+ m_pageClient->setGestureReachedScrollingLimit(limitReached);
+}
+
+void WebPageProxy::startDragDrop(const IntPoint& imageOrigin, const IntPoint& dragPoint, uint64_t okEffect, const HashMap<UINT, Vector<String> >& dataMap, uint64_t fileSize, const String& pathname, const SharedMemory::Handle& fileContentHandle, const IntSize& dragImageSize, const SharedMemory::Handle& dragImageHandle, bool isLinkDrag)
+{
+ COMPtr<WCDataObject> dataObject;
+ WCDataObject::createInstance(&dataObject, dataMap);
+
+ if (fileSize) {
+ RefPtr<SharedMemory> fileContentBuffer = SharedMemory::create(fileContentHandle, SharedMemory::ReadOnly);
+ setFileDescriptorData(dataObject.get(), fileSize, pathname);
+ setFileContentData(dataObject.get(), fileSize, fileContentBuffer->data());
+ }
+
+ RefPtr<SharedMemory> memoryBuffer = SharedMemory::create(dragImageHandle, SharedMemory::ReadOnly);
+ if (!memoryBuffer)
+ return;
+
+ RefPtr<WebDragSource> source = WebDragSource::createInstance();
+ if (!source)
+ return;
+
+ COMPtr<IDragSourceHelper> helper;
+ if (FAILED(::CoCreateInstance(CLSID_DragDropHelper, 0, CLSCTX_INPROC_SERVER, IID_IDragSourceHelper, reinterpret_cast<LPVOID*>(&helper))))
+ return;
+
+ BitmapInfo bitmapInfo = BitmapInfo::create(dragImageSize);
+ void* bits;
+ OwnPtr<HBITMAP> hbmp = adoptPtr(::CreateDIBSection(0, &bitmapInfo, DIB_RGB_COLORS, &bits, 0, 0));
+ memcpy(bits, memoryBuffer->data(), memoryBuffer->size());
+
+ SHDRAGIMAGE sdi;
+ sdi.sizeDragImage.cx = bitmapInfo.bmiHeader.biWidth;
+ sdi.sizeDragImage.cy = bitmapInfo.bmiHeader.biHeight;
+ sdi.crColorKey = 0xffffffff;
+ sdi.hbmpDragImage = hbmp.leakPtr();
+ sdi.ptOffset.x = dragPoint.x() - imageOrigin.x();
+ sdi.ptOffset.y = dragPoint.y() - imageOrigin.y();
+ if (isLinkDrag)
+ sdi.ptOffset.y = bitmapInfo.bmiHeader.biHeight - sdi.ptOffset.y;
+
+ helper->InitializeFromBitmap(&sdi, dataObject.get());
+
+ DWORD effect = DROPEFFECT_NONE;
+
+ DragOperation operation = DragOperationNone;
+ if (::DoDragDrop(dataObject.get(), source.get(), okEffect, &effect) == DRAGDROP_S_DROP) {
+ if (effect & DROPEFFECT_COPY)
+ operation = DragOperationCopy;
+ else if (effect & DROPEFFECT_LINK)
+ operation = DragOperationLink;
+ else if (effect & DROPEFFECT_MOVE)
+ operation = DragOperationMove;
+ }
+ POINT globalPoint;
+ ::GetCursorPos(&globalPoint);
+ POINT localPoint = globalPoint;
+ ::ScreenToClient(m_pageClient->nativeWindow(), &localPoint);
+
+ dragEnded(localPoint, globalPoint, operation);
+}
+
+void WebPageProxy::didChangeCompositionSelection(bool hasComposition)
+{
+ m_pageClient->compositionSelectionChanged(hasComposition);
+}
+
+void WebPageProxy::confirmComposition(const String& compositionString)
+{
+ process()->send(Messages::WebPage::ConfirmComposition(compositionString), m_pageID);
+}
+
+void WebPageProxy::setComposition(const String& compositionString, Vector<CompositionUnderline>& underlines, int cursorPosition)
+{
+ process()->send(Messages::WebPage::SetComposition(compositionString, underlines, cursorPosition), m_pageID);
+}
+
+
} // namespace WebKit