| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 3764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3775 HitTestResult WebViewImpl::coreHitTestResultAt( | 3775 HitTestResult WebViewImpl::coreHitTestResultAt( |
| 3776 const WebPoint& pointInViewport) { | 3776 const WebPoint& pointInViewport) { |
| 3777 DocumentLifecycle::AllowThrottlingScope throttlingScope( | 3777 DocumentLifecycle::AllowThrottlingScope throttlingScope( |
| 3778 mainFrameImpl()->frame()->document()->lifecycle()); | 3778 mainFrameImpl()->frame()->document()->lifecycle()); |
| 3779 FrameView* view = mainFrameImpl()->frameView(); | 3779 FrameView* view = mainFrameImpl()->frameView(); |
| 3780 IntPoint pointInRootFrame = | 3780 IntPoint pointInRootFrame = |
| 3781 view->contentsToFrame(view->viewportToContents(pointInViewport)); | 3781 view->contentsToFrame(view->viewportToContents(pointInViewport)); |
| 3782 return hitTestResultForRootFramePos(pointInRootFrame); | 3782 return hitTestResultForRootFramePos(pointInRootFrame); |
| 3783 } | 3783 } |
| 3784 | 3784 |
| 3785 void WebViewImpl::dragSourceEndedAt(const WebPoint& clientPoint, | 3785 void WebViewImpl::dragSourceEndedAt(const WebPoint& pointInViewport, |
| 3786 const WebPoint& screenPoint, | 3786 const WebPoint& screenPoint, |
| 3787 WebDragOperation operation) { | 3787 WebDragOperation operation) { |
| 3788 WebPoint pointInRootFrame( |
| 3789 page()->frameHost().visualViewport().viewportToRootFrame( |
| 3790 pointInViewport)); |
| 3788 PlatformMouseEvent pme( | 3791 PlatformMouseEvent pme( |
| 3789 clientPoint, screenPoint, WebPointerProperties::Button::Left, | 3792 pointInRootFrame, screenPoint, WebPointerProperties::Button::Left, |
| 3790 PlatformEvent::MouseMoved, 0, PlatformEvent::NoModifiers, | 3793 PlatformEvent::MouseMoved, 0, PlatformEvent::NoModifiers, |
| 3791 PlatformMouseEvent::RealOrIndistinguishable, | 3794 PlatformMouseEvent::RealOrIndistinguishable, |
| 3792 WTF::monotonicallyIncreasingTime()); | 3795 WTF::monotonicallyIncreasingTime()); |
| 3793 m_page->deprecatedLocalMainFrame()->eventHandler().dragSourceEndedAt( | 3796 m_page->deprecatedLocalMainFrame()->eventHandler().dragSourceEndedAt( |
| 3794 pme, static_cast<DragOperation>(operation)); | 3797 pme, static_cast<DragOperation>(operation)); |
| 3795 } | 3798 } |
| 3796 | 3799 |
| 3797 void WebViewImpl::dragSourceSystemDragEnded() { | 3800 void WebViewImpl::dragSourceSystemDragEnded() { |
| 3798 // It's possible for us to get this callback while not doing a drag if | 3801 // It's possible for us to get this callback while not doing a drag if |
| 3799 // it's from a previous page that got unloaded. | 3802 // it's from a previous page that got unloaded. |
| 3800 if (m_doingDragAndDrop) { | 3803 if (m_doingDragAndDrop) { |
| 3801 m_page->dragController().dragEnded(); | 3804 m_page->dragController().dragEnded(); |
| 3802 m_doingDragAndDrop = false; | 3805 m_doingDragAndDrop = false; |
| 3803 } | 3806 } |
| 3804 } | 3807 } |
| 3805 | 3808 |
| 3806 WebDragOperation WebViewImpl::dragTargetDragEnter( | 3809 WebDragOperation WebViewImpl::dragTargetDragEnter( |
| 3807 const WebDragData& webDragData, | 3810 const WebDragData& webDragData, |
| 3808 const WebPoint& clientPoint, | 3811 const WebPoint& pointInViewport, |
| 3809 const WebPoint& screenPoint, | 3812 const WebPoint& screenPoint, |
| 3810 WebDragOperationsMask operationsAllowed, | 3813 WebDragOperationsMask operationsAllowed, |
| 3811 int modifiers) { | 3814 int modifiers) { |
| 3812 DCHECK(!m_currentDragData); | 3815 DCHECK(!m_currentDragData); |
| 3813 | 3816 |
| 3814 m_currentDragData = DataObject::create(webDragData); | 3817 m_currentDragData = DataObject::create(webDragData); |
| 3815 m_operationsAllowed = operationsAllowed; | 3818 m_operationsAllowed = operationsAllowed; |
| 3816 | 3819 |
| 3817 return dragTargetDragEnterOrOver(clientPoint, screenPoint, DragEnter, | 3820 return dragTargetDragEnterOrOver(pointInViewport, screenPoint, DragEnter, |
| 3818 modifiers); | 3821 modifiers); |
| 3819 } | 3822 } |
| 3820 | 3823 |
| 3821 WebDragOperation WebViewImpl::dragTargetDragOver( | 3824 WebDragOperation WebViewImpl::dragTargetDragOver( |
| 3822 const WebPoint& clientPoint, | 3825 const WebPoint& pointInViewport, |
| 3823 const WebPoint& screenPoint, | 3826 const WebPoint& screenPoint, |
| 3824 WebDragOperationsMask operationsAllowed, | 3827 WebDragOperationsMask operationsAllowed, |
| 3825 int modifiers) { | 3828 int modifiers) { |
| 3826 m_operationsAllowed = operationsAllowed; | 3829 m_operationsAllowed = operationsAllowed; |
| 3827 | 3830 |
| 3828 return dragTargetDragEnterOrOver(clientPoint, screenPoint, DragOver, | 3831 return dragTargetDragEnterOrOver(pointInViewport, screenPoint, DragOver, |
| 3829 modifiers); | 3832 modifiers); |
| 3830 } | 3833 } |
| 3831 | 3834 |
| 3832 void WebViewImpl::dragTargetDragLeave() { | 3835 void WebViewImpl::dragTargetDragLeave() { |
| 3833 DCHECK(m_currentDragData); | 3836 DCHECK(m_currentDragData); |
| 3834 | 3837 |
| 3835 DragData dragData(m_currentDragData.get(), IntPoint(), IntPoint(), | 3838 DragData dragData(m_currentDragData.get(), IntPoint(), IntPoint(), |
| 3836 static_cast<DragOperation>(m_operationsAllowed)); | 3839 static_cast<DragOperation>(m_operationsAllowed)); |
| 3837 | 3840 |
| 3838 m_page->dragController().dragExited(&dragData); | 3841 m_page->dragController().dragExited(&dragData); |
| 3839 | 3842 |
| 3840 // FIXME: why is the drag scroll timer not stopped here? | 3843 // FIXME: why is the drag scroll timer not stopped here? |
| 3841 | 3844 |
| 3842 m_dragOperation = WebDragOperationNone; | 3845 m_dragOperation = WebDragOperationNone; |
| 3843 m_currentDragData = nullptr; | 3846 m_currentDragData = nullptr; |
| 3844 } | 3847 } |
| 3845 | 3848 |
| 3846 void WebViewImpl::dragTargetDrop(const WebDragData& webDragData, | 3849 void WebViewImpl::dragTargetDrop(const WebDragData& webDragData, |
| 3847 const WebPoint& clientPoint, | 3850 const WebPoint& pointInViewport, |
| 3848 const WebPoint& screenPoint, | 3851 const WebPoint& screenPoint, |
| 3849 int modifiers) { | 3852 int modifiers) { |
| 3853 WebPoint pointInRootFrame( |
| 3854 page()->frameHost().visualViewport().viewportToRootFrame( |
| 3855 pointInViewport)); |
| 3856 |
| 3850 DCHECK(m_currentDragData); | 3857 DCHECK(m_currentDragData); |
| 3851 m_currentDragData = DataObject::create(webDragData); | 3858 m_currentDragData = DataObject::create(webDragData); |
| 3852 | 3859 |
| 3853 WebAutofillClient* autofillClient = | 3860 WebAutofillClient* autofillClient = |
| 3854 mainFrameImpl() ? mainFrameImpl()->autofillClient() : 0; | 3861 mainFrameImpl() ? mainFrameImpl()->autofillClient() : 0; |
| 3855 UserGestureNotifier notifier(autofillClient, &m_userGestureObserved); | 3862 UserGestureNotifier notifier(autofillClient, &m_userGestureObserved); |
| 3856 | 3863 |
| 3857 // If this webview transitions from the "drop accepting" state to the "not | 3864 // If this webview transitions from the "drop accepting" state to the "not |
| 3858 // accepting" state, then our IPC message reply indicating that may be in- | 3865 // accepting" state, then our IPC message reply indicating that may be in- |
| 3859 // flight, or else delayed by javascript processing in this webview. If a | 3866 // flight, or else delayed by javascript processing in this webview. If a |
| 3860 // drop happens before our IPC reply has reached the browser process, then | 3867 // drop happens before our IPC reply has reached the browser process, then |
| 3861 // the browser forwards the drop to this webview. So only allow a drop to | 3868 // the browser forwards the drop to this webview. So only allow a drop to |
| 3862 // proceed if our webview m_dragOperation state is not DragOperationNone. | 3869 // proceed if our webview m_dragOperation state is not DragOperationNone. |
| 3863 | 3870 |
| 3864 if (m_dragOperation == | 3871 if (m_dragOperation == |
| 3865 WebDragOperationNone) { // IPC RACE CONDITION: do not allow this drop. | 3872 WebDragOperationNone) { // IPC RACE CONDITION: do not allow this drop. |
| 3866 dragTargetDragLeave(); | 3873 dragTargetDragLeave(); |
| 3867 return; | 3874 return; |
| 3868 } | 3875 } |
| 3869 | 3876 |
| 3870 m_currentDragData->setModifiers(modifiers); | 3877 m_currentDragData->setModifiers(modifiers); |
| 3871 DragData dragData(m_currentDragData.get(), clientPoint, screenPoint, | 3878 DragData dragData(m_currentDragData.get(), pointInRootFrame, screenPoint, |
| 3872 static_cast<DragOperation>(m_operationsAllowed)); | 3879 static_cast<DragOperation>(m_operationsAllowed)); |
| 3873 | 3880 |
| 3874 UserGestureIndicator gesture(DefinitelyProcessingNewUserGesture); | 3881 UserGestureIndicator gesture(DefinitelyProcessingNewUserGesture); |
| 3875 m_page->dragController().performDrag(&dragData); | 3882 m_page->dragController().performDrag(&dragData); |
| 3876 | 3883 |
| 3877 m_dragOperation = WebDragOperationNone; | 3884 m_dragOperation = WebDragOperationNone; |
| 3878 m_currentDragData = nullptr; | 3885 m_currentDragData = nullptr; |
| 3879 } | 3886 } |
| 3880 | 3887 |
| 3881 void WebViewImpl::spellingMarkers(WebVector<uint32_t>* markers) { | 3888 void WebViewImpl::spellingMarkers(WebVector<uint32_t>* markers) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 3898 convertedWords.append(words.data(), words.size()); | 3905 convertedWords.append(words.data(), words.size()); |
| 3899 | 3906 |
| 3900 for (Frame* frame = m_page->mainFrame(); frame; | 3907 for (Frame* frame = m_page->mainFrame(); frame; |
| 3901 frame = frame->tree().traverseNext()) { | 3908 frame = frame->tree().traverseNext()) { |
| 3902 if (frame->isLocalFrame()) | 3909 if (frame->isLocalFrame()) |
| 3903 toLocalFrame(frame)->removeSpellingMarkersUnderWords(convertedWords); | 3910 toLocalFrame(frame)->removeSpellingMarkersUnderWords(convertedWords); |
| 3904 } | 3911 } |
| 3905 } | 3912 } |
| 3906 | 3913 |
| 3907 WebDragOperation WebViewImpl::dragTargetDragEnterOrOver( | 3914 WebDragOperation WebViewImpl::dragTargetDragEnterOrOver( |
| 3908 const WebPoint& clientPoint, | 3915 const WebPoint& pointInViewport, |
| 3909 const WebPoint& screenPoint, | 3916 const WebPoint& screenPoint, |
| 3910 DragAction dragAction, | 3917 DragAction dragAction, |
| 3911 int modifiers) { | 3918 int modifiers) { |
| 3912 DCHECK(m_currentDragData); | 3919 DCHECK(m_currentDragData); |
| 3913 | 3920 |
| 3921 WebPoint pointInRootFrame( |
| 3922 page()->frameHost().visualViewport().viewportToRootFrame( |
| 3923 pointInViewport)); |
| 3924 |
| 3914 m_currentDragData->setModifiers(modifiers); | 3925 m_currentDragData->setModifiers(modifiers); |
| 3915 DragData dragData(m_currentDragData.get(), clientPoint, screenPoint, | 3926 DragData dragData(m_currentDragData.get(), pointInRootFrame, screenPoint, |
| 3916 static_cast<DragOperation>(m_operationsAllowed)); | 3927 static_cast<DragOperation>(m_operationsAllowed)); |
| 3917 | 3928 |
| 3918 DragSession dragSession; | 3929 DragSession dragSession; |
| 3919 if (dragAction == DragEnter) | 3930 if (dragAction == DragEnter) |
| 3920 dragSession = m_page->dragController().dragEntered(&dragData); | 3931 dragSession = m_page->dragController().dragEntered(&dragData); |
| 3921 else | 3932 else |
| 3922 dragSession = m_page->dragController().dragUpdated(&dragData); | 3933 dragSession = m_page->dragController().dragUpdated(&dragData); |
| 3923 | 3934 |
| 3924 DragOperation dropEffect = dragSession.operation; | 3935 DragOperation dropEffect = dragSession.operation; |
| 3925 | 3936 |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4733 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) | 4744 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) |
| 4734 return nullptr; | 4745 return nullptr; |
| 4735 return focusedFrame; | 4746 return focusedFrame; |
| 4736 } | 4747 } |
| 4737 | 4748 |
| 4738 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { | 4749 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { |
| 4739 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; | 4750 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
| 4740 } | 4751 } |
| 4741 | 4752 |
| 4742 } // namespace blink | 4753 } // namespace blink |
| OLD | NEW |