| 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 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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 this.focusElementIndex_ = wrap(this.focusElementIndex_ + direction); | 699 this.focusElementIndex_ = wrap(this.focusElementIndex_ + direction); |
| 700 break; | 700 break; |
| 701 case 'Up': | 701 case 'Up': |
| 702 case 'Down': | 702 case 'Down': |
| 703 // Look through all focusable elements. Find the first one that is | 703 // Look through all focusable elements. Find the first one that is |
| 704 // in the same column. | 704 // in the same column. |
| 705 var direction = e.keyIdentifier == 'Up' ? -1 : 1; | 705 var direction = e.keyIdentifier == 'Up' ? -1 : 1; |
| 706 var currentIndex = | 706 var currentIndex = |
| 707 Array.prototype.indexOf.call(this.focusableElements_, | 707 Array.prototype.indexOf.call(this.focusableElements_, |
| 708 this.currentFocusElement_); | 708 this.currentFocusElement_); |
| 709 var newFocusIdx = wrap(currentIndex + direction) | 709 var newFocusIdx = wrap(currentIndex + direction); |
| 710 var tile = this.currentFocusElement_.parentNode; | 710 var tile = this.currentFocusElement_.parentNode; |
| 711 for (;; newFocusIdx = wrap(newFocusIdx + direction)) { | 711 for (;; newFocusIdx = wrap(newFocusIdx + direction)) { |
| 712 var newTile = this.focusableElements_[newFocusIdx].parentNode; | 712 var newTile = this.focusableElements_[newFocusIdx].parentNode; |
| 713 var rowTiles = this.layoutValues_.numRowTiles; | 713 var rowTiles = this.layoutValues_.numRowTiles; |
| 714 if ((newTile.index - tile.index) % rowTiles == 0) | 714 if ((newTile.index - tile.index) % rowTiles == 0) |
| 715 break; | 715 break; |
| 716 } | 716 } |
| 717 | 717 |
| 718 this.focusElementIndex_ = newFocusIdx; | 718 this.focusElementIndex_ = newFocusIdx; |
| 719 break; | 719 break; |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1289 assert(false); | 1289 assert(false); |
| 1290 }, | 1290 }, |
| 1291 }; | 1291 }; |
| 1292 | 1292 |
| 1293 return { | 1293 return { |
| 1294 getCurrentlyDraggingTile: getCurrentlyDraggingTile, | 1294 getCurrentlyDraggingTile: getCurrentlyDraggingTile, |
| 1295 setCurrentDropEffect: setCurrentDropEffect, | 1295 setCurrentDropEffect: setCurrentDropEffect, |
| 1296 TilePage: TilePage, | 1296 TilePage: TilePage, |
| 1297 }; | 1297 }; |
| 1298 }); | 1298 }); |
| OLD | NEW |