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

Unified Diff: Source/web/resources/calendarPicker.js

Issue 195443002: CalendarPicker display in correct format for minimum Value (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: CalendarPicker update scroll values in attachTo Created 6 years, 9 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
« no previous file with comments | « LayoutTests/platform/win/fast/forms/calendar-picker/calendar-picker-appearance-minimum-date-expected.png ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « LayoutTests/platform/win/fast/forms/calendar-picker/calendar-picker-appearance-minimum-date-expected.png ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698