| 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 2163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2174 } | 2174 } |
| 2175 double vertical; | 2175 double vertical; |
| 2176 if (!args->GetNext(&vertical)) { | 2176 if (!args->GetNext(&vertical)) { |
| 2177 args->ThrowError(); | 2177 args->ThrowError(); |
| 2178 return; | 2178 return; |
| 2179 } | 2179 } |
| 2180 | 2180 |
| 2181 bool paged = false; | 2181 bool paged = false; |
| 2182 bool has_precise_scrolling_deltas = false; | 2182 bool has_precise_scrolling_deltas = false; |
| 2183 int modifiers = 0; | 2183 int modifiers = 0; |
| 2184 if (!args->PeekNext().IsEmpty()) { | 2184 bool can_scroll = true; |
| 2185 args->GetNext(&paged); | 2185 if (args->PeekNext().IsEmpty()) |
| 2186 if (!args->PeekNext().IsEmpty()) { | 2186 return; |
| 2187 args->GetNext(&has_precise_scrolling_deltas); | 2187 args->GetNext(&paged); |
| 2188 if (!args->PeekNext().IsEmpty()) | 2188 if (args->PeekNext().IsEmpty()) |
| 2189 modifiers = GetKeyModifiersFromV8(args->PeekNext()); | 2189 return; |
| 2190 } | 2190 args->GetNext(&has_precise_scrolling_deltas); |
| 2191 } | 2191 if (args->PeekNext().IsEmpty()) |
| 2192 return; |
| 2193 v8::Handle<v8::Value> value; |
| 2194 args->GetNext(&value); |
| 2195 modifiers = GetKeyModifiersFromV8(value); |
| 2196 if (args->PeekNext().IsEmpty()) |
| 2197 return; |
| 2198 args->GetNext(&can_scroll); |
| 2192 | 2199 |
| 2193 InitMouseEvent(WebInputEvent::MouseWheel, | 2200 InitMouseEvent(WebInputEvent::MouseWheel, |
| 2194 pressed_button_, | 2201 pressed_button_, |
| 2195 last_mouse_pos_, | 2202 last_mouse_pos_, |
| 2196 GetCurrentEventTimeSec(), | 2203 GetCurrentEventTimeSec(), |
| 2197 click_count_, | 2204 click_count_, |
| 2198 modifiers, | 2205 modifiers, |
| 2199 event); | 2206 event); |
| 2200 event->wheelTicksX = static_cast<float>(horizontal); | 2207 event->wheelTicksX = static_cast<float>(horizontal); |
| 2201 event->wheelTicksY = static_cast<float>(vertical); | 2208 event->wheelTicksY = static_cast<float>(vertical); |
| 2202 event->deltaX = event->wheelTicksX; | 2209 event->deltaX = event->wheelTicksX; |
| 2203 event->deltaY = event->wheelTicksY; | 2210 event->deltaY = event->wheelTicksY; |
| 2204 event->scrollByPage = paged; | 2211 event->scrollByPage = paged; |
| 2205 event->hasPreciseScrollingDeltas = has_precise_scrolling_deltas; | 2212 event->hasPreciseScrollingDeltas = has_precise_scrolling_deltas; |
| 2206 | 2213 event->canScroll = can_scroll; |
| 2207 if (continuous) { | 2214 if (continuous) { |
| 2208 event->wheelTicksX /= kScrollbarPixelsPerTick; | 2215 event->wheelTicksX /= kScrollbarPixelsPerTick; |
| 2209 event->wheelTicksY /= kScrollbarPixelsPerTick; | 2216 event->wheelTicksY /= kScrollbarPixelsPerTick; |
| 2210 } else { | 2217 } else { |
| 2211 event->deltaX *= kScrollbarPixelsPerTick; | 2218 event->deltaX *= kScrollbarPixelsPerTick; |
| 2212 event->deltaY *= kScrollbarPixelsPerTick; | 2219 event->deltaY *= kScrollbarPixelsPerTick; |
| 2213 } | 2220 } |
| 2214 } | 2221 } |
| 2215 | 2222 |
| 2216 void EventSender::FinishDragAndDrop(const WebMouseEvent& e, | 2223 void EventSender::FinishDragAndDrop(const WebMouseEvent& e, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2302 } | 2309 } |
| 2303 default: | 2310 default: |
| 2304 NOTREACHED(); | 2311 NOTREACHED(); |
| 2305 } | 2312 } |
| 2306 } | 2313 } |
| 2307 | 2314 |
| 2308 replaying_saved_events_ = false; | 2315 replaying_saved_events_ = false; |
| 2309 } | 2316 } |
| 2310 | 2317 |
| 2311 } // namespace content | 2318 } // namespace content |
| OLD | NEW |