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

Side by Side Diff: tools/telemetry/telemetry/page/actions/scroll.js

Issue 11858007: Splits SmoothGestureController from RenderWidgetHostImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adds missing ifdef for aura Created 7 years, 8 months 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_widget.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // This file provides the ScrollAction object, which scrolls a page 5 // This file provides the ScrollAction object, which scrolls a page
6 // from top to bottom: 6 // from top to bottom:
7 // 1. var action = new __ScrollAction(callback) 7 // 1. var action = new __ScrollAction(callback)
8 // 2. action.start(element_to_scroll) 8 // 2. action.start(element_to_scroll)
9 'use strict'; 9 'use strict';
10 10
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 return rect; 67 return rect;
68 }; 68 };
69 69
70 SmoothScrollDownGesture.prototype.start = function(distance, callback) { 70 SmoothScrollDownGesture.prototype.start = function(distance, callback) {
71 this.callback_ = callback; 71 this.callback_ = callback;
72 if (window.chrome && 72 if (window.chrome &&
73 chrome.gpuBenchmarking && 73 chrome.gpuBenchmarking &&
74 chrome.gpuBenchmarking.smoothScrollBy) { 74 chrome.gpuBenchmarking.smoothScrollBy) {
75 var rect = getBoundingVisibleRect(this.element_); 75 var rect = getBoundingVisibleRect(this.element_);
76 chrome.gpuBenchmarking.smoothScrollBy(distance, function() { 76 var scrolled = chrome.gpuBenchmarking.smoothScrollBy(
77 callback(); 77 distance, function() {
78 }, rect.left + rect.width / 2, rect.top + rect.height / 2); 78 callback();
79 },
80 rect.left + rect.width / 2, rect.top + rect.height / 2);
81 if (!scrolled)
82 console.log('Unable to start smooth scrolling');
79 return; 83 return;
80 } 84 }
81 85
82 var SCROLL_DELTA = 100; 86 var SCROLL_DELTA = 100;
83 this.element_.scrollTop += SCROLL_DELTA; 87 this.element_.scrollTop += SCROLL_DELTA;
84 requestAnimationFrame(callback); 88 requestAnimationFrame(callback);
85 }; 89 };
86 90
87 // This class scrolls a page from the top to the bottom once. 91 // This class scrolls a page from the top to the bottom once.
88 // 92 //
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 this.endMeasuringHook(); 156 this.endMeasuringHook();
153 157
154 // We're done. 158 // We're done.
155 if (this.callback_) 159 if (this.callback_)
156 this.callback_(); 160 this.callback_();
157 }; 161 };
158 162
159 window.__ScrollAction = ScrollAction; 163 window.__ScrollAction = ScrollAction;
160 window.__ScrollAction_GetBoundingVisibleRect = getBoundingVisibleRect; 164 window.__ScrollAction_GetBoundingVisibleRect = getBoundingVisibleRect;
161 })(); 165 })();
OLDNEW
« no previous file with comments | « content/renderer/render_widget.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698