summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser/resources/local_ntp/most_visited_single.js
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-01-31 16:33:43 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-02-06 16:33:22 +0000
commitda51f56cc21233c2d30f0fe0d171727c3102b2e0 (patch)
tree4e579ab70ce4b19bee7984237f3ce05a96d59d83 /chromium/chrome/browser/resources/local_ntp/most_visited_single.js
parentc8c2d1901aec01e934adf561a9fdf0cc776cdef8 (diff)
BASELINE: Update Chromium to 65.0.3525.40
Also imports missing submodules Change-Id: I36901b7c6a325cda3d2c10cedb2186c25af3b79b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/chrome/browser/resources/local_ntp/most_visited_single.js')
-rw-r--r--chromium/chrome/browser/resources/local_ntp/most_visited_single.js52
1 files changed, 28 insertions, 24 deletions
diff --git a/chromium/chrome/browser/resources/local_ntp/most_visited_single.js b/chromium/chrome/browser/resources/local_ntp/most_visited_single.js
index ca988627132..c4c0bfe2da7 100644
--- a/chromium/chrome/browser/resources/local_ntp/most_visited_single.js
+++ b/chromium/chrome/browser/resources/local_ntp/most_visited_single.js
@@ -199,6 +199,8 @@ var handleCommand = function(data) {
if (cmd == 'tile') {
addTile(data);
} else if (cmd == 'show') {
+ // TODO(treib): If this happens before we have finished loading the previous
+ // tiles, we probably get into a bad state.
showTiles(data);
} else if (cmd == 'updateTheme') {
updateTheme(data);
@@ -364,12 +366,6 @@ var renderTile = function(data) {
tile.className = 'mv-tile';
tile.setAttribute('data-tid', data.tid);
- var html = [];
- html.push('<div class="mv-favicon"></div>');
- html.push('<div class="mv-title"></div><div class="mv-thumb"></div>');
- html.push('<button class="mv-x"></button>');
- tile.innerHTML = html.join('');
- tile.lastElementChild.title = queryArgs['removeTooltip'] || '';
if (isSchemeAllowed(data.url)) {
tile.href = data.url;
@@ -425,14 +421,33 @@ var renderTile = function(data) {
}
});
- var title = tile.querySelector('.mv-title');
+ var favicon = document.createElement('div');
+ favicon.className = 'mv-favicon';
+ var fi = document.createElement('img');
+ fi.src = data.faviconUrl;
+ // Set title and alt to empty so screen readers won't say the image name.
+ fi.title = '';
+ fi.alt = '';
+ loadedCounter += 1;
+ fi.addEventListener('load', countLoad);
+ fi.addEventListener('error', countLoad);
+ fi.addEventListener('error', function(ev) {
+ favicon.classList.add('failed-favicon');
+ });
+ favicon.appendChild(fi);
+ tile.appendChild(favicon);
+
+ var title = document.createElement('div');
+ title.className = 'mv-title';
title.innerText = data.title;
title.style.direction = data.direction || 'ltr';
if (NUM_TITLE_LINES > 1) {
title.classList.add('multiline');
}
+ tile.appendChild(title);
- var thumb = tile.querySelector('.mv-thumb');
+ var thumb = document.createElement('div');
+ thumb.className = 'mv-thumb';
var img = document.createElement('img');
img.title = data.title;
img.src = data.thumbnailUrl;
@@ -460,34 +475,23 @@ var renderTile = function(data) {
countLoad();
});
thumb.appendChild(img);
+ tile.appendChild(thumb);
- var favicon = tile.querySelector('.mv-favicon');
- var fi = document.createElement('img');
- fi.src = data.faviconUrl;
- // Set title and alt to empty so screen readers won't say the image name.
- fi.title = '';
- fi.alt = '';
- loadedCounter += 1;
- fi.addEventListener('load', countLoad);
- fi.addEventListener('error', countLoad);
- fi.addEventListener('error', function(ev) {
- favicon.classList.add('failed-favicon');
- });
- favicon.appendChild(fi);
-
- var mvx = tile.querySelector('.mv-x');
+ var mvx = document.createElement('button');
+ mvx.className = 'mv-x';
+ mvx.title = queryArgs['removeTooltip'] || '';
mvx.addEventListener('click', function(ev) {
removeAllOldTiles();
blacklistTile(tile);
ev.preventDefault();
ev.stopPropagation();
});
-
// Don't allow the event to bubble out to the containing tile, as that would
// trigger navigation to the tile URL.
mvx.addEventListener('keydown', function(event) {
event.stopPropagation();
});
+ tile.appendChild(mvx);
return tile;
};