OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 * @constructor | 6 * @constructor |
7 * @extends {HTMLInputElement} | 7 * @extends {HTMLInputElement} |
8 */ | 8 */ |
9 WebInspector.HistoryInput = function() | 9 WebInspector.HistoryInput = function() |
10 { | 10 { |
11 }; | 11 }; |
12 | 12 |
13 /** | 13 /** |
14 * @return {!WebInspector.HistoryInput} | 14 * @return {!WebInspector.HistoryInput} |
15 */ | 15 */ |
16 WebInspector.HistoryInput.create = function() | 16 WebInspector.HistoryInput.create = function() |
17 { | 17 { |
18 if (!WebInspector.HistoryInput._constructor) | 18 if (!WebInspector.HistoryInput._constructor) |
19 WebInspector.HistoryInput._constructor = registerCustomElement("input",
"history-input", WebInspector.HistoryInput.prototype); | 19 WebInspector.HistoryInput._constructor = registerCustomElement("input",
"history-input", WebInspector.HistoryInput.prototype); |
20 | 20 |
21 return /** @type {!WebInspector.HistoryInput} */(new WebInspector.HistoryInp
ut._constructor()); | 21 return /** @type {!WebInspector.HistoryInput} */(new WebInspector.HistoryInp
ut._constructor()); |
22 }; | 22 }; |
23 | 23 |
24 WebInspector.HistoryInput.prototype = { | 24 WebInspector.HistoryInput.prototype = { |
| 25 /** |
| 26 * @override |
| 27 */ |
25 createdCallback: function() | 28 createdCallback: function() |
26 { | 29 { |
27 this._history = [""]; | 30 this._history = [""]; |
28 this._historyPosition = 0; | 31 this._historyPosition = 0; |
29 this.addEventListener("keydown", this._onKeyDown.bind(this), false); | 32 this.addEventListener("keydown", this._onKeyDown.bind(this), false); |
30 this.addEventListener("input", this._onInput.bind(this), false); | 33 this.addEventListener("input", this._onInput.bind(this), false); |
31 }, | 34 }, |
32 | 35 |
33 /** | 36 /** |
34 * @param {!Event} event | 37 * @param {!Event} event |
(...skipping 29 matching lines...) Expand all Loading... |
64 if (this._history.length > 1 && this._history[this._history.length - 2]
=== this.value) | 67 if (this._history.length > 1 && this._history[this._history.length - 2]
=== this.value) |
65 return; | 68 return; |
66 this._history[this._history.length - 1] = this.value; | 69 this._history[this._history.length - 1] = this.value; |
67 this._historyPosition = this._history.length - 1; | 70 this._historyPosition = this._history.length - 1; |
68 this._history.push(""); | 71 this._history.push(""); |
69 }, | 72 }, |
70 | 73 |
71 __proto__: HTMLInputElement.prototype | 74 __proto__: HTMLInputElement.prototype |
72 }; | 75 }; |
73 | 76 |
OLD | NEW |