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

Side by Side Diff: third_party/google_input_tools/src/chrome/os/inputview/handler/pointerhandler.js

Issue 701603002: Update to google-input-tools version 1.0.5.0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 ChromeOS IME Authors. All Rights Reserved. 1 // Copyright 2014 The ChromeOS IME Authors. All Rights Reserved.
2 // limitations under the License. 2 // limitations under the License.
3 // See the License for the specific language governing permissions and 3 // See the License for the specific language governing permissions and
4 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5 // distributed under the License is distributed on an "AS-IS" BASIS, 5 // distributed under the License is distributed on an "AS-IS" BASIS,
6 // Unless required by applicable law or agreed to in writing, software 6 // Unless required by applicable law or agreed to in writing, software
7 // 7 //
8 // http://www.apache.org/licenses/LICENSE-2.0 8 // http://www.apache.org/licenses/LICENSE-2.0
9 // 9 //
10 // You may obtain a copy of the License at 10 // You may obtain a copy of the License at
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 /** 83 /**
84 * Event handler for previous mousedown or touchstart target. 84 * Event handler for previous mousedown or touchstart target.
85 * 85 *
86 * @private {i18n.input.chrome.inputview.handler.PointerActionBundle} 86 * @private {i18n.input.chrome.inputview.handler.PointerActionBundle}
87 */ 87 */
88 PointerHandler.prototype.previousPointerActionBundle_ = null; 88 PointerHandler.prototype.previousPointerActionBundle_ = null;
89 89
90 90
91 /** 91 /**
92 * Pointer action bundle for mouse down.
93 * This is used in mouse up handler because mouse up event may have different
94 * target than the mouse down event.
95 *
96 * @private {i18n.input.chrome.inputview.handler.PointerActionBundle}
97 */
98 PointerHandler.prototype.pointerActionBundleForMouseDown_ = null;
99
100
101 /**
92 * Creates a new pointer handler. 102 * Creates a new pointer handler.
93 * 103 *
94 * @param {!Node} target . 104 * @param {!Node} target .
95 * @return {!i18n.input.chrome.inputview.handler.PointerActionBundle} . 105 * @return {!i18n.input.chrome.inputview.handler.PointerActionBundle} .
96 * @private 106 * @private
97 */ 107 */
98 PointerHandler.prototype.createPointerActionBundle_ = function(target) { 108 PointerHandler.prototype.createPointerActionBundle_ = function(target) {
99 var uid = goog.getUid(target); 109 var uid = goog.getUid(target);
100 if (!this.pointerActionBundles_[uid]) { 110 if (!this.pointerActionBundles_[uid]) {
101 this.pointerActionBundles_[uid] = new i18n.input.chrome.inputview.handler. 111 this.pointerActionBundles_[uid] = new i18n.input.chrome.inputview.handler.
(...skipping 13 matching lines...) Expand all
115 var pointerActionBundle = this.createPointerActionBundle_( 125 var pointerActionBundle = this.createPointerActionBundle_(
116 /** @type {!Node} */ (e.target)); 126 /** @type {!Node} */ (e.target));
117 if (this.previousPointerActionBundle_ && 127 if (this.previousPointerActionBundle_ &&
118 this.previousPointerActionBundle_ != pointerActionBundle) { 128 this.previousPointerActionBundle_ != pointerActionBundle) {
119 this.previousPointerActionBundle_.cancelDoubleClick(); 129 this.previousPointerActionBundle_.cancelDoubleClick();
120 } 130 }
121 this.previousPointerActionBundle_ = pointerActionBundle; 131 this.previousPointerActionBundle_ = pointerActionBundle;
122 pointerActionBundle.handlePointerDown(e); 132 pointerActionBundle.handlePointerDown(e);
123 if (e.type == goog.events.EventType.MOUSEDOWN) { 133 if (e.type == goog.events.EventType.MOUSEDOWN) {
124 this.mouseDownTick_ = new Date(); 134 this.mouseDownTick_ = new Date();
135 this.pointerActionBundleForMouseDown_ = pointerActionBundle;
125 } 136 }
126 }; 137 };
127 138
128 139
129 /** 140 /**
130 * Callback for pointer out. 141 * Callback for pointer out.
131 * 142 *
132 * @param {!goog.events.BrowserEvent} e The event. 143 * @param {!goog.events.BrowserEvent} e The event.
133 * @private 144 * @private
134 */ 145 */
135 PointerHandler.prototype.onPointerUp_ = function(e) { 146 PointerHandler.prototype.onPointerUp_ = function(e) {
136 if (e.type == goog.events.EventType.MOUSEUP) { 147 if (e.type == goog.events.EventType.MOUSEUP) {
137 // If mouseup happens too fast after mousedown, it may be a tap action on 148 // If mouseup happens too fast after mousedown, it may be a tap action on
138 // touchpad, so delay the pointer up action so user can see the visual 149 // touchpad, so delay the pointer up action so user can see the visual
139 // flash. 150 // flash.
140 if (this.mouseDownTick_ && new Date() - this.mouseDownTick_ < 10) { 151 if (this.mouseDownTick_ && new Date() - this.mouseDownTick_ < 10) {
141 goog.Timer.callOnce(this.onPointerUp_.bind(this, e), 50); 152 goog.Timer.callOnce(this.onPointerUp_.bind(this, e), 50);
142 return; 153 return;
143 } 154 }
155 if (this.pointerActionBundleForMouseDown_) {
156 this.pointerActionBundleForMouseDown_.handlePointerUp(e);
157 this.pointerActionBundleForMouseDown_ = null;
158 return;
159 }
144 } 160 }
145 var uid = goog.getUid(e.target); 161 var uid = goog.getUid(e.target);
146 var pointerActionBundle = this.pointerActionBundles_[uid]; 162 var pointerActionBundle = this.pointerActionBundles_[uid];
147 if (pointerActionBundle) { 163 if (pointerActionBundle) {
148 pointerActionBundle.handlePointerUp(e); 164 pointerActionBundle.handlePointerUp(e);
149 } 165 }
150 }; 166 };
151 167
152 168
153 /** 169 /**
(...skipping 21 matching lines...) Expand all
175 PointerHandler.prototype.disposeInternal = function() { 191 PointerHandler.prototype.disposeInternal = function() {
176 for (var bundle in this.pointerActionBundles_) { 192 for (var bundle in this.pointerActionBundles_) {
177 goog.dispose(bundle); 193 goog.dispose(bundle);
178 } 194 }
179 goog.dispose(this.eventHandler_); 195 goog.dispose(this.eventHandler_);
180 196
181 goog.base(this, 'disposeInternal'); 197 goog.base(this, 'disposeInternal');
182 }; 198 };
183 199
184 }); // goog.scope 200 }); // goog.scope
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698