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

Side by Side Diff: chrome/browser/resources/options/editable_text_field.js

Issue 2939273002: DO NOT SUBMIT: what chrome/browser/resources/ could eventually look like with clang-format (Closed)
Patch Set: Created 3 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 cr.define('options', function() { 5 cr.define('options', function() {
6 /** 6 /**
7 * @constructor 7 * @constructor
8 * @extends {HTMLDivElement} 8 * @extends {HTMLDivElement}
9 */ 9 */
10 var EditableTextField = cr.ui.define('div'); 10 var EditableTextField = cr.ui.define('div');
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 * @param {string} text The text of the cell. 215 * @param {string} text The text of the cell.
216 * @private 216 * @private
217 */ 217 */
218 createEditableTextCell: function(text) { 218 createEditableTextCell: function(text) {
219 // This function should only be called once. 219 // This function should only be called once.
220 if (this.editField_) 220 if (this.editField_)
221 return; 221 return;
222 222
223 var container = this.ownerDocument.createElement('div'); 223 var container = this.ownerDocument.createElement('div');
224 224
225 var textEl = /** @type {HTMLElement} */( 225 var textEl =
226 this.ownerDocument.createElement('div')); 226 /** @type {HTMLElement} */ (this.ownerDocument.createElement('div'));
227 textEl.className = 'static-text'; 227 textEl.className = 'static-text';
228 textEl.textContent = text; 228 textEl.textContent = text;
229 textEl.setAttribute('displaymode', 'static'); 229 textEl.setAttribute('displaymode', 'static');
230 this.appendChild(textEl); 230 this.appendChild(textEl);
231 this.staticText_ = textEl; 231 this.staticText_ = textEl;
232 232
233 var inputEl = /** @type {HTMLElement} */( 233 var inputEl = /** @type {HTMLElement} */ (
234 this.ownerDocument.createElement('input')); 234 this.ownerDocument.createElement('input'));
235 inputEl.className = 'editable-text'; 235 inputEl.className = 'editable-text';
236 inputEl.type = 'text'; 236 inputEl.type = 'text';
237 inputEl.value = text; 237 inputEl.value = text;
238 inputEl.setAttribute('displaymode', 'edit'); 238 inputEl.setAttribute('displaymode', 'edit');
239 inputEl.staticVersion = textEl; 239 inputEl.staticVersion = textEl;
240 this.appendChild(inputEl); 240 this.appendChild(inputEl);
241 this.editField_ = inputEl; 241 this.editField_ = inputEl;
242 }, 242 },
243 243
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 return node instanceof EditableTextField; 363 return node instanceof EditableTextField;
364 }); 364 });
365 if (itemAncestor) 365 if (itemAncestor)
366 document.activeElement.blur(); 366 document.activeElement.blur();
367 }); 367 });
368 368
369 return { 369 return {
370 EditableTextField: EditableTextField, 370 EditableTextField: EditableTextField,
371 }; 371 };
372 }); 372 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698