OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "DragController.h" | 27 #include "DragController.h" |
28 | 28 |
29 #include "DragData.h" | 29 #include "DragData.h" |
30 #include "windows.h" | |
31 #include "SelectionController.h" | 30 #include "SelectionController.h" |
32 #include <wtf/RefPtr.h> | 31 #include <wtf/RefPtr.h> |
33 | 32 |
| 33 #if PLATFORM(WIN) |
| 34 #include <windows.h> |
| 35 #endif |
| 36 |
34 namespace WebCore { | 37 namespace WebCore { |
35 | 38 |
36 const int DragController::LinkDragBorderInset = 2; | 39 const int DragController::LinkDragBorderInset = 2; |
37 const int DragController::MaxOriginalImageArea = 1500 * 1500; | 40 const int DragController::MaxOriginalImageArea = 1500 * 1500; |
38 const int DragController::DragIconRightInset = 7; | 41 const int DragController::DragIconRightInset = 7; |
39 const int DragController::DragIconBottomInset = 3; | 42 const int DragController::DragIconBottomInset = 3; |
40 | 43 |
41 const float DragController::DragImageAlpha = 0.75f; | 44 const float DragController::DragImageAlpha = 0.75f; |
42 | 45 |
43 DragOperation DragController::dragOperation(DragData* dragData) | 46 DragOperation DragController::dragOperation(DragData* dragData) |
44 { | 47 { |
45 //FIXME: to match the macos behaviour we should return DragOperationNone | 48 //FIXME: to match the macos behaviour we should return DragOperationNone |
46 //if we are a modal window, we are the drag source, or the window is an atta
ched sheet | 49 //if we are a modal window, we are the drag source, or the window is an atta
ched sheet |
47 //If this can be determined from within WebCore operationForDrag can be pull
ed into | 50 //If this can be determined from within WebCore operationForDrag can be pull
ed into |
48 //WebCore itself | 51 //WebCore itself |
49 ASSERT(dragData); | 52 ASSERT(dragData); |
50 return dragData->containsURL() && !m_didInitiateDrag ? DragOperationCopy : D
ragOperationNone; | 53 return dragData->containsURL() && !m_didInitiateDrag ? DragOperationCopy : D
ragOperationNone; |
51 } | 54 } |
52 | 55 |
53 bool DragController::isCopyKeyDown() { | 56 bool DragController::isCopyKeyDown() { |
| 57 // TODO(darin): This should not be OS specific. Delegate to the embedder |
| 58 // instead. |
| 59 #if PLATFORM(WIN) |
54 return ::GetAsyncKeyState(VK_CONTROL); | 60 return ::GetAsyncKeyState(VK_CONTROL); |
| 61 #else |
| 62 return false; |
| 63 #endif |
55 } | 64 } |
56 | 65 |
57 const IntSize& DragController::maxDragImageSize() | 66 const IntSize& DragController::maxDragImageSize() |
58 { | 67 { |
59 static const IntSize maxDragImageSize(200, 200); | 68 static const IntSize maxDragImageSize(200, 200); |
60 | 69 |
61 return maxDragImageSize; | 70 return maxDragImageSize; |
62 } | 71 } |
63 | 72 |
64 } | 73 } |
OLD | NEW |