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

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: merge 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 extensionoptions.onpreferredsizechanged = function(evt) { 124 extensionoptions.onpreferredsizechanged = function(evt) {
125 var oldWidth = parseInt(overlayStyle.width, 10); 125 var oldWidth = parseInt(overlayStyle.width, 10);
126 var oldHeight = parseInt(overlayStyle.height, 10); 126 var oldHeight = parseInt(overlayStyle.height, 10);
127 var newWidth = Math.max(evt.width, minWidth); 127 var newWidth = Math.max(evt.width, minWidth);
128 var newHeight = Math.min(evt.height, maxHeight); 128 var newHeight = Math.min(evt.height, maxHeight);
129 129
130 // animationTime is the amount of time in ms that will be used to resize 130 // animationTime is the amount of time in ms that will be used to resize
131 // the overlay. It is calculated by multiplying the pythagorean distance 131 // the overlay. It is calculated by multiplying the pythagorean distance
132 // between old and the new size (in px) with a constant speed of 132 // between old and the new size (in px) with a constant speed of
133 // 0.25 ms/px. 133 // 0.25 ms/px.
134 var animationTime = 0.25 * Math.sqrt( 134 var loading = document.documentElement.classlist.contains('loading');
135 Math.pow(newWidth - oldWidth, 2) + 135 var animationTime = loading ? 0 :
136 Math.pow(newHeight - oldHeight, 2)); 136 0.25 * Math.sqrt(Math.pow(newWidth - oldWidth, 2) +
137 Math.pow(newHeight - oldHeight, 2));
137 138
138 if (animation) 139 if (animation)
139 animation.cancel(); 140 animation.cancel();
140 141
141 animation = overlay.animate([ 142 animation = overlay.animate([
142 {width: oldWidth + 'px', height: oldHeight + 'px'}, 143 {width: oldWidth + 'px', height: oldHeight + 'px'},
143 {width: newWidth + 'px', height: newHeight + 'px'} 144 {width: newWidth + 'px', height: newHeight + 'px'}
144 ], { 145 ], {
145 duration: animationTime, 146 duration: animationTime,
146 delay: 0 147 delay: 0
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 /** @type {HTMLDivElement} */($('extension-options-overlay')) : 190 /** @type {HTMLDivElement} */($('extension-options-overlay')) :
190 null); 191 null);
191 } 192 }
192 }; 193 };
193 194
194 // Export 195 // Export
195 return { 196 return {
196 ExtensionOptionsOverlay: ExtensionOptionsOverlay 197 ExtensionOptionsOverlay: ExtensionOptionsOverlay
197 }; 198 };
198 }); 199 });
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