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

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

Issue 128013002: Fix apps page footer shrinking/overlap for small window sizes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: delay layoutFooter Created 6 years, 11 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
« no previous file with comments | « chrome/browser/resources/ntp4/new_tab.css ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 New tab page 6 * @fileoverview New tab page
7 * This is the main code for the new tab page used by touch-enabled Chrome 7 * This is the main code for the new tab page used by touch-enabled Chrome
8 * browsers. For now this is still a prototype. 8 * browsers. For now this is still a prototype.
9 */ 9 */
10 10
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 // max-width is used because if we run out of space, the nav dots will be 366 // max-width is used because if we run out of space, the nav dots will be
367 // shrunk. 367 // shrunk.
368 styleElement.textContent = '.dot { max-width: ' + pxWidth + 'px; }'; 368 styleElement.textContent = '.dot { max-width: ' + pxWidth + 'px; }';
369 document.querySelector('head').appendChild(styleElement); 369 document.querySelector('head').appendChild(styleElement);
370 } 370 }
371 371
372 /** 372 /**
373 * Layout the footer so that the nav dots stay centered. 373 * Layout the footer so that the nav dots stay centered.
374 */ 374 */
375 function layoutFooter() { 375 function layoutFooter() {
376 // We need the image to be loaded.
377 var logo = $('logo-img');
378 var logoImg = logo.querySelector('img');
379 if (!logoImg.complete) {
380 logoImg.onload = layoutFooter;
381 return;
382 }
383
376 var menu = $('footer-menu-container'); 384 var menu = $('footer-menu-container');
377 var logo = $('logo-img'); 385 if (menu.clientWidth > logoImg.width)
378 if (menu.clientWidth > logo.clientWidth)
379 logo.style.WebkitFlex = '0 1 ' + menu.clientWidth + 'px'; 386 logo.style.WebkitFlex = '0 1 ' + menu.clientWidth + 'px';
380 else 387 else
381 menu.style.WebkitFlex = '0 1 ' + logo.clientWidth + 'px'; 388 menu.style.WebkitFlex = '0 1 ' + logoImg.width + 'px';
382 } 389 }
383 390
384 function themeChanged(opt_hasAttribution) { 391 function themeChanged(opt_hasAttribution) {
385 $('themecss').href = 'chrome://theme/css/new_tab_theme.css?' + Date.now(); 392 $('themecss').href = 'chrome://theme/css/new_tab_theme.css?' + Date.now();
386 393
387 if (typeof opt_hasAttribution != 'undefined') { 394 if (typeof opt_hasAttribution != 'undefined') {
388 document.documentElement.setAttribute('hasattribution', 395 document.documentElement.setAttribute('hasattribution',
389 opt_hasAttribution); 396 opt_hasAttribution);
390 } 397 }
391 398
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 setFaviconDominantColor: setFaviconDominantColor, 712 setFaviconDominantColor: setFaviconDominantColor,
706 showNotification: showNotification, 713 showNotification: showNotification,
707 themeChanged: themeChanged, 714 themeChanged: themeChanged,
708 updateLogin: updateLogin 715 updateLogin: updateLogin
709 }; 716 };
710 }); 717 });
711 718
712 document.addEventListener('DOMContentLoaded', ntp.onLoad); 719 document.addEventListener('DOMContentLoaded', ntp.onLoad);
713 720
714 var toCssPx = cr.ui.toCssPx; 721 var toCssPx = cr.ui.toCssPx;
OLDNEW
« no previous file with comments | « chrome/browser/resources/ntp4/new_tab.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698