| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright (c) 2014 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
| 5 found in the LICENSE file. | 5 found in the LICENSE file. |
| 6 --> | 6 --> |
| 7 | 7 |
| 8 <link rel="import" href="/tracing/ui/base/dom_helpers.html"> | 8 <link rel="import" href="/tracing/ui/base/dom_helpers.html"> |
| 9 <link rel="import" href="/tracing/ui/base/utils.html"> | 9 <link rel="import" href="/tracing/ui/base/utils.html"> |
| 10 | 10 |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 td.classList.add('sensitive'); | 477 td.classList.add('sensitive'); |
| 478 headerCell.tapCallback = this.createSortCallback_(i); | 478 headerCell.tapCallback = this.createSortCallback_(i); |
| 479 // Set arrow position, depending on the sortColumnIndex. | 479 // Set arrow position, depending on the sortColumnIndex. |
| 480 if (this.sortColumnIndex_ === i) | 480 if (this.sortColumnIndex_ === i) |
| 481 headerCell.sideContent = this.sortDescending_ ? | 481 headerCell.sideContent = this.sortDescending_ ? |
| 482 DESCENDING_ARROW : ASCENDING_ARROW; | 482 DESCENDING_ARROW : ASCENDING_ARROW; |
| 483 else | 483 else |
| 484 headerCell.sideContent = UNSORTED_ARROW; | 484 headerCell.sideContent = UNSORTED_ARROW; |
| 485 } | 485 } |
| 486 | 486 |
| 487 td.appendChild(headerCell); | 487 Polymer.dom(td).appendChild(headerCell); |
| 488 this.headerCells_.push(headerCell); | 488 this.headerCells_.push(headerCell); |
| 489 } | 489 } |
| 490 }, | 490 }, |
| 491 | 491 |
| 492 applySizes_: function() { | 492 applySizes_: function() { |
| 493 if (this.tableRows_.length === 0 && !this.showHeader) | 493 if (this.tableRows_.length === 0 && !this.showHeader) |
| 494 return; | 494 return; |
| 495 var rowToRemoveSizing; | 495 var rowToRemoveSizing; |
| 496 var rowToSize; | 496 var rowToSize; |
| 497 if (this.showHeader) { | 497 if (this.showHeader) { |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 'expand-button'); | 659 'expand-button'); |
| 660 expandButton.textContent = RIGHT_ARROW; | 660 expandButton.textContent = RIGHT_ARROW; |
| 661 if (rowInfo.isExpanded) | 661 if (rowInfo.isExpanded) |
| 662 expandButton.classList.add('button-expanded'); | 662 expandButton.classList.add('button-expanded'); |
| 663 } else { | 663 } else { |
| 664 td.style.paddingLeft = INDENT_SPACE_NO_BUTTON + 'px'; | 664 td.style.paddingLeft = INDENT_SPACE_NO_BUTTON + 'px'; |
| 665 } | 665 } |
| 666 } | 666 } |
| 667 | 667 |
| 668 if (value !== undefined) | 668 if (value !== undefined) |
| 669 td.appendChild(tr.ui.b.asHTMLOrTextNode(value, this.ownerDocument)); | 669 Polymer.dom(td).appendChild( |
| 670 tr.ui.b.asHTMLOrTextNode(value, this.ownerDocument)); |
| 670 | 671 |
| 671 i += colSpan; | 672 i += colSpan; |
| 672 } | 673 } |
| 673 | 674 |
| 674 var isSelectable = tableSection === this.$.body; | 675 var isSelectable = tableSection === this.$.body; |
| 675 var isExpandable = rowInfo.userRow[this.subRowsPropertyName_] && | 676 var isExpandable = rowInfo.userRow[this.subRowsPropertyName_] && |
| 676 rowInfo.userRow[this.subRowsPropertyName_].length; | 677 rowInfo.userRow[this.subRowsPropertyName_].length; |
| 677 | 678 |
| 678 if (isSelectable || isExpandable) { | 679 if (isSelectable || isExpandable) { |
| 679 trElement.addEventListener('click', function(e) { | 680 trElement.addEventListener('click', function(e) { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 this.headerDirty_ = false; | 787 this.headerDirty_ = false; |
| 787 } | 788 } |
| 788 if (this.bodyDirty_) { | 789 if (this.bodyDirty_) { |
| 789 this.$.body.textContent = ''; | 790 this.$.body.textContent = ''; |
| 790 this.generateTableRowNodes_( | 791 this.generateTableRowNodes_( |
| 791 this.$.body, | 792 this.$.body, |
| 792 this.tableRows_, this.tableRowsInfo_, 0, | 793 this.tableRows_, this.tableRowsInfo_, 0, |
| 793 undefined, undefined); | 794 undefined, undefined); |
| 794 if (this.tableRows_.length === 0 && this.emptyValue_ !== undefined) { | 795 if (this.tableRows_.length === 0 && this.emptyValue_ !== undefined) { |
| 795 var trElement = this.ownerDocument.createElement('tr'); | 796 var trElement = this.ownerDocument.createElement('tr'); |
| 796 this.$.body.appendChild(trElement); | 797 Polymer.dom(this.$.body).appendChild(trElement); |
| 797 trElement.classList.add('empty-row'); | 798 trElement.classList.add('empty-row'); |
| 798 var td = this.ownerDocument.createElement('td'); | 799 var td = this.ownerDocument.createElement('td'); |
| 799 trElement.appendChild(td); | 800 Polymer.dom(trElement).appendChild(td); |
| 800 td.colSpan = this.tableColumns_.length; | 801 td.colSpan = this.tableColumns_.length; |
| 801 var emptyValue = this.emptyValue_; | 802 var emptyValue = this.emptyValue_; |
| 802 td.appendChild( | 803 Polymer.dom(td).appendChild( |
| 803 tr.ui.b.asHTMLOrTextNode(emptyValue, this.ownerDocument)); | 804 tr.ui.b.asHTMLOrTextNode(emptyValue, this.ownerDocument)); |
| 804 } | 805 } |
| 805 this.bodyDirty_ = false; | 806 this.bodyDirty_ = false; |
| 806 } | 807 } |
| 807 | 808 |
| 808 if (wasBodyOrHeaderDirty) | 809 if (wasBodyOrHeaderDirty) |
| 809 this.applySizes_(); | 810 this.applySizes_(); |
| 810 | 811 |
| 811 if (this.footerDirty_) { | 812 if (this.footerDirty_) { |
| 812 this.$.foot.textContent = ''; | 813 this.$.foot.textContent = ''; |
| 813 this.generateTableRowNodes_( | 814 this.generateTableRowNodes_( |
| 814 this.$.foot, | 815 this.$.foot, |
| 815 this.tableFooterRows_, this.tableFooterRowsInfo_, 0, | 816 this.tableFooterRows_, this.tableFooterRowsInfo_, 0, |
| 816 undefined, undefined); | 817 undefined, undefined); |
| 817 if (this.tableFooterRowsInfo_.length) { | 818 if (this.tableFooterRowsInfo_.length) { |
| 818 this.$.body.classList.add('has-footer'); | 819 this.$.body.classList.add('has-footer'); |
| 819 } else { | 820 } else { |
| 820 this.$.body.classList.remove('has-footer'); | 821 this.$.body.classList.remove('has-footer'); |
| 821 } | 822 } |
| 822 this.footerDirty_ = false; | 823 this.footerDirty_ = false; |
| 823 } | 824 } |
| 824 }, | 825 }, |
| 825 | 826 |
| 826 appendNewElement_: function(parent, tagName) { | 827 appendNewElement_: function(parent, tagName) { |
| 827 var element = parent.ownerDocument.createElement(tagName); | 828 var element = parent.ownerDocument.createElement(tagName); |
| 828 parent.appendChild(element); | 829 Polymer.dom(parent).appendChild(element); |
| 829 return element; | 830 return element; |
| 830 }, | 831 }, |
| 831 | 832 |
| 832 getExpandedForTableRow: function(userRow) { | 833 getExpandedForTableRow: function(userRow) { |
| 833 this.rebuildIfNeeded_(); | 834 this.rebuildIfNeeded_(); |
| 834 var rowInfo = this.tableRowsInfo_.get(userRow); | 835 var rowInfo = this.tableRowsInfo_.get(userRow); |
| 835 if (rowInfo === undefined) | 836 if (rowInfo === undefined) |
| 836 throw new Error('Row has not been seen, must expand its parents'); | 837 throw new Error('Row has not been seen, must expand its parents'); |
| 837 return rowInfo.isExpanded; | 838 return rowInfo.isExpanded; |
| 838 }, | 839 }, |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1395 this.cellTitle_ = ''; | 1396 this.cellTitle_ = ''; |
| 1396 }, | 1397 }, |
| 1397 | 1398 |
| 1398 set cellTitle(value) { | 1399 set cellTitle(value) { |
| 1399 this.cellTitle_ = value; | 1400 this.cellTitle_ = value; |
| 1400 | 1401 |
| 1401 var titleNode = tr.ui.b.asHTMLOrTextNode( | 1402 var titleNode = tr.ui.b.asHTMLOrTextNode( |
| 1402 this.cellTitle_, this.ownerDocument); | 1403 this.cellTitle_, this.ownerDocument); |
| 1403 | 1404 |
| 1404 this.$.title.innerText = ''; | 1405 this.$.title.innerText = ''; |
| 1405 this.$.title.appendChild(titleNode); | 1406 Polymer.dom(this.$.title).appendChild(titleNode); |
| 1406 }, | 1407 }, |
| 1407 | 1408 |
| 1408 get cellTitle() { | 1409 get cellTitle() { |
| 1409 return this.cellTitle_; | 1410 return this.cellTitle_; |
| 1410 }, | 1411 }, |
| 1411 | 1412 |
| 1412 clearSideContent: function() { | 1413 clearSideContent: function() { |
| 1413 this.$.side.textContent = ''; | 1414 this.$.side.textContent = ''; |
| 1414 }, | 1415 }, |
| 1415 | 1416 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1429 get tapCallback() { | 1430 get tapCallback() { |
| 1430 return this.tapCallback_; | 1431 return this.tapCallback_; |
| 1431 }, | 1432 }, |
| 1432 | 1433 |
| 1433 onTap_: function() { | 1434 onTap_: function() { |
| 1434 if (this.tapCallback_) | 1435 if (this.tapCallback_) |
| 1435 this.tapCallback_(); | 1436 this.tapCallback_(); |
| 1436 } | 1437 } |
| 1437 }); | 1438 }); |
| 1438 </script> | 1439 </script> |
| OLD | NEW |