blob: 2759ceb7dd62e6badfe49d0476b9a174db7f46fe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @fileoverview JS helpers used on login.
*/
cr.define('cr.ui.LoginUITools', function() {
return {
/**
* Computes max-height for an element so that it doesn't overlap shelf.
* @param {element} DOM element
* @param {wholeWindow} Whether the element can go outside outer-container.
*/
getMaxHeightBeforeShelfOverlapping : function(element, wholeWindow) {
var maxAllowedHeight =
$('outer-container').offsetHeight -
element.getBoundingClientRect().top -
parseInt(window.getComputedStyle(element).marginTop) -
parseInt(window.getComputedStyle(element).marginBottom);
if (wholeWindow)
maxAllowedHeight +=
parseInt(window.getComputedStyle($('outer-container')).bottom);
return maxAllowedHeight;
}
}
});
|