RESOLVED FIXED 12278
REGRESSION(r13070): Dragged image size includes padding
https://bugs.webkit.org/show_bug.cgi?id=12278
Summary REGRESSION(r13070): Dragged image size includes padding
Matt Lilek
Reported 2007-01-15 01:22:29 PST
Dragged images seem to have any padding on them included when calculating the size of the semi-transparent drag image. Load the testcase at the URL on this bug report then drag the image. The WebKit logo is at fullsize and should therefore stay the same when dragged, but instead has the 100px padding applied to it.
Attachments
patch with change log (10.73 KB, patch)
2007-01-16 00:00 PST, Darin Adler
mjs: review+
Matt Lilek
Comment 1 2007-01-15 19:08:12 PST
The rect the drag image size is calculated from includes borders as well.
Darin Adler
Comment 2 2007-01-15 23:28:20 PST
The bug here is in -[WebElementDictionary _imageRect], which calls HitTestResult::boundingBox. There's been an attempt to generalize things too much. An image's rect is not the same thing as the absoluteBoundingBoxRect, which is what HitTestResult::boundingBox computes. To find the image's rect, we need to take the margin and border into account as RenderImage::paint does. I suggest we add a function to HitTestResult called imageRect and use that.
Dave Hyatt
Comment 3 2007-01-15 23:42:00 PST
Custom HTML drag images should use the border box though. I think _imageRect may be set for those too? http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSProgTopics/Tasks/DragAndDrop.html Note that setDragImage can be called with either an image object or an element, although haven't we now unified the two? In this API, the borders/padding should be included. It's really just our "built-in" image dragging that should exclude them. In the future we may want to enhance the API to specify which box to use.
Darin Adler
Comment 4 2007-01-16 00:00:06 PST
Created attachment 12477 [details] patch with change log
Dave Hyatt
Comment 5 2007-01-16 13:00:39 PST
Comment on attachment 12477 [details] patch with change log Is this only used for built-in images and not for custom drag images?
Darin Adler
Comment 6 2007-01-16 13:41:37 PST
(In reply to comment #5) > Is this only used for built-in images and not for custom drag images? Yes, that's right. Ultimately we could rewrite this to work in a simpler way. For this patch, I just fixed the regression in WebKit API that caused the bug rather than trying to remove this code path and unify with other dragging down at the WebCore level.
Mark Rowe (bdash)
Comment 7 2007-01-16 19:55:45 PST
Maciej Stachowiak
Comment 8 2007-01-17 01:34:59 PST
Comment on attachment 12477 [details] patch with change log r=me
Darin Adler
Comment 9 2007-01-17 15:09:30 PST
Committed revision 18918.
Note You need to log in before you can comment on or make changes to this bug.