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

Side by Side Diff: chrome/browser/resources/extensions/extension_options_overlay.js

Issue 896283003: extensions: don't animate options dialog when loading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 cr.define('extensions', function() { 5 cr.define('extensions', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * The ExtensionOptionsOverlay will show an extension's options page using 9 * The ExtensionOptionsOverlay will show an extension's options page using
10 * an <extensionoptions> element. 10 * an <extensionoptions> element.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 extensionoptions.onpreferredsizechanged = function(evt) { 114 extensionoptions.onpreferredsizechanged = function(evt) {
115 var oldWidth = parseInt(overlayStyle.width, 10); 115 var oldWidth = parseInt(overlayStyle.width, 10);
116 var oldHeight = parseInt(overlayStyle.height, 10); 116 var oldHeight = parseInt(overlayStyle.height, 10);
117 var newWidth = Math.max(evt.width, minWidth); 117 var newWidth = Math.max(evt.width, minWidth);
118 var newHeight = Math.min(evt.height, maxHeight); 118 var newHeight = Math.min(evt.height, maxHeight);
119 119
120 // animationTime is the amount of time in ms that will be used to resize 120 // animationTime is the amount of time in ms that will be used to resize
121 // the overlay. It is calculated by multiplying the pythagorean distance 121 // the overlay. It is calculated by multiplying the pythagorean distance
122 // between old and the new size (in px) with a constant speed of 122 // between old and the new size (in px) with a constant speed of
123 // 0.25 ms/px. 123 // 0.25 ms/px.
124 var animationTime = 0.25 * Math.sqrt( 124 var loading = document.documentElement.classlist.contains('loading');
Dan Beam 2015/02/04 19:09:30 note: this doesn't work all that well but will whe
125 Math.pow(newWidth - oldWidth, 2) + 125 var animationTime = loading ? 0 :
126 Math.pow(newHeight - oldHeight, 2)); 126 0.25 * Math.sqrt(Math.pow(newWidth - oldWidth, 2) +
127 Math.pow(newHeight - oldHeight, 2));
127 128
128 if (animation) { 129 if (animation) {
129 animation.cancel(); 130 animation.cancel();
130 } 131 }
131 animation = overlay.animate([ 132 animation = overlay.animate([
132 {width: oldWidth + 'px', height: oldHeight + 'px'}, 133 {width: oldWidth + 'px', height: oldHeight + 'px'},
133 {width: newWidth + 'px', height: newHeight + 'px'} 134 {width: newWidth + 'px', height: newHeight + 'px'}
134 ], { 135 ], {
135 duration: animationTime, 136 duration: animationTime,
136 delay: 0 137 delay: 0
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 /** @type {HTMLDivElement} */($('extension-options-overlay')) : 174 /** @type {HTMLDivElement} */($('extension-options-overlay')) :
174 null); 175 null);
175 } 176 }
176 }; 177 };
177 178
178 // Export 179 // Export
179 return { 180 return {
180 ExtensionOptionsOverlay: ExtensionOptionsOverlay 181 ExtensionOptionsOverlay: ExtensionOptionsOverlay
181 }; 182 };
182 }); 183 });
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