diff options
author | Shimeng (Simon) Wang <swang@google.com> | 2010-12-07 17:22:45 -0800 |
---|---|---|
committer | Shimeng (Simon) Wang <swang@google.com> | 2010-12-22 14:15:40 -0800 |
commit | 4576aa36e9a9671459299c7963ac95aa94beaea9 (patch) | |
tree | 3863574e050f168c0126ecb47c83319fab0972d8 /WebCore/page/qt/FrameQt.cpp | |
parent | 55323ac613cc31553107b68603cb627264d22bb0 (diff) | |
download | external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.zip external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.tar.gz external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.tar.bz2 |
Merge WebKit at r73109: Initial merge by git.
Change-Id: I61f1a66d9642e3d8405d3ac6ccab2a53421c75d8
Diffstat (limited to 'WebCore/page/qt/FrameQt.cpp')
-rw-r--r-- | WebCore/page/qt/FrameQt.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
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()); } } |