summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-01 05:59:47 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-01 05:59:47 +0000
commit1a13224309d6d1d94a2cd1b1d492cd2f78f20e94 (patch)
tree8408ce72902d64bfc6281224d3dbe6e750daad7a /chrome/browser/resources
parent0ff62860f0db277412f8c56b43cc65356af6d820 (diff)
downloadchromium_src-1a13224309d6d1d94a2cd1b1d492cd2f78f20e94.zip
chromium_src-1a13224309d6d1d94a2cd1b1d492cd2f78f20e94.tar.gz
chromium_src-1a13224309d6d1d94a2cd1b1d492cd2f78f20e94.tar.bz2
De-suck the NTP a bit more:
* When there are no apps, don't show the apps section. * Expand the MV section by default, like it was in M6. * Fix bug where recently closed is incorrectly toggleable. * Stop showing miniview items for MV section when there is no more room. * Don't show filler MV items in miniview. * MV section is 5px too high because we were only apply extra padding to the first section, even if that section was disabled. TEST=Visual inspection. Review URL: http://codereview.chromium.org/3292003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58139 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources')
-rw-r--r--chrome/browser/resources/new_new_tab.css7
-rw-r--r--chrome/browser/resources/new_new_tab.html3
-rw-r--r--chrome/browser/resources/new_new_tab.js9
-rw-r--r--chrome/browser/resources/ntp/apps.js6
-rw-r--r--chrome/browser/resources/ntp/most_visited.js9
5 files changed, 23 insertions, 11 deletions
diff --git a/chrome/browser/resources/new_new_tab.css b/chrome/browser/resources/new_new_tab.css
index ef82016..8987445 100644
--- a/chrome/browser/resources/new_new_tab.css
+++ b/chrome/browser/resources/new_new_tab.css
@@ -338,13 +338,6 @@ html[dir=rtl] #option-menu > [command=hide]:before {
cursor: pointer;
}
-/* The first one is special because we want a little extra space at the top of
-the layout. */
-.section:first-child > h2 {
- padding-top: 20px;
- background-size: 100% 44px, 100% 10px;
-}
-
.section > h2 > .disclosure {
margin-left: -13px;
padding-right: 4px;
diff --git a/chrome/browser/resources/new_new_tab.html b/chrome/browser/resources/new_new_tab.html
index f14d019..ae85056 100644
--- a/chrome/browser/resources/new_new_tab.html
+++ b/chrome/browser/resources/new_new_tab.html
@@ -130,7 +130,8 @@ if ('mode' in hashParams) {
</div>
<div class="sections">
- <div class="section" section="APPS" id="apps-section">
+ <!-- Start disabled. We only enable if we have at least one app. -->
+ <div class="section disabled" section="APPS" id="apps-section">
<h2><img class="disclosure" img src="ntp/ntp_disclosure_triangle.png"
><span i18n-content="apps"></span><div class="back"></div></h2>
<div class="maxiview" id="apps-section-content"></div>
diff --git a/chrome/browser/resources/new_new_tab.js b/chrome/browser/resources/new_new_tab.js
index f780837..89297c5c 100644
--- a/chrome/browser/resources/new_new_tab.js
+++ b/chrome/browser/resources/new_new_tab.js
@@ -6,6 +6,9 @@
// than this many items in the miniview.
var MAX_MINIVIEW_ITEMS = 15;
+// Extra spacing at the top of the layout.
+var LAYOUT_SPACING_TOP = 5;
+
var loading = true;
function updateSimpleSection(id, section) {
@@ -152,7 +155,7 @@ SectionLayoutInfo.getAll = function() {
function layoutSections() {
var sections = SectionLayoutInfo.getAll();
var expandedSection = null;
- var headerHeight = 0;
+ var headerHeight = LAYOUT_SPACING_TOP;
var footerHeight = 0;
// Calculate the height of the fixed elements above the expanded section. Also
@@ -204,7 +207,7 @@ function layoutSections() {
}
// Now position all the elements.
- var y = 0;
+ var y = LAYOUT_SPACING_TOP;
for (i = 0, section; section = sections[i]; i++) {
section.header.style.top = y + 'px';
y += section.header.offsetHeight;
@@ -737,7 +740,7 @@ $('main').addEventListener('click', function(e) {
}
p = p.parentNode;
- if (p.noexpand) {
+ if (p.hasAttribute('noexpand')) {
return;
}
diff --git a/chrome/browser/resources/ntp/apps.js b/chrome/browser/resources/ntp/apps.js
index 5735b61..5bf1d1a 100644
--- a/chrome/browser/resources/ntp/apps.js
+++ b/chrome/browser/resources/ntp/apps.js
@@ -10,6 +10,11 @@ function getAppsCallback(data) {
appsSectionContent.textContent = '';
appsMiniview.textContent = '';
+ if (data.apps.length == 0) {
+ appsSection.classList.add('disabled');
+ return;
+ }
+
data.apps.forEach(function(app) {
appsSectionContent.appendChild(apps.createElement(app));
});
@@ -20,6 +25,7 @@ function getAppsCallback(data) {
appsMiniview.appendChild(apps.createMiniviewElement(app));
});
+ appsSection.classList.remove('disabled');
layoutSections();
}
diff --git a/chrome/browser/resources/ntp/most_visited.js b/chrome/browser/resources/ntp/most_visited.js
index acb0200..ca01c1e 100644
--- a/chrome/browser/resources/ntp/most_visited.js
+++ b/chrome/browser/resources/ntp/most_visited.js
@@ -561,6 +561,10 @@ var MostVisited = (function() {
this.miniview.textContent = '';
var data = this.data.slice(0, MAX_MINIVIEW_ITEMS);
for (var i = 0, item; item = data[i]; i++) {
+ if (item.filler) {
+ continue;
+ }
+
var span = document.createElement('span');
var a = span.appendChild(document.createElement('a'));
a.href = item.url;
@@ -568,6 +572,11 @@ var MostVisited = (function() {
a.style.backgroundImage = url('chrome://favicon/' + item.url);
a.className = 'item';
this.miniview.appendChild(span);
+
+ if ((a.offsetLeft + a.offsetWidth) > this.miniview.offsetWidth) {
+ this.miniview.removeChild(span);
+ return;
+ }
}
},