| 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 createdCallback: function() | 25 createdCallback: function() |
| 26 { | 26 { |
| 27 this._history = [""]; | 27 this._history = [""]; |
| 28 this._historyPosition = 0; | 28 this._historyPosition = 0; |
| 29 this.addEventListener("keydown", this._onKeyDown.bind(this), false); | 29 this.addEventListener("keydown", this._onKeyDown.bind(this), false); |
| 30 this.addEventListener("input", this._onInput.bind(this), false); | 30 this.addEventListener("input", this._onInput.bind(this), false); |
| 31 }, | 31 }, |
| 32 | 32 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 62 _saveToHistory: function() | 62 _saveToHistory: function() |
| 63 { | 63 { |
| 64 if (this._history.length > 1 && this._history[this._history.length - 2]
=== this.value) | 64 if (this._history.length > 1 && this._history[this._history.length - 2]
=== this.value) |
| 65 return; | 65 return; |
| 66 this._history[this._history.length - 1] = this.value; | 66 this._history[this._history.length - 1] = this.value; |
| 67 this._historyPosition = this._history.length - 1; | 67 this._historyPosition = this._history.length - 1; |
| 68 this._history.push(""); | 68 this._history.push(""); |
| 69 }, | 69 }, |
| 70 | 70 |
| 71 __proto__: HTMLInputElement.prototype | 71 __proto__: HTMLInputElement.prototype |
| 72 } | 72 }; |
| 73 | 73 |
| OLD | NEW |