(tree, indent)
| 577 | } |
| 578 | |
| 579 | expandTree(tree, indent) { |
| 580 | let index = 0; |
| 581 | let id = "R/"; |
| 582 | let row = tree.row; |
| 583 | |
| 584 | if (row) { |
| 585 | index = row.rowIndex; |
| 586 | id = row.id; |
| 587 | |
| 588 | tree.arrow.textContent = EXPANDED_ARROW; |
| 589 | // Collapse the children when the row is clicked again. |
| 590 | let expandHandler = row.onclick; |
| 591 | row.onclick = () => { |
| 592 | this.collapseRow(tree, expandHandler); |
| 593 | } |
| 594 | } |
| 595 | |
| 596 | // Collect the children, and sort them by ticks. |
| 597 | let children = []; |
| 598 | let filter = |
| 599 | filterFromFilterId(this.currentState.callTree.attribution); |
| 600 | for (let childId in tree.children) { |
| 601 | let child = tree.children[childId]; |
| 602 | if (child.ticks > 0) { |
| 603 | children.push(child); |
| 604 | if (child.delayedExpansion) { |
| 605 | expandTreeNode(this.currentState.file, child, filter); |
| 606 | } |
| 607 | } |
| 608 | } |
| 609 | children.sort(this.sortFromId(this.currentState.callTree.sort)); |
| 610 | |
| 611 | for (let i = 0; i < children.length; i++) { |
| 612 | let node = children[i]; |
| 613 | let row = this.rows.insertRow(index); |
| 614 | row.id = id + i + "/"; |
| 615 | |
| 616 | if (node.type === "CAT") { |
| 617 | row.style.backgroundColor = CATEGORY_COLOR; |
| 618 | } else { |
| 619 | row.style.backgroundColor = bucketFromKind(node.type).backgroundColor; |
| 620 | } |
| 621 | |
| 622 | // Inclusive time % cell. |
| 623 | let c = row.insertCell(); |
| 624 | c.textContent = (node.ticks * 100 / this.tickCount).toFixed(2) + "%"; |
| 625 | c.style.textAlign = "right"; |
| 626 | // Percent-of-parent cell. |
| 627 | c = row.insertCell(); |
| 628 | c.textContent = (node.ticks * 100 / tree.ticks).toFixed(2) + "%"; |
| 629 | c.style.textAlign = "right"; |
| 630 | // Exclusive time % cell. |
| 631 | if (this.currentState.mode !== "bottom-up") { |
| 632 | c = row.insertCell(-1); |
| 633 | c.textContent = (node.ownTicks * 100 / this.tickCount).toFixed(2) + "%"; |
| 634 | c.style.textAlign = "right"; |
| 635 | } |
| 636 |
no test coverage detected