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

Side by Side Diff: ui/login/login_ui_tools.js

Issue 2467783002: ChromeOS: update alignment of user POD error bubble. (Closed)
Patch Set: Implemented side positioning. Removed debug. Created 4 years, 1 month 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
« ui/login/bubble.js ('K') | « ui/login/bubble.js ('k') | 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 /** 5 /**
6 * @fileoverview JS helpers used on login. 6 * @fileoverview JS helpers used on login.
7 */ 7 */
8 8
9 cr.define('cr.ui.LoginUITools', function() { 9 cr.define('cr.ui.LoginUITools', function() {
10 return { 10 return {
11 /** 11 /**
12 * Computes max-height for an element so that it doesn't overlap shelf. 12 * Computes max-height for an element so that it doesn't overlap shelf.
13 * @param {element} DOM element 13 * @param {element} DOM element
14 * @param {wholeWindow} Whether the element can go outside outer-container. 14 * @param {wholeWindow} Whether the element can go outside outer-container.
15 */ 15 */
16 getMaxHeightBeforeShelfOverlapping : function(element, wholeWindow) { 16 getMaxHeightBeforeShelfOverlapping : function(element, wholeWindow) {
17 var maxAllowedHeight = 17 var maxAllowedHeight =
18 $('outer-container').offsetHeight - 18 $('outer-container').offsetHeight -
19 element.getBoundingClientRect().top - 19 element.getBoundingClientRect().top -
20 parseInt(window.getComputedStyle(element).marginTop) - 20 parseInt(window.getComputedStyle(element).marginTop) -
21 parseInt(window.getComputedStyle(element).marginBottom); 21 parseInt(window.getComputedStyle(element).marginBottom);
22 if (wholeWindow) 22 if (wholeWindow)
23 maxAllowedHeight += 23 maxAllowedHeight +=
24 parseInt(window.getComputedStyle($('outer-container')).bottom); 24 parseInt(window.getComputedStyle($('outer-container')).bottom);
xiyuan 2016/11/02 16:17:22 unrelated to your change, but could you wrap this
Alexander Alekseev 2016/11/03 01:27:43 Done.
25 return maxAllowedHeight; 25 return maxAllowedHeight;
26 } 26 },
27
28 /**
29 * Computes max-width for an element so that it does fit the
30 * outer-container.
31 * @param {element} DOM element
32 */
33 getMaxWidthToFit : function(element) {
34 var maxAllowedWidth =
35 $('outer-container').offsetWidth -
36 element.getBoundingClientRect().left -
37 parseInt(window.getComputedStyle(element).marginLeft) -
38 parseInt(window.getComputedStyle(element).marginRight);
39 return maxAllowedWidth;
40 },
27 } 41 }
28 }); 42 });
OLDNEW
« ui/login/bubble.js ('K') | « ui/login/bubble.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698