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

Unified Diff: chrome/browser/resources/pdf/viewport_scroller.js

Issue 2617663002: WIP: run clang-format-js on lots of things (Closed)
Patch Set: merge Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/pdf/viewport.js ('k') | chrome/browser/resources/pdf/zoom_manager.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/pdf/viewport_scroller.js
diff --git a/chrome/browser/resources/pdf/viewport_scroller.js b/chrome/browser/resources/pdf/viewport_scroller.js
index f46ef4db4126c7c1367eccde8d7029b404470507..7ce0fe111b7bd52d97907be502d3114090f22c87 100644
--- a/chrome/browser/resources/pdf/viewport_scroller.js
+++ b/chrome/browser/resources/pdf/viewport_scroller.js
@@ -43,9 +43,9 @@ ViewportScroller.prototype = {
*/
startDragScrollTimer_: function() {
if (this.timerId_ === null) {
- this.timerId_ =
- this.window_.setInterval(this.dragScrollPage_.bind(this),
- ViewportScroller.DRAG_TIMER_INTERVAL_MS_);
+ this.timerId_ = this.window_.setInterval(
+ this.dragScrollPage_.bind(this),
+ ViewportScroller.DRAG_TIMER_INTERVAL_MS_);
this.lastFrameTime_ = Date.now();
}
},
@@ -70,7 +70,7 @@ ViewportScroller.prototype = {
var position = this.viewport_.position;
var currentFrameTime = Date.now();
var timeAdjustment = (currentFrameTime - this.lastFrameTime_) /
- ViewportScroller.DRAG_TIMER_INTERVAL_MS_;
+ ViewportScroller.DRAG_TIMER_INTERVAL_MS_;
position.y += (this.scrollVelocity_.y * timeAdjustment);
position.x += (this.scrollVelocity_.x * timeAdjustment);
this.viewport_.position = position;
@@ -85,18 +85,19 @@ ViewportScroller.prototype = {
* @return {Object} Object with x and y direction scroll velocity.
*/
calculateVelocity_: function(event) {
- var x = Math.min(Math.max(-event.offsetX,
- event.offsetX - this.plugin_.offsetWidth, 0),
- ViewportScroller.MAX_DRAG_SCROLL_DISTANCE_) *
- Math.sign(event.offsetX);
- var y = Math.min(Math.max(-event.offsetY,
- event.offsetY - this.plugin_.offsetHeight, 0),
- ViewportScroller.MAX_DRAG_SCROLL_DISTANCE_) *
- Math.sign(event.offsetY);
- return {
- x: x,
- y: y
- };
+ var x =
+ Math.min(
+ Math.max(
+ -event.offsetX, event.offsetX - this.plugin_.offsetWidth, 0),
+ ViewportScroller.MAX_DRAG_SCROLL_DISTANCE_) *
+ Math.sign(event.offsetX);
+ var y =
+ Math.min(
+ Math.max(
+ -event.offsetY, event.offsetY - this.plugin_.offsetHeight, 0),
+ ViewportScroller.MAX_DRAG_SCROLL_DISTANCE_) *
+ Math.sign(event.offsetY);
+ return {x: x, y: y};
},
/**
@@ -122,13 +123,13 @@ ViewportScroller.prototype = {
if (isSelecting) {
if (!this.mousemoveCallback_)
this.mousemoveCallback_ = this.onMousemove_.bind(this);
- this.plugin_.addEventListener('mousemove', this.mousemoveCallback_,
- false);
+ this.plugin_.addEventListener(
+ 'mousemove', this.mousemoveCallback_, false);
} else {
this.stopDragScrollTimer_();
if (this.mousemoveCallback_) {
- this.plugin_.removeEventListener('mousemove', this.mousemoveCallback_,
- false);
+ this.plugin_.removeEventListener(
+ 'mousemove', this.mousemoveCallback_, false);
}
}
}
« no previous file with comments | « chrome/browser/resources/pdf/viewport.js ('k') | chrome/browser/resources/pdf/zoom_manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698