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

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

Issue 879333002: Support buttons attribute for drag event (blink side). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 years, 9 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 | « Source/web/WebViewImpl.h ('k') | public/web/WebView.h » ('j') | 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 STATIC_ASSERT_MATCHING_ENUM(DragOperationCopy); 230 STATIC_ASSERT_MATCHING_ENUM(DragOperationCopy);
231 STATIC_ASSERT_MATCHING_ENUM(DragOperationLink); 231 STATIC_ASSERT_MATCHING_ENUM(DragOperationLink);
232 STATIC_ASSERT_MATCHING_ENUM(DragOperationGeneric); 232 STATIC_ASSERT_MATCHING_ENUM(DragOperationGeneric);
233 STATIC_ASSERT_MATCHING_ENUM(DragOperationPrivate); 233 STATIC_ASSERT_MATCHING_ENUM(DragOperationPrivate);
234 STATIC_ASSERT_MATCHING_ENUM(DragOperationMove); 234 STATIC_ASSERT_MATCHING_ENUM(DragOperationMove);
235 STATIC_ASSERT_MATCHING_ENUM(DragOperationDelete); 235 STATIC_ASSERT_MATCHING_ENUM(DragOperationDelete);
236 STATIC_ASSERT_MATCHING_ENUM(DragOperationEvery); 236 STATIC_ASSERT_MATCHING_ENUM(DragOperationEvery);
237 237
238 static bool shouldUseExternalPopupMenus = false; 238 static bool shouldUseExternalPopupMenus = false;
239 239
240 static int webInputEventKeyStateToPlatformEventKeyState(int webInputEventKeyStat e)
241 {
242 int platformEventKeyState = 0;
243 if (webInputEventKeyState & WebInputEvent::ShiftKey)
244 platformEventKeyState = platformEventKeyState | PlatformEvent::ShiftKey;
245 if (webInputEventKeyState & WebInputEvent::ControlKey)
246 platformEventKeyState = platformEventKeyState | PlatformEvent::CtrlKey;
247 if (webInputEventKeyState & WebInputEvent::AltKey)
248 platformEventKeyState = platformEventKeyState | PlatformEvent::AltKey;
249 if (webInputEventKeyState & WebInputEvent::MetaKey)
250 platformEventKeyState = platformEventKeyState | PlatformEvent::MetaKey;
251 return platformEventKeyState;
252 }
253
254 namespace { 240 namespace {
255 241
256 class UserGestureNotifier { 242 class UserGestureNotifier {
257 public: 243 public:
258 // If a UserGestureIndicator is created for a user gesture since the last 244 // If a UserGestureIndicator is created for a user gesture since the last
259 // page load and *userGestureObserved is false, the UserGestureNotifier 245 // page load and *userGestureObserved is false, the UserGestureNotifier
260 // will notify the client and set *userGestureObserved to true. 246 // will notify the client and set *userGestureObserved to true.
261 UserGestureNotifier(WebAutofillClient*, bool* userGestureObserved); 247 UserGestureNotifier(WebAutofillClient*, bool* userGestureObserved);
262 ~UserGestureNotifier(); 248 ~UserGestureNotifier();
263 249
(...skipping 3368 matching lines...) Expand 10 before | Expand all | Expand 10 after
3632 m_page->dragController().dragEnded(); 3618 m_page->dragController().dragEnded();
3633 m_doingDragAndDrop = false; 3619 m_doingDragAndDrop = false;
3634 } 3620 }
3635 } 3621 }
3636 3622
3637 WebDragOperation WebViewImpl::dragTargetDragEnter( 3623 WebDragOperation WebViewImpl::dragTargetDragEnter(
3638 const WebDragData& webDragData, 3624 const WebDragData& webDragData,
3639 const WebPoint& clientPoint, 3625 const WebPoint& clientPoint,
3640 const WebPoint& screenPoint, 3626 const WebPoint& screenPoint,
3641 WebDragOperationsMask operationsAllowed, 3627 WebDragOperationsMask operationsAllowed,
3642 int keyModifiers) 3628 int modifiers)
3643 { 3629 {
3644 ASSERT(!m_currentDragData); 3630 ASSERT(!m_currentDragData);
3645 3631
3646 m_currentDragData = DataObject::create(webDragData); 3632 m_currentDragData = DataObject::create(webDragData);
3647 m_operationsAllowed = operationsAllowed; 3633 m_operationsAllowed = operationsAllowed;
3648 3634
3649 return dragTargetDragEnterOrOver(clientPoint, screenPoint, DragEnter, keyMod ifiers); 3635 return dragTargetDragEnterOrOver(clientPoint, screenPoint, DragEnter, modifi ers);
3650 } 3636 }
3651 3637
3652 WebDragOperation WebViewImpl::dragTargetDragOver( 3638 WebDragOperation WebViewImpl::dragTargetDragOver(
3653 const WebPoint& clientPoint, 3639 const WebPoint& clientPoint,
3654 const WebPoint& screenPoint, 3640 const WebPoint& screenPoint,
3655 WebDragOperationsMask operationsAllowed, 3641 WebDragOperationsMask operationsAllowed,
3656 int keyModifiers) 3642 int modifiers)
3657 { 3643 {
3658 m_operationsAllowed = operationsAllowed; 3644 m_operationsAllowed = operationsAllowed;
3659 3645
3660 return dragTargetDragEnterOrOver(clientPoint, screenPoint, DragOver, keyModi fiers); 3646 return dragTargetDragEnterOrOver(clientPoint, screenPoint, DragOver, modifie rs);
3661 } 3647 }
3662 3648
3663 void WebViewImpl::dragTargetDragLeave() 3649 void WebViewImpl::dragTargetDragLeave()
3664 { 3650 {
3665 ASSERT(m_currentDragData); 3651 ASSERT(m_currentDragData);
3666 3652
3667 DragData dragData( 3653 DragData dragData(
3668 m_currentDragData.get(), 3654 m_currentDragData.get(),
3669 IntPoint(), 3655 IntPoint(),
3670 IntPoint(), 3656 IntPoint(),
3671 static_cast<DragOperation>(m_operationsAllowed)); 3657 static_cast<DragOperation>(m_operationsAllowed));
3672 3658
3673 m_page->dragController().dragExited(&dragData); 3659 m_page->dragController().dragExited(&dragData);
3674 3660
3675 // FIXME: why is the drag scroll timer not stopped here? 3661 // FIXME: why is the drag scroll timer not stopped here?
3676 3662
3677 m_dragOperation = WebDragOperationNone; 3663 m_dragOperation = WebDragOperationNone;
3678 m_currentDragData = nullptr; 3664 m_currentDragData = nullptr;
3679 } 3665 }
3680 3666
3681 void WebViewImpl::dragTargetDrop(const WebPoint& clientPoint, 3667 void WebViewImpl::dragTargetDrop(const WebPoint& clientPoint,
3682 const WebPoint& screenPoint, 3668 const WebPoint& screenPoint,
3683 int keyModifiers) 3669 int modifiers)
3684 { 3670 {
3685 ASSERT(m_currentDragData); 3671 ASSERT(m_currentDragData);
3686 3672
3687 WebAutofillClient* autofillClient = mainFrameImpl() ? mainFrameImpl()->autof illClient() : 0; 3673 WebAutofillClient* autofillClient = mainFrameImpl() ? mainFrameImpl()->autof illClient() : 0;
3688 UserGestureNotifier notifier(autofillClient, &m_userGestureObserved); 3674 UserGestureNotifier notifier(autofillClient, &m_userGestureObserved);
3689 3675
3690 // If this webview transitions from the "drop accepting" state to the "not 3676 // If this webview transitions from the "drop accepting" state to the "not
3691 // accepting" state, then our IPC message reply indicating that may be in- 3677 // accepting" state, then our IPC message reply indicating that may be in-
3692 // flight, or else delayed by javascript processing in this webview. If a 3678 // flight, or else delayed by javascript processing in this webview. If a
3693 // drop happens before our IPC reply has reached the browser process, then 3679 // drop happens before our IPC reply has reached the browser process, then
3694 // the browser forwards the drop to this webview. So only allow a drop to 3680 // the browser forwards the drop to this webview. So only allow a drop to
3695 // proceed if our webview m_dragOperation state is not DragOperationNone. 3681 // proceed if our webview m_dragOperation state is not DragOperationNone.
3696 3682
3697 if (m_dragOperation == WebDragOperationNone) { // IPC RACE CONDITION: do not allow this drop. 3683 if (m_dragOperation == WebDragOperationNone) { // IPC RACE CONDITION: do not allow this drop.
3698 dragTargetDragLeave(); 3684 dragTargetDragLeave();
3699 return; 3685 return;
3700 } 3686 }
3701 3687
3702 m_currentDragData->setModifierKeyState(webInputEventKeyStateToPlatformEventK eyState(keyModifiers)); 3688 m_currentDragData->setModifiers(toPlatformMouseEventModifiers(modifiers));
3703 DragData dragData( 3689 DragData dragData(
3704 m_currentDragData.get(), 3690 m_currentDragData.get(),
3705 clientPoint, 3691 clientPoint,
3706 screenPoint, 3692 screenPoint,
3707 static_cast<DragOperation>(m_operationsAllowed)); 3693 static_cast<DragOperation>(m_operationsAllowed));
3708 3694
3709 UserGestureIndicator gesture(DefinitelyProcessingNewUserGesture); 3695 UserGestureIndicator gesture(DefinitelyProcessingNewUserGesture);
3710 m_page->dragController().performDrag(&dragData); 3696 m_page->dragController().performDrag(&dragData);
3711 3697
3712 m_dragOperation = WebDragOperationNone; 3698 m_dragOperation = WebDragOperationNone;
(...skipping 17 matching lines...) Expand all
3730 { 3716 {
3731 Vector<String> convertedWords; 3717 Vector<String> convertedWords;
3732 convertedWords.append(words.data(), words.size()); 3718 convertedWords.append(words.data(), words.size());
3733 3719
3734 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traver seNext()) { 3720 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traver seNext()) {
3735 if (frame->isLocalFrame()) 3721 if (frame->isLocalFrame())
3736 toLocalFrame(frame)->removeSpellingMarkersUnderWords(convertedWords) ; 3722 toLocalFrame(frame)->removeSpellingMarkersUnderWords(convertedWords) ;
3737 } 3723 }
3738 } 3724 }
3739 3725
3740 WebDragOperation WebViewImpl::dragTargetDragEnterOrOver(const WebPoint& clientPo int, const WebPoint& screenPoint, DragAction dragAction, int keyModifiers) 3726 WebDragOperation WebViewImpl::dragTargetDragEnterOrOver(const WebPoint& clientPo int, const WebPoint& screenPoint, DragAction dragAction, int modifiers)
3741 { 3727 {
3742 ASSERT(m_currentDragData); 3728 ASSERT(m_currentDragData);
3743 3729
3744 m_currentDragData->setModifierKeyState(webInputEventKeyStateToPlatformEventK eyState(keyModifiers)); 3730 m_currentDragData->setModifiers(toPlatformMouseEventModifiers(modifiers));
3745 DragData dragData( 3731 DragData dragData(
3746 m_currentDragData.get(), 3732 m_currentDragData.get(),
3747 clientPoint, 3733 clientPoint,
3748 screenPoint, 3734 screenPoint,
3749 static_cast<DragOperation>(m_operationsAllowed)); 3735 static_cast<DragOperation>(m_operationsAllowed));
3750 3736
3751 DragSession dragSession; 3737 DragSession dragSession;
3752 if (dragAction == DragEnter) 3738 if (dragAction == DragEnter)
3753 dragSession = m_page->dragController().dragEntered(&dragData); 3739 dragSession = m_page->dragController().dragEntered(&dragData);
3754 else 3740 else
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
4666 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4652 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4667 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4653 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4668 } 4654 }
4669 4655
4670 void WebViewImpl::forceNextWebGLContextCreationToFail() 4656 void WebViewImpl::forceNextWebGLContextCreationToFail()
4671 { 4657 {
4672 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); 4658 WebGLRenderingContext::forceNextWebGLContextCreationToFail();
4673 } 4659 }
4674 4660
4675 } // namespace blink 4661 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | public/web/WebView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698