| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 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 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 return this._proxyElement; | 146 return this._proxyElement; |
| 147 }, | 147 }, |
| 148 | 148 |
| 149 detach: function() | 149 detach: function() |
| 150 { | 150 { |
| 151 this._removeFromElement(); | 151 this._removeFromElement(); |
| 152 this._proxyElement.parentElement.insertBefore(this._element, this._proxy
Element); | 152 this._proxyElement.parentElement.insertBefore(this._element, this._proxy
Element); |
| 153 this._proxyElement.remove(); | 153 this._proxyElement.remove(); |
| 154 delete this._proxyElement; | 154 delete this._proxyElement; |
| 155 this._element.classList.remove("text-prompt"); | 155 this._element.classList.remove("text-prompt"); |
| 156 WebInspector.restoreFocusFromElement(this._element); | 156 this._focusRestorer.restore(); |
| 157 }, | 157 }, |
| 158 | 158 |
| 159 /** | 159 /** |
| 160 * @return {string} | 160 * @return {string} |
| 161 */ | 161 */ |
| 162 text: function() | 162 text: function() |
| 163 { | 163 { |
| 164 return this._element.textContent; | 164 return this._element.textContent; |
| 165 }, | 165 }, |
| 166 | 166 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 { | 234 { |
| 235 this._isEditing = true; | 235 this._isEditing = true; |
| 236 this._contentElement.classList.add("text-prompt-editing"); | 236 this._contentElement.classList.add("text-prompt-editing"); |
| 237 if (blurListener) { | 237 if (blurListener) { |
| 238 this._blurListener = blurListener; | 238 this._blurListener = blurListener; |
| 239 this._element.addEventListener("blur", this._blurListener, false); | 239 this._element.addEventListener("blur", this._blurListener, false); |
| 240 } | 240 } |
| 241 this._oldTabIndex = this._element.tabIndex; | 241 this._oldTabIndex = this._element.tabIndex; |
| 242 if (this._element.tabIndex < 0) | 242 if (this._element.tabIndex < 0) |
| 243 this._element.tabIndex = 0; | 243 this._element.tabIndex = 0; |
| 244 WebInspector.setCurrentFocusElement(this._element); | 244 this._focusRestorer = new WebInspector.ElementFocusRestorer(this._elemen
t); |
| 245 if (!this.text()) | 245 if (!this.text()) |
| 246 this._updateAutoComplete(); | 246 this._updateAutoComplete(); |
| 247 }, | 247 }, |
| 248 | 248 |
| 249 _stopEditing: function() | 249 _stopEditing: function() |
| 250 { | 250 { |
| 251 this._element.tabIndex = this._oldTabIndex; | 251 this._element.tabIndex = this._oldTabIndex; |
| 252 if (this._blurListener) | 252 if (this._blurListener) |
| 253 this._element.removeEventListener("blur", this._blurListener, false)
; | 253 this._element.removeEventListener("blur", this._blurListener, false)
; |
| 254 this._contentElement.classList.remove("text-prompt-editing"); | 254 this._contentElement.classList.remove("text-prompt-editing"); |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 }, | 1019 }, |
| 1020 | 1020 |
| 1021 /** | 1021 /** |
| 1022 * @return {string|undefined} | 1022 * @return {string|undefined} |
| 1023 */ | 1023 */ |
| 1024 _currentHistoryItem: function() | 1024 _currentHistoryItem: function() |
| 1025 { | 1025 { |
| 1026 return this._data[this._data.length - this._historyOffset]; | 1026 return this._data[this._data.length - this._historyOffset]; |
| 1027 } | 1027 } |
| 1028 }; | 1028 }; |
| OLD | NEW |