| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "web/WebFrameWidgetBase.h" | 5 #include "web/WebFrameWidgetBase.h" |
| 6 | 6 |
| 7 #include "core/frame/FrameHost.h" | 7 #include "core/frame/FrameHost.h" |
| 8 #include "core/frame/VisualViewport.h" | 8 #include "core/frame/VisualViewport.h" |
| 9 #include "core/input/EventHandler.h" |
| 9 #include "core/page/DragActions.h" | 10 #include "core/page/DragActions.h" |
| 10 #include "core/page/DragController.h" | 11 #include "core/page/DragController.h" |
| 11 #include "core/page/DragData.h" | 12 #include "core/page/DragData.h" |
| 12 #include "core/page/DragSession.h" | 13 #include "core/page/DragSession.h" |
| 13 #include "core/page/Page.h" | 14 #include "core/page/Page.h" |
| 14 #include "public/web/WebAutofillClient.h" | 15 #include "public/web/WebAutofillClient.h" |
| 15 #include "public/web/WebDocument.h" | 16 #include "public/web/WebDocument.h" |
| 16 #include "web/WebLocalFrameImpl.h" | 17 #include "web/WebLocalFrameImpl.h" |
| 17 #include "web/WebViewImpl.h" | 18 #include "web/WebViewImpl.h" |
| 18 | 19 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 m_currentDragData->setModifiers(modifiers); | 85 m_currentDragData->setModifiers(modifiers); |
| 85 DragData dragData(m_currentDragData.get(), pointInRootFrame, screenPoint, | 86 DragData dragData(m_currentDragData.get(), pointInRootFrame, screenPoint, |
| 86 static_cast<DragOperation>(m_operationsAllowed)); | 87 static_cast<DragOperation>(m_operationsAllowed)); |
| 87 | 88 |
| 88 page()->dragController().performDrag(&dragData); | 89 page()->dragController().performDrag(&dragData); |
| 89 | 90 |
| 90 m_dragOperation = WebDragOperationNone; | 91 m_dragOperation = WebDragOperationNone; |
| 91 m_currentDragData = nullptr; | 92 m_currentDragData = nullptr; |
| 92 } | 93 } |
| 93 | 94 |
| 95 void WebFrameWidgetBase::dragSourceEndedAt(const WebPoint& pointInViewport, |
| 96 const WebPoint& screenPoint, |
| 97 WebDragOperation operation) { |
| 98 WebPoint pointInRootFrame( |
| 99 page()->frameHost().visualViewport().viewportToRootFrame( |
| 100 pointInViewport)); |
| 101 PlatformMouseEvent pme( |
| 102 pointInRootFrame, screenPoint, WebPointerProperties::Button::Left, |
| 103 PlatformEvent::MouseMoved, 0, PlatformEvent::NoModifiers, |
| 104 PlatformMouseEvent::RealOrIndistinguishable, |
| 105 WTF::monotonicallyIncreasingTime()); |
| 106 page()->deprecatedLocalMainFrame()->eventHandler().dragSourceEndedAt( |
| 107 pme, static_cast<DragOperation>(operation)); |
| 108 } |
| 109 |
| 110 void WebFrameWidgetBase::dragSourceSystemDragEnded() { |
| 111 // It's possible for us to get this callback while not doing a drag if it's |
| 112 // from a previous page that got unloaded. |
| 113 if (view()->doingDragAndDrop()) { |
| 114 page()->dragController().dragEnded(); |
| 115 view()->setDoingDragAndDrop(false); |
| 116 } |
| 117 } |
| 118 |
| 94 WebDragOperation WebFrameWidgetBase::dragTargetDragEnterOrOver( | 119 WebDragOperation WebFrameWidgetBase::dragTargetDragEnterOrOver( |
| 95 const WebPoint& pointInViewport, | 120 const WebPoint& pointInViewport, |
| 96 const WebPoint& screenPoint, | 121 const WebPoint& screenPoint, |
| 97 DragAction dragAction, | 122 DragAction dragAction, |
| 98 int modifiers) { | 123 int modifiers) { |
| 99 DCHECK(m_currentDragData); | 124 DCHECK(m_currentDragData); |
| 100 | 125 |
| 101 WebPoint pointInRootFrame(viewportToRootFrame(pointInViewport)); | 126 WebPoint pointInRootFrame(viewportToRootFrame(pointInViewport)); |
| 102 | 127 |
| 103 m_currentDragData->setModifiers(modifiers); | 128 m_currentDragData->setModifiers(modifiers); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 127 | 152 |
| 128 WebViewImpl* WebFrameWidgetBase::view() const { | 153 WebViewImpl* WebFrameWidgetBase::view() const { |
| 129 return static_cast<WebLocalFrameImpl*>(localRoot())->viewImpl(); | 154 return static_cast<WebLocalFrameImpl*>(localRoot())->viewImpl(); |
| 130 } | 155 } |
| 131 | 156 |
| 132 Page* WebFrameWidgetBase::page() const { | 157 Page* WebFrameWidgetBase::page() const { |
| 133 return view()->page(); | 158 return view()->page(); |
| 134 } | 159 } |
| 135 | 160 |
| 136 } // namespace blink | 161 } // namespace blink |
| OLD | NEW |