Title: [91463] trunk/Source/WebKit2
- Revision
- 91463
- Author
- [email protected]
- Date
- 2011-07-21 06:39:34 -0700 (Thu, 21 Jul 2011)
Log Message
[Qt][WK2] Code cleanup for drag-and-drop
https://bugs.webkit.org/show_bug.cgi?id=64916
Reviewed by Andreas Kling.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::startDrag):
Allow receiving a NULL bitmap from the web process.
* UIProcess/qt/qdesktopwebpageproxy.cpp:
(QDesktopWebPageProxy::handleEvent):
Fix typo introduced in http://trac.webkit.org/changeset/90458.
All DnD related events should be GraphicsScene events.
* WebProcess/WebCoreSupport/qt/WebDragClientQt.cpp:
(WebKit::convertQPixmapToShareableBitmap):
Remove hack that creates a 1x1 bitmap.
It is no longer needed after http://trac.webkit.org/changeset/91016.
(WebKit::WebDragClient::startDrag):
Allow sending a NULL bitmap to the UI process.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (91462 => 91463)
--- trunk/Source/WebKit2/ChangeLog 2011-07-21 13:28:12 UTC (rev 91462)
+++ trunk/Source/WebKit2/ChangeLog 2011-07-21 13:39:34 UTC (rev 91463)
@@ -1,3 +1,27 @@
+2011-07-21 Yael Aharon <[email protected]>
+
+ [Qt][WK2] Code cleanup for drag-and-drop
+ https://bugs.webkit.org/show_bug.cgi?id=64916
+
+ Reviewed by Andreas Kling.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::startDrag):
+ Allow receiving a NULL bitmap from the web process.
+
+ * UIProcess/qt/qdesktopwebpageproxy.cpp:
+ (QDesktopWebPageProxy::handleEvent):
+ Fix typo introduced in http://trac.webkit.org/changeset/90458.
+ All DnD related events should be GraphicsScene events.
+
+ * WebProcess/WebCoreSupport/qt/WebDragClientQt.cpp:
+ (WebKit::convertQPixmapToShareableBitmap):
+ Remove hack that creates a 1x1 bitmap.
+ It is no longer needed after http://trac.webkit.org/changeset/91016.
+
+ (WebKit::WebDragClient::startDrag):
+ Allow sending a NULL bitmap to the UI process.
+
2011-07-20 Tim Horton <[email protected]>
Scrollbar color heuristic needs to be hooked up in WebKit1
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (91462 => 91463)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2011-07-21 13:28:12 UTC (rev 91462)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2011-07-21 13:39:34 UTC (rev 91463)
@@ -892,9 +892,12 @@
#if PLATFORM(QT)
void WebPageProxy::startDrag(const DragData& dragData, const ShareableBitmap::Handle& dragImageHandle)
{
- RefPtr<ShareableBitmap> dragImage = ShareableBitmap::create(dragImageHandle);
- if (!dragImage)
- return;
+ RefPtr<ShareableBitmap> dragImage = 0;
+ if (!dragImageHandle.isNull()) {
+ dragImage = ShareableBitmap::create(dragImageHandle);
+ if (!dragImage)
+ return;
+ }
m_pageClient->startDrag(dragData, dragImage.release());
}
Modified: trunk/Source/WebKit2/UIProcess/qt/qdesktopwebpageproxy.cpp (91462 => 91463)
--- trunk/Source/WebKit2/UIProcess/qt/qdesktopwebpageproxy.cpp 2011-07-21 13:28:12 UTC (rev 91462)
+++ trunk/Source/WebKit2/UIProcess/qt/qdesktopwebpageproxy.cpp 2011-07-21 13:39:34 UTC (rev 91463)
@@ -93,13 +93,13 @@
return handleWheelEvent(reinterpret_cast<QGraphicsSceneWheelEvent*>(ev));
case QEvent::GraphicsSceneHoverMove:
return handleHoverMoveEvent(reinterpret_cast<QGraphicsSceneHoverEvent*>(ev));
- case QEvent::DragEnter:
+ case QEvent::GraphicsSceneDragEnter:
return handleDragEnterEvent(reinterpret_cast<QGraphicsSceneDragDropEvent*>(ev));
- case QEvent::DragLeave:
+ case QEvent::GraphicsSceneDragLeave:
return handleDragLeaveEvent(reinterpret_cast<QGraphicsSceneDragDropEvent*>(ev));
- case QEvent::DragMove:
+ case QEvent::GraphicsSceneDragMove:
return handleDragMoveEvent(reinterpret_cast<QGraphicsSceneDragDropEvent*>(ev));
- case QEvent::Drop:
+ case QEvent::GraphicsSceneDrop:
return handleDropEvent(reinterpret_cast<QGraphicsSceneDragDropEvent*>(ev));
}
return QtWebPageProxy::handleEvent(ev);
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebDragClientQt.cpp (91462 => 91463)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebDragClientQt.cpp 2011-07-21 13:28:12 UTC (rev 91462)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebDragClientQt.cpp 2011-07-21 13:39:34 UTC (rev 91463)
@@ -40,15 +40,13 @@
static PassRefPtr<ShareableBitmap> convertQPixmapToShareableBitmap(QPixmap* pixmap)
{
- // FIXME: We need this hack until https://bugs.webkit.org/show_bug.cgi?id=60621 is fixed.
- // We cannot pass a null handle so create a pixmap size 1x1 and send that instead.
- QPixmap p(QSize(1, 1));
- if (pixmap)
- p = *pixmap;
- RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(IntSize(p.size()), ShareableBitmap::SupportsAlpha);
+ if (!pixmap)
+ return 0;
+
+ RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(IntSize(pixmap->size()), ShareableBitmap::SupportsAlpha);
OwnPtr<GraphicsContext> graphicsContext = bitmap->createGraphicsContext();
- graphicsContext->platformContext()->drawPixmap(0, 0, p);
+ graphicsContext->platformContext()->drawPixmap(0, 0, *pixmap);
return bitmap.release();
}
@@ -61,7 +59,7 @@
RefPtr<ShareableBitmap> bitmap = convertQPixmapToShareableBitmap(dragImage);
ShareableBitmap::Handle handle;
- if (!bitmap->createHandle(handle))
+ if (bitmap && !bitmap->createHandle(handle))
return;
m_page->send(Messages::WebPageProxy::StartDrag(dragData, handle));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes