Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: content/shell/renderer/test_runner/event_sender.cc

Issue 739013008: Explicitly suppress scrolling for wheel events that will trigger zooming (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unit tests Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 if (!args->PeekNext().IsEmpty()) { 2210 bool can_scroll = true;
2211 args->GetNext(&paged); 2211 if (args->PeekNext().IsEmpty())
2212 if (!args->PeekNext().IsEmpty()) { 2212 return;
2213 args->GetNext(&has_precise_scrolling_deltas); 2213 args->GetNext(&paged);
2214 if (!args->PeekNext().IsEmpty()) 2214 if (args->PeekNext().IsEmpty())
2215 modifiers = GetKeyModifiersFromV8(args->PeekNext()); 2215 return;
2216 } 2216 args->GetNext(&has_precise_scrolling_deltas);
2217 } 2217 if (args->PeekNext().IsEmpty())
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);
2218 2225
2219 InitMouseEvent(WebInputEvent::MouseWheel, 2226 InitMouseEvent(WebInputEvent::MouseWheel,
2220 pressed_button_, 2227 pressed_button_,
2221 last_mouse_pos_, 2228 last_mouse_pos_,
2222 GetCurrentEventTimeSec(), 2229 GetCurrentEventTimeSec(),
2223 click_count_, 2230 click_count_,
2224 modifiers, 2231 modifiers,
2225 event); 2232 event);
2226 event->wheelTicksX = static_cast<float>(horizontal); 2233 event->wheelTicksX = static_cast<float>(horizontal);
2227 event->wheelTicksY = static_cast<float>(vertical); 2234 event->wheelTicksY = static_cast<float>(vertical);
2228 event->deltaX = event->wheelTicksX; 2235 event->deltaX = event->wheelTicksX;
2229 event->deltaY = event->wheelTicksY; 2236 event->deltaY = event->wheelTicksY;
2230 event->scrollByPage = paged; 2237 event->scrollByPage = paged;
2231 event->hasPreciseScrollingDeltas = has_precise_scrolling_deltas; 2238 event->hasPreciseScrollingDeltas = has_precise_scrolling_deltas;
2232 2239 event->canScroll = can_scroll;
2233 if (continuous) { 2240 if (continuous) {
2234 event->wheelTicksX /= kScrollbarPixelsPerTick; 2241 event->wheelTicksX /= kScrollbarPixelsPerTick;
2235 event->wheelTicksY /= kScrollbarPixelsPerTick; 2242 event->wheelTicksY /= kScrollbarPixelsPerTick;
2236 } else { 2243 } else {
2237 event->deltaX *= kScrollbarPixelsPerTick; 2244 event->deltaX *= kScrollbarPixelsPerTick;
2238 event->deltaY *= kScrollbarPixelsPerTick; 2245 event->deltaY *= kScrollbarPixelsPerTick;
2239 } 2246 }
2240 } 2247 }
2241 2248
2242 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
2336 2343
2337 bool EventSender::HandleInputEventOnViewOrPopup(const WebInputEvent& event) { 2344 bool EventSender::HandleInputEventOnViewOrPopup(const WebInputEvent& event) {
2338 if (WebPagePopup* popup = view_->pagePopup()) { 2345 if (WebPagePopup* popup = view_->pagePopup()) {
2339 if (!WebInputEvent::isKeyboardEventType(event.type)) 2346 if (!WebInputEvent::isKeyboardEventType(event.type))
2340 return popup->handleInputEvent(event); 2347 return popup->handleInputEvent(event);
2341 } 2348 }
2342 return view_->handleInputEvent(event); 2349 return view_->handleInputEvent(event);
2343 } 2350 }
2344 2351
2345 } // namespace content 2352 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698