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

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

Issue 2915773003: PDF Plugin: Add compile targets for a few more files. (Closed)
Patch Set: Addressing comments. 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 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 Polymer({ 5 Polymer({
6 is: 'viewer-page-indicator', 6 is: 'viewer-page-indicator',
7 7
8 properties: { 8 properties: {
9 label: { 9 label: {
10 type: String, 10 type: String,
11 value: '1' 11 value: '1'
12 }, 12 },
13 13
14 index: { 14 index: {
15 type: Number, 15 type: Number,
16 observer: 'indexChanged' 16 observer: 'indexChanged'
17 }, 17 },
18 18
19 pageLabels: { 19 pageLabels: {
20 type: Array, 20 type: Array,
21 value: null, 21 value: null,
22 observer: 'pageLabelsChanged' 22 observer: 'pageLabelsChanged'
23 } 23 }
24 }, 24 },
25 25
26 /** @type {number|undefined} */
26 timerId: undefined, 27 timerId: undefined,
27 28
29 /** @override */
28 ready: function() { 30 ready: function() {
29 var callback = this.fadeIn.bind(this, 2000); 31 var callback = this.fadeIn.bind(this, 2000);
30 window.addEventListener('scroll', function() { 32 window.addEventListener('scroll', function() {
31 requestAnimationFrame(callback); 33 requestAnimationFrame(callback);
32 }); 34 });
33 }, 35 },
34 36
35 initialFadeIn: function() { 37 initialFadeIn: function() {
36 this.fadeIn(6000); 38 this.fadeIn(6000);
37 }, 39 },
38 40
41 /** @param {number} displayTime */
39 fadeIn: function(displayTime) { 42 fadeIn: function(displayTime) {
40 var percent = window.scrollY / 43 var percent = window.scrollY /
41 (document.body.scrollHeight - 44 (document.body.scrollHeight -
42 document.documentElement.clientHeight); 45 document.documentElement.clientHeight);
43 this.style.top = percent * 46 this.style.top = percent *
44 (document.documentElement.clientHeight - this.offsetHeight) + 'px'; 47 (document.documentElement.clientHeight - this.offsetHeight) + 'px';
45 // <if expr="is_macosx"> 48 // <if expr="is_macosx">
46 // On the Mac, if overlay scrollbars are enabled, prevent them from 49 // On the Mac, if overlay scrollbars are enabled, prevent them from
47 // overlapping the triangle. 50 // overlapping the triangle.
48 if (window.innerWidth == document.body.scrollWidth) 51 if (window.innerWidth == document.body.scrollWidth)
(...skipping 14 matching lines...) Expand all
63 this.indexChanged(); 66 this.indexChanged();
64 }, 67 },
65 68
66 indexChanged: function() { 69 indexChanged: function() {
67 if (this.pageLabels) 70 if (this.pageLabels)
68 this.label = this.pageLabels[this.index]; 71 this.label = this.pageLabels[this.index];
69 else 72 else
70 this.label = String(this.index + 1); 73 this.label = String(this.index + 1);
71 } 74 }
72 }); 75 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698