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

Side by Side Diff: chrome/browser/resources/print_preview/preview_area.js

Issue 8592003: Print Preview: Fixing javascript error occuring in the margins code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Creating getter in previewArea Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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('print_preview', function() { 5 cr.define('print_preview', function() {
6 'strict'; 6 'strict';
7 7
8 /** 8 /**
9 * Creates a PreviewArea object. It represents the area where the preview 9 * Creates a PreviewArea object. It represents the area where the preview
10 * document is displayed. 10 * document is displayed.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 * The height of the plugin area in percent, excluding any visible 84 * The height of the plugin area in percent, excluding any visible
85 * scrollbars. 85 * scrollbars.
86 * @type {number} 86 * @type {number}
87 */ 87 */
88 get heightPercent() { 88 get heightPercent() {
89 var height = this.pdfPlugin_.getHeight(); 89 var height = this.pdfPlugin_.getHeight();
90 var scrollbarHeight = this.pdfPlugin_.getHorizontalScrollbarThickness(); 90 var scrollbarHeight = this.pdfPlugin_.getHorizontalScrollbarThickness();
91 return (height - scrollbarHeight) / height; 91 return (height - scrollbarHeight) / height;
92 }, 92 },
93 93
94 get pdfPlugin() {
95 return this.pdfPlugin_;
96 },
97
94 get pdfLoaded() { 98 get pdfLoaded() {
95 return this.pdfLoaded_; 99 return this.pdfLoaded_;
96 }, 100 },
97 101
98 set pdfLoaded(pdfLoaded) { 102 set pdfLoaded(pdfLoaded) {
99 this.pdfLoaded_ = pdfLoaded; 103 this.pdfLoaded_ = pdfLoaded;
100 }, 104 },
101 105
102 /** 106 /**
103 * Queries the plugin for the location of the most visible page and updates 107 * Queries the plugin for the location of the most visible page and updates
104 * |this.pageLocationNormalized|. 108 * |this.pageLocationNormalized|.
105 */ 109 */
106 update: function() { 110 update: function() {
107 if (!this.pdfLoaded_) 111 if (!this.pdfLoaded_)
kmadhusu 2011/11/21 19:20:22 Reuse the getter function.
dpapad 2011/11/22 02:05:10 Why use the getter within this class when the vari
kmadhusu 2011/11/22 02:32:26 Ofcourse it is not strict rule, it is just my opin
108 return; 112 return;
109 var pluginLocation = 113 var pluginLocation =
110 this.pdfPlugin_.getPageLocationNormalized().split(';'); 114 this.pdfPlugin_.getPageLocationNormalized().split(';');
111 this.pageLocationNormalized = new print_preview.Rect( 115 this.pageLocationNormalized = new print_preview.Rect(
112 parseFloat(pluginLocation[0]), 116 parseFloat(pluginLocation[0]),
113 parseFloat(pluginLocation[1]), 117 parseFloat(pluginLocation[1]),
114 parseFloat(pluginLocation[2]), 118 parseFloat(pluginLocation[2]),
115 parseFloat(pluginLocation[3])); 119 parseFloat(pluginLocation[3]));
116 }, 120 },
117 121
118 /** 122 /**
119 * Resets the state variables of |this|. 123 * Resets the state variables of |this|.
120 */ 124 */
121 resetState: function() { 125 resetState: function() {
122 if (this.pdfPlugin_) { 126 if (this.pdfPlugin_) {
kmadhusu 2011/11/21 19:20:22 same here
dpapad 2011/11/22 02:05:10 See previous comment.
123 this.zoomLevel_ = this.pdfPlugin_.getZoomLevel(); 127 this.zoomLevel_ = this.pdfPlugin_.getZoomLevel();
124 this.pageOffset_ = { 128 this.pageOffset_ = {
125 x: this.pdfPlugin_.pageXOffset(), 129 x: this.pdfPlugin_.pageXOffset(),
126 y: this.pdfPlugin_.pageYOffset() 130 y: this.pdfPlugin_.pageYOffset()
127 }; 131 };
128 } 132 }
129 this.pdfLoaded_ = false; 133 this.pdfLoaded_ = false;
130 }, 134 },
131 135
132 /** 136 /**
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 if (cr.isMac) 242 if (cr.isMac)
239 $('open-preview-app-throbber').hidden = true; 243 $('open-preview-app-throbber').hidden = true;
240 this.displayErrorMessageAndNotify(errorMessage); 244 this.displayErrorMessageAndNotify(errorMessage);
241 } 245 }
242 }; 246 };
243 247
244 return { 248 return {
245 PreviewArea: PreviewArea, 249 PreviewArea: PreviewArea,
246 }; 250 };
247 }); 251 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698