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

Side by Side Diff: chrome/browser/resources/pdf/zoom_manager.js

Issue 2617663002: WIP: run clang-format-js on lots of things (Closed)
Patch Set: merge Created 3 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
« no previous file with comments | « chrome/browser/resources/pdf/viewport_scroller.js ('k') | chrome/browser/resources/plugins.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 'use strict'; 5 'use strict';
6 6
7 /** 7 /**
8 * Abstract parent of classes that manage updating the browser 8 * Abstract parent of classes that manage updating the browser
9 * with zoom changes and/or updating the viewer's zoom when 9 * with zoom changes and/or updating the viewer's zoom when
10 * the browser zoom changes. 10 * the browser zoom changes.
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // previous extension-initiated zoom-level change, ignore this zoom change. 138 // previous extension-initiated zoom-level change, ignore this zoom change.
139 // Once the browser zoom level is changed, we check whether the extension's 139 // Once the browser zoom level is changed, we check whether the extension's
140 // zoom level matches the most recently sent zoom level. 140 // zoom level matches the most recently sent zoom level.
141 if (this.changingBrowserZoom_) 141 if (this.changingBrowserZoom_)
142 return; 142 return;
143 143
144 let zoom = this.viewport_.zoom; 144 let zoom = this.viewport_.zoom;
145 if (this.floatingPointEquals(this.browserZoom_, zoom)) 145 if (this.floatingPointEquals(this.browserZoom_, zoom))
146 return; 146 return;
147 147
148 this.changingBrowserZoom_ = this.setBrowserZoomFunction_(zoom).then( 148 this.changingBrowserZoom_ =
149 function() { 149 this.setBrowserZoomFunction_(zoom).then(function() {
150 this.browserZoom_ = zoom; 150 this.browserZoom_ = zoom;
151 this.changingBrowserZoom_ = null; 151 this.changingBrowserZoom_ = null;
152 152
153 // The extension's zoom level may have changed while the browser zoom 153 // The extension's zoom level may have changed while the browser zoom
154 // change was in progress. We call back into onPdfZoomChange to ensure the 154 // change was in progress. We call back into onPdfZoomChange to ensure
155 // browser zoom is up to date. 155 // the
156 this.onPdfZoomChange(); 156 // browser zoom is up to date.
157 }.bind(this)); 157 this.onPdfZoomChange();
158 }.bind(this));
158 } 159 }
159 160
160 /** 161 /**
161 * Combines the internal pdf zoom and the browser zoom to 162 * Combines the internal pdf zoom and the browser zoom to
162 * produce the total zoom level for the viewer. 163 * produce the total zoom level for the viewer.
163 * @param {number} internalZoom the zoom level internal to the viewer. 164 * @param {number} internalZoom the zoom level internal to the viewer.
164 * @return {number} the total zoom level. 165 * @return {number} the total zoom level.
165 */ 166 */
166 applyBrowserZoom(internalZoom) { 167 applyBrowserZoom(internalZoom) {
167 // The internal zoom and browser zoom are changed together, so the 168 // The internal zoom and browser zoom are changed together, so the
(...skipping 22 matching lines...) Expand all
190 /** 191 /**
191 * Invoked when a browser-initiated zoom-level change occurs. 192 * Invoked when a browser-initiated zoom-level change occurs.
192 * @param {number} newZoom the new browser zoom level. 193 * @param {number} newZoom the new browser zoom level.
193 */ 194 */
194 onBrowserZoomChange(newZoom) { 195 onBrowserZoomChange(newZoom) {
195 let oldZoom = this.browserZoom_; 196 let oldZoom = this.browserZoom_;
196 this.browserZoom_ = newZoom; 197 this.browserZoom_ = newZoom;
197 this.viewport_.updateZoomFromBrowserChange(oldZoom); 198 this.viewport_.updateZoomFromBrowserChange(oldZoom);
198 } 199 }
199 }; 200 };
OLDNEW
« no previous file with comments | « chrome/browser/resources/pdf/viewport_scroller.js ('k') | chrome/browser/resources/plugins.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698