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

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

Issue 2147343002: DevTools: cleanup treeoutline expand logic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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();
529 }, 527 },
530 528
531 /** 529 /**
532 * @param {number} childIndex 530 * @param {number} childIndex
533 */ 531 */
534 removeChildAtIndex: function(childIndex) 532 removeChildAtIndex: function(childIndex)
535 { 533 {
536 if (childIndex < 0 || childIndex >= this._children.length) 534 if (childIndex < 0 || childIndex >= this._children.length)
537 throw "childIndex out of range"; 535 throw "childIndex out of range";
538 536
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 var item = this; 874 var item = this;
877 while (item) { 875 while (item) {
878 if (item.expanded) 876 if (item.expanded)
879 item.collapse(); 877 item.collapse();
880 item = item.traverseNextTreeElement(false, this, true); 878 item = item.traverseNextTreeElement(false, this, true);
881 } 879 }
882 }, 880 },
883 881
884 expand: function() 882 expand: function()
885 { 883 {
886 if (!this._expandable || (this.expanded && this._children)) 884 if (!this._expandable || this.expanded)
887 return; 885 return;
888 886
889 // Set this before onpopulate. Since onpopulate can add elements, this m akes 887 // Set this before onpopulate. Since onpopulate can add elements, this m akes
890 // sure the expanded flag is true before calling those functions. This p revents the possibility 888 // sure the expanded flag is true before calling those functions. This p revents the possibility
891 // of an infinite loop if onpopulate were to call expand. 889 // of an infinite loop if onpopulate were to call expand.
892 890
893 this.expanded = true; 891 this.expanded = true;
894 892
895 this._populateIfNeeded(); 893 this._populateIfNeeded();
896 this._listItemNode.classList.add("expanded"); 894 this._listItemNode.classList.add("expanded");
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 isEventWithinDisclosureTriangle: function(event) 1161 isEventWithinDisclosureTriangle: function(event)
1164 { 1162 {
1165 // FIXME: We should not use getComputedStyle(). For that we need to get rid of using ::before for disclosure triangle. (http://webk.it/74446) 1163 // FIXME: We should not use getComputedStyle(). For that we need to get rid of using ::before for disclosure triangle. (http://webk.it/74446)
1166 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddi ngLeft; 1164 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddi ngLeft;
1167 console.assert(paddingLeftValue.endsWith("px")); 1165 console.assert(paddingLeftValue.endsWith("px"));
1168 var computedLeftPadding = parseFloat(paddingLeftValue); 1166 var computedLeftPadding = parseFloat(paddingLeftValue);
1169 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; 1167 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding;
1170 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowTo ggleWidth && this._expandable; 1168 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowTo ggleWidth && this._expandable;
1171 } 1169 }
1172 } 1170 }
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