OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Google Inc. | 3 * Copyright (C) 2008 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 IntRect topLevelRect; | 80 IntRect topLevelRect; |
81 IntRect paintingRect = renderer->paintingRootRect(topLevelRect); | 81 IntRect paintingRect = renderer->paintingRootRect(topLevelRect); |
82 | 82 |
83 OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size())); | 83 OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size())); |
84 if (!buffer) | 84 if (!buffer) |
85 return 0; | 85 return 0; |
86 buffer->context()->translate(-paintingRect.x(), -paintingRect.y()); | 86 buffer->context()->translate(-paintingRect.x(), -paintingRect.y()); |
87 buffer->context()->clip(FloatRect(0, 0, paintingRect.right(), paintingRect.b
ottom())); | 87 buffer->context()->clip(FloatRect(0, 0, paintingRect.right(), paintingRect.b
ottom())); |
88 | 88 |
89 m_view->paint(buffer->context(), paintingRect); | 89 m_view->paintContents(buffer->context(), paintingRect); |
90 | 90 |
91 RefPtr<Image> image = buffer->copyImage(); | 91 RefPtr<Image> image = buffer->copyImage(); |
92 return createDragImageFromImage(image.get()); | 92 return createDragImageFromImage(image.get()); |
93 } | 93 } |
94 | 94 |
95 DragImageRef Frame::dragImageForSelection() | 95 DragImageRef Frame::dragImageForSelection() |
96 { | 96 { |
97 if (!selection()->isRange()) | 97 if (!selection()->isRange()) |
98 return 0; | 98 return 0; |
99 | 99 |
100 const ScopedState state(this, 0); | 100 const ScopedState state(this, 0); |
101 m_view->setPaintBehavior(PaintBehaviorSelectionOnly); | 101 m_view->setPaintBehavior(PaintBehaviorSelectionOnly); |
102 m_doc->updateLayout(); | 102 m_doc->updateLayout(); |
103 | 103 |
104 IntRect paintingRect = enclosingIntRect(selectionBounds()); | 104 IntRect paintingRect = enclosingIntRect(selectionBounds()); |
105 | 105 |
106 OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size())); | 106 OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size())); |
107 if (!buffer) | 107 if (!buffer) |
108 return 0; | 108 return 0; |
109 buffer->context()->translate(-paintingRect.x(), -paintingRect.y()); | 109 buffer->context()->translate(-paintingRect.x(), -paintingRect.y()); |
110 buffer->context()->clip(FloatRect(0, 0, paintingRect.right(), paintingRect.b
ottom())); | 110 buffer->context()->clip(FloatRect(0, 0, paintingRect.right(), paintingRect.b
ottom())); |
111 | 111 |
112 m_view->paint(buffer->context(), paintingRect); | 112 m_view->paintContents(buffer->context(), paintingRect); |
113 | 113 |
114 RefPtr<Image> image = buffer->copyImage(); | 114 RefPtr<Image> image = buffer->copyImage(); |
115 return createDragImageFromImage(image.get()); | 115 return createDragImageFromImage(image.get()); |
116 } | 116 } |
117 | 117 |
118 } // namespace WebCore | 118 } // namespace WebCore |
OLD | NEW |