Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(473)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/Widget.js

Issue 2190213002: DevTools: measure should not destroy elements hierarchy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 var activeElement = this.element.ownerDocument.activeElement; 453 var activeElement = this.element.ownerDocument.activeElement;
454 return activeElement && activeElement.isSelfOrDescendant(this.element); 454 return activeElement && activeElement.isSelfOrDescendant(this.element);
455 }, 455 },
456 456
457 /** 457 /**
458 * @return {!Size} 458 * @return {!Size}
459 */ 459 */
460 measurePreferredSize: function() 460 measurePreferredSize: function()
461 { 461 {
462 var document = this.element.ownerDocument; 462 var document = this.element.ownerDocument;
463 var oldParent = this.element.parentElement;
464 var oldNextSibling = this.element.nextSibling;
465
463 WebInspector.Widget._originalAppendChild.call(document.body, this.elemen t); 466 WebInspector.Widget._originalAppendChild.call(document.body, this.elemen t);
464 this.element.positionAt(0, 0); 467 this.element.positionAt(0, 0);
465 var result = new Size(this.element.offsetWidth, this.element.offsetHeigh t); 468 var result = new Size(this.element.offsetWidth, this.element.offsetHeigh t);
469
466 this.element.positionAt(undefined, undefined); 470 this.element.positionAt(undefined, undefined);
467 WebInspector.Widget._originalRemoveChild.call(document.body, this.elemen t); 471 if (oldParent)
472 WebInspector.Widget._originalInsertBefore.call(oldParent, this.eleme nt, oldNextSibling);
473 else
474 WebInspector.Widget._originalRemoveChild.call(document.body, this.el ement);
468 return result; 475 return result;
469 }, 476 },
470 477
471 /** 478 /**
472 * @return {!Constraints} 479 * @return {!Constraints}
473 */ 480 */
474 calculateConstraints: function() 481 calculateConstraints: function()
475 { 482 {
476 return new Constraints(); 483 return new Constraints();
477 }, 484 },
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 { 792 {
786 WebInspector.Widget.__assert(!child.__widgetCounter && !child.__widget, "Att empt to remove element containing widget via regular DOM operation"); 793 WebInspector.Widget.__assert(!child.__widgetCounter && !child.__widget, "Att empt to remove element containing widget via regular DOM operation");
787 return WebInspector.Widget._originalRemoveChild.call(this, child); 794 return WebInspector.Widget._originalRemoveChild.call(this, child);
788 } 795 }
789 796
790 Element.prototype.removeChildren = function() 797 Element.prototype.removeChildren = function()
791 { 798 {
792 WebInspector.Widget.__assert(!this.__widgetCounter, "Attempt to remove eleme nt containing widget via regular DOM operation"); 799 WebInspector.Widget.__assert(!this.__widgetCounter, "Attempt to remove eleme nt containing widget via regular DOM operation");
793 WebInspector.Widget._originalRemoveChildren.call(this); 800 WebInspector.Widget._originalRemoveChildren.call(this);
794 } 801 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698