Diff
Modified: trunk/LayoutTests/ChangeLog (115154 => 115155)
--- trunk/LayoutTests/ChangeLog 2012-04-25 01:11:24 UTC (rev 115154)
+++ trunk/LayoutTests/ChangeLog 2012-04-25 01:17:55 UTC (rev 115155)
@@ -1,3 +1,14 @@
+2012-04-24 Kent Tamura <[email protected]>
+
+ Calendar Picker: Open a calendar picker by keyboard operation
+ https://bugs.webkit.org/show_bug.cgi?id=84680
+
+ Reviewed by Kentaro Hara.
+
+ * fast/forms/date/date-stepup-stepdown-from-renderer-expected.txt:
+ * fast/forms/date/date-stepup-stepdown-from-renderer.html:
+ Stepping up/down by kerboard was removed. Update the test to confirm it doesn't work.
+
2012-04-24 Alpha Lam <[email protected]>
[chromium] Unreviewed test expectations update.
Modified: trunk/LayoutTests/fast/forms/date/date-stepup-stepdown-from-renderer-expected.txt (115154 => 115155)
--- trunk/LayoutTests/fast/forms/date/date-stepup-stepdown-from-renderer-expected.txt 2012-04-25 01:11:24 UTC (rev 115154)
+++ trunk/LayoutTests/fast/forms/date/date-stepup-stepdown-from-renderer-expected.txt 2012-04-25 01:17:55 UTC (rev 115155)
@@ -1,27 +1,9 @@
-Check stepping-up and -down for date input fields from renderer. No cases of empty initial values.
+Check if stepping-up and -down for date input fields from renderer does not work.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-Function arguments are (value, step, {min or max}, [stepCount]).
-Normal cases
-PASS stepUp("2010-02-10", null, null) is "2010-02-11"
-PASS stepDown("2010-02-10", null, null) is "2010-02-09"
-PASS stepUp("2010-02-10", null, null, 10) is "2010-02-20"
-PASS stepDown("2010-02-10", null, null, 11) is "2010-01-30"
-PASS stepUp("1970-01-01", "4", null, 2) is "1970-01-09"
-PASS stepDown("1970-01-01", "4", null, 3) is "1969-12-20"
-Step=any
-PASS stepUp("2010-02-10", "any", null) is "2010-02-11"
-PASS stepDown("2010-02-10", "any", null) is "2010-02-09"
-Overflow/underflow
-PASS stepUp("2010-02-10", "3.40282346e+38", null) is "275760-09-13"
-PASS stepDown("2010-02-10", "3.40282346e+38", null) is "1970-01-01"
-PASS stepUp("2010-02-10", "1", "2010-02-10") is "2010-02-10"
-PASS stepDown("2010-02-10", "1", "2010-02-10") is "2010-02-10"
-stepDown()/stepUp() for stepMismatch values
-PASS stepDown("2010-02-10", "3", "2010-02-06") is "2010-02-09"
-PASS stepUp("1970-01-02", "2", "") is "1970-01-03"
+PASS stepUp("2010-02-10") is "2010-02-10"
PASS successfullyParsed is true
Modified: trunk/LayoutTests/fast/forms/date/date-stepup-stepdown-from-renderer.html (115154 => 115155)
--- trunk/LayoutTests/fast/forms/date/date-stepup-stepdown-from-renderer.html 2012-04-25 01:11:24 UTC (rev 115154)
+++ trunk/LayoutTests/fast/forms/date/date-stepup-stepdown-from-renderer.html 2012-04-25 01:17:55 UTC (rev 115155)
@@ -7,10 +7,9 @@
<p id="description"></p>
<div id="console"></div>
<script>
-description('Check stepping-up and -down for date input fields from renderer. No cases of empty initial values.');
+description('Check if stepping-up and -down for date input fields from renderer does not work.');
var input = document.createElement('input');
-var invalidStateErr = '"Error: INVALID_STATE_ERR: DOM Exception 11"';
function sendKey(keyName) {
var event = document.createEvent('KeyboardEvent');
@@ -18,61 +17,22 @@
input.dispatchEvent(event);
}
-function setInputAttributes(min, max, step, value) {
- input.min = min;
- input.max = max;
- input.step = step;
- input.value = value;
-}
-
function stepUp(value, step, max, optionalStepCount) {
- setInputAttributes(null, max, step, value);
- if (typeof optionalStepCount != "undefined")
- if (optionalStepCount < 0)
- for (var i = 0; i < -optionalStepCount; i++)
- sendKey('Down');
- else
- for (var i = 0; i < optionalStepCount; i++)
- sendKey('Up');
- else
- sendKey('Up');
+ input.value = value;
+ sendKey('Up');
return input.value;
}
function stepDown(value, step, min, optionalStepCount) {
- setInputAttributes(min, null, step, value);
- if (typeof optionalStepCount != "undefined")
- if (optionalStepCount < 0)
- for (var i = 0; i < -optionalStepCount; i++)
- sendKey('Up');
- else
- for (var i = 0; i < optionalStepCount; i++)
- sendKey('Down');
- else
- sendKey('Down');
+ input.value = value;
+ sendKey('Down');
return input.value;
}
input.type = 'date';
-debug('Function arguments are (value, step, {min or max}, [stepCount]).');
-debug('Normal cases');
-shouldBe('stepUp("2010-02-10", null, null)', '"2010-02-11"');
-shouldBe('stepDown("2010-02-10", null, null)', '"2010-02-09"');
-shouldBe('stepUp("2010-02-10", null, null, 10)', '"2010-02-20"');
-shouldBe('stepDown("2010-02-10", null, null, 11)', '"2010-01-30"');
-shouldBe('stepUp("1970-01-01", "4", null, 2)', '"1970-01-09"');
-shouldBe('stepDown("1970-01-01", "4", null, 3)', '"1969-12-20"');
-debug('Step=any');
-shouldBe('stepUp("2010-02-10", "any", null)', '"2010-02-11"');
-shouldBe('stepDown("2010-02-10", "any", null)', '"2010-02-09"');
-debug('Overflow/underflow');
-shouldBe('stepUp("2010-02-10", "3.40282346e+38", null)','"275760-09-13"');
-shouldBe('stepDown("2010-02-10", "3.40282346e+38", null)', '"1970-01-01"');
-shouldBe('stepUp("2010-02-10", "1", "2010-02-10")', '"2010-02-10"');
-shouldBe('stepDown("2010-02-10", "1", "2010-02-10")', '"2010-02-10"');
-debug('stepDown()/stepUp() for stepMismatch values');
-shouldBe('stepDown("2010-02-10", "3", "2010-02-06")', '"2010-02-09"');
-shouldBe('stepUp("1970-01-02", "2", "")', '"1970-01-03"');
+shouldBe('stepUp("2010-02-10")', '"2010-02-10"');
+// The following check was disabled because it tries to open a calendar picker and DRT crashes.
+//shouldBe('stepDown("2010-02-10")', '"2010-02-10"');
debug('');
</script>
Modified: trunk/Source/WebCore/ChangeLog (115154 => 115155)
--- trunk/Source/WebCore/ChangeLog 2012-04-25 01:11:24 UTC (rev 115154)
+++ trunk/Source/WebCore/ChangeLog 2012-04-25 01:17:55 UTC (rev 115155)
@@ -1,3 +1,35 @@
+2012-04-24 Kent Tamura <[email protected]>
+
+ Calendar Picker: Open a calendar picker by keyboard operation
+ https://bugs.webkit.org/show_bug.cgi?id=84680
+
+ Reviewed by Kentaro Hara.
+
+ - Open a calendar picker by the down arrow key.
+ - Remove stepping down/up by keyboard and wheel operations.
+ This behavior was for text fields with spin buttons. Because the date
+ type doesn't have spin buttons, we should remove this behavior.
+
+ No new tests for opening a calendar picker. This behavior is not
+ testable by DRT yet. For removal of stepping up/down,
+ fast/forms/date/date-stepup-stepdown-from-renderer.html is updated.
+
+ * html/BaseDateAndTimeInputType.cpp:
+ (WebCore::BaseDateAndTimeInputType::handleKeydownEvent):
+ Check shouldHaveSpinButton() before spin button key operations.
+ (WebCore::BaseDateAndTimeInputType::handleWheelEvent):
+ Check shouldHaveSpinButton() before spin button wheel operations.
+ * html/BaseDateAndTimeInputType.h:
+ (BaseDateAndTimeInputType):
+ Make handleKeydownEvent() protected because a subclass overrides it.
+ * html/DateInputType.cpp:
+ (WebCore::DateInputType::handleKeydownEvent):
+ Open a calendar picker by the down arrow key.
+ * html/DateInputType.h:
+ (DateInputType): Add handleKeydownEvent() declaration.
+ * html/shadow/CalendarPickerElement.h:
+ (CalendarPickerElement): Make openPopup() public because DateInputType calls it.
+
2012-04-24 Sheriff Bot <[email protected]>
Unreviewed, rolling out r115099, r115102, and r115127.
Modified: trunk/Source/WebCore/html/BaseDateAndTimeInputType.cpp (115154 => 115155)
--- trunk/Source/WebCore/html/BaseDateAndTimeInputType.cpp 2012-04-25 01:11:24 UTC (rev 115154)
+++ trunk/Source/WebCore/html/BaseDateAndTimeInputType.cpp 2012-04-25 01:17:55 UTC (rev 115155)
@@ -132,14 +132,16 @@
void BaseDateAndTimeInputType::handleKeydownEvent(KeyboardEvent* event)
{
- handleKeydownEventForSpinButton(event);
+ if (shouldHaveSpinButton())
+ handleKeydownEventForSpinButton(event);
if (!event->defaultHandled())
TextFieldInputType::handleKeydownEvent(event);
}
void BaseDateAndTimeInputType::handleWheelEvent(WheelEvent* event)
{
- handleWheelEventForSpinButton(event);
+ if (shouldHaveSpinButton())
+ handleWheelEventForSpinButton(event);
}
double BaseDateAndTimeInputType::parseToDouble(const String& src, double defaultValue) const
Modified: trunk/Source/WebCore/html/BaseDateAndTimeInputType.h (115154 => 115155)
--- trunk/Source/WebCore/html/BaseDateAndTimeInputType.h 2012-04-25 01:11:24 UTC (rev 115154)
+++ trunk/Source/WebCore/html/BaseDateAndTimeInputType.h 2012-04-25 01:17:55 UTC (rev 115155)
@@ -41,6 +41,7 @@
class BaseDateAndTimeInputType : public TextFieldInputType {
protected:
BaseDateAndTimeInputType(HTMLInputElement* element) : TextFieldInputType(element) { }
+ virtual void handleKeydownEvent(KeyboardEvent*) OVERRIDE;
virtual double parseToDouble(const String&, double) const OVERRIDE;
virtual bool parseToDateComponents(const String&, DateComponents*) const OVERRIDE;
String serializeWithComponents(const DateComponents&) const;
@@ -62,7 +63,6 @@
virtual bool isSteppable() const OVERRIDE;
virtual bool stepMismatch(const String&, double) const OVERRIDE;
virtual double stepBase() const OVERRIDE;
- virtual void handleKeydownEvent(KeyboardEvent*) OVERRIDE;
virtual void handleWheelEvent(WheelEvent*) OVERRIDE;
virtual String serialize(double) const OVERRIDE;
virtual String serializeWithMilliseconds(double) const;
Modified: trunk/Source/WebCore/html/DateInputType.cpp (115154 => 115155)
--- trunk/Source/WebCore/html/DateInputType.cpp 2012-04-25 01:11:24 UTC (rev 115154)
+++ trunk/Source/WebCore/html/DateInputType.cpp 2012-04-25 01:17:55 UTC (rev 115155)
@@ -35,6 +35,7 @@
#include "DateComponents.h"
#include "HTMLInputElement.h"
#include "HTMLNames.h"
+#include "KeyboardEvent.h"
#include "LocalizedDate.h"
#include <wtf/PassOwnPtr.h>
@@ -129,6 +130,19 @@
return false;
}
+void DateInputType::handleKeydownEvent(KeyboardEvent* event)
+{
+ if (element()->disabled() || element()->readOnly())
+ return;
+ if (event->keyIdentifier() == "Down") {
+ if (m_pickerElement)
+ m_pickerElement->openPopup();
+ event->setDefaultHandled();
+ return;
+ }
+ BaseDateAndTimeInputType::handleKeydownEvent(event);
+}
+
void DateInputType::handleBlurEvent()
{
if (m_pickerElement)
Modified: trunk/Source/WebCore/html/DateInputType.h (115154 => 115155)
--- trunk/Source/WebCore/html/DateInputType.h 2012-04-25 01:11:24 UTC (rev 115154)
+++ trunk/Source/WebCore/html/DateInputType.h 2012-04-25 01:17:55 UTC (rev 115155)
@@ -58,6 +58,7 @@
#if ENABLE(CALENDAR_PICKER)
virtual void createShadowSubtree() OVERRIDE;
virtual void destroyShadowSubtree() OVERRIDE;
+ virtual void handleKeydownEvent(KeyboardEvent*) OVERRIDE;
virtual void handleBlurEvent() OVERRIDE;
virtual bool supportsPlaceholder() const OVERRIDE;
virtual bool usesFixedPlaceholder() const OVERRIDE;
Modified: trunk/Source/WebCore/html/shadow/CalendarPickerElement.h (115154 => 115155)
--- trunk/Source/WebCore/html/shadow/CalendarPickerElement.h 2012-04-25 01:11:24 UTC (rev 115154)
+++ trunk/Source/WebCore/html/shadow/CalendarPickerElement.h 2012-04-25 01:17:55 UTC (rev 115155)
@@ -43,6 +43,7 @@
class CalendarPickerElement : public HTMLDivElement, public PagePopupClient {
public:
static PassRefPtr<CalendarPickerElement> create(Document*);
+ void openPopup();
void closePopup();
private:
@@ -58,7 +59,6 @@
virtual void didClosePopup() OVERRIDE;
HTMLInputElement* hostInput();
- void openPopup();
PagePopup* m_popup;
};