2010-11-20 Andreas Kling <kling@webkit.org>
authorandreas.kling@nokia.com <andreas.kling@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 21 Nov 2010 06:44:29 +0000 (06:44 +0000)
committerandreas.kling@nokia.com <andreas.kling@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 21 Nov 2010 06:44:29 +0000 (06:44 +0000)
        Reviewed by Antonio Gomes.

        [Qt] Limit the size of image preview "cursor" when dragging
        https://bugs.webkit.org/show_bug.cgi?id=49872

        Respect DragController::maxDragImageSize() (currently 400x400.)

        * platform/qt/DragImageQt.cpp:
        (WebCore::dragImageSize):
        (WebCore::scaleDragImage):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@72495 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/qt/DragImageQt.cpp

index be7b99c..77bc712 100644 (file)
@@ -2,6 +2,19 @@
 
         Reviewed by Antonio Gomes.
 
+        [Qt] Limit the size of image preview "cursor" when dragging
+        https://bugs.webkit.org/show_bug.cgi?id=49872
+
+        Respect DragController::maxDragImageSize() (currently 400x400.)
+
+        * platform/qt/DragImageQt.cpp:
+        (WebCore::dragImageSize):
+        (WebCore::scaleDragImage):
+
+2010-11-20  Andreas Kling  <kling@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
 
index b153e88..90b1bbc 100644 (file)
 
 namespace WebCore {
 
-IntSize dragImageSize(DragImageRef)
+IntSize dragImageSize(DragImageRef image)
 {
-    return IntSize(0, 0);
+    if (!image)
+        return IntSize();
+
+    return image->size();
 }
 
 void deleteDragImage(DragImageRef image)
@@ -41,8 +44,15 @@ void deleteDragImage(DragImageRef image)
     delete image;
 }
 
-DragImageRef scaleDragImage(DragImageRef image, FloatSize)
+DragImageRef scaleDragImage(DragImageRef image, FloatSize scale)
 {
+    if (!image)
+        return 0;
+
+    int scaledWidth = image->width() * scale.width();
+    int scaledHeight = image->height() * scale.height();
+
+    *image = image->scaled(scaledWidth, scaledHeight);
     return image;
 }