Chromium Code Reviews| Index: ui/login/login_ui_tools.js |
| diff --git a/ui/login/login_ui_tools.js b/ui/login/login_ui_tools.js |
| index 2759ceb7dd62e6badfe49d0476b9a174db7f46fe..f78cecb82bc5bfe97adc1db272ebd92b37fdd068 100644 |
| --- a/ui/login/login_ui_tools.js |
| +++ b/ui/login/login_ui_tools.js |
| @@ -23,6 +23,20 @@ cr.define('cr.ui.LoginUITools', function() { |
| maxAllowedHeight += |
| 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.
|
| return maxAllowedHeight; |
| - } |
| + }, |
| + |
| + /** |
| + * Computes max-width for an element so that it does fit the |
| + * outer-container. |
| + * @param {element} DOM element |
| + */ |
| + getMaxWidthToFit : function(element) { |
| + var maxAllowedWidth = |
| + $('outer-container').offsetWidth - |
| + element.getBoundingClientRect().left - |
| + parseInt(window.getComputedStyle(element).marginLeft) - |
| + parseInt(window.getComputedStyle(element).marginRight); |
| + return maxAllowedWidth; |
| + }, |
| } |
| }); |