[Webkit-unassigned] [Bug 43449] [chromium] Generate drag images for HTML elements and selections.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Aug 5 14:58:59 PDT 2010


--- Comment #8 from Daniel Cheng <dcheng at chromium.org>  2010-08-05 14:58:59 PST ---
(In reply to comment #5)
> (From update of attachment 63493 [details])
> WebCore/page/Frame.h:225
>  +          DragImageRef dragImageForElement(Node* node);
> Generally we don't give arguments names when the names don't add clarity.


> WebCore/page/chromium/FrameChromium.cpp:47
>  +      renderer->updateDragState(true);
> I probably would have created saveState/restoreState functions for these.
> WebCore/page/chromium/FrameChromium.cpp:67
>  +      // Restore original state.
> Functional devisions ad more clarity than comment blocks.  Even if the functions are only called once.


> I would actually probably have used a RAII instead of two functions even.
> WebCore/page/chromium/FrameChromium.cpp:82
>  +          return result;
> Eh, just return 0 here.


> WebCore/page/chromium/FrameChromium.cpp:102
>  +      result = createDragImageFromImage(buffer->image());
> And just return directly here.  no need for result.


> WebCore/page/chromium/FrameChromium.cpp:84
>  +      IntRect paintingRect = enclosingIntRect(selectionBounds());
> Are we intentionally rounding here...
> WebCore/page/chromium/FrameChromium.cpp:89
>  +      buffer->context()->clip(FloatRect(0, 0, paintingRect.right(), paintingRect.bottom()));
> Only then to convert back to floats here?

Yes. FrameView::paint() and GraphicsContext::translate() take integer arguments.

> I wish we had some way to test this stuff.  DRT ideally should have a way to dump the drag image.  Or expose it to javascript so it could be drawn to a canvas.

Several questions:
1) Is there a better way to do dragImageForSelection()? PaintBehaviorForceBlackText seems like an ugly hack, and it's unnecessary on the Mac. Is there some way to tell the renderer to paint the selection, but without the selection highlight?

2) dragImageForElement and dragImageForSelection are (to the best of my understanding) platform independent. Would it make sense to move this into Frame so all the other ports can use it? It's worth pointing out that some ports already have their own implementations of these functions (with different names) as well...

Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

More information about the webkit-unassigned mailing list