OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 | 707 |
708 scrollToLastRow: function() | 708 scrollToLastRow: function() |
709 { | 709 { |
710 this._scrollContainer.scrollTop = this._scrollContainer.scrollHeight - t
his._scrollContainer.offsetHeight; | 710 this._scrollContainer.scrollTop = this._scrollContainer.scrollHeight - t
his._scrollContainer.offsetHeight; |
711 }, | 711 }, |
712 | 712 |
713 _positionResizers: function() | 713 _positionResizers: function() |
714 { | 714 { |
715 var headerTableColumns = this._headerTableColumnGroup.children; | 715 var headerTableColumns = this._headerTableColumnGroup.children; |
716 var numColumns = headerTableColumns.length - 1; // Do not process corner
column. | 716 var numColumns = headerTableColumns.length - 1; // Do not process corner
column. |
717 var left = 0; | 717 var left = []; |
718 var previousResizer = null; | 718 var previousResizer = null; |
719 | 719 |
| 720 for (var i = 0; i < numColumns - 1; i++) { |
| 721 // Get the width of the cell in the first (and only) row of the |
| 722 // header table in order to determine the width of the column, since |
| 723 // it is not possible to query a column for its width. |
| 724 left[i] = (left[i-1] || 0) + this.headerTableBody.rows[0].cells[i].o
ffsetWidth; |
| 725 } |
| 726 |
720 // Make n - 1 resizers for n columns. | 727 // Make n - 1 resizers for n columns. |
721 for (var i = 0; i < numColumns - 1; i++) { | 728 for (var i = 0; i < numColumns - 1; i++) { |
722 var resizer = this.resizers[i]; | 729 var resizer = this.resizers[i]; |
723 | 730 |
724 if (!resizer) { | 731 if (!resizer) { |
725 // This is the first call to updateWidth, so the resizers need | 732 // This is the first call to updateWidth, so the resizers need |
726 // to be created. | 733 // to be created. |
727 resizer = document.createElement("div"); | 734 resizer = document.createElement("div"); |
728 resizer.classList.add("data-grid-resizer"); | 735 resizer.classList.add("data-grid-resizer"); |
729 // This resizer is associated with the column to its right. | 736 // This resizer is associated with the column to its right. |
730 WebInspector.installDragHandle(resizer, this._startResizerDraggi
ng.bind(this), this._resizerDragging.bind(this), this._endResizerDragging.bind(t
his), "col-resize"); | 737 WebInspector.installDragHandle(resizer, this._startResizerDraggi
ng.bind(this), this._resizerDragging.bind(this), this._endResizerDragging.bind(t
his), "col-resize"); |
731 this.element.appendChild(resizer); | 738 this.element.appendChild(resizer); |
732 this.resizers[i] = resizer; | 739 this.resizers[i] = resizer; |
733 } | 740 } |
734 | 741 |
735 // Get the width of the cell in the first (and only) row of the | |
736 // header table in order to determine the width of the column, since | |
737 // it is not possible to query a column for its width. | |
738 left += this.headerTableBody.rows[0].cells[i].offsetWidth; | |
739 | 742 |
740 if (!this._columnsArray[i].hidden) { | 743 if (!this._columnsArray[i].hidden) { |
741 resizer.style.removeProperty("display"); | 744 resizer.style.removeProperty("display"); |
742 if (resizer._position !== left) { | 745 if (resizer._position !== left[i]) { |
743 resizer._position = left; | 746 resizer._position = left[i]; |
744 resizer.style.left = left + "px"; | 747 resizer.style.left = left[i] + "px"; |
745 } | 748 } |
746 resizer.leftNeighboringColumnIndex = i; | 749 resizer.leftNeighboringColumnIndex = i; |
747 if (previousResizer) | 750 if (previousResizer) |
748 previousResizer.rightNeighboringColumnIndex = i; | 751 previousResizer.rightNeighboringColumnIndex = i; |
749 previousResizer = resizer; | 752 previousResizer = resizer; |
750 } else { | 753 } else { |
751 if (previousResizer && previousResizer._position !== left) { | 754 if (previousResizer && previousResizer._position !== left[i]) { |
752 previousResizer._position = left; | 755 previousResizer._position = left[i]; |
753 previousResizer.style.left = left + "px"; | 756 previousResizer.style.left = left[i] + "px"; |
754 } | 757 } |
755 resizer.style.setProperty("display", "none"); | 758 if (resizer.style.getPropertyValue("display") !== "none") |
| 759 resizer.style.setProperty("display", "none"); |
756 resizer.leftNeighboringColumnIndex = 0; | 760 resizer.leftNeighboringColumnIndex = 0; |
757 resizer.rightNeighboringColumnIndex = 0; | 761 resizer.rightNeighboringColumnIndex = 0; |
758 } | 762 } |
759 } | 763 } |
760 if (previousResizer) | 764 if (previousResizer) |
761 previousResizer.rightNeighboringColumnIndex = numColumns - 1; | 765 previousResizer.rightNeighboringColumnIndex = numColumns - 1; |
762 }, | 766 }, |
763 | 767 |
764 addCreationNode: function(hasChildren) | 768 addCreationNode: function(hasChildren) |
765 { | 769 { |
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1810 | 1814 |
1811 WebInspector.CreationDataGridNode.prototype = { | 1815 WebInspector.CreationDataGridNode.prototype = { |
1812 makeNormal: function() | 1816 makeNormal: function() |
1813 { | 1817 { |
1814 delete this.isCreationNode; | 1818 delete this.isCreationNode; |
1815 delete this.makeNormal; | 1819 delete this.makeNormal; |
1816 }, | 1820 }, |
1817 | 1821 |
1818 __proto__: WebInspector.DataGridNode.prototype | 1822 __proto__: WebInspector.DataGridNode.prototype |
1819 } | 1823 } |
OLD | NEW |