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

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

Issue 1463143005: DevTools: avoid layout thrashing on Layers panel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/timeline/Layers3DView.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) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 279
280 if (nextSelectedElement) { 280 if (nextSelectedElement) {
281 nextSelectedElement.reveal(); 281 nextSelectedElement.reveal();
282 nextSelectedElement.select(false, true); 282 nextSelectedElement.select(false, true);
283 } 283 }
284 284
285 if (handled) 285 if (handled)
286 event.consume(true); 286 event.consume(true);
287 }, 287 },
288 288
289 /**
290 * @param {!TreeElement} treeElement
291 */
292 _deferredScrollIntoView: function(treeElement)
293 {
294 if (!this._treeElementToScrollIntoView)
295 this.element.window().requestAnimationFrame(deferredScrollIntoView.b ind(this));
296 this._treeElementToScrollIntoView = treeElement;
297 /**
298 * @this {TreeOutline}
299 */
300 function deferredScrollIntoView()
301 {
302 var treeElement = this._treeElementToScrollIntoView;
303 delete this._treeElementToScrollIntoView;
304 if (treeElement.treeOutline !== this || !treeElement.listItemElement )
pfeldman 2015/11/20 22:48:52 nuke those
305 return;
306 treeElement.listItemElement.scrollIntoViewIfNeeded();
307 treeElement.onreveal();
308 }
309 },
310
289 __proto__: WebInspector.Object.prototype 311 __proto__: WebInspector.Object.prototype
290 } 312 }
291 313
292 /** 314 /**
293 * @constructor 315 * @constructor
294 * @extends {TreeOutline} 316 * @extends {TreeOutline}
295 * @param {string=} className 317 * @param {string=} className
296 */ 318 */
297 function TreeOutlineInShadow(className) 319 function TreeOutlineInShadow(className)
298 { 320 {
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 876
855 reveal: function() 877 reveal: function()
856 { 878 {
857 var currentAncestor = this.parent; 879 var currentAncestor = this.parent;
858 while (currentAncestor && !currentAncestor.root) { 880 while (currentAncestor && !currentAncestor.root) {
859 if (!currentAncestor.expanded) 881 if (!currentAncestor.expanded)
860 currentAncestor.expand(); 882 currentAncestor.expand();
861 currentAncestor = currentAncestor.parent; 883 currentAncestor = currentAncestor.parent;
862 } 884 }
863 885
886 this.treeOutline._deferredScrollIntoView(this);
887 },
888
889 _deferredScrollIntoView: function()
pfeldman 2015/11/20 22:48:52 unused
890 {
864 this.listItemElement.scrollIntoViewIfNeeded(); 891 this.listItemElement.scrollIntoViewIfNeeded();
865
866 this.onreveal();
pfeldman 2015/11/20 22:48:52 I think you want it there synchronously.
867 }, 892 },
868 893
869 /** 894 /**
870 * @return {boolean} 895 * @return {boolean}
871 */ 896 */
872 revealed: function() 897 revealed: function()
873 { 898 {
874 var currentAncestor = this.parent; 899 var currentAncestor = this.parent;
875 while (currentAncestor && !currentAncestor.root) { 900 while (currentAncestor && !currentAncestor.root) {
876 if (!currentAncestor.expanded) 901 if (!currentAncestor.expanded)
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 isEventWithinDisclosureTriangle: function(event) 1118 isEventWithinDisclosureTriangle: function(event)
1094 { 1119 {
1095 // FIXME: We should not use getComputedStyle(). For that we need to get rid of using ::before for disclosure triangle. (http://webk.it/74446) 1120 // FIXME: We should not use getComputedStyle(). For that we need to get rid of using ::before for disclosure triangle. (http://webk.it/74446)
1096 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddi ngLeft; 1121 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddi ngLeft;
1097 console.assert(paddingLeftValue.endsWith("px")); 1122 console.assert(paddingLeftValue.endsWith("px"));
1098 var computedLeftPadding = parseFloat(paddingLeftValue); 1123 var computedLeftPadding = parseFloat(paddingLeftValue);
1099 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; 1124 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding;
1100 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowTo ggleWidth && this._expandable; 1125 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowTo ggleWidth && this._expandable;
1101 } 1126 }
1102 } 1127 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/timeline/Layers3DView.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698