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

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

Issue 2182783002: Revert of DevTools: cleanup treeoutline expand logic (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/components/ObjectPropertiesSection.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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 this.treeOutline._bindTreeElement(current); 517 this.treeOutline._bindTreeElement(current);
518 child.onattach(); 518 child.onattach();
519 child._ensureSelection(); 519 child._ensureSelection();
520 if (this.treeOutline) 520 if (this.treeOutline)
521 this.treeOutline.dispatchEventToListeners(TreeOutline.Events.Element Attached, child); 521 this.treeOutline.dispatchEventToListeners(TreeOutline.Events.Element Attached, child);
522 var nextSibling = child.nextSibling ? child.nextSibling._listItemNode : null; 522 var nextSibling = child.nextSibling ? child.nextSibling._listItemNode : null;
523 this._childrenListNode.insertBefore(child._listItemNode, nextSibling); 523 this._childrenListNode.insertBefore(child._listItemNode, nextSibling);
524 this._childrenListNode.insertBefore(child._childrenListNode, nextSibling ); 524 this._childrenListNode.insertBefore(child._childrenListNode, nextSibling );
525 if (child.selected) 525 if (child.selected)
526 child.select(); 526 child.select();
527 if (child.expanded)
528 child.expand();
527 }, 529 },
528 530
529 /** 531 /**
530 * @param {number} childIndex 532 * @param {number} childIndex
531 */ 533 */
532 removeChildAtIndex: function(childIndex) 534 removeChildAtIndex: function(childIndex)
533 { 535 {
534 if (childIndex < 0 || childIndex >= this._children.length) 536 if (childIndex < 0 || childIndex >= this._children.length)
535 throw "childIndex out of range"; 537 throw "childIndex out of range";
536 538
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 var item = this; 876 var item = this;
875 while (item) { 877 while (item) {
876 if (item.expanded) 878 if (item.expanded)
877 item.collapse(); 879 item.collapse();
878 item = item.traverseNextTreeElement(false, this, true); 880 item = item.traverseNextTreeElement(false, this, true);
879 } 881 }
880 }, 882 },
881 883
882 expand: function() 884 expand: function()
883 { 885 {
884 if (!this._expandable || this.expanded) 886 if (!this._expandable || (this.expanded && this._children))
885 return; 887 return;
886 888
887 // Set this before onpopulate. Since onpopulate can add elements, this m akes 889 // Set this before onpopulate. Since onpopulate can add elements, this m akes
888 // sure the expanded flag is true before calling those functions. This p revents the possibility 890 // sure the expanded flag is true before calling those functions. This p revents the possibility
889 // of an infinite loop if onpopulate were to call expand. 891 // of an infinite loop if onpopulate were to call expand.
890 892
891 this.expanded = true; 893 this.expanded = true;
892 894
893 this._populateIfNeeded(); 895 this._populateIfNeeded();
894 this._listItemNode.classList.add("expanded"); 896 this._listItemNode.classList.add("expanded");
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 isEventWithinDisclosureTriangle: function(event) 1163 isEventWithinDisclosureTriangle: function(event)
1162 { 1164 {
1163 // FIXME: We should not use getComputedStyle(). For that we need to get rid of using ::before for disclosure triangle. (http://webk.it/74446) 1165 // FIXME: We should not use getComputedStyle(). For that we need to get rid of using ::before for disclosure triangle. (http://webk.it/74446)
1164 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddi ngLeft; 1166 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddi ngLeft;
1165 console.assert(paddingLeftValue.endsWith("px")); 1167 console.assert(paddingLeftValue.endsWith("px"));
1166 var computedLeftPadding = parseFloat(paddingLeftValue); 1168 var computedLeftPadding = parseFloat(paddingLeftValue);
1167 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; 1169 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding;
1168 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowTo ggleWidth && this._expandable; 1170 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowTo ggleWidth && this._expandable;
1169 } 1171 }
1170 } 1172 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698