Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: chrome/browser/resources/ntp4/tile_page.js

Issue 7833021: [ntp4] Add a 'Manage Bookmarks' link at the top of the Bookmarks page. Also right-align links. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 /** 442 /**
443 * Returns the width of the scrollbar, in pixels, if it is active, or 0 443 * Returns the width of the scrollbar, in pixels, if it is active, or 0
444 * otherwise. 444 * otherwise.
445 * @type {number} 445 * @type {number}
446 */ 446 */
447 get scrollbarWidth() { 447 get scrollbarWidth() {
448 return this.scrollbar_.hidden ? 0 : 13; 448 return this.scrollbar_.hidden ? 0 : 13;
449 }, 449 },
450 450
451 /** 451 /**
452 * Returns any extra padding to insert to the bottom of a tile page. By
453 * default there is none, but subclasses can override.
454 * @type {number}
455 */
456 get extraBottomPadding() {
457 return 0;
458 },
459
460 /**
452 * Cleans up resources that are no longer needed after this TilePage 461 * Cleans up resources that are no longer needed after this TilePage
453 * instance is removed from the DOM. 462 * instance is removed from the DOM.
454 */ 463 */
455 tearDown: function() { 464 tearDown: function() {
456 this.eventTracker.removeAll(); 465 this.eventTracker.removeAll();
457 }, 466 },
458 467
459 /** 468 /**
460 * Appends a tile to the end of the tile grid. 469 * Appends a tile to the end of the tile grid.
461 * @param {HTMLElement} tileElement The contents of the tile. 470 * @param {HTMLElement} tileElement The contents of the tile.
(...skipping 17 matching lines...) Expand all
479 if (animate) 488 if (animate)
480 tileElement.classList.add('new-tile-contents'); 489 tileElement.classList.add('new-tile-contents');
481 var wrapperDiv = new Tile(tileElement); 490 var wrapperDiv = new Tile(tileElement);
482 if (index == this.tileElements_.length) { 491 if (index == this.tileElements_.length) {
483 this.tileGrid_.appendChild(wrapperDiv); 492 this.tileGrid_.appendChild(wrapperDiv);
484 } else { 493 } else {
485 this.tileGrid_.insertBefore(wrapperDiv, 494 this.tileGrid_.insertBefore(wrapperDiv,
486 this.tileElements_[index]); 495 this.tileElements_[index]);
487 } 496 }
488 this.calculateLayoutValues_(); 497 this.calculateLayoutValues_();
498 this.heightChanged_();
489 499
490 this.positionTile_(index); 500 this.positionTile_(index);
491 }, 501 },
492 502
493 /** 503 /**
494 * Removes the given tile and animates the respositioning of the other 504 * Removes the given tile and animates the respositioning of the other
495 * tiles. 505 * tiles.
496 * @param {HTMLElement} tile The tile to remove from |tileGrid_|. 506 * @param {HTMLElement} tile The tile to remove from |tileGrid_|.
497 * @param {?boolean} animate If true, tiles will animate. 507 * @param {?boolean} animate If true, tiles will animate.
498 */ 508 */
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 * Called when the height of |this| has changed: update the size of 758 * Called when the height of |this| has changed: update the size of
749 * tileGrid. 759 * tileGrid.
750 * @private 760 * @private
751 */ 761 */
752 heightChanged_: function() { 762 heightChanged_: function() {
753 // The tile grid will expand to the bottom footer, or enough to hold all 763 // The tile grid will expand to the bottom footer, or enough to hold all
754 // the tiles, whichever is greater. It would be nicer if tilePage were 764 // the tiles, whichever is greater. It would be nicer if tilePage were
755 // a flex box, and the tile grid could be box-flex: 1, but this exposes a 765 // a flex box, and the tile grid could be box-flex: 1, but this exposes a
756 // bug where repositioning tiles will cause the scroll position to reset. 766 // bug where repositioning tiles will cause the scroll position to reset.
757 this.tileGrid_.style.minHeight = (this.clientHeight - 767 this.tileGrid_.style.minHeight = (this.clientHeight -
758 this.tileGrid_.offsetTop) + 'px'; 768 this.tileGrid_.offsetTop - this.content_.offsetTop -
769 this.extraBottomPadding) + 'px';
759 }, 770 },
760 771
761 /** 772 /**
762 * Scrolls the page in response to a mousewheel event. 773 * Scrolls the page in response to a mousewheel event.
763 * @param {Event} e The mousewheel event. 774 * @param {Event} e The mousewheel event.
764 */ 775 */
765 handleMouseWheel: function(e) { 776 handleMouseWheel: function(e) {
766 this.content_.scrollTop -= e.wheelDeltaY / 3; 777 this.content_.scrollTop -= e.wheelDeltaY / 3;
767 }, 778 },
768 779
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 setDropEffect: function(dataTransfer) { 1052 setDropEffect: function(dataTransfer) {
1042 assert(false); 1053 assert(false);
1043 }, 1054 },
1044 }; 1055 };
1045 1056
1046 return { 1057 return {
1047 getCurrentlyDraggingTile: getCurrentlyDraggingTile, 1058 getCurrentlyDraggingTile: getCurrentlyDraggingTile,
1048 TilePage: TilePage, 1059 TilePage: TilePage,
1049 }; 1060 };
1050 }); 1061 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/ntp4/new_tab.html ('k') | chrome/browser/ui/webui/ntp/ntp_resource_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698