| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 cr.define('ntp4', function() { | 5 cr.define('ntp4', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 // We can't pass the currently dragging tile via dataTransfer because of | 8 // We can't pass the currently dragging tile via dataTransfer because of |
| 9 // http://crbug.com/31037 | 9 // http://crbug.com/31037 |
| 10 var currentlyDraggingTile = null; | 10 var currentlyDraggingTile = null; |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 this.classList.add('animating-tile-page'); | 493 this.classList.add('animating-tile-page'); |
| 494 var index = Array.prototype.indexOf.call(this.tileElements_, tile); | 494 var index = Array.prototype.indexOf.call(this.tileElements_, tile); |
| 495 tile.parentNode.removeChild(tile); | 495 tile.parentNode.removeChild(tile); |
| 496 this.calculateLayoutValues_(); | 496 this.calculateLayoutValues_(); |
| 497 for (var i = index; i < this.tileElements_.length; i++) { | 497 for (var i = index; i < this.tileElements_.length; i++) { |
| 498 this.positionTile_(i); | 498 this.positionTile_(i); |
| 499 } | 499 } |
| 500 }, | 500 }, |
| 501 | 501 |
| 502 /** | 502 /** |
| 503 * Removes all tiles from the page. |
| 504 */ |
| 505 removeAllTiles: function() { |
| 506 this.tileGrid_.innerHTML = ''; |
| 507 }, |
| 508 |
| 509 /** |
| 503 * Makes some calculations for tile layout. These change depending on | 510 * Makes some calculations for tile layout. These change depending on |
| 504 * height, width, and the number of tiles. | 511 * height, width, and the number of tiles. |
| 505 * TODO(estade): optimize calls to this function. Do nothing if the page is | 512 * TODO(estade): optimize calls to this function. Do nothing if the page is |
| 506 * hidden, but call before being shown. | 513 * hidden, but call before being shown. |
| 507 * @private | 514 * @private |
| 508 */ | 515 */ |
| 509 calculateLayoutValues_: function() { | 516 calculateLayoutValues_: function() { |
| 510 var grid = this.gridValues_; | 517 var grid = this.gridValues_; |
| 511 var availableSpace = this.tileGrid_.clientWidth - 2 * MIN_WIDE_MARGIN; | 518 var availableSpace = this.tileGrid_.clientWidth - 2 * MIN_WIDE_MARGIN; |
| 512 var wide = availableSpace >= grid.minWideWidth; | 519 var wide = availableSpace >= grid.minWideWidth; |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 */ | 1005 */ |
| 999 tileMoved: function(draggedTile) { | 1006 tileMoved: function(draggedTile) { |
| 1000 }, | 1007 }, |
| 1001 }; | 1008 }; |
| 1002 | 1009 |
| 1003 return { | 1010 return { |
| 1004 getCurrentlyDraggingTile: getCurrentlyDraggingTile, | 1011 getCurrentlyDraggingTile: getCurrentlyDraggingTile, |
| 1005 TilePage: TilePage, | 1012 TilePage: TilePage, |
| 1006 }; | 1013 }; |
| 1007 }); | 1014 }); |
| OLD | NEW |