| 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 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 case 'changed': | 983 case 'changed': |
| 984 entry.node.textContent = entry.oldText; | 984 entry.node.textContent = entry.oldText; |
| 985 break; | 985 break; |
| 986 } | 986 } |
| 987 } | 987 } |
| 988 }; | 988 }; |
| 989 | 989 |
| 990 /** | 990 /** |
| 991 * @param {!Element} element | 991 * @param {!Element} element |
| 992 * @param {?Element=} containerElement | 992 * @param {?Element=} containerElement |
| 993 * @return {!Size} | 993 * @return {!UI.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 = element.getBoundingClientRect(); | 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 new Size(result.width, result.height); | 1008 return new UI.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 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2025 var fileSelectorElement = createElement('input'); | 2025 var fileSelectorElement = createElement('input'); |
| 2026 fileSelectorElement.type = 'file'; | 2026 fileSelectorElement.type = 'file'; |
| 2027 fileSelectorElement.style.display = 'none'; | 2027 fileSelectorElement.style.display = 'none'; |
| 2028 fileSelectorElement.setAttribute('tabindex', -1); | 2028 fileSelectorElement.setAttribute('tabindex', -1); |
| 2029 fileSelectorElement.onchange = onChange; | 2029 fileSelectorElement.onchange = onChange; |
| 2030 function onChange(event) { | 2030 function onChange(event) { |
| 2031 callback(fileSelectorElement.files[0]); | 2031 callback(fileSelectorElement.files[0]); |
| 2032 } | 2032 } |
| 2033 return fileSelectorElement; | 2033 return fileSelectorElement; |
| 2034 }; | 2034 }; |
| OLD | NEW |