Title: [133011] trunk
Revision
133011
Author
[email protected]
Date
2012-10-31 04:38:46 -0700 (Wed, 31 Oct 2012)

Log Message

Calendar picker can flicker when opened from the suggestion picker
https://bugs.webkit.org/show_bug.cgi?id=100816

Reviewed by Kent Tamura.

Source/WebCore:

Calendar picker was opening before the hiding completed.

No new tests. Added test to date-suggestion-picker-key-operations.html.

* Resources/pagepopups/pickerCommon.js: Added didHide event.
* Resources/pagepopups/suggestionPicker.js:
(SuggestionPicker.prototype.selectEntry): Use didHide event so we don't open the calendar picker prematurely.
(SuggestionPicker._handleWindowDidHide): When the window finished hiding, open the calendar picker.

LayoutTests:

* fast/forms/resources/picker-common.js:
(openPicker): Fix mistake.
* platform/chromium-win/platform/chromium/fast/forms/suggestion-picker/date-suggestion-picker-key-operations-expected.txt:
* platform/chromium/fast/forms/suggestion-picker/date-suggestion-picker-key-operations-expected.txt:
* platform/chromium/fast/forms/suggestion-picker/date-suggestion-picker-key-operations.html: Test that didHide event fires after the entry was selected and before the calendar picker opened.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (133010 => 133011)


--- trunk/LayoutTests/ChangeLog	2012-10-31 11:33:27 UTC (rev 133010)
+++ trunk/LayoutTests/ChangeLog	2012-10-31 11:38:46 UTC (rev 133011)
@@ -1,3 +1,16 @@
+2012-10-31  Keishi Hattori  <[email protected]>
+
+        Calendar picker can flicker when opened from the suggestion picker
+        https://bugs.webkit.org/show_bug.cgi?id=100816
+
+        Reviewed by Kent Tamura.
+
+        * fast/forms/resources/picker-common.js:
+        (openPicker): Fix mistake.
+        * platform/chromium-win/platform/chromium/fast/forms/suggestion-picker/date-suggestion-picker-key-operations-expected.txt:
+        * platform/chromium/fast/forms/suggestion-picker/date-suggestion-picker-key-operations-expected.txt:
+        * platform/chromium/fast/forms/suggestion-picker/date-suggestion-picker-key-operations.html: Test that didHide event fires after the entry was selected and before the calendar picker opened.
+
 2012-10-31  Raphael Kubo da Costa  <[email protected]>
 
         [EFL] Unreviewed, unskip fast/forms/select-multiple-elements-with-mouse-drag.html.

Modified: trunk/LayoutTests/fast/forms/resources/picker-common.js (133010 => 133011)


--- trunk/LayoutTests/fast/forms/resources/picker-common.js	2012-10-31 11:33:27 UTC (rev 133010)
+++ trunk/LayoutTests/fast/forms/resources/picker-common.js	2012-10-31 11:38:46 UTC (rev 133011)
@@ -16,7 +16,7 @@
     popupWindow = document.getElementById('mock-page-popup').contentWindow;
     if (typeof callback === "function") {
         popupOpenCallback = callback;
-        popupWindow.addEventListener("resize", popupOpenCallbackWrapper, false);
+        popupWindow.addEventListener("didOpenPicker", popupOpenCallbackWrapper, false);
     }
 }
 

Modified: trunk/LayoutTests/platform/chromium/fast/forms/suggestion-picker/date-suggestion-picker-key-operations-expected.txt (133010 => 133011)


--- trunk/LayoutTests/platform/chromium/fast/forms/suggestion-picker/date-suggestion-picker-key-operations-expected.txt	2012-10-31 11:33:27 UTC (rev 133010)
+++ trunk/LayoutTests/platform/chromium/fast/forms/suggestion-picker/date-suggestion-picker-key-operations-expected.txt	2012-10-31 11:38:46 UTC (rev 133011)
@@ -30,6 +30,8 @@
 Reopen popup.
 PASS highlightedEntry() is "@openCalendarPicker"
 Open calendar picker.
+PASS expectingDidHideEvent is true
+PASS expectingDidHideEvent is false
 Confirm calendar picker did open.
 PASS popupWindow.document.getElementById("main").classList.contains("calendar-picker") is true
 Check that escape key closes the popup.

Modified: trunk/LayoutTests/platform/chromium/fast/forms/suggestion-picker/date-suggestion-picker-key-operations.html (133010 => 133011)


--- trunk/LayoutTests/platform/chromium/fast/forms/suggestion-picker/date-suggestion-picker-key-operations.html	2012-10-31 11:33:27 UTC (rev 133010)
+++ trunk/LayoutTests/platform/chromium/fast/forms/suggestion-picker/date-suggestion-picker-key-operations.html	2012-10-31 11:38:46 UTC (rev 133011)
@@ -89,13 +89,13 @@
 
 openPicker(document.getElementById('date'), test1);
 
+var expectingDidHideEvent = false;
+
 function test1() {
     debug('Check that page popup exists.');
     shouldBe('popupWindow.pagePopupController.toString()', '"[object PagePopupController]"');
     popupWindow.focus();
 
-    popupWindow.removeEventListener("resize", test1, false);
-
     debug('Check that up/down arrow keys work.');
     shouldBeNull('highlightedEntry()');
     eventSender.keyDown('downArrow');
@@ -135,14 +135,10 @@
     shouldBe('document.getElementById("date").value', '"2012-03-08"');
 
     debug('Reopen popup.');
-    openPicker(document.getElementById('date'));
-    popupWindow.addEventListener("resize", test2, false);
+    openPicker(document.getElementById('date'), test2);
 }
 
 function test2() {
-    popupWindow.removeEventListener("resize", test2, false);
-    popupWindow.addEventListener("resize", test3, false);
-
     popupWindow.focus();
 
     eventSender.keyDown('pageDown');
@@ -151,12 +147,24 @@
     shouldBe('highlightedEntry()', '"@openCalendarPicker"');
 
     debug('Open calendar picker.');
+    expectingDidHideEvent = true;
+    popupWindow.addEventListener("didHide", testDidHide, false);
+    popupWindow.addEventListener("didOpenPicker", test3, false);
     eventSender.keyDown('\n');
 }
 
+function testDidHide() {
+    popupWindow.removeEventListener("didHide", testDidHide);
+
+    shouldBeTrue('expectingDidHideEvent');
+    expectingDidHideEvent = false;
+}
+
 function test3() {
-    popupWindow.removeEventListener("resize", test3, false);
+    popupWindow.removeEventListener("didOpenPicker", test3);
 
+    shouldBeFalse('expectingDidHideEvent');
+
     debug('Confirm calendar picker did open.');
     shouldBeTrue('popupWindow.document.getElementById("main").classList.contains("calendar-picker")');
 

Modified: trunk/LayoutTests/platform/chromium-win/platform/chromium/fast/forms/suggestion-picker/date-suggestion-picker-key-operations-expected.txt (133010 => 133011)


--- trunk/LayoutTests/platform/chromium-win/platform/chromium/fast/forms/suggestion-picker/date-suggestion-picker-key-operations-expected.txt	2012-10-31 11:33:27 UTC (rev 133010)
+++ trunk/LayoutTests/platform/chromium-win/platform/chromium/fast/forms/suggestion-picker/date-suggestion-picker-key-operations-expected.txt	2012-10-31 11:38:46 UTC (rev 133011)
@@ -30,6 +30,8 @@
 Reopen popup.
 PASS highlightedEntry() is "@openCalendarPicker"
 Open calendar picker.
+PASS expectingDidHideEvent is true
+PASS expectingDidHideEvent is false
 Confirm calendar picker did open.
 PASS popupWindow.document.getElementById("main").classList.contains("calendar-picker") is true
 Check that escape key closes the popup.

Modified: trunk/Source/WebCore/ChangeLog (133010 => 133011)


--- trunk/Source/WebCore/ChangeLog	2012-10-31 11:33:27 UTC (rev 133010)
+++ trunk/Source/WebCore/ChangeLog	2012-10-31 11:38:46 UTC (rev 133011)
@@ -1,3 +1,19 @@
+2012-10-31  Keishi Hattori  <[email protected]>
+
+        Calendar picker can flicker when opened from the suggestion picker
+        https://bugs.webkit.org/show_bug.cgi?id=100816
+
+        Reviewed by Kent Tamura.
+
+        Calendar picker was opening before the hiding completed.
+
+        No new tests. Added test to date-suggestion-picker-key-operations.html.
+
+        * Resources/pagepopups/pickerCommon.js: Added didHide event.
+        * Resources/pagepopups/suggestionPicker.js:
+        (SuggestionPicker.prototype.selectEntry): Use didHide event so we don't open the calendar picker prematurely.
+        (SuggestionPicker._handleWindowDidHide): When the window finished hiding, open the calendar picker.
+
 2012-10-31  Allan Sandfeld Jensen  <[email protected]>
 
         Reset binding test result after r132973

Modified: trunk/Source/WebCore/Resources/pagepopups/pickerCommon.js (133010 => 133011)


--- trunk/Source/WebCore/Resources/pagepopups/pickerCommon.js	2012-10-31 11:33:27 UTC (rev 133010)
+++ trunk/Source/WebCore/Resources/pagepopups/pickerCommon.js	2012-10-31 11:38:46 UTC (rev 133011)
@@ -169,8 +169,9 @@
 
 window.addEventListener("resize", function() {
     if (window.innerWidth === 1 && window.innerHeight === 1)
-        return;
-    window.dispatchEvent(new CustomEvent("didOpenPicker"));
+        window.dispatchEvent(new CustomEvent("didHide"));
+    else
+        window.dispatchEvent(new CustomEvent("didOpenPicker"));
 }, false);
 
 /**

Modified: trunk/Source/WebCore/Resources/pagepopups/suggestionPicker.js (133010 => 133011)


--- trunk/Source/WebCore/Resources/pagepopups/suggestionPicker.js	2012-10-31 11:33:27 UTC (rev 133010)
+++ trunk/Source/WebCore/Resources/pagepopups/suggestionPicker.js	2012-10-31 11:38:46 UTC (rev 133011)
@@ -190,11 +190,16 @@
     if (typeof entry.dataset.value !== "undefined") {
         this.submitValue(entry.dataset.value);
     } else if (entry.dataset.action ="" SuggestionPicker.ActionNames.OpenCalendarPicker) {
+        window.addEventListener("didHide", SuggestionPicker._handleWindowDidHide, false);
         hideWindow();
-        setTimeout(openCalendarPicker, 0);
     }
 };
 
+SuggestionPicker._handleWindowDidHide = function() {
+    openCalendarPicker();
+    window.removeEventListener("didHide", SuggestionPicker._handleWindowDidHide);
+};
+
 /**
  * @param {!Event} event
  */
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to