Title: [129207] trunk/Source
- Revision
- 129207
- Author
- [email protected]
- Date
- 2012-09-21 03:08:31 -0700 (Fri, 21 Sep 2012)
Log Message
Add datalist suggestions into DateTimeChooserParameters
https://bugs.webkit.org/show_bug.cgi?id=97292
Reviewed by Kent Tamura.
Source/WebCore:
We read datalist suggestions, add them to DateTimeChooserParameters,
and pass them to the page popup.
No new tests. No behavior change yet.
* html/shadow/CalendarPickerElement.cpp:
(WebCore::CalendarPickerElement::openPopup): Read datalist suggestions and add them to DateTimeChooserParameters
* platform/DateTimeChooser.h:
(DateTimeChooserParameters): Added localizedSuggestionValues so we can show localized values inside the page popup.
Source/WebKit/chromium:
* src/DateTimeChooserImpl.cpp:
(WebKit::DateTimeChooserImpl::writeDocument): Add the necessary parameters for SuggestionPicker.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (129206 => 129207)
--- trunk/Source/WebCore/ChangeLog 2012-09-21 10:06:10 UTC (rev 129206)
+++ trunk/Source/WebCore/ChangeLog 2012-09-21 10:08:31 UTC (rev 129207)
@@ -1,3 +1,20 @@
+2012-09-21 Keishi Hattori <[email protected]>
+
+ Add datalist suggestions into DateTimeChooserParameters
+ https://bugs.webkit.org/show_bug.cgi?id=97292
+
+ Reviewed by Kent Tamura.
+
+ We read datalist suggestions, add them to DateTimeChooserParameters,
+ and pass them to the page popup.
+
+ No new tests. No behavior change yet.
+
+ * html/shadow/CalendarPickerElement.cpp:
+ (WebCore::CalendarPickerElement::openPopup): Read datalist suggestions and add them to DateTimeChooserParameters
+ * platform/DateTimeChooser.h:
+ (DateTimeChooserParameters): Added localizedSuggestionValues so we can show localized values inside the page popup.
+
2012-09-21 Yoshifumi Inoue <[email protected]>
[Forms] DateTimeEditElement::layout() should take date time format as a parameter
Modified: trunk/Source/WebCore/html/shadow/CalendarPickerElement.cpp (129206 => 129207)
--- trunk/Source/WebCore/html/shadow/CalendarPickerElement.cpp 2012-09-21 10:06:10 UTC (rev 129206)
+++ trunk/Source/WebCore/html/shadow/CalendarPickerElement.cpp 2012-09-21 10:08:31 UTC (rev 129207)
@@ -37,7 +37,9 @@
#include "ChromeClient.h"
#include "Event.h"
#include "FrameView.h"
+#include "HTMLDataListElement.h"
#include "HTMLInputElement.h"
+#include "HTMLOptionElement.h"
#include "Page.h"
#include "RenderDetailsMarker.h"
@@ -140,7 +142,16 @@
parameters.step = step.toDouble();
parameters.anchorRectInRootView = document()->view()->contentsToRootView(hostInput()->pixelSnappedBoundingBox());
parameters.currentValue = input->value();
- // FIXME: parameters.suggestionValues and suggestionLabels will be used when we support datalist.
+ if (HTMLDataListElement* dataList = input->dataList()) {
+ RefPtr<HTMLCollection> options = dataList->options();
+ for (unsigned i = 0; HTMLOptionElement* option = toHTMLOptionElement(options->item(i)); ++i) {
+ if (!input->isValidValue(option->value()))
+ continue;
+ parameters.suggestionValues.append(input->sanitizeValue(option->value()));
+ parameters.localizedSuggestionValues.append(input->localizeValue(option->value()));
+ parameters.suggestionLabels.append(option->value() == option->label() ? String() : option->label());
+ }
+ }
m_chooser = chrome->client()->openDateTimeChooser(this, parameters);
}
Modified: trunk/Source/WebCore/platform/DateTimeChooser.h (129206 => 129207)
--- trunk/Source/WebCore/platform/DateTimeChooser.h 2012-09-21 10:06:10 UTC (rev 129206)
+++ trunk/Source/WebCore/platform/DateTimeChooser.h 2012-09-21 10:08:31 UTC (rev 129207)
@@ -41,6 +41,7 @@
IntRect anchorRectInRootView;
String currentValue;
Vector<String> suggestionValues;
+ Vector<String> localizedSuggestionValues;
Vector<String> suggestionLabels;
double minimum;
double maximum;
Modified: trunk/Source/WebKit/chromium/ChangeLog (129206 => 129207)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-09-21 10:06:10 UTC (rev 129206)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-09-21 10:08:31 UTC (rev 129207)
@@ -1,3 +1,13 @@
+2012-09-21 Keishi Hattori <[email protected]>
+
+ Add datalist suggestions into DateTimeChooserParameters
+ https://bugs.webkit.org/show_bug.cgi?id=97292
+
+ Reviewed by Kent Tamura.
+
+ * src/DateTimeChooserImpl.cpp:
+ (WebKit::DateTimeChooserImpl::writeDocument): Add the necessary parameters for SuggestionPicker.
+
2012-09-20 Tony Chang <[email protected]>
[chromium] Unreviewed build fix. webkit_unit_tests have global constructors.
Modified: trunk/Source/WebKit/chromium/src/DateTimeChooserImpl.cpp (129206 => 129207)
--- trunk/Source/WebKit/chromium/src/DateTimeChooserImpl.cpp 2012-09-21 10:06:10 UTC (rev 129206)
+++ trunk/Source/WebKit/chromium/src/DateTimeChooserImpl.cpp 2012-09-21 10:08:31 UTC (rev 129207)
@@ -37,6 +37,7 @@
#include "ChromeClientImpl.h"
#include "DateComponents.h"
#include "DateTimeChooserClient.h"
+#include "InputTypeNames.h"
#include "Language.h"
#include "LocalizedDate.h"
#include "NotImplemented.h"
@@ -106,6 +107,14 @@
addProperty("dayLabels", WebCore::weekDayShortLabels(), writer);
Direction dir = direction(WebCore::monthLabels()[0][0]);
addProperty("isRTL", dir == RightToLeft || dir == RightToLeftArabic, writer);
+ if (m_parameters.suggestionValues.size()) {
+ addProperty("inputWidth", static_cast<unsigned>(m_parameters.anchorRectInRootView.width()), writer);
+ addProperty("suggestionValues", m_parameters.suggestionValues, writer);
+ addProperty("localizedSuggestionValues", m_parameters.localizedSuggestionValues, writer);
+ addProperty("suggestionLabels", m_parameters.suggestionLabels, writer);
+ addProperty("showOtherDateEntry", m_parameters.type == WebCore::InputTypeNames::date(), writer);
+ addProperty("otherDateLabel", Platform::current()->queryLocalizedString(WebLocalizedString::OtherDateLabel), writer);
+ }
addString("}\n", writer);
writer.addData(WebCore::pickerCommonJs, sizeof(WebCore::pickerCommonJs));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes