Summary: | REGRESSION(r13070): Dragged image size includes padding | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Matt Lilek <dev+webkit> | ||||
Component: | WebKit Misc. | Assignee: | Darin Adler <darin> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | hyatt | ||||
Priority: | P1 | Keywords: | HasReduction, InRadar, Regression | ||||
Version: | 420+ | ||||||
Hardware: | Mac | ||||||
OS: | OS X 10.4 | ||||||
URL: | data:text/html,<img src="http://webkit.org/images/icon-gold.png" style="padding:100px; border:1px solid black"> | ||||||
Attachments: |
|
Description
Matt Lilek
2007-01-15 01:22:29 PST
The rect the drag image size is calculated from includes borders as well. 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. 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. Created attachment 12477 [details]
patch with change log
Comment on attachment 12477 [details]
patch with change log
Is this only used for built-in images and not for custom drag images?
(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. Comment on attachment 12477 [details]
patch with change log
r=me
Committed revision 18918. |