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

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

Issue 2592433003: [DevTools] Replace ViewportControl with ListControl. (Closed)
Patch Set: small fix Created 4 years 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
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 980 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 969 matching lines...) Expand 10 before | Expand all | Expand 10 after
1988 return new Promise(fulfill => { 1988 return new Promise(fulfill => {
1989 var image = new Image(); 1989 var image = new Image();
1990 image.addEventListener('load', () => fulfill(image)); 1990 image.addEventListener('load', () => fulfill(image));
1991 image.addEventListener('error', () => fulfill(null)); 1991 image.addEventListener('error', () => fulfill(null));
1992 image.src = url; 1992 image.src = url;
1993 }); 1993 });
1994 }; 1994 };
1995 1995
1996 /** @type {!UI.ThemeSupport} */ 1996 /** @type {!UI.ThemeSupport} */
1997 UI.themeSupport; 1997 UI.themeSupport;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698