| 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 2049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2060 NOTREACHED(); | 2060 NOTREACHED(); |
| 2061 } | 2061 } |
| 2062 | 2062 |
| 2063 event.globalX = event.x; | 2063 event.globalX = event.x; |
| 2064 event.globalY = event.y; | 2064 event.globalY = event.y; |
| 2065 event.timeStampSeconds = GetCurrentEventTimeSec(); | 2065 event.timeStampSeconds = GetCurrentEventTimeSec(); |
| 2066 | 2066 |
| 2067 if (force_layout_on_events_) | 2067 if (force_layout_on_events_) |
| 2068 view_->layout(); | 2068 view_->layout(); |
| 2069 | 2069 |
| 2070 view_->handleInputEvent(event); | 2070 bool result = view_->handleInputEvent(event); |
| 2071 | 2071 |
| 2072 // Long press might start a drag drop session. Complete it if so. | 2072 // Long press might start a drag drop session. Complete it if so. |
| 2073 if (type == WebInputEvent::GestureLongPress && !current_drag_data_.isNull()) { | 2073 if (type == WebInputEvent::GestureLongPress && !current_drag_data_.isNull()) { |
| 2074 WebMouseEvent mouse_event; | 2074 WebMouseEvent mouse_event; |
| 2075 InitMouseEvent(WebInputEvent::MouseDown, | 2075 InitMouseEvent(WebInputEvent::MouseDown, |
| 2076 pressed_button_, | 2076 pressed_button_, |
| 2077 point, | 2077 point, |
| 2078 GetCurrentEventTimeSec(), | 2078 GetCurrentEventTimeSec(), |
| 2079 click_count_, | 2079 click_count_, |
| 2080 0, | 2080 0, |
| 2081 &mouse_event); | 2081 &mouse_event); |
| 2082 | 2082 |
| 2083 FinishDragAndDrop(mouse_event, blink::WebDragOperationNone); | 2083 FinishDragAndDrop(mouse_event, blink::WebDragOperationNone); |
| 2084 } | 2084 } |
| 2085 args->Return(result); |
| 2085 } | 2086 } |
| 2086 | 2087 |
| 2087 void EventSender::UpdateClickCountForButton( | 2088 void EventSender::UpdateClickCountForButton( |
| 2088 WebMouseEvent::Button button_type) { | 2089 WebMouseEvent::Button button_type) { |
| 2089 if ((GetCurrentEventTimeSec() - last_click_time_sec_ < | 2090 if ((GetCurrentEventTimeSec() - last_click_time_sec_ < |
| 2090 kMultipleClickTimeSec) && | 2091 kMultipleClickTimeSec) && |
| 2091 (!OutsideMultiClickRadius(last_mouse_pos_, last_click_pos_)) && | 2092 (!OutsideMultiClickRadius(last_mouse_pos_, last_click_pos_)) && |
| 2092 (button_type == last_button_type_)) { | 2093 (button_type == last_button_type_)) { |
| 2093 ++click_count_; | 2094 ++click_count_; |
| 2094 } else { | 2095 } else { |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2241 } | 2242 } |
| 2242 default: | 2243 default: |
| 2243 NOTREACHED(); | 2244 NOTREACHED(); |
| 2244 } | 2245 } |
| 2245 } | 2246 } |
| 2246 | 2247 |
| 2247 replaying_saved_events_ = false; | 2248 replaying_saved_events_ = false; |
| 2248 } | 2249 } |
| 2249 | 2250 |
| 2250 } // namespace content | 2251 } // namespace content |
| OLD | NEW |