| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2011 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2011 Google Inc. All Rights Reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 } | 495 } |
| 496 | 496 |
| 497 /** | 497 /** |
| 498 * @return {boolean} | 498 * @return {boolean} |
| 499 */ | 499 */ |
| 500 hasFocus() { | 500 hasFocus() { |
| 501 return this.element.hasFocus(); | 501 return this.element.hasFocus(); |
| 502 } | 502 } |
| 503 | 503 |
| 504 /** | 504 /** |
| 505 * @return {!UI.Size} | |
| 506 */ | |
| 507 measurePreferredSize() { | |
| 508 var document = this.element.ownerDocument; | |
| 509 var oldParent = this.element.parentElement; | |
| 510 var oldNextSibling = this.element.nextSibling; | |
| 511 | |
| 512 UI.Widget._originalAppendChild.call(document.body, this.element); | |
| 513 this.element.positionAt(0, 0); | |
| 514 var result = new UI.Size(this.element.offsetWidth, this.element.offsetHeight
); | |
| 515 | |
| 516 this.element.positionAt(undefined, undefined); | |
| 517 if (oldParent) | |
| 518 UI.Widget._originalInsertBefore.call(oldParent, this.element, oldNextSibli
ng); | |
| 519 else | |
| 520 UI.Widget._originalRemoveChild.call(document.body, this.element); | |
| 521 return result; | |
| 522 } | |
| 523 | |
| 524 /** | |
| 525 * @return {!UI.Constraints} | 505 * @return {!UI.Constraints} |
| 526 */ | 506 */ |
| 527 calculateConstraints() { | 507 calculateConstraints() { |
| 528 return new UI.Constraints(); | 508 return new UI.Constraints(); |
| 529 } | 509 } |
| 530 | 510 |
| 531 /** | 511 /** |
| 532 * @return {!UI.Constraints} | 512 * @return {!UI.Constraints} |
| 533 */ | 513 */ |
| 534 constraints() { | 514 constraints() { |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 UI.Widget.__assert( | 727 UI.Widget.__assert( |
| 748 !child.__widgetCounter && !child.__widget, | 728 !child.__widgetCounter && !child.__widget, |
| 749 'Attempt to remove element containing widget via regular DOM operation'); | 729 'Attempt to remove element containing widget via regular DOM operation'); |
| 750 return UI.Widget._originalRemoveChild.call(this, child); | 730 return UI.Widget._originalRemoveChild.call(this, child); |
| 751 }; | 731 }; |
| 752 | 732 |
| 753 Element.prototype.removeChildren = function() { | 733 Element.prototype.removeChildren = function() { |
| 754 UI.Widget.__assert(!this.__widgetCounter, 'Attempt to remove element containin
g widget via regular DOM operation'); | 734 UI.Widget.__assert(!this.__widgetCounter, 'Attempt to remove element containin
g widget via regular DOM operation'); |
| 755 UI.Widget._originalRemoveChildren.call(this); | 735 UI.Widget._originalRemoveChildren.call(this); |
| 756 }; | 736 }; |
| OLD | NEW |