Index: chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_images_grid.js |
diff --git a/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_images_grid.js b/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_images_grid.js |
index 35a0d99103cf1f581303f646577c46265264ef19..e71a44a600eac9b8580942d299e532c9c9e55d6b 100644 |
--- a/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_images_grid.js |
+++ b/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_images_grid.js |
@@ -247,6 +247,22 @@ cr.define('wallpapers', function() { |
}, |
/** |
+ * Inserts newElement at the position specified by index. |
+ * @param {number} index The index of the newElement to insert. |
+ * @type {!Object} Wallpaper information inserted into the data model. |
flackr
2013/04/15 15:02:02
@param {!Object} newElement
Although I'd prefer th
bshe
2013/04/15 15:22:10
Done.
|
+ */ |
+ insertElement: function(index, newElement) { |
+ // splice may dispatch a change event because the position of selected |
+ // element changing. But the actual selected element didn't change after |
+ // splice. Sets inProgramSelection to true to disable the event handler of |
+ // change event. Otherwise, wallpaper may reset to previous one as |
flackr
2013/04/15 15:02:02
Can we not we prevent handling a change event whic
bshe
2013/04/15 15:22:10
Sorry, just to confirm. Do you mean we check if th
flackr
2013/04/15 20:00:54
Yes.
On 2013/04/15 15:22:10, bshe wrote:
bshe
2013/04/15 23:38:22
Done.
|
+ // described in http://crbug.com/229036. |
+ this.inProgramSelection_ = true; |
+ this.dataModel.splice(index, 0, newElement); |
+ this.inProgramSelection_ = false; |
+ }, |
+ |
+ /** |
* Forces re-display, size re-calculation and focuses grid. |
*/ |
updateAndFocus: function() { |