Chromium Code Reviews| Index: chrome/browser/resources/ntp4/bookmarks_page.js |
| =================================================================== |
| --- chrome/browser/resources/ntp4/bookmarks_page.js (revision 102206) |
| +++ chrome/browser/resources/ntp4/bookmarks_page.js (working copy) |
| @@ -384,10 +384,19 @@ |
| if (this.currentlyInFolder_(bookmark.parentId)) { |
| // Hide the import promo if it exists. |
| this.hideImportPromo_(); |
| - // If source of the add came from this page, show an animated insertion, |
| - // otherwise just quietly do it. |
| - this.addTileAt(new Bookmark(bookmark), bookmark.index, fromCurrentPage); |
| - this.repositionTiles_(); |
| + // Only add the item if it should be visible. |
| + if (bookmark.index < MAX_BOOKMARK_TILES) { |
| + // If source of the add came from this page, show an animated |
| + // insertion, otherwise just quietly do it. |
| + this.addTileAt(new Bookmark(bookmark), bookmark.index, |
| + fromCurrentPage); |
| + // Delete extra tiles if they exist. |
| + while (this.tiles.length > MAX_BOOKMARK_TILES) { |
| + var tile = this.tiles[this.tiles.length-1]; |
|
Evan Stade
2011/09/22 02:52:19
spaces around operators
csilv
2011/09/22 17:07:01
Done.
|
| + this.removeTile(tile, false); |
| + } |
| + this.repositionTiles_(); |
| + } |
| } |
| }, |