OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/shell/renderer/test_runner/event_sender.h" | 5 #include "content/shell/renderer/test_runner/event_sender.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "content/public/common/page_zoom.h" | 10 #include "content/public/common/page_zoom.h" |
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1182 | 1182 |
1183 void EventSender::MouseDown(int button_number, int modifiers) { | 1183 void EventSender::MouseDown(int button_number, int modifiers) { |
1184 if (force_layout_on_events_) | 1184 if (force_layout_on_events_) |
1185 view_->layout(); | 1185 view_->layout(); |
1186 | 1186 |
1187 DCHECK_NE(-1, button_number); | 1187 DCHECK_NE(-1, button_number); |
1188 | 1188 |
1189 WebMouseEvent::Button button_type = | 1189 WebMouseEvent::Button button_type = |
1190 GetButtonTypeFromButtonNumber(button_number); | 1190 GetButtonTypeFromButtonNumber(button_number); |
1191 | 1191 |
| 1192 // Ignore invalid uses of mouseDown() while drag is in progress. |
| 1193 if (button_type == WebMouseEvent::ButtonLeft && |
| 1194 !current_drag_data_.isNull()) |
| 1195 return; |
| 1196 |
1192 UpdateClickCountForButton(button_type); | 1197 UpdateClickCountForButton(button_type); |
1193 | 1198 |
1194 pressed_button_ = button_type; | 1199 pressed_button_ = button_type; |
1195 | 1200 |
1196 WebMouseEvent event; | 1201 WebMouseEvent event; |
1197 InitMouseEvent(WebInputEvent::MouseDown, | 1202 InitMouseEvent(WebInputEvent::MouseDown, |
1198 button_type, | 1203 button_type, |
1199 last_mouse_pos_, | 1204 last_mouse_pos_, |
1200 GetCurrentEventTimeSec(), | 1205 GetCurrentEventTimeSec(), |
1201 click_count_, | 1206 click_count_, |
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2336 | 2341 |
2337 bool EventSender::HandleInputEventOnViewOrPopup(const WebInputEvent& event) { | 2342 bool EventSender::HandleInputEventOnViewOrPopup(const WebInputEvent& event) { |
2338 if (WebPagePopup* popup = view_->pagePopup()) { | 2343 if (WebPagePopup* popup = view_->pagePopup()) { |
2339 if (!WebInputEvent::isKeyboardEventType(event.type)) | 2344 if (!WebInputEvent::isKeyboardEventType(event.type)) |
2340 return popup->handleInputEvent(event); | 2345 return popup->handleInputEvent(event); |
2341 } | 2346 } |
2342 return view_->handleInputEvent(event); | 2347 return view_->handleInputEvent(event); |
2343 } | 2348 } |
2344 | 2349 |
2345 } // namespace content | 2350 } // namespace content |
OLD | NEW |