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

Unified Diff: chrome/browser/resources/shared/js/cr/ui/card_slider.js

Issue 9358031: Added new adaptive "Suggest" tab on the New Tab Page, behing the flag, for the experiments. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed bug in card_slider.js which prevented correct card be selected in dome cases Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/shared/js/cr/ui/card_slider.js
diff --git a/chrome/browser/resources/shared/js/cr/ui/card_slider.js b/chrome/browser/resources/shared/js/cr/ui/card_slider.js
index f7da9aa002afd9229f44fa44e1da20302f8da5dc..c819549772b7cd1d551d76775d76b4215169523c 100644
--- a/chrome/browser/resources/shared/js/cr/ui/card_slider.js
+++ b/chrome/browser/resources/shared/js/cr/ui/card_slider.js
@@ -344,7 +344,7 @@ cr.define('cr.ui', function() {
if (this.currentCard_ == -1)
this.currentCard_ = 0;
else if (index <= this.currentCard_)
- this.selectCard(this.currentCard_ + 1, false, true);
+ this.selectCard(this.currentCard_ + 1, false, true, true);
this.fireAddedEvent_(card, index);
},
@@ -436,14 +436,20 @@ cr.define('cr.ui', function() {
* current position to new position.
* @param {boolean=} opt_dontNotify If true, don't tell subscribers that
* we've changed cards.
+ * @param {boolean=} opt_forceChange If true, ignore if the card already
+ * selected.
Dan Beam 2012/02/28 20:14:24 Why is this necessary? In theory if you're insert
GeorgeY 2012/02/28 21:17:42 I just fixed a *bug* that was here: if you inserte
Dan Beam 2012/02/28 22:30:12 I don't see a bug fix, I see an override.
GeorgeY 2012/02/29 00:15:45 Bug: insert a card *prior* to the selected card. C
*/
- selectCard: function(newCardIndex, opt_animate, opt_dontNotify) {
+ selectCard: function(newCardIndex, opt_animate, opt_dontNotify,
+ opt_forceChange) {
this.assertValidIndex_(newCardIndex);
var previousCard = this.currentCardValue;
var isChangingCard =
!this.cards_[newCardIndex].classList.contains('selected-card');
+ if (opt_forceChange != 'undefined' && opt_forceChange)
Dan Beam 2012/02/28 20:14:24 typeof opt_forceChange
GeorgeY 2012/02/28 21:17:42 Done.
+ isChangingCard = true;
+
if (isChangingCard) {
if (previousCard)
previousCard.classList.remove('selected-card');

Powered by Google App Engine
This is Rietveld 408576698