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

Side by Side Diff: chrome/browser/resources/ntp/most_visited.js

Issue 3363001: Different approach to NTP layout (Closed)
Patch Set: cleanup Created 10 years, 3 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // Dependencies that we should remove/formalize: 5 // Dependencies that we should remove/formalize:
6 // ../shared/js/class_list.js 6 // ../shared/js/class_list.js
7 // util.js 7 // util.js
8 // 8 //
9 // afterTransition 9 // afterTransition
10 // chrome.send 10 // chrome.send
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 var cols = 4; 248 var cols = 4;
249 var rows = 2; 249 var rows = 2;
250 var marginWidth = 10; 250 var marginWidth = 10;
251 var marginHeight = 7; 251 var marginHeight = 7;
252 var borderWidth = 4; 252 var borderWidth = 4;
253 var thumbWidth = small ? 150 : 207; 253 var thumbWidth = small ? 150 : 207;
254 var thumbHeight = small ? 93 : 129; 254 var thumbHeight = small ? 93 : 129;
255 var w = thumbWidth + 2 * borderWidth + 2 * marginWidth; 255 var w = thumbWidth + 2 * borderWidth + 2 * marginWidth;
256 var h = thumbHeight + 40 + 2 * marginHeight; 256 var h = thumbHeight + 40 + 2 * marginHeight;
257 var sumWidth = cols * w - 2 * marginWidth; 257 var sumWidth = cols * w - 2 * marginWidth;
258 var topSpacing = 10;
258 259
259 var rtl = isRtl(); 260 var rtl = isRtl();
260 var rects = []; 261 var rects = [];
261 262
262 if (this.visible) { 263 if (this.visible) {
263 for (var i = 0; i < rows * cols; i++) { 264 for (var i = 0; i < rows * cols; i++) {
264 var row = Math.floor(i / cols); 265 var row = Math.floor(i / cols);
265 var col = i % cols; 266 var col = i % cols;
266 var left = rtl ? sumWidth - col * w - thumbWidth - 2 * borderWidth : 267 var left = rtl ? sumWidth - col * w - thumbWidth - 2 * borderWidth :
267 col * w; 268 col * w;
268 269
269 var top = row * h; 270 var top = row * h + topSpacing;
270 271
271 rects[i] = {left: left, top: top}; 272 rects[i] = {left: left, top: top};
272 } 273 }
273 } 274 }
274 return rects; 275 return rects;
275 }, 276 },
276 277
277 applyMostVisitedRects_: function() { 278 applyMostVisitedRects_: function() {
278 if (this.visible) { 279 if (this.visible) {
279 var rects = this.getMostVisitedLayoutRects_(); 280 var rects = this.getMostVisitedLayoutRects_();
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 handleKeyDown_: function(e) { 606 handleKeyDown_: function(e) {
606 if (!IS_MAC && e.keyCode == 46 || // Del 607 if (!IS_MAC && e.keyCode == 46 || // Del
607 IS_MAC && e.metaKey && e.keyCode == 8) { // Cmd + Backspace 608 IS_MAC && e.metaKey && e.keyCode == 8) { // Cmd + Backspace
608 this.blacklist(e.target); 609 this.blacklist(e.target);
609 } 610 }
610 } 611 }
611 }; 612 };
612 613
613 return MostVisited; 614 return MostVisited;
614 })(); 615 })();
OLDNEW
« chrome/browser/resources/new_new_tab.js ('K') | « chrome/browser/resources/ntp/most_visited.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698