Roll src/third_party/WebKit 8ea8f1a:8a69bd1 (svn 193559:193579)
[chromium-blink-merge.git] / ui / login / login_ui_tools.js
blob1daf6854674e8f7f4c333dbb1b42504033261bea
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
3 // found in the LICENSE file.
5 /**
6  * @fileoverview JS helpers used on login.
7  */
9 cr.define('cr.ui.LoginUITools', function() {
10   return {
11     /**
12      * Computes max-height for an element so that it doesn't overlap shelf.
13      * @param {element} DOM element
14      */
15     getMaxHeightBeforeShelfOverlapping : function(element) {
16       var maxAllowedHeight =
17           $('outer-container').offsetHeight -
18           element.getBoundingClientRect().top -
19           parseInt(window.getComputedStyle(element).marginTop) -
20           parseInt(window.getComputedStyle(element).marginBottom);
21       return maxAllowedHeight;
22     }
23   }
24 });