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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js

Issue 2615753003: DevTools: do not subscribe to global object events from the widgets that are not necessarily dispos… (Closed)
Patch Set: same Created 3 years, 11 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 | « third_party/WebKit/Source/devtools/front_end/sources/OpenResourceDialog.js ('k') | 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 /* 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 this._contentElement.createChild('content'); 113 this._contentElement.createChild('content');
114 this._proxyElement.style.display = this._proxyElementDisplay; 114 this._proxyElement.style.display = this._proxyElementDisplay;
115 element.parentElement.insertBefore(this._proxyElement, element); 115 element.parentElement.insertBefore(this._proxyElement, element);
116 this._proxyElement.appendChild(element); 116 this._proxyElement.appendChild(element);
117 this._element.classList.add('text-prompt'); 117 this._element.classList.add('text-prompt');
118 this._element.addEventListener('keydown', this._boundOnKeyDown, false); 118 this._element.addEventListener('keydown', this._boundOnKeyDown, false);
119 this._element.addEventListener('input', this._boundOnInput, false); 119 this._element.addEventListener('input', this._boundOnInput, false);
120 this._element.addEventListener('mousewheel', this._boundOnMouseWheel, false) ; 120 this._element.addEventListener('mousewheel', this._boundOnMouseWheel, false) ;
121 this._element.addEventListener('selectstart', this._boundClearAutocomplete, false); 121 this._element.addEventListener('selectstart', this._boundClearAutocomplete, false);
122 this._element.addEventListener('blur', this._boundClearAutocomplete, false); 122 this._element.addEventListener('blur', this._boundClearAutocomplete, false);
123 this._element.ownerDocument.defaultView.addEventListener('resize', this._bou ndClearAutocomplete, false);
124 123
125 this._suggestBox = new UI.SuggestBox(this, 20, true); 124 this._suggestBox = new UI.SuggestBox(this, 20, true);
126 125
127 if (this._title) 126 if (this._title)
128 this._proxyElement.title = this._title; 127 this._proxyElement.title = this._title;
129 128
130 return this._proxyElement; 129 return this._proxyElement;
131 } 130 }
132 131
133 detach() { 132 detach() {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 setPlaceholder(placeholder) { 201 setPlaceholder(placeholder) {
203 this._element.setAttribute('data-placeholder', placeholder); 202 this._element.setAttribute('data-placeholder', placeholder);
204 } 203 }
205 204
206 _removeFromElement() { 205 _removeFromElement() {
207 this.clearAutocomplete(); 206 this.clearAutocomplete();
208 this._element.removeEventListener('keydown', this._boundOnKeyDown, false); 207 this._element.removeEventListener('keydown', this._boundOnKeyDown, false);
209 this._element.removeEventListener('input', this._boundOnInput, false); 208 this._element.removeEventListener('input', this._boundOnInput, false);
210 this._element.removeEventListener('selectstart', this._boundClearAutocomplet e, false); 209 this._element.removeEventListener('selectstart', this._boundClearAutocomplet e, false);
211 this._element.removeEventListener('blur', this._boundClearAutocomplete, fals e); 210 this._element.removeEventListener('blur', this._boundClearAutocomplete, fals e);
212 this._element.ownerDocument.defaultView.removeEventListener('resize', this._ boundClearAutocomplete, false);
213 if (this._isEditing) 211 if (this._isEditing)
214 this._stopEditing(); 212 this._stopEditing();
215 if (this._suggestBox) 213 if (this._suggestBox)
216 this._suggestBox.removeFromElement(); 214 this._suggestBox.removeFromElement();
217 } 215 }
218 216
219 /** 217 /**
220 * @param {function(!Event)=} blurListener 218 * @param {function(!Event)=} blurListener
221 */ 219 */
222 _startEditing(blurListener) { 220 _startEditing(blurListener) {
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 } 633 }
636 }; 634 };
637 635
638 UI.TextPrompt.DefaultAutocompletionTimeout = 250; 636 UI.TextPrompt.DefaultAutocompletionTimeout = 250;
639 637
640 /** @enum {symbol} */ 638 /** @enum {symbol} */
641 UI.TextPrompt.Events = { 639 UI.TextPrompt.Events = {
642 ItemApplied: Symbol('text-prompt-item-applied'), 640 ItemApplied: Symbol('text-prompt-item-applied'),
643 ItemAccepted: Symbol('text-prompt-item-accepted') 641 ItemAccepted: Symbol('text-prompt-item-accepted')
644 }; 642 };
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/sources/OpenResourceDialog.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698