Title: [134034] trunk/Source/WebCore
Revision
134034
Author
kei...@webkit.org
Date
2012-11-09 01:58:08 -0800 (Fri, 09 Nov 2012)

Log Message

Month picker should select the current month when navigating while keeping selection position.
https://bugs.webkit.org/show_bug.cgi?id=101724

Reviewed by Kent Tamura.

Month picker needs to behave differently because selection won't be in the same position when changing current month.

No new tests. Test will be added in Bug 101556.

* Resources/pagepopups/calendarPicker.js:
(DaysTable.prototype.navigateToMonth): Date/Week picker should keep selection position for first selected date node.
(DaysTable.prototype._startMoveInAnimation): Moving shared code to separate function.
(MonthPickerDaysTable.prototype.navigateToMonth): Month picker should just select the month.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (134033 => 134034)


--- trunk/Source/WebCore/ChangeLog	2012-11-09 09:50:57 UTC (rev 134033)
+++ trunk/Source/WebCore/ChangeLog	2012-11-09 09:58:08 UTC (rev 134034)
@@ -1,3 +1,19 @@
+2012-11-09  Keishi Hattori  <kei...@webkit.org>
+
+        Month picker should select the current month when navigating while keeping selection position.
+        https://bugs.webkit.org/show_bug.cgi?id=101724
+
+        Reviewed by Kent Tamura.
+
+        Month picker needs to behave differently because selection won't be in the same position when changing current month.
+
+        No new tests. Test will be added in Bug 101556.
+
+        * Resources/pagepopups/calendarPicker.js:
+        (DaysTable.prototype.navigateToMonth): Date/Week picker should keep selection position for first selected date node.
+        (DaysTable.prototype._startMoveInAnimation): Moving shared code to separate function.
+        (MonthPickerDaysTable.prototype.navigateToMonth): Month picker should just select the month.
+
 2012-11-09  Alexei Filippov  <a...@chromium.org>
 
         Web Inspector: Fix heap snapshots counted several times by NMI

Modified: trunk/Source/WebCore/Resources/pagepopups/calendarPicker.js (134033 => 134034)


--- trunk/Source/WebCore/Resources/pagepopups/calendarPicker.js	2012-11-09 09:50:57 UTC (rev 134033)
+++ trunk/Source/WebCore/Resources/pagepopups/calendarPicker.js	2012-11-09 09:58:08 UTC (rev 134034)
@@ -1325,12 +1325,8 @@
  */
 DaysTable.prototype.navigateToMonth = function(month, navigationBehaviour) {
     var firstNodeInSelectedRange = this._firstNodeInSelectedRange();
-    if (navigationBehaviour & CalendarPicker.NavigationBehaviour.Animate) {
-        var daysStyle = this._daysContainer.style;
-        daysStyle.position = "relative";
-        daysStyle.webkitTransition = "left 0.1s ease";
-        daysStyle.left = (this.picker.currentMonth().valueOf() > month.valueOf() ? "" : "-") + this._daysContainer.offsetWidth + "px";
-    }
+    if (navigationBehaviour & CalendarPicker.NavigationBehaviour.Animate)
+        this._startMoveInAnimation(month);
     this._renderMonth(month);
     if (navigationBehaviour & CalendarPicker.NavigationBehaviour.KeepSelectionPosition && firstNodeInSelectedRange) {
         var x = parseInt(firstNodeInSelectedRange.dataset.positionX, 10);
@@ -1339,6 +1335,16 @@
     }
 };
 
+/**
+ * @param {!Month} month
+ */
+DaysTable.prototype._startMoveInAnimation = function(month) {
+    var daysStyle = this._daysContainer.style;
+    daysStyle.position = "relative";
+    daysStyle.webkitTransition = "left 0.1s ease";
+    daysStyle.left = (this.picker.currentMonth().valueOf() > month.valueOf() ? "" : "-") + this._daysContainer.offsetWidth + "px";
+};
+
 DaysTable.prototype._moveInDays = function() {
     var daysStyle = this._daysContainer.style;
     if (daysStyle.left == "0px")
@@ -1600,7 +1606,20 @@
 
 /**
  * @param {!Month} month
+ * @param {!CalendarPicker.NavigationBehaviour} navigationBehaviour
  */
+MonthPickerDaysTable.prototype.navigateToMonth = function(month, navigationBehaviour) {
+    var hadSelection = this._hasSelection();
+    if (navigationBehaviour & CalendarPicker.NavigationBehaviour.Animate)
+        this._startMoveInAnimation(month);
+    this._renderMonth(month);
+    if (navigationBehaviour & CalendarPicker.NavigationBehaviour.KeepSelectionPosition && hadSelection)
+        this.selectRange(month);
+};
+
+/**
+ * @param {!Month} month
+ */
 MonthPickerDaysTable.prototype._markRangeAsSelected = function(month) {
     var monthString = month.toString();
     for (var w = 0; w < DaysTable._Weeks; w++) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to