| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * Overrided metadata worker's path. | 6 * Overrided metadata worker's path. |
| 7 * @type {string} | 7 * @type {string} |
| 8 */ | 8 */ |
| 9 ContentMetadataProvider.WORKER_SCRIPT = '/js/metadata_worker.js'; | 9 ContentMetadataProvider.WORKER_SCRIPT = '/js/metadata_worker.js'; |
| 10 | 10 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 var content = queryRequiredElement(document, '#content'); | 77 var content = queryRequiredElement(document, '#content'); |
| 78 content.addEventListener('click', this.onContentClick_.bind(this)); | 78 content.addEventListener('click', this.onContentClick_.bind(this)); |
| 79 | 79 |
| 80 this.topToolbar_ = queryRequiredElement(document, '#top-toolbar'); | 80 this.topToolbar_ = queryRequiredElement(document, '#top-toolbar'); |
| 81 this.bottomToolbar_ = queryRequiredElement(document, '#bottom-toolbar'); | 81 this.bottomToolbar_ = queryRequiredElement(document, '#bottom-toolbar'); |
| 82 | 82 |
| 83 this.filenameSpacer_ = queryRequiredElement(this.topToolbar_, | 83 this.filenameSpacer_ = queryRequiredElement(this.topToolbar_, |
| 84 '.filename-spacer'); | 84 '.filename-spacer'); |
| 85 | 85 |
| 86 /** | 86 /** |
| 87 * @private {PaperInput} | 87 * @private {HTMLInputElement} |
| 88 * @const | 88 * @const |
| 89 */ | 89 */ |
| 90 this.filenameEdit_ = /** @type {PaperInput} */ | 90 this.filenameEdit_ = /** @type {HTMLInputElement} */ |
| 91 (queryRequiredElement(this.filenameSpacer_, 'paper-input')); | 91 (queryRequiredElement(this.filenameSpacer_, 'input')); |
| 92 | 92 |
| 93 this.filenameCanvas_ = document.createElement('canvas'); | 93 this.filenameCanvas_ = document.createElement('canvas'); |
| 94 this.filenameCanvasContext_ = this.filenameCanvas_.getContext('2d'); | 94 this.filenameCanvasContext_ = this.filenameCanvas_.getContext('2d'); |
| 95 | 95 |
| 96 // Set font style of canvas context to same font style with rename field. | 96 // Set font style of canvas context to same font style with rename field. |
| 97 var filenameEditComputedStyle = window.getComputedStyle( | 97 var filenameEditComputedStyle = window.getComputedStyle(this.filenameEdit_); |
| 98 this.filenameEdit_.inputElement); | |
| 99 this.filenameCanvasContext_.font = filenameEditComputedStyle.font; | 98 this.filenameCanvasContext_.font = filenameEditComputedStyle.font; |
| 100 | 99 |
| 101 this.filenameEdit_.addEventListener('blur', | 100 this.filenameEdit_.addEventListener('blur', |
| 102 this.onFilenameEditBlur_.bind(this)); | 101 this.onFilenameEditBlur_.bind(this)); |
| 103 this.filenameEdit_.addEventListener('focus', | 102 this.filenameEdit_.addEventListener('focus', |
| 104 this.onFilenameFocus_.bind(this)); | 103 this.onFilenameFocus_.bind(this)); |
| 105 this.filenameEdit_.addEventListener('input', | 104 this.filenameEdit_.addEventListener('input', |
| 106 this.resizeRenameField_.bind(this)); | 105 this.resizeRenameField_.bind(this)); |
| 107 this.filenameEdit_.addEventListener('keydown', | 106 this.filenameEdit_.addEventListener('keydown', |
| 108 this.onFilenameEditKeydown_.bind(this)); | 107 this.onFilenameEditKeydown_.bind(this)); |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 }); | 753 }); |
| 755 }; | 754 }; |
| 756 | 755 |
| 757 /** | 756 /** |
| 758 * Click event handler on filename edit box | 757 * Click event handler on filename edit box |
| 759 * @private | 758 * @private |
| 760 */ | 759 */ |
| 761 Gallery.prototype.onFilenameFocus_ = function() { | 760 Gallery.prototype.onFilenameFocus_ = function() { |
| 762 ImageUtil.setAttribute(this.filenameSpacer_, 'renaming', true); | 761 ImageUtil.setAttribute(this.filenameSpacer_, 'renaming', true); |
| 763 this.filenameEdit_.originalValue = this.filenameEdit_.value; | 762 this.filenameEdit_.originalValue = this.filenameEdit_.value; |
| 764 setTimeout(this.filenameEdit_.inputElement.select.bind( | 763 setTimeout(this.filenameEdit_.select.bind(this.filenameEdit_), 0); |
| 765 this.filenameEdit_.inputElement), 0); | |
| 766 this.onUserAction_(); | 764 this.onUserAction_(); |
| 767 }; | 765 }; |
| 768 | 766 |
| 769 /** | 767 /** |
| 770 * Blur event handler on filename edit box. | 768 * Blur event handler on filename edit box. |
| 771 * | 769 * |
| 772 * @param {!Event} event Blur event. | 770 * @param {!Event} event Blur event. |
| 773 * @private | 771 * @private |
| 774 */ | 772 */ |
| 775 Gallery.prototype.onFilenameEditBlur_ = function(event) { | 773 Gallery.prototype.onFilenameEditBlur_ = function(event) { |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 */ | 929 */ |
| 932 var initializePromise = | 930 var initializePromise = |
| 933 Promise.all([loadTimeDataPromise, volumeManagerPromise]). | 931 Promise.all([loadTimeDataPromise, volumeManagerPromise]). |
| 934 then(function(args) { | 932 then(function(args) { |
| 935 var volumeManager = args[1]; | 933 var volumeManager = args[1]; |
| 936 gallery = new Gallery(volumeManager); | 934 gallery = new Gallery(volumeManager); |
| 937 }); | 935 }); |
| 938 | 936 |
| 939 // Loads entries. | 937 // Loads entries. |
| 940 initializePromise.then(reload); | 938 initializePromise.then(reload); |
| OLD | NEW |