| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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('cr.ui', function() { | 5 cr.define('cr.ui', function() { |
| 6 // require cr.ui.define | 6 // require cr.ui.define |
| 7 // require cr.ui.limitInputWidth | 7 // require cr.ui.limitInputWidth |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * The number of pixels to indent per level. | 10 * The number of pixels to indent per level. |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 var eventsToStop = ['mousedown', 'mouseup', 'contextmenu', 'dblclick']; | 564 var eventsToStop = ['mousedown', 'mouseup', 'contextmenu', 'dblclick']; |
| 565 eventsToStop.forEach(function(type) { | 565 eventsToStop.forEach(function(type) { |
| 566 input.addEventListener(type, stopPropagation); | 566 input.addEventListener(type, stopPropagation); |
| 567 }); | 567 }); |
| 568 | 568 |
| 569 // Wait for the input element to recieve focus before sizing it. | 569 // Wait for the input element to recieve focus before sizing it. |
| 570 var rowElement = this.rowElement; | 570 var rowElement = this.rowElement; |
| 571 function onFocus() { | 571 function onFocus() { |
| 572 input.removeEventListener('focus', onFocus); | 572 input.removeEventListener('focus', onFocus); |
| 573 // 20 = the padding and border of the tree-row | 573 // 20 = the padding and border of the tree-row |
| 574 cr.ui.limitInputWidth(input, rowElement, 20); | 574 cr.ui.limitInputWidth(input, rowElement, 100); |
| 575 } | 575 } |
| 576 input.addEventListener('focus', onFocus); | 576 input.addEventListener('focus', onFocus); |
| 577 input.focus(); | 577 input.focus(); |
| 578 input.select(); | 578 input.select(); |
| 579 | 579 |
| 580 this.oldLabel_ = text; | 580 this.oldLabel_ = text; |
| 581 } else { | 581 } else { |
| 582 this.removeAttribute('editing'); | 582 this.removeAttribute('editing'); |
| 583 this.draggable = true; | 583 this.draggable = true; |
| 584 input = labelEl.firstChild; | 584 input = labelEl.firstChild; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 } | 656 } |
| 657 return item; | 657 return item; |
| 658 } | 658 } |
| 659 | 659 |
| 660 // Export | 660 // Export |
| 661 return { | 661 return { |
| 662 Tree: Tree, | 662 Tree: Tree, |
| 663 TreeItem: TreeItem | 663 TreeItem: TreeItem |
| 664 }; | 664 }; |
| 665 }); | 665 }); |
| OLD | NEW |