Commit b76334fe authored by huangs's avatar huangs Committed by Commit bot

[Icons NTP] Make Fast Local NTP render largeIconUrl instead of thumbnail, if available.

This is the fast local NTP counterpart to https://crrev.com/1013173003.

BUG=467712

Review URL: https://codereview.chromium.org/1029583003

Cr-Commit-Position: refs/heads/master@{#321861}
parent 86ffe2c8
...@@ -151,13 +151,24 @@ html[dir=rtl] .mv-title[style*='direction: rtl'] { ...@@ -151,13 +151,24 @@ html[dir=rtl] .mv-title[style*='direction: rtl'] {
width: 148px; width: 148px;
} }
.mv-thumb img { .mv-thumb img.thumbnail {
height: auto; height: auto;
min-height: 100%; min-height: 100%;
width: 100%; width: 100%;
} }
.mv-thumb.failed-img { .mv-thumb img.large-icon {
height: 48px;
left: 50%;
margin-left: -24px;
margin-top: -24px;
position: absolute;
top: 50%;
width: 48px;
}
.mv-thumb.failed-img,
.mv-thumb.large-icon-outer {
background-color: #fff; background-color: #fff;
height: 94px; height: 94px;
width: 148px; width: 148px;
......
...@@ -279,12 +279,23 @@ var renderTile = function(data) { ...@@ -279,12 +279,23 @@ var renderTile = function(data) {
title.style.direction = data.direction || 'ltr'; title.style.direction = data.direction || 'ltr';
var thumb = tile.querySelector('.mv-thumb'); var thumb = tile.querySelector('.mv-thumb');
if (data.thumbnailUrl) { if (data.largeIconUrl || data.thumbnailUrl) {
var img = document.createElement('img'); var img = document.createElement('img');
img.title = data.title; img.title = data.title;
img.src = data.thumbnailUrl; if (data.largeIconUrl) {
img.src = data.largeIconUrl;
img.classList.add('large-icon');
} else {
img.src = data.thumbnailUrl;
img.classList.add('thumbnail');
}
loadedCounter += 1; loadedCounter += 1;
img.addEventListener('load', countLoad); img.addEventListener('load', countLoad);
if (data.largeIconUrl) {
img.addEventListener('load', function(ev) {
thumb.classList.add('large-icon-outer');
});
}
img.addEventListener('error', countLoad); img.addEventListener('error', countLoad);
img.addEventListener('error', function(ev) { img.addEventListener('error', function(ev) {
thumb.classList.add('failed-img'); thumb.classList.add('failed-img');
......
...@@ -46,9 +46,7 @@ img.large-icon { ...@@ -46,9 +46,7 @@ img.large-icon {
left: 50%; left: 50%;
margin-left: -24px; margin-left: -24px;
margin-top: -24px; margin-top: -24px;
min-height: initial;
position: absolute; position: absolute;
top: 50%; top: 50%;
vertical-align: middle;
width: 48px; width: 48px;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment