Add a calendar picker indicator to date-type input fields
https://bugs.webkit.org/show_bug.cgi?id=80478
Reviewed by Hajime Morita.
Source/WebCore:
Add an indicator to date-type controls. The bahevior change is enclosed
with ENABLE_CALENDAR_PICKER.
- Remove spin buttons from date-type controls.
It's not so helpful if we have a calendar picker. We introduce
TextFieldInputType::shouldHaveSpinButton().
- Add CalendarPickerElement.
This is added into a shadow tree of a date-type control. It uses
RenderDetailsMarker.
We're going to add click handler and so on to CalendarPickerElement.
Test: fast/forms/date/date-appearance.html
* WebCore.gypi: Add CalendarPickerElement.{cpp,h}
* css/html.css:
(input::-webkit-calendar-picker-indicator):
* html/DateInputType.cpp:
(WebCore::DateInputType::createShadowSubtree): Insert CalendarPickerElement.
(WebCore::DateInputType::needsContainer):
Alwyas return true because we have an extra decoration element.
(WebCore::DateInputType::shouldHaveSpinButton):
Always return false to disable spin button.
* html/DateInputType.h:
(DateInputType): Add declarations.
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::shouldHaveSpinButton):
(WebCore::TextFieldInputType::createShadowSubtree): Move some code to shouldHaveSpinButton().
* html/TextFieldInputType.h:
(TextFieldInputType): Add a declartion.
* html/shadow/CalendarPickerElement.cpp:
(WebCore::CalendarPickerElement::CalendarPickerElement):
(WebCore::CalendarPickerElement::create):
(WebCore::CalendarPickerElement::createRenderer): Creates RenderDetailsMarker.
* html/shadow/CalendarPickerElement.h: Added.
* rendering/RenderDetailsMarker.cpp:
(WebCore::RenderDetailsMarker::isOpen): Always show a down arrow if this is in <input>.
* rendering/RenderDetailsMarker.h:
Source/WebKit/chromium:
* features.gypi: Enable CALENDAR_PICKER for non-Android platforms. This
doesn't affect any bahevior because INPUT_TYPE_DATE is disabled.
LayoutTests:
* fast/forms/date/date-appearance.html: Added.
* platform/chromium-mac-snowleopard/fast/forms/date/date-appearance-expected.png: Added.
* platform/chromium-mac-snowleopard/fast/forms/date/date-appearance-expected.txt: Added.
git-svn-id: svn://svn.chromium.org/blink/trunk@112839 bbb929c8-8fbe-4397-9dbb-9b2b20218538
diff --git a/Source/WebCore/css/html.css b/Source/WebCore/css/html.css
index c107bd8..212bd7a 100644
--- a/Source/WebCore/css/html.css
+++ b/Source/WebCore/css/html.css
@@ -668,6 +668,15 @@
#endif // defined(ENABLE_INPUT_TYPE_COLOR) && ENABLE_INPUT_TYPE_COLOR
+#if defined(ENABLE_CALENDAR_PICKER) && ENABLE_CALENDAR_PICKER
+input::-webkit-calendar-picker-indicator {
+ display: inline-block;
+ width: 0.66em;
+ height: 0.66em;
+ -webkit-margin-end: 0.2em;
+}
+#endif // ENABLE_CALENDAR_PICKER
+
select {
-webkit-appearance: menulist;
-webkit-box-sizing: border-box;