diff options
author | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-01 20:42:27 +0000 |
---|---|---|
committer | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-01 20:42:27 +0000 |
commit | 0307076af6164e2fcc2346a5af35ad610b9aa9e8 (patch) | |
tree | 7a925177e85000117428b37fd3902390146b6d3f /chrome | |
parent | 858f65c7eddb2fde46c86c6e28664782b3f98820 (diff) | |
download | chromium_src-0307076af6164e2fcc2346a5af35ad610b9aa9e8.zip chromium_src-0307076af6164e2fcc2346a5af35ad610b9aa9e8.tar.gz chromium_src-0307076af6164e2fcc2346a5af35ad610b9aa9e8.tar.bz2 |
Automation provider should send real windows messages to the window when simulating drags, rather than ChromeViews events. Sending ChromeViews events directly to the RootView means that capture isn't set up properly and some state relating to dragging isn't saved on the frame.
B=1303306
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/automation/automation_provider.cc | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 1ca0d81..2cd8377 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -1257,19 +1257,44 @@ void AutomationProvider::WindowSimulateDrag(const IPC::Message& message, if (browser_tracker_->ContainsHandle(handle) && (drag_path.size() > 1)) { succeeded = true; + UINT down_message = 0; + UINT up_message = 0; + WPARAM wparam_flags = 0; + if (flags & ChromeViews::Event::EF_SHIFT_DOWN) + wparam_flags |= MK_SHIFT; + if (flags & ChromeViews::Event::EF_CONTROL_DOWN) + wparam_flags |= MK_CONTROL; + if (flags & ChromeViews::Event::EF_LEFT_BUTTON_DOWN) { + wparam_flags |= MK_LBUTTON; + down_message = WM_LBUTTONDOWN; + up_message = WM_LBUTTONUP; + } + if (flags & ChromeViews::Event::EF_MIDDLE_BUTTON_DOWN) { + wparam_flags |= MK_MBUTTON; + down_message = WM_MBUTTONDOWN; + up_message = WM_MBUTTONUP; + } + if (flags & ChromeViews::Event::EF_RIGHT_BUTTON_DOWN) { + wparam_flags |= MK_RBUTTON; + down_message = WM_LBUTTONDOWN; + up_message = WM_LBUTTONUP; + } + Browser* browser = browser_tracker_->GetResource(handle); DCHECK(browser); - ChromeViews::RootView* root = browser->window()->GetRootView(); - DCHECK(root); - ScheduleMouseEvent(root, ChromeViews::Event::ET_MOUSE_PRESSED, - drag_path[0], flags); + HWND top_level_hwnd = browser->GetTopLevelHWND(); + SetCursorPos(drag_path[0].x, drag_path[0].y); + SendMessage(top_level_hwnd, down_message, wparam_flags, + MAKELPARAM(drag_path[0].x, drag_path[0].y)); for (int i = 1; i < static_cast<int>(drag_path.size()); ++i) { - ScheduleMouseEvent(root, ChromeViews::Event::ET_MOUSE_DRAGGED, - drag_path[i], flags); + SetCursorPos(drag_path[i].x, drag_path[i].y); + SendMessage(top_level_hwnd, WM_MOUSEMOVE, wparam_flags, + MAKELPARAM(drag_path[i].x, drag_path[i].y)); } POINT end = drag_path[drag_path.size() - 1]; - ScheduleMouseEvent(root, ChromeViews::Event::ET_MOUSE_RELEASED, - drag_path[drag_path.size() - 1], flags); + SetCursorPos(end.x, end.y); + SendMessage(top_level_hwnd, up_message, wparam_flags, + MAKELPARAM(end.x, end.y)); MessageLoop::current()->PostTask(FROM_HERE, new InvokeTaskLaterTask( |