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

Side by Side Diff: ui/login/bubble.js

Issue 2202583002: Hides the error bubble on scroll event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 /** 5 /**
6 * @fileoverview Bubble implementation. 6 * @fileoverview Bubble implementation.
7 */ 7 */
8 8
9 // TODO(xiyuan): Move this into shared. 9 // TODO(xiyuan): Move this into shared.
10 cr.define('cr.ui', function() { 10 cr.define('cr.ui', function() {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 // Whether to hide bubble when key is pressed. 55 // Whether to hide bubble when key is pressed.
56 hideOnKeyPress_: true, 56 hideOnKeyPress_: true,
57 57
58 /** @override */ 58 /** @override */
59 decorate: function() { 59 decorate: function() {
60 this.docKeyDownHandler_ = this.handleDocKeyDown_.bind(this); 60 this.docKeyDownHandler_ = this.handleDocKeyDown_.bind(this);
61 this.selfClickHandler_ = this.handleSelfClick_.bind(this); 61 this.selfClickHandler_ = this.handleSelfClick_.bind(this);
62 this.ownerDocument.addEventListener('click', 62 this.ownerDocument.addEventListener('click',
63 this.handleDocClick_.bind(this)); 63 this.handleDocClick_.bind(this));
64 // Set useCapture to true because scroll event does not bubble.
65 this.ownerDocument.addEventListener('scroll',
66 this.handleScroll_.bind(this),
67 true);
64 this.ownerDocument.addEventListener('keydown', 68 this.ownerDocument.addEventListener('keydown',
65 this.docKeyDownHandler_); 69 this.docKeyDownHandler_);
66 window.addEventListener('blur', this.handleWindowBlur_.bind(this)); 70 window.addEventListener('blur', this.handleWindowBlur_.bind(this));
67 this.addEventListener('webkitTransitionEnd', 71 this.addEventListener('webkitTransitionEnd',
68 this.handleTransitionEnd_.bind(this)); 72 this.handleTransitionEnd_.bind(this));
69 // Guard timer for 200ms + epsilon. 73 // Guard timer for 200ms + epsilon.
70 ensureTransitionEndEvent(this, 250); 74 ensureTransitionEndEvent(this, 250);
71 }, 75 },
72 76
73 /** 77 /**
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 */ 298 */
295 handleTransitionEnd_: function(e) { 299 handleTransitionEnd_: function(e) {
296 if (this.classList.contains('faded')) { 300 if (this.classList.contains('faded')) {
297 this.hidden = true; 301 this.hidden = true;
298 if (this.elementToFocusOnHide_) 302 if (this.elementToFocusOnHide_)
299 this.elementToFocusOnHide_.focus(); 303 this.elementToFocusOnHide_.focus();
300 } 304 }
301 }, 305 },
302 306
303 /** 307 /**
308 * Handler of scroll event.
309 * @private
310 */
311 handleScroll_: function(e) {
312 if (!this.hidden)
313 this.hide();
314 },
315
316 /**
304 * Handler of document click event. 317 * Handler of document click event.
305 * @private 318 * @private
306 */ 319 */
307 handleDocClick_: function(e) { 320 handleDocClick_: function(e) {
308 // Ignore clicks on anchor element. 321 // Ignore clicks on anchor element.
309 if (e.target == this.anchor_) 322 if (e.target == this.anchor_)
310 return; 323 return;
311 324
312 if (!this.hidden) 325 if (!this.hidden)
313 this.hide(); 326 this.hide();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 handleWindowBlur_: function(e) { 365 handleWindowBlur_: function(e) {
353 if (!this.hidden) 366 if (!this.hidden)
354 this.hide(); 367 this.hide();
355 } 368 }
356 }; 369 };
357 370
358 return { 371 return {
359 Bubble: Bubble 372 Bubble: Bubble
360 }; 373 };
361 }); 374 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698