OLD | NEW |
1 "use strict"; | 1 "use strict"; |
2 /* | 2 /* |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 20 matching lines...) Expand all Loading... |
31 function SuggestionPicker(element, config) { | 31 function SuggestionPicker(element, config) { |
32 Picker.call(this, element, config); | 32 Picker.call(this, element, config); |
33 this._isFocusByMouse = false; | 33 this._isFocusByMouse = false; |
34 this._containerElement = null; | 34 this._containerElement = null; |
35 this._setColors(); | 35 this._setColors(); |
36 this._layout(); | 36 this._layout(); |
37 this._fixWindowSize(); | 37 this._fixWindowSize(); |
38 this._handleBodyKeyDownBound = this._handleBodyKeyDown.bind(this); | 38 this._handleBodyKeyDownBound = this._handleBodyKeyDown.bind(this); |
39 document.body.addEventListener("keydown", this._handleBodyKeyDownBound); | 39 document.body.addEventListener("keydown", this._handleBodyKeyDownBound); |
40 this._element.addEventListener("mouseout", this._handleMouseOut.bind(this),
false); | 40 this._element.addEventListener("mouseout", this._handleMouseOut.bind(this),
false); |
41 }; | 41 } |
42 SuggestionPicker.prototype = Object.create(Picker.prototype); | 42 SuggestionPicker.prototype = Object.create(Picker.prototype); |
43 | 43 |
44 SuggestionPicker.NumberOfVisibleEntries = 20; | 44 SuggestionPicker.NumberOfVisibleEntries = 20; |
45 | 45 |
46 // An entry needs to be at least this many pixels visible for it to be a visible
entry. | 46 // An entry needs to be at least this many pixels visible for it to be a visible
entry. |
47 SuggestionPicker.VisibleEntryThresholdHeight = 4; | 47 SuggestionPicker.VisibleEntryThresholdHeight = 4; |
48 | 48 |
49 SuggestionPicker.ActionNames = { | 49 SuggestionPicker.ActionNames = { |
50 OpenCalendarPicker: "openCalendarPicker" | 50 OpenCalendarPicker: "openCalendarPicker" |
51 }; | 51 }; |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 /** | 316 /** |
317 * @param {!Event} event | 317 * @param {!Event} event |
318 */ | 318 */ |
319 SuggestionPicker.prototype._handleMouseOut = function(event) { | 319 SuggestionPicker.prototype._handleMouseOut = function(event) { |
320 if (!document.activeElement.classList.contains(SuggestionPicker.ListEntryCla
ss)) | 320 if (!document.activeElement.classList.contains(SuggestionPicker.ListEntryCla
ss)) |
321 return; | 321 return; |
322 this._isFocusByMouse = false; | 322 this._isFocusByMouse = false; |
323 document.activeElement.blur(); | 323 document.activeElement.blur(); |
324 event.preventDefault(); | 324 event.preventDefault(); |
325 }; | 325 }; |
OLD | NEW |