| 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);
|
| }
|
| }
|
| }
|
|
|