BaseChooserOnlyDateAndTimeInputType should implement DateTimeChooserClient
authorKent Tamura <tkent@chromium.org>
Mon, 5 Nov 2012 08:22:02 +0000 (08:22 +0000)
committerKent Tamura <tkent@chromium.org>
Mon, 5 Nov 2012 08:22:02 +0000 (08:22 +0000)
commit0afb777bdf5e004656100441a3e61bcad470c361
tree19f35170ce5d092783202784ac41a02bbfcdb25d
parent072e854ccfc7c265be013a9e74dab0089dd7ef7a
BaseChooserOnlyDateAndTimeInputType should implement DateTimeChooserClient
https://bugs.webkit.org/show_bug.cgi?id=101038

Reviewed by Hajime Morita.

Add DateTimeChooserClient behavior to BaseChooserOnlyDateAndTimeInputType.
It means that date/time input elements without
ENABLE_INPUT_MULTIPLE_FIELDS_UI can open date/time choosers by
DOMActivate event.

This patch doesn't change behavior yet because Chromimum-Android port
intercepts user events and doesn't deliver them to date/time input
elements. <http://crbug.com/159381>

* html/BaseChooserOnlyDateAndTimeInputType.cpp:
Add DateTimeChooserClient behavior. The code is similar to
PickerIndicatorElement.
(WebCore::BaseChooserOnlyDateAndTimeInputType::~BaseChooserOnlyDateAndTimeInputType):
Closes DateTimeChooser.
(WebCore::BaseChooserOnlyDateAndTimeInputType::handleDOMActivateEvent):
Open DateTimeChooser if
 - The element is not disabled,
 - The element is not read-only,
 - The element has a renderer,
 - This event is created by a user gesture, and
 - The element has no DateTimeChooser.
(WebCore::BaseChooserOnlyDateAndTimeInputType::detach):
Closes DateTimeChooser.
(WebCore::BaseChooserOnlyDateAndTimeInputType::didChooseValue):
Set a string value coming from a chooser to the input element.
(WebCore::BaseChooserOnlyDateAndTimeInputType::didEndChooser):
Clear m_dateTimeChooser when the chooser was closed.
(WebCore::BaseChooserOnlyDateAndTimeInputType::closeDateTimeChooser):
Requests to close the chooser.
* html/BaseChooserOnlyDateAndTimeInputType.h:
(BaseChooserOnlyDateAndTimeInputType):
 - Implement DateTimeChooserClient
 - Add closeDateTimeChooser helper function.
 - Add detach override.
 - Add m_dateTimeChooser.
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setupDateTimeChooserParameters):
Added. The code is moved from PickerIndicatorElement.cpp in order to
share it with BaseChooserOnlyDateAndTimeInputType.
* html/HTMLInputElement.h:
(HTMLInputElement): Declare setupDateTimeChooserParameters.
* html/shadow/PickerIndicatorElement.cpp:
(WebCore::PickerIndicatorElement::openPopup):
Move some code to HTMLInputElement::setupDateTimeChooserParameters.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@133441 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.cpp
Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.h
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLInputElement.h
Source/WebCore/html/shadow/PickerIndicatorElement.cpp