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

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

Issue 8605001: Print Preview: Fixing code style issues reported by gsjlint. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebasing 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 function MarginsUI() { 8 function MarginsUI() {
9 var marginsUI = document.createElement('div'); 9 var marginsUI = document.createElement('div');
10 marginsUI.__proto__ = MarginsUI.prototype; 10 marginsUI.__proto__ = MarginsUI.prototype;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 /** 73 /**
74 * @return {array} An array including all |MarginUIPair| objects. 74 * @return {array} An array including all |MarginUIPair| objects.
75 */ 75 */
76 get pairsAsList() { 76 get pairsAsList() {
77 return [this.topPair_, this.leftPair_, this.rightPair_, this.bottomPair_]; 77 return [this.topPair_, this.leftPair_, this.rightPair_, this.bottomPair_];
78 }, 78 },
79 79
80 /** 80 /**
81 * Updates the state of the margins UI. 81 * Updates the state of the margins UI.
82 * @param {print_preview.Rect} 82 * @param {print_preview.Rect} marginsRectangle
83 * @param {Margins} marginValues 83 * @param {Margins} marginValues
84 * @param {array} valueLimits 84 * @param {array} valueLimits
85 */ 85 */
86 update: function(marginsRectangle, marginValues, valueLimits, 86 update: function(marginsRectangle, marginValues, valueLimits,
87 keepDisplayedValue, valueLimitsInPercent) { 87 keepDisplayedValue, valueLimitsInPercent) {
88 var uiPairs = this.pairsAsList; 88 var uiPairs = this.pairsAsList;
89 var order = ['top', 'left', 'right', 'bottom']; 89 var order = ['top', 'left', 'right', 'bottom'];
90 for (var i = 0; i < uiPairs.length; i++) { 90 for (var i = 0; i < uiPairs.length; i++) {
91 uiPairs[i].update(marginsRectangle, 91 uiPairs[i].update(marginsRectangle,
92 marginValues[order[i]], 92 marginValues[order[i]],
(...skipping 29 matching lines...) Expand all
122 removeFromFlow ? this.hidden = true : this.classList.add('invisible'); 122 removeFromFlow ? this.hidden = true : this.classList.add('invisible');
123 }, 123 },
124 124
125 /** 125 /**
126 * Applies a clipping mask on |this| so that it does not paint on top of the 126 * Applies a clipping mask on |this| so that it does not paint on top of the
127 * scrollbars (if any). 127 * scrollbars (if any).
128 */ 128 */
129 applyClippingMask_: function() { 129 applyClippingMask_: function() {
130 var bottom = previewArea.height; 130 var bottom = previewArea.height;
131 var right = previewArea.width; 131 var right = previewArea.width;
132 this.style.clip = "rect(0, " + right + "px, " + bottom + "px, 0)"; 132 this.style.clip = 'rect(0, ' + right + 'px, ' + bottom + 'px, 0)';
133 }, 133 },
134 134
135 /** 135 /**
136 * Adds event listeners for various events. 136 * Adds event listeners for various events.
137 * @private 137 * @private
138 */ 138 */
139 addEventListeners_: function() { 139 addEventListeners_: function() {
140 var uiPairs = this.pairsAsList; 140 var uiPairs = this.pairsAsList;
141 for (var i = 0; i < uiPairs.length; i++) { 141 for (var i = 0; i < uiPairs.length; i++) {
142 uiPairs[i].addEventListener(customEvents.MARGIN_LINE_MOUSE_DOWN, 142 uiPairs[i].addEventListener(customEvents.MARGIN_LINE_MOUSE_DOWN,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 this.lastClickedMarginsUIPair.getDragDisplacementFrom(point); 198 this.lastClickedMarginsUIPair.getDragDisplacementFrom(point);
199 dragEvent.destinationPoint = point; 199 dragEvent.destinationPoint = point;
200 this.dispatchEvent(dragEvent); 200 this.dispatchEvent(dragEvent);
201 }, 201 },
202 }; 202 };
203 203
204 return { 204 return {
205 MarginsUI: MarginsUI 205 MarginsUI: MarginsUI
206 }; 206 };
207 }); 207 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/print_preview/margin_utils.js ('k') | chrome/browser/resources/print_preview/margins_ui_pair.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698