OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview This implements a table header. | 6 * @fileoverview This implements a table header. |
7 */ | 7 */ |
8 | 8 |
9 cr.define('cr.ui.table', function() { | 9 cr.define('cr.ui.table', function() { |
10 /** @const */ var TableSplitter = cr.ui.TableSplitter; | 10 /** @const */ var TableSplitter = cr.ui.TableSplitter; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 splitter.hidden = !cm.isVisible(i); | 127 splitter.hidden = !cm.isVisible(i); |
128 | 128 |
129 this.headerInner_.appendChild(splitter); | 129 this.headerInner_.appendChild(splitter); |
130 splitters.push(splitter); | 130 splitters.push(splitter); |
131 } | 131 } |
132 this.placeSplitters_(splitters); | 132 this.placeSplitters_(splitters); |
133 }, | 133 }, |
134 | 134 |
135 /** | 135 /** |
136 * Place splitters to right positions. | 136 * Place splitters to right positions. |
137 * @param {Array.<HTMLElement>|NodeList} splitters Array of splitters. | 137 * @param {Array<HTMLElement>|NodeList} splitters Array of splitters. |
138 */ | 138 */ |
139 placeSplitters_: function(splitters) { | 139 placeSplitters_: function(splitters) { |
140 var cm = this.table_.columnModel; | 140 var cm = this.table_.columnModel; |
141 var place = 0; | 141 var place = 0; |
142 for (var i = 0; i < cm.size; i++) { | 142 for (var i = 0; i < cm.size; i++) { |
143 // Don't account for the widths of hidden columns. | 143 // Don't account for the widths of hidden columns. |
144 if (splitters[i].hidden) | 144 if (splitters[i].hidden) |
145 continue; | 145 continue; |
146 place += cm.getWidth(i); | 146 place += cm.getWidth(i); |
147 splitters[i].style.webkitMarginStart = place + 'px'; | 147 splitters[i].style.webkitMarginStart = place + 'px'; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 /** | 258 /** |
259 * Rectangular area around the splitters sensitive to touch events | 259 * Rectangular area around the splitters sensitive to touch events |
260 * (in pixels). | 260 * (in pixels). |
261 */ | 261 */ |
262 TableHeader.TOUCH_DRAG_AREA_WIDTH = 30; | 262 TableHeader.TOUCH_DRAG_AREA_WIDTH = 30; |
263 | 263 |
264 return { | 264 return { |
265 TableHeader: TableHeader | 265 TableHeader: TableHeader |
266 }; | 266 }; |
267 }); | 267 }); |
OLD | NEW |