OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). | 4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). |
5 * Copyright (C) 2009 Joseph Pecoraro | 5 * Copyright (C) 2009 Joseph Pecoraro |
6 * | 6 * |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
9 * are met: | 9 * are met: |
10 * | 10 * |
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 * @param {!Element} element | 991 * @param {!Element} element |
992 * @param {?Element=} containerElement | 992 * @param {?Element=} containerElement |
993 * @return {!Size} | 993 * @return {!Size} |
994 */ | 994 */ |
995 UI.measurePreferredSize = function(element, containerElement) { | 995 UI.measurePreferredSize = function(element, containerElement) { |
996 var oldParent = element.parentElement; | 996 var oldParent = element.parentElement; |
997 var oldNextSibling = element.nextSibling; | 997 var oldNextSibling = element.nextSibling; |
998 containerElement = containerElement || element.ownerDocument.body; | 998 containerElement = containerElement || element.ownerDocument.body; |
999 containerElement.appendChild(element); | 999 containerElement.appendChild(element); |
1000 element.positionAt(0, 0); | 1000 element.positionAt(0, 0); |
1001 var result = new Size(element.offsetWidth, element.offsetHeight); | 1001 var result = element.getBoundingClientRect(); |
1002 | 1002 |
1003 element.positionAt(undefined, undefined); | 1003 element.positionAt(undefined, undefined); |
1004 if (oldParent) | 1004 if (oldParent) |
1005 oldParent.insertBefore(element, oldNextSibling); | 1005 oldParent.insertBefore(element, oldNextSibling); |
1006 else | 1006 else |
1007 element.remove(); | 1007 element.remove(); |
1008 return result; | 1008 return new Size(result.width, result.height); |
1009 }; | 1009 }; |
1010 | 1010 |
1011 /** | 1011 /** |
1012 * @unrestricted | 1012 * @unrestricted |
1013 */ | 1013 */ |
1014 UI.InvokeOnceHandlers = class { | 1014 UI.InvokeOnceHandlers = class { |
1015 /** | 1015 /** |
1016 * @param {boolean} autoInvoke | 1016 * @param {boolean} autoInvoke |
1017 */ | 1017 */ |
1018 constructor(autoInvoke) { | 1018 constructor(autoInvoke) { |
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2009 return new Promise(fulfill => { | 2009 return new Promise(fulfill => { |
2010 var image = new Image(); | 2010 var image = new Image(); |
2011 image.addEventListener('load', () => fulfill(image)); | 2011 image.addEventListener('load', () => fulfill(image)); |
2012 image.addEventListener('error', () => fulfill(null)); | 2012 image.addEventListener('error', () => fulfill(null)); |
2013 image.src = url; | 2013 image.src = url; |
2014 }); | 2014 }); |
2015 }; | 2015 }; |
2016 | 2016 |
2017 /** @type {!UI.ThemeSupport} */ | 2017 /** @type {!UI.ThemeSupport} */ |
2018 UI.themeSupport; | 2018 UI.themeSupport; |
OLD | NEW |