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

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 can_scroll = true;
2184 if (!args->PeekNext().IsEmpty()) { 2185 if (!args->PeekNext().IsEmpty()) {
2185 args->GetNext(&paged); 2186 args->GetNext(&paged);
tdresser 2014/12/02 15:37:38 Invert each of these conditions (including the one
lanwei 2014/12/02 22:28:06 Done. Thanks for the suggestion, looks much clear
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 v8::Handle<v8::Value> value;
2191 args->GetNext(&value);
2192 modifiers = GetKeyModifiersFromV8(value);
2193 if (!args->PeekNext().IsEmpty())
2194 args->GetNext(&can_scroll);
2195 }
2190 } 2196 }
2191 } 2197 }
2192 2198
2193 InitMouseEvent(WebInputEvent::MouseWheel, 2199 InitMouseEvent(WebInputEvent::MouseWheel,
2194 pressed_button_, 2200 pressed_button_,
2195 last_mouse_pos_, 2201 last_mouse_pos_,
2196 GetCurrentEventTimeSec(), 2202 GetCurrentEventTimeSec(),
2197 click_count_, 2203 click_count_,
2198 modifiers, 2204 modifiers,
2199 event); 2205 event);
2200 event->wheelTicksX = static_cast<float>(horizontal); 2206 event->wheelTicksX = static_cast<float>(horizontal);
2201 event->wheelTicksY = static_cast<float>(vertical); 2207 event->wheelTicksY = static_cast<float>(vertical);
2202 event->deltaX = event->wheelTicksX; 2208 event->deltaX = event->wheelTicksX;
2203 event->deltaY = event->wheelTicksY; 2209 event->deltaY = event->wheelTicksY;
2204 event->scrollByPage = paged; 2210 event->scrollByPage = paged;
2205 event->hasPreciseScrollingDeltas = has_precise_scrolling_deltas; 2211 event->hasPreciseScrollingDeltas = has_precise_scrolling_deltas;
2206 2212 event->canScroll = can_scroll;
2207 if (continuous) { 2213 if (continuous) {
2208 event->wheelTicksX /= kScrollbarPixelsPerTick; 2214 event->wheelTicksX /= kScrollbarPixelsPerTick;
2209 event->wheelTicksY /= kScrollbarPixelsPerTick; 2215 event->wheelTicksY /= kScrollbarPixelsPerTick;
2210 } else { 2216 } else {
2211 event->deltaX *= kScrollbarPixelsPerTick; 2217 event->deltaX *= kScrollbarPixelsPerTick;
2212 event->deltaY *= kScrollbarPixelsPerTick; 2218 event->deltaY *= kScrollbarPixelsPerTick;
2213 } 2219 }
2214 } 2220 }
2215 2221
2216 void EventSender::FinishDragAndDrop(const WebMouseEvent& e, 2222 void EventSender::FinishDragAndDrop(const WebMouseEvent& e,
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
2302 } 2308 }
2303 default: 2309 default:
2304 NOTREACHED(); 2310 NOTREACHED();
2305 } 2311 }
2306 } 2312 }
2307 2313
2308 replaying_saved_events_ = false; 2314 replaying_saved_events_ = false;
2309 } 2315 }
2310 2316
2311 } // namespace content 2317 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698