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

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

Issue 934303003: Fixed the bug that caused extension options not to fit their overlays properly when zoomed. (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
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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // undesirable effects. 120 // undesirable effects.
121 var animation = null; 121 var animation = null;
122 122
123 /** 123 /**
124 * Resize the overlay if the <extensionoptions> changes preferred size. 124 * Resize the overlay if the <extensionoptions> changes preferred size.
125 * @param {{width: number, height: number}} evt 125 * @param {{width: number, height: number}} evt
126 */ 126 */
127 extensionoptions.onpreferredsizechanged = function(evt) { 127 extensionoptions.onpreferredsizechanged = function(evt) {
128 var oldWidth = parseInt(overlayStyle.width, 10); 128 var oldWidth = parseInt(overlayStyle.width, 10);
129 var oldHeight = parseInt(overlayStyle.height, 10); 129 var oldHeight = parseInt(overlayStyle.height, 10);
130 var newWidth = Math.max(evt.width, minWidth); 130 // The overlay must be slightly larger than the extension options to
131 var newHeight = Math.min(evt.height, maxHeight); 131 // avoid creating scrollbars.
132 var newWidth = Math.max(evt.width + 2, minWidth);
not at google - send to devlin 2015/02/18 18:00:12 Could you explain where the value of 2 comes from,
paulmeyer 2015/02/18 18:14:11 2 pixels allows the overlay a 1 pixel border aroun
not at google - send to devlin 2015/02/18 19:19:10 Ok, thanks for explaining. Why is the pixel neede
paulmeyer 2015/02/19 18:42:58 It looks like there is a problem with the preferre
133 var newHeight = Math.min(evt.height + 2, maxHeight);
132 134
133 // animationTime is the amount of time in ms that will be used to resize 135 // animationTime is the amount of time in ms that will be used to resize
134 // the overlay. It is calculated by multiplying the pythagorean distance 136 // the overlay. It is calculated by multiplying the pythagorean distance
135 // between old and the new size (in px) with a constant speed of 137 // between old and the new size (in px) with a constant speed of
136 // 0.25 ms/px. 138 // 0.25 ms/px.
137 var loading = document.documentElement.classList.contains('loading'); 139 var loading = document.documentElement.classList.contains('loading');
138 var animationTime = loading ? 0 : 140 var animationTime = loading ? 0 :
139 0.25 * Math.sqrt(Math.pow(newWidth - oldWidth, 2) + 141 0.25 * Math.sqrt(Math.pow(newWidth - oldWidth, 2) +
140 Math.pow(newHeight - oldHeight, 2)); 142 Math.pow(newHeight - oldHeight, 2));
141 143
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 /** @type {HTMLDivElement} */($('extension-options-overlay')) : 195 /** @type {HTMLDivElement} */($('extension-options-overlay')) :
194 null); 196 null);
195 } 197 }
196 }; 198 };
197 199
198 // Export 200 // Export
199 return { 201 return {
200 ExtensionOptionsOverlay: ExtensionOptionsOverlay 202 ExtensionOptionsOverlay: ExtensionOptionsOverlay
201 }; 203 };
202 }); 204 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698