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

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

Issue 1557563002: Fix for overlapping of cursor with page number in page selector. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 4 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
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 Polymer({ 5 Polymer({
6 is: 'viewer-page-selector', 6 is: 'viewer-page-selector',
7 7
8 properties: { 8 properties: {
9 /** 9 /**
10 * The number of pages the document contains. 10 * The number of pages the document contains.
(...skipping 20 matching lines...) Expand all
31 31
32 if (!isNaN(page) && page <= this.docLength && page > 0) 32 if (!isNaN(page) && page <= this.docLength && page > 0)
33 this.fire('change-page', {page: page - 1}); 33 this.fire('change-page', {page: page - 1});
34 else 34 else
35 this.$.input.value = this.pageNo; 35 this.$.input.value = this.pageNo;
36 this.$.input.blur(); 36 this.$.input.blur();
37 }, 37 },
38 38
39 docLengthChanged: function() { 39 docLengthChanged: function() {
40 var numDigits = this.docLength.toString().length; 40 var numDigits = this.docLength.toString().length;
41 this.$.pageselector.style.width = numDigits + 'ch'; 41 // Increasing the width of pageselector by 1 'ch' for cursor.
42 this.$.pageselector.style.width = numDigits + 1 + 'ch';
42 // Set both sides of the slash to the same width, so that the layout is 43 // Set both sides of the slash to the same width, so that the layout is
43 // exactly centered. 44 // exactly centered.
44 this.$['pagelength-spacer'].style.width = numDigits + 'ch'; 45 this.$['pagelength-spacer'].style.width = numDigits + 'ch';
tsergeant 2016/01/06 01:58:59 Any changes to line 42 need to be made here as wel
Deepak 2016/01/06 07:35:35 Done.
45 }, 46 },
46 47
47 select: function() { 48 select: function() {
48 this.$.input.select(); 49 this.$.input.select();
49 }, 50 },
50 51
51 /** 52 /**
52 * @return {boolean} True if the selector input field is currently focused. 53 * @return {boolean} True if the selector input field is currently focused.
53 */ 54 */
54 isActive: function() { 55 isActive: function() {
55 return this.shadowRoot.activeElement == this.$.input; 56 return this.shadowRoot.activeElement == this.$.input;
56 } 57 }
57 }); 58 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698