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

Side by Side Diff: components/dom_distiller/core/javascript/dom_distiller_viewer.js

Issue 1148083003: Remove uses of const in distiller javascript (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 function addToPage(html) { 5 function addToPage(html) {
6 var div = document.createElement('div'); 6 var div = document.createElement('div');
7 div.innerHTML = html; 7 div.innerHTML = html;
8 document.getElementById('content').appendChild(div); 8 document.getElementById('content').appendChild(div);
9 fillYouTubePlaceholders(); 9 fillYouTubePlaceholders();
10 } 10 }
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 var clampedScale = 1; 197 var clampedScale = 1;
198 198
199 var lastSpan; 199 var lastSpan;
200 var lastClientMid; 200 var lastClientMid;
201 201
202 var scale = 1; 202 var scale = 1;
203 var shiftX; 203 var shiftX;
204 var shiftY; 204 var shiftY;
205 205
206 // The zooming speed relative to pinching speed. 206 // The zooming speed relative to pinching speed.
207 const FONT_SCALE_MULTIPLIER = 0.5; 207 var FONT_SCALE_MULTIPLIER = 0.5;
208 const MIN_SPAN_LENGTH = 20; 208 var MIN_SPAN_LENGTH = 20;
209 209
210 // The font size is guaranteed to be in px. 210 // The font size is guaranteed to be in px.
211 var baseSize = 211 var baseSize =
212 parseFloat(getComputedStyle(document.documentElement).fontSize); 212 parseFloat(getComputedStyle(document.documentElement).fontSize);
213 213
214 var refreshTransform = function() { 214 var refreshTransform = function() {
215 var slowedScale = Math.exp(Math.log(scale) * FONT_SCALE_MULTIPLIER); 215 var slowedScale = Math.exp(Math.log(scale) * FONT_SCALE_MULTIPLIER);
216 clampedScale = Math.max(0.4, Math.min(2.5, fontSizeAnchor * slowedScale)); 216 clampedScale = Math.max(0.4, Math.min(2.5, fontSizeAnchor * slowedScale));
217 217
218 // Use "fake" 3D transform so that the layer is not repainted. 218 // Use "fake" 3D transform so that the layer is not repainted.
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 shiftY: shiftY 362 shiftY: shiftY
363 }; 363 };
364 } 364 }
365 }; 365 };
366 }()); 366 }());
367 367
368 window.addEventListener('touchstart', pincher.handleTouchStart, false); 368 window.addEventListener('touchstart', pincher.handleTouchStart, false);
369 window.addEventListener('touchmove', pincher.handleTouchMove, false); 369 window.addEventListener('touchmove', pincher.handleTouchMove, false);
370 window.addEventListener('touchend', pincher.handleTouchEnd, false); 370 window.addEventListener('touchend', pincher.handleTouchEnd, false);
371 window.addEventListener('touchcancel', pincher.handleTouchCancel, false); 371 window.addEventListener('touchcancel', pincher.handleTouchCancel, false);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698