Chromium Code Reviews| Index: Source/web/resources/calendarPicker.js |
| diff --git a/Source/web/resources/calendarPicker.js b/Source/web/resources/calendarPicker.js |
| index 7f28be81849dc1297b6801a4bbb3cd0ad2237c21..8b9f8930eeff652c2c46b1dc7a7f87eee223cf13 100644 |
| --- a/Source/web/resources/calendarPicker.js |
| +++ b/Source/web/resources/calendarPicker.js |
| @@ -1522,11 +1522,8 @@ ScrollView.prototype.setContentOffset = function(value) { |
| value = Math.min(this.maximumContentOffset - this._height, Math.max(this.minimumContentOffset, Math.floor(value))); |
| if (this._contentOffset === value) |
| return; |
| - var newPartitionNumber = Math.floor(value / ScrollView.PartitionHeight); |
| - var partitionChanged = this._partitionNumber !== newPartitionNumber; |
| - this._partitionNumber = newPartitionNumber; |
| + var partitionChanged = this._updateScrollContent(value); |
|
keishi
2014/03/14 10:51:07
Set this._contentOffset before calling _updateScro
Habib Virji
2014/03/14 11:18:36
Done.
|
| this._contentOffset = value; |
| - this.contentElement.style.webkitTransform = "translate(0, " + (-this.contentPositionForContentOffset(this._contentOffset)) + "px)"; |
| if (this.delegate) { |
| this.delegate.scrollViewDidChangeContentOffset(this); |
| if (partitionChanged) |
| @@ -1535,6 +1532,28 @@ ScrollView.prototype.setContentOffset = function(value) { |
| }; |
| /** |
| + * @param {!number} value |
| + * @return {!number} partitionChanged |
| + */ |
| +ScrollView.prototype._updateScrollContent = function(value) { |
| + var newPartitionNumber = Math.floor(value / ScrollView.PartitionHeight); |
| + var partitionChanged = this._partitionNumber !== newPartitionNumber; |
| + this._partitionNumber = newPartitionNumber; |
| + this.contentElement.style.webkitTransform = "translate(0, " + (-this.contentPositionForContentOffset(value)) + "px)"; |
| + return partitionChanged; |
| +}; |
| + |
| +/** |
| + * @param {!View|Node} parent |
| + * @param {?View|Node=} before |
| + * @override |
| + */ |
| +ScrollView.prototype.attachTo = function(parent, before) { |
| + View.prototype.attachTo.call(this, parent, before); |
| + this._updateScrollContent(this._contentOffset); |
| +}; |
| + |
| +/** |
| * @param {!number} offset |
| */ |
| ScrollView.prototype.contentPositionForContentOffset = function(offset) { |