Home | History | Annotate | Download | only in actions

Lines Matching refs:this

2 // Use of this source code is governed by a BSD-style license that can be
5 // This file provides the ScrollAction object, which scrolls a page
16 this.element_ = opt_options.element;
17 this.left_start_ratio_ = opt_options.left_start_ratio;
18 this.top_start_ratio_ = opt_options.top_start_ratio;
19 this.direction_ = opt_options.direction;
20 this.speed_ = opt_options.speed;
21 this.gesture_source_type_ = opt_options.gesture_source_type;
23 this.element_ = document.scrollingElement || document.body;
24 this.left_start_ratio_ = 0.5;
25 this.top_start_ratio_ = 0.5;
26 this.direction_ = 'down';
27 this.speed_ = 800;
28 this.gesture_source_type_ = chrome.gpuBenchmarking.DEFAULT_INPUT;
40 // This class scrolls a page from the top to the bottom once.
44 var self = this;
46 this.beginMeasuringHook = function() {};
47 this.endMeasuringHook = function() {};
49 this.callback_ = opt_callback;
50 this.distance_func_ = opt_distance_func;
56 if (this.element_ == document.body)
59 clientHeight = this.element_.clientHeight;
61 return this.element_.scrollHeight -
62 this.element_.scrollTop -
67 return this.element_.scrollTop;
73 if (this.element_ == document.body)
76 clientWidth = this.element_.clientWidth;
78 return this.element_.scrollWidth - this.element_.scrollLeft - clientWidth;
82 return this.element_.scrollLeft;
86 if (this.distance_func_)
87 return this.distance_func_();
89 if (this.options_.direction_ == 'down') {
90 return this.getScrollDistanceDown_();
91 } else if (this.options_.direction_ == 'up') {
92 return this.getScrollDistanceUp_();
93 } else if (this.options_.direction_ == 'right') {
94 return this.getScrollDistanceRight_();
95 } else if (this.options_.direction_ == 'left') {
96 return this.getScrollDistanceLeft_();
97 } else if (this.options_.direction_ == 'upleft') {
98 return Math.min(this.getScrollDistanceUp_(),
99 this.getScrollDistanceLeft_());
100 } else if (this.options_.direction_ == 'upright') {
101 return Math.min(this.getScrollDistanceUp_(),
102 this.getScrollDistanceRight_());
103 } else if (this.options_.direction_ == 'downleft') {
104 return Math.min(this.getScrollDistanceDown_(),
105 this.getScrollDistanceLeft_());
106 } else if (this.options_.direction_ == 'downright') {
107 return Math.min(this.getScrollDistanceDown_(),
108 this.getScrollDistanceRight_());
113 this.options_ = new ScrollGestureOptions(opt_options);
114 // Assign this.element_ here instead of constructor, because the constructor
115 // ensures this method will be called after the document is loaded.
116 this.element_ = this.options_.element_;
117 requestAnimationFrame(this.startGesture_.bind(this));
121 this.beginMeasuringHook();
124 this.options_.speed_;
126 this.getScrollDistance_());
128 var rect = __GestureCommon_GetBoundingVisibleRect(this.options_.element_);
130 rect.left + rect.width * this.options_.left_start_ratio_;
132 rect.top + rect.height * this.options_.top_start_ratio_;
134 distance, this.onGestureComplete_.bind(this), start_left, start_top,
135 this.options_.gesture_source_type_, this.options_.direction_,
136 this.options_.speed_);
140 this.endMeasuringHook();
143 if (this.callback_)
144 this.callback_();