[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

andreas.kling at nokia.com andreas.kling at nokia.com
Wed Dec 22 16:17:30 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit e6fb0ea80df9b353ce02ec3757d8a5e12b299ed7
Author: andreas.kling at nokia.com <andreas.kling at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Nov 21 06:36:37 2010 +0000

    2010-11-20  Andreas Kling  <kling at webkit.org>
    
            Reviewed by Antonio Gomes.
    
            [Qt] Dragging a selection should use a rendering of the selection as "cursor" for the drag
            https://bugs.webkit.org/show_bug.cgi?id=49870
    
            * WebCoreSupport/DragClientQt.cpp:
            (WebCore::DragClientQt::startDrag): Pass the DragImage to QDrag::setPixmap()
    2010-11-20  Andreas Kling  <kling at webkit.org>
    
            Reviewed by Antonio Gomes.
    
            [Qt] Dragging a selection should use a rendering of the selection as "cursor" for the drag
            https://bugs.webkit.org/show_bug.cgi?id=49870
    
            Implement Frame::dragImageForSelection() and the necessary DragImage helpers for Qt.
    
            * page/qt/FrameQt.cpp:
            (WebCore::Frame::dragImageForSelection):
            * platform/qt/DragImageQt.cpp:
            (WebCore::deleteDragImage):
            (WebCore::createDragImageFromImage):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72494 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f7ae57f..be7b99c 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-11-20  Andreas Kling  <kling at webkit.org>
+
+        Reviewed by Antonio Gomes.
+
+        [Qt] Dragging a selection should use a rendering of the selection as "cursor" for the drag
+        https://bugs.webkit.org/show_bug.cgi?id=49870
+
+        Implement Frame::dragImageForSelection() and the necessary DragImage helpers for Qt.
+
+        * page/qt/FrameQt.cpp:
+        (WebCore::Frame::dragImageForSelection):
+        * platform/qt/DragImageQt.cpp:
+        (WebCore::deleteDragImage):
+        (WebCore::createDragImageFromImage):
+
 2010-11-20  Xan Lopez  <xlopez at igalia.com>
 
         Reviewed by Martin Robinson.
diff --git a/WebCore/page/qt/FrameQt.cpp b/WebCore/page/qt/FrameQt.cpp
index ed75eb8..467592c 100644
--- a/WebCore/page/qt/FrameQt.cpp
+++ b/WebCore/page/qt/FrameQt.cpp
@@ -23,6 +23,9 @@
 
 #include "config.h"
 #include "Frame.h"
+#include "FrameView.h"
+#include "Image.h"
+#include "ImageBuffer.h"
 
 #include "NotImplemented.h"
 
@@ -36,8 +39,27 @@ DragImageRef Frame::nodeImage(Node*)
 
 DragImageRef Frame::dragImageForSelection()
 {
-    notImplemented();
-    return 0;
+    if (!selection()->isRange())
+        return 0;
+
+    m_doc->updateLayout();
+
+    IntRect paintingRect = enclosingIntRect(selection()->bounds());
+    OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size()));
+    if (!buffer)
+        return 0;
+
+    GraphicsContext* context = buffer->context();
+    context->translate(-paintingRect.x(), -paintingRect.y());
+    context->clip(FloatRect(0, 0, paintingRect.right(), paintingRect.bottom()));
+
+    PaintBehavior previousPaintBehavior = m_view->paintBehavior();
+    m_view->setPaintBehavior(PaintBehaviorSelectionOnly);
+    m_view->paintContents(context, paintingRect);
+    m_view->setPaintBehavior(previousPaintBehavior);
+
+    RefPtr<Image> image = buffer->copyImage();
+    return createDragImageFromImage(image.get());
 }
 
 }
diff --git a/WebCore/platform/qt/DragImageQt.cpp b/WebCore/platform/qt/DragImageQt.cpp
index 3a077e1..b153e88 100644
--- a/WebCore/platform/qt/DragImageQt.cpp
+++ b/WebCore/platform/qt/DragImageQt.cpp
@@ -36,8 +36,9 @@ IntSize dragImageSize(DragImageRef)
     return IntSize(0, 0);
 }
 
-void deleteDragImage(DragImageRef)
+void deleteDragImage(DragImageRef image)
 {
+    delete image;
 }
 
 DragImageRef scaleDragImage(DragImageRef image, FloatSize)
@@ -50,9 +51,12 @@ DragImageRef dissolveDragImageToFraction(DragImageRef image, float)
     return image;
 }
 
-DragImageRef createDragImageFromImage(Image*)
+DragImageRef createDragImageFromImage(Image* image)
 {
-    return 0;
+    if (!image)
+        return 0;
+
+    return new QPixmap(*image->nativeImageForCurrentFrame());
 }
 
 DragImageRef createDragImageIconForCachedImage(CachedImage*)
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index 4c428e9..0326d76 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,13 @@
+2010-11-20  Andreas Kling  <kling at webkit.org>
+
+        Reviewed by Antonio Gomes.
+
+        [Qt] Dragging a selection should use a rendering of the selection as "cursor" for the drag
+        https://bugs.webkit.org/show_bug.cgi?id=49870
+
+        * WebCoreSupport/DragClientQt.cpp:
+        (WebCore::DragClientQt::startDrag): Pass the DragImage to QDrag::setPixmap()
+
 2010-11-20  Sam Magnuson  <smagnuso at gmail.com>
 
         Reviewed by Andreas Kling.
diff --git a/WebKit/qt/WebCoreSupport/DragClientQt.cpp b/WebKit/qt/WebCoreSupport/DragClientQt.cpp
index 52229dc..f136328 100644
--- a/WebKit/qt/WebCoreSupport/DragClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/DragClientQt.cpp
@@ -86,7 +86,7 @@ void DragClientQt::willPerformDragSourceAction(DragSourceAction, const IntPoint&
 {
 }
 
-void DragClientQt::startDrag(DragImageRef, const IntPoint&, const IntPoint&, Clipboard* clipboard, Frame* frame, bool)
+void DragClientQt::startDrag(DragImageRef dragImage, const IntPoint&, const IntPoint&, Clipboard* clipboard, Frame* frame, bool)
 {
 #ifndef QT_NO_DRAGANDDROP
     QMimeData* clipboardData = static_cast<ClipboardQt*>(clipboard)->clipboardData();
@@ -94,7 +94,9 @@ void DragClientQt::startDrag(DragImageRef, const IntPoint&, const IntPoint&, Cli
     QWidget* view = m_webPage->view();
     if (view) {
         QDrag* drag = new QDrag(view);
-        if (clipboardData && clipboardData->hasImage())
+        if (dragImage)
+            drag->setPixmap(*dragImage);
+        else if (clipboardData && clipboardData->hasImage())
             drag->setPixmap(qvariant_cast<QPixmap>(clipboardData->imageData()));
         DragOperation dragOperationMask = clipboard->sourceOperation();
         drag->setMimeData(clipboardData);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list