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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/UIUtils.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 | « no previous file | third_party/WebKit/Source/devtools/front_end/ui/Widget.js » ('j') | 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) 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 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 } 1042 }
1043 } 1043 }
1044 1044
1045 /** 1045 /**
1046 * @param {!Element} element 1046 * @param {!Element} element
1047 * @param {?Element=} containerElement 1047 * @param {?Element=} containerElement
1048 * @return {!Size} 1048 * @return {!Size}
1049 */ 1049 */
1050 WebInspector.measurePreferredSize = function(element, containerElement) 1050 WebInspector.measurePreferredSize = function(element, containerElement)
1051 { 1051 {
1052 var oldParent = element.parentElement;
1053 var oldNextSibling = element.nextSibling;
1052 containerElement = containerElement || element.ownerDocument.body; 1054 containerElement = containerElement || element.ownerDocument.body;
1053 containerElement.appendChild(element); 1055 containerElement.appendChild(element);
1054 element.positionAt(0, 0); 1056 element.positionAt(0, 0);
1055 var result = new Size(element.offsetWidth, element.offsetHeight); 1057 var result = new Size(element.offsetWidth, element.offsetHeight);
1058
1056 element.positionAt(undefined, undefined); 1059 element.positionAt(undefined, undefined);
1057 element.remove(); 1060 if (oldParent)
1061 oldParent.insertBefore(element, oldNextSibling);
1062 else
1063 element.remove();
1058 return result; 1064 return result;
1059 } 1065 }
1060 1066
1061 /** 1067 /**
1062 * @constructor 1068 * @constructor
1063 * @param {boolean} autoInvoke 1069 * @param {boolean} autoInvoke
1064 */ 1070 */
1065 WebInspector.InvokeOnceHandlers = function(autoInvoke) 1071 WebInspector.InvokeOnceHandlers = function(autoInvoke)
1066 { 1072 {
1067 this._handlers = null; 1073 this._handlers = null;
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
1993 * @param {string} title 1999 * @param {string} title
1994 * @return {!Element} 2000 * @return {!Element}
1995 */ 2001 */
1996 WebInspector.linkifyDocumentationURLAsNode = function(article, title) 2002 WebInspector.linkifyDocumentationURLAsNode = function(article, title)
1997 { 2003 {
1998 return WebInspector.linkifyURLAsNode("https://developers.google.com/web/tool s/chrome-devtools/" + article, title, undefined, true); 2004 return WebInspector.linkifyURLAsNode("https://developers.google.com/web/tool s/chrome-devtools/" + article, title, undefined, true);
1999 } 2005 }
2000 2006
2001 /** @type {!WebInspector.ThemeSupport} */ 2007 /** @type {!WebInspector.ThemeSupport} */
2002 WebInspector.themeSupport; 2008 WebInspector.themeSupport;
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/ui/Widget.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698