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

Side by Side Diff: chrome/browser/resources/pdf/elements/viewer-page-selector/viewer-page-selector.js

Issue 1312373002: Material PDF: Style audit and cleanup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 var DIGIT_LENGTH = 0.6; 5 var DIGIT_LENGTH = 0.6;
6 6
7 Polymer({ 7 Polymer({
8 is: 'viewer-page-selector', 8 is: 'viewer-page-selector',
9 9
10 properties: { 10 properties: {
(...skipping 19 matching lines...) Expand all
30 var page = parseInt(this.pageNo); 30 var page = parseInt(this.pageNo);
31 if (!isNaN(page)) { 31 if (!isNaN(page)) {
32 this.fire('change-page', {page: page - 1}); 32 this.fire('change-page', {page: page - 1});
33 this.$.input.blur(); 33 this.$.input.blur();
34 } 34 }
35 }, 35 },
36 36
37 docLengthChanged: function() { 37 docLengthChanged: function() {
38 var numDigits = this.docLength.toString().length; 38 var numDigits = this.docLength.toString().length;
39 this.$.pageselector.style.width = (numDigits * DIGIT_LENGTH) + 'em'; 39 this.$.pageselector.style.width = (numDigits * DIGIT_LENGTH) + 'em';
40 // Set both sides of the slash to the same width, so that the layout is
41 // exactly centered.
42 this.$['pagelength-inner'].style.width =
43 this.$.pageselector.getBoundingClientRect().width + 'px';
40 }, 44 },
41 45
42 select: function() { 46 select: function() {
43 this.$.input.select(); 47 this.$.input.select();
44 }, 48 },
45 49
46 /** 50 /**
47 * @return {boolean} True if the selector input field is currently focused. 51 * @return {boolean} True if the selector input field is currently focused.
48 */ 52 */
49 isActive: function() { 53 isActive: function() {
50 return this.shadowRoot.activeElement == this.$.input; 54 return this.shadowRoot.activeElement == this.$.input;
51 } 55 }
52 }); 56 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698