OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2009, 2010 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 |
11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
13 * | 13 * |
14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #include "config.h" | 27 #include "config.h" |
28 #include "core/page/DragController.h" | 28 #include "core/page/DragController.h" |
29 | 29 |
30 #include <wtf/CurrentTime.h> | |
31 #include <wtf/RefPtr.h> | |
32 #include "HTMLNames.h" | 30 #include "HTMLNames.h" |
33 #include "core/dom/Clipboard.h" | 31 #include "core/dom/Clipboard.h" |
34 #include "core/dom/ClipboardAccessPolicy.h" | 32 #include "core/dom/ClipboardAccessPolicy.h" |
35 #include "core/dom/Document.h" | 33 #include "core/dom/Document.h" |
36 #include "core/dom/DocumentFragment.h" | 34 #include "core/dom/DocumentFragment.h" |
37 #include "core/dom/Element.h" | 35 #include "core/dom/Element.h" |
38 #include "core/dom/ExceptionCodePlaceholder.h" | 36 #include "core/dom/ExceptionCodePlaceholder.h" |
39 #include "core/dom/Node.h" | 37 #include "core/dom/Node.h" |
40 #include "core/dom/Text.h" | 38 #include "core/dom/Text.h" |
41 #include "core/dom/TextEvent.h" | 39 #include "core/dom/TextEvent.h" |
(...skipping 14 matching lines...) Expand all Loading... |
56 #include "core/page/DragActions.h" | 54 #include "core/page/DragActions.h" |
57 #include "core/page/DragClient.h" | 55 #include "core/page/DragClient.h" |
58 #include "core/page/DragSession.h" | 56 #include "core/page/DragSession.h" |
59 #include "core/page/DragState.h" | 57 #include "core/page/DragState.h" |
60 #include "core/page/EventHandler.h" | 58 #include "core/page/EventHandler.h" |
61 #include "core/page/Frame.h" | 59 #include "core/page/Frame.h" |
62 #include "core/page/FrameView.h" | 60 #include "core/page/FrameView.h" |
63 #include "core/page/Page.h" | 61 #include "core/page/Page.h" |
64 #include "core/page/Settings.h" | 62 #include "core/page/Settings.h" |
65 #include "core/platform/DragData.h" | 63 #include "core/platform/DragData.h" |
| 64 #include "core/platform/DragImage.h" |
66 #include "core/platform/graphics/FloatRect.h" | 65 #include "core/platform/graphics/FloatRect.h" |
67 #include "core/platform/graphics/Image.h" | 66 #include "core/platform/graphics/Image.h" |
68 #include "core/platform/graphics/ImageOrientation.h" | 67 #include "core/platform/graphics/ImageOrientation.h" |
69 #include "core/platform/network/ResourceRequest.h" | 68 #include "core/platform/network/ResourceRequest.h" |
70 #include "core/rendering/HitTestRequest.h" | 69 #include "core/rendering/HitTestRequest.h" |
71 #include "core/rendering/HitTestResult.h" | 70 #include "core/rendering/HitTestResult.h" |
72 #include "core/rendering/RenderImage.h" | 71 #include "core/rendering/RenderImage.h" |
73 #include "core/rendering/RenderView.h" | 72 #include "core/rendering/RenderView.h" |
74 #include "weborigin/SecurityOrigin.h" | 73 #include "weborigin/SecurityOrigin.h" |
| 74 #include "wtf/CurrentTime.h" |
| 75 #include "wtf/OwnPtr.h" |
| 76 #include "wtf/PassOwnPtr.h" |
| 77 #include "wtf/RefPtr.h" |
75 | 78 |
76 #if OS(WINDOWS) | 79 #if OS(WINDOWS) |
77 #include <windows.h> | 80 #include <windows.h> |
78 #endif | 81 #endif |
79 | 82 |
80 namespace WebCore { | 83 namespace WebCore { |
81 | 84 |
82 const int DragController::LinkDragBorderInset = 2; | 85 const int DragController::LinkDragBorderInset = 2; |
83 const int DragController::MaxOriginalImageArea = 1500 * 1500; | 86 const int DragController::MaxOriginalImageArea = 1500 * 1500; |
84 const int DragController::DragIconRightInset = 7; | 87 const int DragController::DragIconRightInset = 7; |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 // something that's not actually under the drag origin. | 721 // something that's not actually under the drag origin. |
719 return false; | 722 return false; |
720 KURL linkURL = hitTestResult.absoluteLinkURL(); | 723 KURL linkURL = hitTestResult.absoluteLinkURL(); |
721 KURL imageURL = hitTestResult.absoluteImageURL(); | 724 KURL imageURL = hitTestResult.absoluteImageURL(); |
722 | 725 |
723 IntPoint mouseDraggedPoint = src->view()->windowToContents(dragEvent.positio
n()); | 726 IntPoint mouseDraggedPoint = src->view()->windowToContents(dragEvent.positio
n()); |
724 | 727 |
725 m_draggingImageURL = KURL(); | 728 m_draggingImageURL = KURL(); |
726 m_sourceDragOperation = srcOp; | 729 m_sourceDragOperation = srcOp; |
727 | 730 |
728 DragImageRef dragImage = 0; | 731 OwnPtr<DragImage> dragImage; |
729 IntPoint dragLoc(0, 0); | 732 IntPoint dragLoc(0, 0); |
730 IntPoint dragImageOffset(0, 0); | 733 IntPoint dragImageOffset(0, 0); |
731 | 734 |
732 Clipboard* clipboard = state.m_dragClipboard.get(); | 735 Clipboard* clipboard = state.m_dragClipboard.get(); |
733 if (state.m_dragType == DragSourceActionDHTML) | 736 if (state.m_dragType == DragSourceActionDHTML) |
734 dragImage = clipboard->createDragImage(dragImageOffset); | 737 dragImage = clipboard->createDragImage(dragImageOffset); |
735 if (state.m_dragType == DragSourceActionSelection || !imageURL.isEmpty() ||
!linkURL.isEmpty()) | 738 if (state.m_dragType == DragSourceActionSelection || !imageURL.isEmpty() ||
!linkURL.isEmpty()) |
736 // Selection, image, and link drags receive a default set of allowed dra
g operations that | 739 // Selection, image, and link drags receive a default set of allowed dra
g operations that |
737 // follows from: | 740 // follows from: |
738 // http://trac.webkit.org/browser/trunk/WebKit/mac/WebView/WebHTMLView.m
m?rev=48526#L3430 | 741 // http://trac.webkit.org/browser/trunk/WebKit/mac/WebView/WebHTMLView.m
m?rev=48526#L3430 |
739 m_sourceDragOperation = static_cast<DragOperation>(m_sourceDragOperation
| DragOperationGeneric | DragOperationCopy); | 742 m_sourceDragOperation = static_cast<DragOperation>(m_sourceDragOperation
| DragOperationGeneric | DragOperationCopy); |
740 | 743 |
741 // We allow DHTML/JS to set the drag image, even if its a link, image or tex
t we're dragging. | 744 // We allow DHTML/JS to set the drag image, even if its a link, image or tex
t we're dragging. |
742 // This is in the spirit of the IE API, which allows overriding of pasteboar
d data and DragOp. | 745 // This is in the spirit of the IE API, which allows overriding of pasteboar
d data and DragOp. |
743 if (dragImage) { | 746 if (dragImage) { |
744 dragLoc = dragLocForDHTMLDrag(mouseDraggedPoint, dragOrigin, dragImageOf
fset, !linkURL.isEmpty()); | 747 dragLoc = dragLocForDHTMLDrag(mouseDraggedPoint, dragOrigin, dragImageOf
fset, !linkURL.isEmpty()); |
745 m_dragOffset = dragImageOffset; | 748 m_dragOffset = dragImageOffset; |
746 } | 749 } |
747 | 750 |
748 bool startedDrag = true; // optimism - we almost always manage to start the
drag | 751 bool startedDrag = true; // optimism - we almost always manage to start the
drag |
749 | 752 |
750 Node* node = state.m_dragSrc.get(); | 753 Node* node = state.m_dragSrc.get(); |
751 | 754 |
752 Image* image = node->isElementNode() ? getImage(toElement(node)) : 0; | 755 Image* image = node->isElementNode() ? getImage(toElement(node)) : 0; |
753 if (state.m_dragType == DragSourceActionSelection) { | 756 if (state.m_dragType == DragSourceActionSelection) { |
754 if (!clipboard->hasData()) { | 757 if (!clipboard->hasData()) { |
755 if (enclosingTextFormControl(src->selection()->start())) | 758 if (enclosingTextFormControl(src->selection()->start())) { |
756 clipboard->writePlainText(src->editor()->selectedTextForClipboar
d()); | 759 clipboard->writePlainText(src->editor()->selectedTextForClipboar
d()); |
757 else { | 760 } else { |
758 RefPtr<Range> selectionRange = src->selection()->toNormalizedRan
ge(); | 761 RefPtr<Range> selectionRange = src->selection()->toNormalizedRan
ge(); |
759 ASSERT(selectionRange); | 762 ASSERT(selectionRange); |
760 | 763 |
761 clipboard->writeRange(selectionRange.get(), src); | 764 clipboard->writeRange(selectionRange.get(), src); |
762 } | 765 } |
763 } | 766 } |
764 if (!dragImage) { | 767 if (!dragImage) { |
765 dragImage = createDragImageForSelection(src->dragImageForSelection()
, DragImageAlpha); | 768 dragImage = src->dragImageForSelection(); |
| 769 if (dragImage) |
| 770 dragImage->dissolveToFraction(DragImageAlpha); |
766 dragLoc = dragLocForSelectionDrag(src); | 771 dragLoc = dragLocForSelectionDrag(src); |
767 m_dragOffset = IntPoint(dragOrigin.x() - dragLoc.x(), dragOrigin.y()
- dragLoc.y()); | 772 m_dragOffset = IntPoint(dragOrigin.x() - dragLoc.x(), dragOrigin.y()
- dragLoc.y()); |
768 } | 773 } |
769 doSystemDrag(dragImage, dragLoc, dragOrigin, clipboard, src, false); | 774 doSystemDrag(dragImage.get(), dragLoc, dragOrigin, clipboard, src, false
); |
770 } else if (!imageURL.isEmpty() && node && node->isElementNode() && image &&
!image->isNull() | 775 } else if (!imageURL.isEmpty() && node && node->isElementNode() && image &&
!image->isNull() |
771 && (m_dragSourceAction & DragSourceActionImage)) { | 776 && (m_dragSourceAction & DragSourceActionImage)) { |
772 // We shouldn't be starting a drag for an image that can't provide an ex
tension. | 777 // We shouldn't be starting a drag for an image that can't provide an ex
tension. |
773 // This is an early detection for problems encountered later upon drop. | 778 // This is an early detection for problems encountered later upon drop. |
774 ASSERT(!image->filenameExtension().isEmpty()); | 779 ASSERT(!image->filenameExtension().isEmpty()); |
775 Element* element = toElement(node); | 780 Element* element = toElement(node); |
776 if (!clipboard->hasData()) { | 781 if (!clipboard->hasData()) { |
777 m_draggingImageURL = imageURL; | 782 m_draggingImageURL = imageURL; |
778 prepareClipboardForImageDrag(src, clipboard, element, linkURL, image
URL, hitTestResult.altDisplayString()); | 783 prepareClipboardForImageDrag(src, clipboard, element, linkURL, image
URL, hitTestResult.altDisplayString()); |
779 } | 784 } |
780 | 785 |
781 if (!dragImage) { | 786 if (!dragImage) { |
782 IntRect imageRect = hitTestResult.imageRect(); | 787 IntRect imageRect = hitTestResult.imageRect(); |
783 imageRect.setLocation(m_page->mainFrame()->view()->rootViewToContent
s(src->view()->contentsToRootView(imageRect.location()))); | 788 imageRect.setLocation(m_page->mainFrame()->view()->rootViewToContent
s(src->view()->contentsToRootView(imageRect.location()))); |
784 doImageDrag(element, dragOrigin, hitTestResult.imageRect(), clipboar
d, src, m_dragOffset); | 789 doImageDrag(element, dragOrigin, hitTestResult.imageRect(), clipboar
d, src, m_dragOffset); |
785 } else | 790 } else { |
786 // DHTML defined drag image | 791 // DHTML defined drag image |
787 doSystemDrag(dragImage, dragLoc, dragOrigin, clipboard, src, false); | 792 doSystemDrag(dragImage.get(), dragLoc, dragOrigin, clipboard, src, f
alse); |
788 | 793 } |
789 } else if (!linkURL.isEmpty() && (m_dragSourceAction & DragSourceActionLink)
) { | 794 } else if (!linkURL.isEmpty() && (m_dragSourceAction & DragSourceActionLink)
) { |
790 if (!clipboard->hasData()) | 795 if (!clipboard->hasData()) |
791 // Simplify whitespace so the title put on the clipboard resembles w
hat the user sees | 796 // Simplify whitespace so the title put on the clipboard resembles w
hat the user sees |
792 // on the web page. This includes replacing newlines with spaces. | 797 // on the web page. This includes replacing newlines with spaces. |
793 clipboard->writeURL(linkURL, hitTestResult.textContent().simplifyWhi
teSpace(), src); | 798 clipboard->writeURL(linkURL, hitTestResult.textContent().simplifyWhi
teSpace(), src); |
794 | 799 |
795 if (src->selection()->isCaret() && src->selection()->isContentEditable()
) { | 800 if (src->selection()->isCaret() && src->selection()->isContentEditable()
) { |
796 // a user can initiate a drag on a link without having any text | 801 // a user can initiate a drag on a link without having any text |
797 // selected. In this case, we should expand the selection to | 802 // selected. In this case, we should expand the selection to |
798 // the enclosing anchor element | 803 // the enclosing anchor element |
799 Position pos = src->selection()->base(); | 804 Position pos = src->selection()->base(); |
800 Node* node = enclosingAnchorElement(pos); | 805 Node* node = enclosingAnchorElement(pos); |
801 if (node) | 806 if (node) |
802 src->selection()->setSelection(VisibleSelection::selectionFromCo
ntentsOfNode(node)); | 807 src->selection()->setSelection(VisibleSelection::selectionFromCo
ntentsOfNode(node)); |
803 } | 808 } |
804 | 809 |
805 if (!dragImage) { | 810 if (!dragImage) { |
806 FontRenderingMode renderingMode = src->settings() ? src->settings()-
>fontRenderingMode() : NormalRenderingMode; | 811 FontRenderingMode renderingMode = src->settings() ? src->settings()-
>fontRenderingMode() : NormalRenderingMode; |
807 float deviceScaleFactor = src->page() ? src->page()->deviceScaleFact
or() : 1; | 812 float deviceScaleFactor = src->page() ? src->page()->deviceScaleFact
or() : 1; |
808 dragImage = createDragImageForLink(linkURL, hitTestResult.textConten
t(), renderingMode, deviceScaleFactor); | 813 dragImage = DragImage::create(linkURL, hitTestResult.textContent(),
renderingMode, deviceScaleFactor); |
809 IntSize size = dragImageSize(dragImage); | 814 IntSize size = dragImage ? dragImage->size() : IntSize(); |
810 m_dragOffset = IntPoint(-size.width() / 2, -LinkDragBorderInset); | 815 m_dragOffset = IntPoint(-size.width() / 2, -LinkDragBorderInset); |
811 dragLoc = IntPoint(mouseDraggedPoint.x() + m_dragOffset.x(), mouseDr
aggedPoint.y() + m_dragOffset.y()); | 816 dragLoc = IntPoint(mouseDraggedPoint.x() + m_dragOffset.x(), mouseDr
aggedPoint.y() + m_dragOffset.y()); |
812 } | 817 } |
813 doSystemDrag(dragImage, dragLoc, mouseDraggedPoint, clipboard, src, true
); | 818 doSystemDrag(dragImage.get(), dragLoc, mouseDraggedPoint, clipboard, src
, true); |
814 } else if (state.m_dragType == DragSourceActionDHTML) { | 819 } else if (state.m_dragType == DragSourceActionDHTML) { |
815 ASSERT(m_dragSourceAction & DragSourceActionDHTML); | 820 ASSERT(m_dragSourceAction & DragSourceActionDHTML); |
816 doSystemDrag(dragImage, dragLoc, dragOrigin, clipboard, src, false); | 821 doSystemDrag(dragImage.get(), dragLoc, dragOrigin, clipboard, src, false
); |
817 } else { | 822 } else { |
818 // draggableNode() determined an image or link node was draggable, but i
t turns out the | 823 // draggableNode() determined an image or link node was draggable, but i
t turns out the |
819 // image or link had no URL, so there is nothing to drag. | 824 // image or link had no URL, so there is nothing to drag. |
820 startedDrag = false; | 825 startedDrag = false; |
821 } | 826 } |
822 | 827 |
823 if (dragImage) | |
824 deleteDragImage(dragImage); | |
825 return startedDrag; | 828 return startedDrag; |
826 } | 829 } |
827 | 830 |
828 void DragController::doImageDrag(Element* element, const IntPoint& dragOrigin, c
onst IntRect& rect, Clipboard* clipboard, Frame* frame, IntPoint& dragImageOffse
t) | 831 void DragController::doImageDrag(Element* element, const IntPoint& dragOrigin, c
onst IntRect& rect, Clipboard* clipboard, Frame* frame, IntPoint& dragImageOffse
t) |
829 { | 832 { |
830 IntPoint mouseDownPoint = dragOrigin; | 833 IntPoint mouseDownPoint = dragOrigin; |
831 DragImageRef dragImage; | 834 OwnPtr<DragImage> dragImage; |
832 IntPoint origin; | 835 IntPoint origin; |
833 | 836 |
834 Image* image = getImage(element); | 837 Image* image = getImage(element); |
835 if (image && image->size().height() * image->size().width() <= MaxOriginalIm
ageArea | 838 if (image && image->size().height() * image->size().width() <= MaxOriginalIm
ageArea |
836 && (dragImage = createDragImageFromImage(image, element->renderer() ? el
ement->renderer()->shouldRespectImageOrientation() : DoNotRespectImageOrientatio
n))) { | 839 && (dragImage = DragImage::create(image, element->renderer() ? element->
renderer()->shouldRespectImageOrientation() : DoNotRespectImageOrientation))) { |
837 IntSize originalSize = rect.size(); | 840 IntSize originalSize = rect.size(); |
838 origin = rect.location(); | 841 origin = rect.location(); |
839 | 842 |
840 dragImage = fitDragImageToMaxSize(dragImage, rect.size(), maxDragImageSi
ze()); | 843 dragImage->fitToMaxSize(rect.size(), maxDragImageSize()); |
841 dragImage = dissolveDragImageToFraction(dragImage, DragImageAlpha); | 844 dragImage->dissolveToFraction(DragImageAlpha); |
842 IntSize newSize = dragImageSize(dragImage); | 845 IntSize newSize = dragImage->size(); |
843 | 846 |
844 // Properly orient the drag image and orient it differently if it's smal
ler than the original | 847 // Properly orient the drag image and orient it differently if it's smal
ler than the original |
845 float scale = newSize.width() / (float)originalSize.width(); | 848 float scale = newSize.width() / (float)originalSize.width(); |
846 float dx = origin.x() - mouseDownPoint.x(); | 849 float dx = origin.x() - mouseDownPoint.x(); |
847 dx *= scale; | 850 dx *= scale; |
848 origin.setX((int)(dx + 0.5)); | 851 origin.setX((int)(dx + 0.5)); |
849 float dy = origin.y() - mouseDownPoint.y(); | 852 float dy = origin.y() - mouseDownPoint.y(); |
850 dy *= scale; | 853 dy *= scale; |
851 origin.setY((int)(dy + 0.5)); | 854 origin.setY((int)(dy + 0.5)); |
852 } else { | |
853 dragImage = createDragImageIconForCachedImage(getCachedImage(element)); | |
854 if (dragImage) | |
855 origin = IntPoint(DragIconRightInset - dragImageSize(dragImage).widt
h(), DragIconBottomInset); | |
856 } | 855 } |
857 | 856 |
858 dragImageOffset = mouseDownPoint + origin; | 857 dragImageOffset = mouseDownPoint + origin; |
859 doSystemDrag(dragImage, dragImageOffset, dragOrigin, clipboard, frame, false
); | 858 doSystemDrag(dragImage.get(), dragImageOffset, dragOrigin, clipboard, frame,
false); |
860 | |
861 deleteDragImage(dragImage); | |
862 } | 859 } |
863 | 860 |
864 void DragController::doSystemDrag(DragImageRef image, const IntPoint& dragLoc, c
onst IntPoint& eventPos, Clipboard* clipboard, Frame* frame, bool forLink) | 861 void DragController::doSystemDrag(DragImage* image, const IntPoint& dragLoc, con
st IntPoint& eventPos, Clipboard* clipboard, Frame* frame, bool forLink) |
865 { | 862 { |
866 m_didInitiateDrag = true; | 863 m_didInitiateDrag = true; |
867 m_dragInitiator = frame->document(); | 864 m_dragInitiator = frame->document(); |
868 // Protect this frame and view, as a load may occur mid drag and attempt to
unload this frame | 865 // Protect this frame and view, as a load may occur mid drag and attempt to
unload this frame |
869 RefPtr<Frame> frameProtector = m_page->mainFrame(); | 866 RefPtr<Frame> frameProtector = m_page->mainFrame(); |
870 RefPtr<FrameView> viewProtector = frameProtector->view(); | 867 RefPtr<FrameView> viewProtector = frameProtector->view(); |
871 m_client->startDrag(image, viewProtector->rootViewToContents(frame->view()->
contentsToRootView(dragLoc)), | 868 m_client->startDrag(image, viewProtector->rootViewToContents(frame->view()->
contentsToRootView(dragLoc)), |
872 viewProtector->rootViewToContents(frame->view()->contentsToRootView(even
tPos)), clipboard, frameProtector.get(), forLink); | 869 viewProtector->rootViewToContents(frame->view()->contentsToRootView(even
tPos)), clipboard, frameProtector.get(), forLink); |
873 // DragClient::startDrag can cause our Page to dispear, deallocating |this|. | 870 // DragClient::startDrag can cause our Page to dispear, deallocating |this|. |
874 if (!frameProtector->page()) | 871 if (!frameProtector->page()) |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 #endif | 919 #endif |
923 return maxDragImageSize; | 920 return maxDragImageSize; |
924 } | 921 } |
925 | 922 |
926 void DragController::cleanupAfterSystemDrag() | 923 void DragController::cleanupAfterSystemDrag() |
927 { | 924 { |
928 } | 925 } |
929 | 926 |
930 } // namespace WebCore | 927 } // namespace WebCore |
931 | 928 |
OLD | NEW |