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

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: 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 2163 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 bool suppress_scroll = false;
2184 if (!args->PeekNext().IsEmpty()) { 2185 if (!args->PeekNext().IsEmpty()) {
2185 args->GetNext(&paged); 2186 args->GetNext(&paged);
2186 if (!args->PeekNext().IsEmpty()) { 2187 if (!args->PeekNext().IsEmpty()) {
2187 args->GetNext(&has_precise_scrolling_deltas); 2188 args->GetNext(&has_precise_scrolling_deltas);
2188 if (!args->PeekNext().IsEmpty()) 2189 if (!args->PeekNext().IsEmpty()) {
2189 modifiers = GetKeyModifiersFromV8(args->PeekNext()); 2190 modifiers = GetKeyModifiersFromV8(args->PeekNext());
2191 args->Skip();
tdresser 2014/11/27 15:06:08 Can't you replace args->PeekNext(); args->Skip();
lanwei 2014/12/02 06:28:54 Done.
2192 if (!args->PeekNext().IsEmpty())
2193 args->GetNext(&suppress_scroll);
2194 }
2190 } 2195 }
2191 } 2196 }
2192 2197
2193 InitMouseEvent(WebInputEvent::MouseWheel, 2198 InitMouseEvent(WebInputEvent::MouseWheel,
2194 pressed_button_, 2199 pressed_button_,
2195 last_mouse_pos_, 2200 last_mouse_pos_,
2196 GetCurrentEventTimeSec(), 2201 GetCurrentEventTimeSec(),
2197 click_count_, 2202 click_count_,
2198 modifiers, 2203 modifiers,
2199 event); 2204 event);
2200 event->wheelTicksX = static_cast<float>(horizontal); 2205 event->wheelTicksX = static_cast<float>(horizontal);
2201 event->wheelTicksY = static_cast<float>(vertical); 2206 event->wheelTicksY = static_cast<float>(vertical);
2202 event->deltaX = event->wheelTicksX; 2207 event->deltaX = event->wheelTicksX;
2203 event->deltaY = event->wheelTicksY; 2208 event->deltaY = event->wheelTicksY;
2204 event->scrollByPage = paged; 2209 event->scrollByPage = paged;
2205 event->hasPreciseScrollingDeltas = has_precise_scrolling_deltas; 2210 event->hasPreciseScrollingDeltas = has_precise_scrolling_deltas;
2206 2211 event->suppressScroll = suppress_scroll;
2207 if (continuous) { 2212 if (continuous) {
2208 event->wheelTicksX /= kScrollbarPixelsPerTick; 2213 event->wheelTicksX /= kScrollbarPixelsPerTick;
2209 event->wheelTicksY /= kScrollbarPixelsPerTick; 2214 event->wheelTicksY /= kScrollbarPixelsPerTick;
2210 } else { 2215 } else {
2211 event->deltaX *= kScrollbarPixelsPerTick; 2216 event->deltaX *= kScrollbarPixelsPerTick;
2212 event->deltaY *= kScrollbarPixelsPerTick; 2217 event->deltaY *= kScrollbarPixelsPerTick;
2213 } 2218 }
2214 } 2219 }
2215 2220
2216 void EventSender::FinishDragAndDrop(const WebMouseEvent& e, 2221 void EventSender::FinishDragAndDrop(const WebMouseEvent& e,
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
2302 } 2307 }
2303 default: 2308 default:
2304 NOTREACHED(); 2309 NOTREACHED();
2305 } 2310 }
2306 } 2311 }
2307 2312
2308 replaying_saved_events_ = false; 2313 replaying_saved_events_ = false;
2309 } 2314 }
2310 2315
2311 } // namespace content 2316 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698