| 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 2189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2200 } | 2200 } |
| 2201 double vertical; | 2201 double vertical; |
| 2202 if (!args->GetNext(&vertical)) { | 2202 if (!args->GetNext(&vertical)) { |
| 2203 args->ThrowError(); | 2203 args->ThrowError(); |
| 2204 return; | 2204 return; |
| 2205 } | 2205 } |
| 2206 | 2206 |
| 2207 bool paged = false; | 2207 bool paged = false; |
| 2208 bool has_precise_scrolling_deltas = false; | 2208 bool has_precise_scrolling_deltas = false; |
| 2209 int modifiers = 0; | 2209 int modifiers = 0; |
| 2210 bool can_scroll = true; | 2210 if (!args->PeekNext().IsEmpty()) { |
| 2211 if (args->PeekNext().IsEmpty()) | 2211 args->GetNext(&paged); |
| 2212 return; | 2212 if (!args->PeekNext().IsEmpty()) { |
| 2213 args->GetNext(&paged); | 2213 args->GetNext(&has_precise_scrolling_deltas); |
| 2214 if (args->PeekNext().IsEmpty()) | 2214 if (!args->PeekNext().IsEmpty()) |
| 2215 return; | 2215 modifiers = GetKeyModifiersFromV8(args->PeekNext()); |
| 2216 args->GetNext(&has_precise_scrolling_deltas); | 2216 } |
| 2217 if (args->PeekNext().IsEmpty()) | 2217 } |
| 2218 return; | |
| 2219 v8::Handle<v8::Value> value; | |
| 2220 args->GetNext(&value); | |
| 2221 modifiers = GetKeyModifiersFromV8(value); | |
| 2222 if (args->PeekNext().IsEmpty()) | |
| 2223 return; | |
| 2224 args->GetNext(&can_scroll); | |
| 2225 | 2218 |
| 2226 InitMouseEvent(WebInputEvent::MouseWheel, | 2219 InitMouseEvent(WebInputEvent::MouseWheel, |
| 2227 pressed_button_, | 2220 pressed_button_, |
| 2228 last_mouse_pos_, | 2221 last_mouse_pos_, |
| 2229 GetCurrentEventTimeSec(), | 2222 GetCurrentEventTimeSec(), |
| 2230 click_count_, | 2223 click_count_, |
| 2231 modifiers, | 2224 modifiers, |
| 2232 event); | 2225 event); |
| 2233 event->wheelTicksX = static_cast<float>(horizontal); | 2226 event->wheelTicksX = static_cast<float>(horizontal); |
| 2234 event->wheelTicksY = static_cast<float>(vertical); | 2227 event->wheelTicksY = static_cast<float>(vertical); |
| 2235 event->deltaX = event->wheelTicksX; | 2228 event->deltaX = event->wheelTicksX; |
| 2236 event->deltaY = event->wheelTicksY; | 2229 event->deltaY = event->wheelTicksY; |
| 2237 event->scrollByPage = paged; | 2230 event->scrollByPage = paged; |
| 2238 event->hasPreciseScrollingDeltas = has_precise_scrolling_deltas; | 2231 event->hasPreciseScrollingDeltas = has_precise_scrolling_deltas; |
| 2239 event->canScroll = can_scroll; | 2232 |
| 2240 if (continuous) { | 2233 if (continuous) { |
| 2241 event->wheelTicksX /= kScrollbarPixelsPerTick; | 2234 event->wheelTicksX /= kScrollbarPixelsPerTick; |
| 2242 event->wheelTicksY /= kScrollbarPixelsPerTick; | 2235 event->wheelTicksY /= kScrollbarPixelsPerTick; |
| 2243 } else { | 2236 } else { |
| 2244 event->deltaX *= kScrollbarPixelsPerTick; | 2237 event->deltaX *= kScrollbarPixelsPerTick; |
| 2245 event->deltaY *= kScrollbarPixelsPerTick; | 2238 event->deltaY *= kScrollbarPixelsPerTick; |
| 2246 } | 2239 } |
| 2247 } | 2240 } |
| 2248 | 2241 |
| 2249 void EventSender::FinishDragAndDrop(const WebMouseEvent& e, | 2242 void EventSender::FinishDragAndDrop(const WebMouseEvent& e, |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2343 | 2336 |
| 2344 bool EventSender::HandleInputEventOnViewOrPopup(const WebInputEvent& event) { | 2337 bool EventSender::HandleInputEventOnViewOrPopup(const WebInputEvent& event) { |
| 2345 if (WebPagePopup* popup = view_->pagePopup()) { | 2338 if (WebPagePopup* popup = view_->pagePopup()) { |
| 2346 if (!WebInputEvent::isKeyboardEventType(event.type)) | 2339 if (!WebInputEvent::isKeyboardEventType(event.type)) |
| 2347 return popup->handleInputEvent(event); | 2340 return popup->handleInputEvent(event); |
| 2348 } | 2341 } |
| 2349 return view_->handleInputEvent(event); | 2342 return view_->handleInputEvent(event); |
| 2350 } | 2343 } |
| 2351 | 2344 |
| 2352 } // namespace content | 2345 } // namespace content |
| OLD | NEW |