| Index: chrome/browser/resources/ntp4/md_incognito_tab.js
|
| diff --git a/chrome/browser/resources/ntp4/md_incognito_tab.js b/chrome/browser/resources/ntp4/md_incognito_tab.js
|
| index a48c9a0d3ba991e267c72305f3272989c1ade41a..4a36703026a43362714c02f437053043b1ef655a 100644
|
| --- a/chrome/browser/resources/ntp4/md_incognito_tab.js
|
| +++ b/chrome/browser/resources/ntp4/md_incognito_tab.js
|
| @@ -2,25 +2,9 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -// Handle the bookmark bar and theme change requests from the C++ side.
|
| -var ntp = {
|
| - /** @param {string} attached */
|
| - setBookmarkBarAttached: function(attached) {
|
| - document.documentElement.setAttribute('bookmarkbarattached', attached);
|
| - },
|
| -
|
| - /** @param {!{hasCustomBackground: boolean}} themeData */
|
| - themeChanged: function(themeData) {
|
| - document.documentElement.setAttribute('hascustombackground',
|
| - themeData.hasCustomBackground);
|
| - $('incognitothemecss').href =
|
| - 'chrome://theme/css/incognito_new_tab_theme.css?' + Date.now();
|
| - },
|
| -};
|
| -
|
| // Let the width of two lists of bulletpoints in a horizontal alignment
|
| // determine the maximum content width.
|
| -window.addEventListener('load', function() {
|
| +function recomputeLayoutWidth() {
|
| var bulletpoints = document.querySelectorAll('.bulletpoints');
|
| var content = document.querySelector('.content');
|
|
|
| @@ -39,11 +23,34 @@ window.addEventListener('load', function() {
|
| // Limit the maximum width to 600px. That might force the two lists
|
| // of bulletpoints under each other, in which case we must swap the left
|
| // and right margin.
|
| - if (maxWidth > 600) {
|
| - maxWidth = 600;
|
| -
|
| - bulletpoints[1].classList.add('tooWide');
|
| - }
|
| + var MAX_ALLOWED_WIDTH = 600;
|
| + var tooWide = maxWidth > MAX_ALLOWED_WIDTH;
|
| + bulletpoints[1].classList.toggle('too-wide', tooWide);
|
| + if (tooWide)
|
| + maxWidth = MAX_ALLOWED_WIDTH;
|
|
|
| content.style.maxWidth = maxWidth + "px";
|
| -});
|
| +}
|
| +
|
| +window.addEventListener('load', recomputeLayoutWidth);
|
| +
|
| +// Handle the bookmark bar, theme, and font size change requests
|
| +// from the C++ side.
|
| +var ntp = {
|
| + /** @param {string} attached */
|
| + setBookmarkBarAttached: function(attached) {
|
| + document.documentElement.setAttribute('bookmarkbarattached', attached);
|
| + },
|
| +
|
| + /** @param {!{hasCustomBackground: boolean}} themeData */
|
| + themeChanged: function(themeData) {
|
| + document.documentElement.setAttribute('hascustombackground',
|
| + themeData.hasCustomBackground);
|
| + $('incognitothemecss').href =
|
| + 'chrome://theme/css/incognito_new_tab_theme.css?' + Date.now();
|
| + },
|
| +
|
| + defaultFontSizeChanged: function() {
|
| + setTimeout(recomputeLayoutWidth, 100);
|
| + }
|
| +};
|
|
|