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