Changeset 101315 in webkit
- Timestamp:
- Nov 28, 2011, 6:34:38 PM (15 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
inspector/front-end/treeoutline.js (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r101314 r101315 1 2011-11-28 Timothy Hatcher <timothy@apple.com> 2 3 Add support for knowing when a TreeElement is added or changed anywhere in a TreeOutline. 4 5 Reviewed by Brian Weinstein. 6 7 * inspector/front-end/treeoutline.js: 8 (TreeOutline.prototype.appendChild): Call onadd if it exists. 9 (TreeOutline.prototype.insertChild): Ditto. 10 (TreeOutline.prototype._treeElementDidChange): Added. Call onchange if it exists. 11 (TreeElement.prototype.set title): Call didChange. 12 (TreeElement.prototype.set titleHTML): Ditto. 13 (TreeElement.prototype.set tooltip): Ditto. 14 (TreeElement.prototype.set hasChildren): Ditto. 15 (TreeElement.prototype._fireDidChange): Added. Call TreeOutline._treeElementDidChange. 16 (TreeElement.prototype.didChange): Added. Schedule a timeout for _fireDidChange. 17 (TreeElement.prototype.expand): Move the code that sets the expanded flag to the beginning 18 which is before onpopulate. Since onpopulate can add elements and call onadd, this makes 19 sure the expanded flag is true before calling those functions. 20 1 21 2011-11-28 Timothy Hatcher <timothy@apple.com> 2 22 -
trunk/Source/WebCore/inspector/front-end/treeoutline.js
r101314 r101315 93 93 94 94 child._attach(); 95 96 if (this.treeOutline.onadd) 97 this.treeOutline.onadd(child); 95 98 } 96 99 … … 141 144 142 145 child._attach(); 146 147 if (this.treeOutline.onadd) 148 this.treeOutline.onadd(child); 143 149 } 144 150 … … 334 340 335 341 return this.getCachedTreeElement(representedObject); 342 } 343 344 TreeOutline.prototype._treeElementDidChange = function(treeElement) 345 { 346 if (treeElement.treeOutline !== this) 347 return; 348 349 if (this.onchange) 350 this.onchange(treeElement); 336 351 } 337 352 … … 513 528 this._title = x; 514 529 this._setListItemNodeContent(); 530 this.didChange(); 515 531 }, 516 532 … … 522 538 this._titleHTML = x; 523 539 this._setListItemNodeContent(); 540 this.didChange(); 524 541 }, 525 542 … … 532 549 if (this._listItemNode) 533 550 this._listItemNode.title = x ? x : ""; 551 this.didChange(); 534 552 }, 535 553 … … 553 571 this.collapse(); 554 572 } 573 574 this.didChange(); 555 575 }, 556 576 … … 586 606 if (x && this.expanded) 587 607 this.expand(); 608 }, 609 610 _fireDidChange: function() 611 { 612 delete this._didChangeTimeoutIdentifier; 613 614 if (this.treeOutline) 615 this.treeOutline._treeElementDidChange(this); 616 }, 617 618 didChange: function() 619 { 620 if (!this.treeOutline) 621 return; 622 623 // Prevent telling the TreeOutline multiple times in a row by delaying it with a timeout. 624 if (!this._didChangeTimeoutIdentifier) 625 this._didChangeTimeoutIdentifier = setTimeout(this._fireDidChange.bind(this), 0); 588 626 }, 589 627 … … 742 780 return; 743 781 782 // Set this before onpopulate. Since onpopulate can add elements and call onadd, this makes 783 // sure the expanded flag is true before calling those functions. This prevents the possibility 784 // of an infinite loop if onpopulate or onadd were to call expand. 785 786 this.expanded = true; 787 if (this.treeOutline) 788 this.treeOutline._treeElementsExpandedState[this.identifier] = true; 789 744 790 if (this.treeOutline && (!this._childrenListNode || this._shouldRefreshChildren)) { 745 791 if (this._childrenListNode && this._childrenListNode.parentNode) … … 769 815 if (this._childrenListNode) 770 816 this._childrenListNode.classList.add("expanded"); 771 772 this.expanded = true;773 if (this.treeOutline)774 this.treeOutline._treeElementsExpandedState[this.identifier] = true;775 817 776 818 if (this.onexpand)
Note:
See TracChangeset
for help on using the changeset viewer.