Index: chrome/browser/resources/ntp4/apps_page.js |
diff --git a/chrome/browser/resources/ntp4/apps_page.js b/chrome/browser/resources/ntp4/apps_page.js |
index 50cfdd20b6ac22c4ea5117a49ffe4e48eb7d9d81..cc411da871f4ab6833c5dc690dcd04668e6e94e6 100644 |
--- a/chrome/browser/resources/ntp4/apps_page.js |
+++ b/chrome/browser/resources/ntp4/apps_page.js |
@@ -181,15 +181,25 @@ cr.define('ntp4', function() { |
var appContents = this.ownerDocument.createElement('div'); |
appContents.className = 'app-contents'; |
+ if (!this.appData_.icon_big_exists && this.appData_.icon_small_exists) |
+ this.useSmallIcon_ = true; |
+ |
var appImg = this.ownerDocument.createElement('img'); |
- appImg.src = this.appData_.icon_big; |
- // We use a mask of the same image so CSS rules can highlight just the |
- // image when it's touched. |
- appImg.style.WebkitMaskImage = url(this.appData_.icon_big); |
+ appImg.src = this.useSmallIcon_ ? this.appData_.icon_small : |
+ this.appData_.icon_big; |
// We put a click handler just on the app image - so clicking on the |
// margins between apps doesn't do anything. |
appImg.addEventListener('click', this.onClick_.bind(this)); |
- appContents.appendChild(appImg); |
+ if (this.useSmallIcon_) { |
+ var imgDiv = this.ownerDocument.createElement('div'); |
+ imgDiv.setAttribute('class', 'app-icon-div'); |
Evan Stade
2011/08/02 21:47:14
imgDiv.class =
Greg Billock
2011/08/03 19:05:50
Done. (className)
|
+ imgDiv.appendChild(appImg); |
+ imgDiv.addEventListener('click', this.onClick_.bind(this)); |
+ this.imgDiv_ = imgDiv; |
+ appContents.appendChild(imgDiv); |
+ } else { |
+ appContents.appendChild(appImg); |
+ } |
this.appImg_ = appImg; |
var appSpan = this.ownerDocument.createElement('span'); |
@@ -264,7 +274,19 @@ cr.define('ntp4', function() { |
*/ |
setBounds: function(size, x, y) { |
var imgSize = size * APP_IMG_SIZE_FRACTION; |
- this.appImg_.style.width = this.appImg_.style.height = imgSize + 'px'; |
+ if (this.useSmallIcon_) { |
+ this.imgDiv_.style.width = imgSize + 'px'; |
+ this.imgDiv_.style.height = (imgSize - 4) + 'px'; |
+ this.appImg_.style.width = this.appImg_.style.height = '32px'; |
Evan Stade
2011/08/02 21:47:14
define in css file
Greg Billock
2011/08/03 19:05:50
These should really come from the icon size we cho
|
+ var margin = (size - imgSize) / 2; |
+ this.imgDiv_.style['margin-left'] = margin + 'px'; |
Evan Stade
2011/08/02 21:47:14
marginLeft
but I feel like you should be able to
Greg Billock
2011/08/03 19:05:50
Yeah, I moved these and got it looking better with
|
+ this.imgDiv_.style['margin-right'] = margin + 'px'; |
+ this.imgDiv_.style['margin-bottom'] = '4px'; |
Evan Stade
2011/08/02 21:47:14
define in css file
Greg Billock
2011/08/03 19:05:50
Done.
|
+ } |
Evan Stade
2011/08/02 21:47:14
else on same line
Greg Billock
2011/08/03 19:05:50
Done.
|
+ else { |
+ this.appImg_.style.width = this.appImg_.style.height = imgSize + 'px'; |
+ } |
+ |
this.style.width = this.style.height = size + 'px'; |
if (this.isStore_) |
this.appsPromoExtras_.style.left = size + (imgSize - size) / 2 + 'px'; |