Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(802)

Side by Side Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 2396693002: Convert drag event position to root frame. (Closed)
Patch Set: Convert drag event position to root frame. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/web/WebInputEventConversion.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3691 matching lines...) Expand 10 before | Expand all | Expand 10 after
3702 // FIXME: why is the drag scroll timer not stopped here? 3702 // FIXME: why is the drag scroll timer not stopped here?
3703 3703
3704 m_dragOperation = WebDragOperationNone; 3704 m_dragOperation = WebDragOperationNone;
3705 m_currentDragData = nullptr; 3705 m_currentDragData = nullptr;
3706 } 3706 }
3707 3707
3708 void WebViewImpl::dragTargetDrop(const WebDragData& webDragData, const WebPoint& clientPoint, 3708 void WebViewImpl::dragTargetDrop(const WebDragData& webDragData, const WebPoint& clientPoint,
3709 const WebPoint& screenPoint, 3709 const WebPoint& screenPoint,
3710 int modifiers) 3710 int modifiers)
3711 { 3711 {
3712 WebPoint clientPointInRootFrame(convertDragEventPointToRootFrame(mainFrameIm pl()->frameView(), IntPoint(clientPoint.x, clientPoint.y)));
bokan 2016/10/04 23:47:23 no need for the helper function, just call page()-
hush (inactive) 2016/10/05 00:24:33 Done.
3713
3712 DCHECK(m_currentDragData); 3714 DCHECK(m_currentDragData);
3713 m_currentDragData = DataObject::create(webDragData); 3715 m_currentDragData = DataObject::create(webDragData);
3714 3716
3715 WebAutofillClient* autofillClient = mainFrameImpl() ? mainFrameImpl()->autof illClient() : 0; 3717 WebAutofillClient* autofillClient = mainFrameImpl() ? mainFrameImpl()->autof illClient() : 0;
3716 UserGestureNotifier notifier(autofillClient, &m_userGestureObserved); 3718 UserGestureNotifier notifier(autofillClient, &m_userGestureObserved);
3717 3719
3718 // If this webview transitions from the "drop accepting" state to the "not 3720 // If this webview transitions from the "drop accepting" state to the "not
3719 // accepting" state, then our IPC message reply indicating that may be in- 3721 // accepting" state, then our IPC message reply indicating that may be in-
3720 // flight, or else delayed by javascript processing in this webview. If a 3722 // flight, or else delayed by javascript processing in this webview. If a
3721 // drop happens before our IPC reply has reached the browser process, then 3723 // drop happens before our IPC reply has reached the browser process, then
3722 // the browser forwards the drop to this webview. So only allow a drop to 3724 // the browser forwards the drop to this webview. So only allow a drop to
3723 // proceed if our webview m_dragOperation state is not DragOperationNone. 3725 // proceed if our webview m_dragOperation state is not DragOperationNone.
3724 3726
3725 if (m_dragOperation == WebDragOperationNone) { // IPC RACE CONDITION: do not allow this drop. 3727 if (m_dragOperation == WebDragOperationNone) { // IPC RACE CONDITION: do not allow this drop.
3726 dragTargetDragLeave(); 3728 dragTargetDragLeave();
3727 return; 3729 return;
3728 } 3730 }
3729 3731
3730 m_currentDragData->setModifiers(modifiers); 3732 m_currentDragData->setModifiers(modifiers);
3731 DragData dragData( 3733 DragData dragData(
3732 m_currentDragData.get(), 3734 m_currentDragData.get(),
3733 clientPoint, 3735 clientPointInRootFrame,
3734 screenPoint, 3736 screenPoint,
3735 static_cast<DragOperation>(m_operationsAllowed)); 3737 static_cast<DragOperation>(m_operationsAllowed));
3736 3738
3737 UserGestureIndicator gesture(DefinitelyProcessingNewUserGesture); 3739 UserGestureIndicator gesture(DefinitelyProcessingNewUserGesture);
3738 m_page->dragController().performDrag(&dragData); 3740 m_page->dragController().performDrag(&dragData);
3739 3741
3740 m_dragOperation = WebDragOperationNone; 3742 m_dragOperation = WebDragOperationNone;
3741 m_currentDragData = nullptr; 3743 m_currentDragData = nullptr;
3742 } 3744 }
3743 3745
(...skipping 18 matching lines...) Expand all
3762 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traver seNext()) { 3764 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traver seNext()) {
3763 if (frame->isLocalFrame()) 3765 if (frame->isLocalFrame())
3764 toLocalFrame(frame)->removeSpellingMarkersUnderWords(convertedWords) ; 3766 toLocalFrame(frame)->removeSpellingMarkersUnderWords(convertedWords) ;
3765 } 3767 }
3766 } 3768 }
3767 3769
3768 WebDragOperation WebViewImpl::dragTargetDragEnterOrOver(const WebPoint& clientPo int, const WebPoint& screenPoint, DragAction dragAction, int modifiers) 3770 WebDragOperation WebViewImpl::dragTargetDragEnterOrOver(const WebPoint& clientPo int, const WebPoint& screenPoint, DragAction dragAction, int modifiers)
3769 { 3771 {
3770 DCHECK(m_currentDragData); 3772 DCHECK(m_currentDragData);
3771 3773
3774 WebPoint clientPointInRootFrame(convertDragEventPointToRootFrame(mainFrameIm pl()->frameView(), IntPoint(clientPoint.x, clientPoint.y)));
3775
3772 m_currentDragData->setModifiers(modifiers); 3776 m_currentDragData->setModifiers(modifiers);
3773 DragData dragData( 3777 DragData dragData(
3774 m_currentDragData.get(), 3778 m_currentDragData.get(),
3775 clientPoint, 3779 clientPointInRootFrame,
3776 screenPoint, 3780 screenPoint,
3777 static_cast<DragOperation>(m_operationsAllowed)); 3781 static_cast<DragOperation>(m_operationsAllowed));
3778 3782
3779 DragSession dragSession; 3783 DragSession dragSession;
3780 if (dragAction == DragEnter) 3784 if (dragAction == DragEnter)
3781 dragSession = m_page->dragController().dragEntered(&dragData); 3785 dragSession = m_page->dragController().dragEntered(&dragData);
3782 else 3786 else
3783 dragSession = m_page->dragController().dragUpdated(&dragData); 3787 dragSession = m_page->dragController().dragUpdated(&dragData);
3784 3788
3785 DragOperation dropEffect = dragSession.operation; 3789 DragOperation dropEffect = dragSession.operation;
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
4592 return nullptr; 4596 return nullptr;
4593 return focusedFrame; 4597 return focusedFrame;
4594 } 4598 }
4595 4599
4596 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const 4600 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const
4597 { 4601 {
4598 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; 4602 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr;
4599 } 4603 }
4600 4604
4601 } // namespace blink 4605 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebInputEventConversion.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698