Diff
Modified: trunk/LayoutTests/ChangeLog (139864 => 139865)
--- trunk/LayoutTests/ChangeLog 2013-01-16 10:59:33 UTC (rev 139864)
+++ trunk/LayoutTests/ChangeLog 2013-01-16 11:04:36 UTC (rev 139865)
@@ -1,3 +1,23 @@
+2013-01-16 Kent Tamura <[email protected]>
+
+ INPUT_MULTIPLE_FIELDS_UI: Unable to edit a time field with step=86400, and confusing appearance
+ https://bugs.webkit.org/show_bug.cgi?id=106983
+
+ Reviewed by Kentaro Hara.
+
+ Note: We don't add tests for input[type=datetime] now because the WHATWG
+ specification might be changed.
+
+ * fast/forms/datetimelocal-multiple-fields/datetimelocal-multiple-fields-readonly-subfield-expected.txt: Added.
+ * fast/forms/datetimelocal-multiple-fields/datetimelocal-multiple-fields-readonly-subfield.html: Added.
+
+ * fast/forms/time-multiple-fields/time-multiple-fields-readonly-subfield-expected.txt:
+ * fast/forms/time-multiple-fields/time-multiple-fields-readonly-subfield.html:
+ Update test cases for new behavior. We should not make hour fields
+ read-only for input[type=time].
+ * platform/chromium-mac/fast/forms/time/time-appearance-basic-expected.png: Ditto.
+ * platform/chromium/TestExpectations: Add time-appearance-basic.html.
+
2013-01-16 Nandor Huszka <[email protected]>
[Qt] Unreviewed gardening.
Added: trunk/LayoutTests/fast/forms/datetimelocal-multiple-fields/datetimelocal-multiple-fields-readonly-subfield-expected.txt (0 => 139865)
--- trunk/LayoutTests/fast/forms/datetimelocal-multiple-fields/datetimelocal-multiple-fields-readonly-subfield-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/forms/datetimelocal-multiple-fields/datetimelocal-multiple-fields-readonly-subfield-expected.txt 2013-01-16 11:04:36 UTC (rev 139865)
@@ -0,0 +1,33 @@
+Sub-fields in input[type=datetime-local] should be read-only in some cases. This requires window.internals.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+createInput argument order: min, max, step, value
+
+Hour field:
+PASS isReadOnlyField(createInput("2013-01-16T11:00", "", step1day, ""), pseudoHour) is true
+PASS isReadOnlyField(createInput("2013-01-16T11:00", "", step1day, ""), pseudoAMPM) is true
+PASS isReadOnlyField(createInput("2013-01-16T11:00", "", step1day, ""), pseudoMinute) is true
+PASS isReadOnlyField(createInput("2013-01-16T11:30", "", step1day, "2013-01-16T11:30"), pseudoHour) is true
+PASS isReadOnlyField(createInput("2013-01-16T11:30", "", step1day, "2013-01-16T11:30"), pseudoAMPM) is true
+PASS isReadOnlyField(createInput("2013-01-16T11:30", "", step1day, "2013-01-16T11:30"), pseudoMinute) is true
+PASS isReadOnlyField(createInput("2013-01-16T11:30", "", step1day, "2013-01-16T12:30"), pseudoHour) is false
+PASS isReadOnlyField(createInput("2013-01-16T11:30", "", step1day, "2013-01-16T12:30"), pseudoAMPM) is false
+PASS isReadOnlyField(createInput("2013-01-16T11:30", "", step1day, "2013-01-16T12:30"), pseudoMinute) is true
+PASS isReadOnlyField(createInput("2013-01-16T00:00", "", step1day, "2013-01-16T12:30"), pseudoHour) is false
+PASS isReadOnlyField(createInput("2013-01-16T00:00", "", step1day, "2013-01-16T12:30"), pseudoAMPM) is false
+PASS isReadOnlyField(createInput("2013-01-16T00:00", "", step1day, "2013-01-16T12:30"), pseudoMinute) is false
+PASS isReadOnlyField(createInput("2013-01-16T11:00", "2013-01-16T23:00", step1day, ""), pseudoHour) is false
+PASS isReadOnlyField(createInput("2013-01-16T11:00", "2013-01-16T23:00", step1day, ""), pseudoAMPM) is false
+PASS isReadOnlyField(createInput("2013-01-16T11:00", "2013-01-16T23:00", step1day, ""), pseudoMinute) is true
+PASS isReadOnlyField(createInput("2013-01-16T11:30", "2013-01-16T23:00", step1day, "2013-01-16T11:30"), pseudoHour) is false
+PASS isReadOnlyField(createInput("2013-01-16T11:30", "2013-01-16T23:00", step1day, "2013-01-16T11:30"), pseudoAMPM) is false
+PASS isReadOnlyField(createInput("2013-01-16T11:30", "2013-01-16T23:00", step1day, "2013-01-16T11:30"), pseudoMinute) is true
+PASS isReadOnlyField(createInput("2013-01-16T11:30", "2013-01-16T11:59", step1day, "2013-01-16T11:30"), pseudoHour) is false
+PASS isReadOnlyField(createInput("2013-01-16T11:30", "2013-01-16T11:59", step1day, "2013-01-16T11:30"), pseudoAMPM) is false
+PASS isReadOnlyField(createInput("2013-01-16T11:30", "2013-01-16T11:59", step1day, "2013-01-16T11:30"), pseudoMinute) is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/forms/datetimelocal-multiple-fields/datetimelocal-multiple-fields-readonly-subfield.html (0 => 139865)
--- trunk/LayoutTests/fast/forms/datetimelocal-multiple-fields/datetimelocal-multiple-fields-readonly-subfield.html (rev 0)
+++ trunk/LayoutTests/fast/forms/datetimelocal-multiple-fields/datetimelocal-multiple-fields-readonly-subfield.html 2013-01-16 11:04:36 UTC (rev 139865)
@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<body>
+<script src=""
+<script>
+function createInput(min, max, step, value) {
+ var input = document.createElement('input');
+ input.type = 'datetime-local';
+ if (min)
+ input.min = min;
+ if (max)
+ input.max = max;
+ if (step)
+ input.step = step;
+ if (value)
+ input.value = value;
+ return input;
+}
+
+function isReadOnlyField(input, pseudo) {
+ var node = internals.youngestShadowRoot(input).querySelector('*[pseudo="' + pseudo + '"]');
+ if (!node)
+ testFailed('Requested node is missing.');
+ return node && node.hasAttribute('readonly');
+}
+
+var pseudoMinute = '-webkit-datetime-edit-minute-field';
+var pseudoHour = '-webkit-datetime-edit-hour-field';
+var pseudoAMPM = '-webkit-datetime-edit-ampm-field';
+var step1day = '86400';
+
+description('Sub-fields in input[type=datetime-local] should be read-only in some cases. This requires window.internals.');
+debug('createInput argument order: min, max, step, value');
+debug('');
+
+debug('Hour field:');
+shouldBeTrue('isReadOnlyField(createInput("2013-01-16T11:00", "", step1day, ""), pseudoHour)');
+shouldBeTrue('isReadOnlyField(createInput("2013-01-16T11:00", "", step1day, ""), pseudoAMPM)');
+shouldBeTrue('isReadOnlyField(createInput("2013-01-16T11:00", "", step1day, ""), pseudoMinute)');
+
+shouldBeTrue('isReadOnlyField(createInput("2013-01-16T11:30", "", step1day, "2013-01-16T11:30"), pseudoHour)');
+shouldBeTrue('isReadOnlyField(createInput("2013-01-16T11:30", "", step1day, "2013-01-16T11:30"), pseudoAMPM)');
+shouldBeTrue('isReadOnlyField(createInput("2013-01-16T11:30", "", step1day, "2013-01-16T11:30"), pseudoMinute)');
+
+shouldBeFalse('isReadOnlyField(createInput("2013-01-16T11:30", "", step1day, "2013-01-16T12:30"), pseudoHour)');
+shouldBeFalse('isReadOnlyField(createInput("2013-01-16T11:30", "", step1day, "2013-01-16T12:30"), pseudoAMPM)');
+shouldBeTrue('isReadOnlyField(createInput("2013-01-16T11:30", "", step1day, "2013-01-16T12:30"), pseudoMinute)');
+
+shouldBeFalse('isReadOnlyField(createInput("2013-01-16T00:00", "", step1day, "2013-01-16T12:30"), pseudoHour)');
+shouldBeFalse('isReadOnlyField(createInput("2013-01-16T00:00", "", step1day, "2013-01-16T12:30"), pseudoAMPM)');
+shouldBeFalse('isReadOnlyField(createInput("2013-01-16T00:00", "", step1day, "2013-01-16T12:30"), pseudoMinute)');
+
+shouldBeFalse('isReadOnlyField(createInput("2013-01-16T11:00", "2013-01-16T23:00", step1day, ""), pseudoHour)');
+shouldBeFalse('isReadOnlyField(createInput("2013-01-16T11:00", "2013-01-16T23:00", step1day, ""), pseudoAMPM)');
+shouldBeTrue('isReadOnlyField(createInput("2013-01-16T11:00", "2013-01-16T23:00", step1day, ""), pseudoMinute)');
+
+shouldBeFalse('isReadOnlyField(createInput("2013-01-16T11:30", "2013-01-16T23:00", step1day, "2013-01-16T11:30"), pseudoHour)');
+shouldBeFalse('isReadOnlyField(createInput("2013-01-16T11:30", "2013-01-16T23:00", step1day, "2013-01-16T11:30"), pseudoAMPM)');
+shouldBeTrue('isReadOnlyField(createInput("2013-01-16T11:30", "2013-01-16T23:00", step1day, "2013-01-16T11:30"), pseudoMinute)');
+
+shouldBeFalse('isReadOnlyField(createInput("2013-01-16T11:30", "2013-01-16T11:59", step1day, "2013-01-16T11:30"), pseudoHour)');
+shouldBeFalse('isReadOnlyField(createInput("2013-01-16T11:30", "2013-01-16T11:59", step1day, "2013-01-16T11:30"), pseudoAMPM)');
+shouldBeTrue('isReadOnlyField(createInput("2013-01-16T11:30", "2013-01-16T11:59", step1day, "2013-01-16T11:30"), pseudoMinute)');
+
+</script>
+<script src=""
+</body>
+
Modified: trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-readonly-subfield-expected.txt (139864 => 139865)
--- trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-readonly-subfield-expected.txt 2013-01-16 10:59:33 UTC (rev 139864)
+++ trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-readonly-subfield-expected.txt 2013-01-16 11:04:36 UTC (rev 139865)
@@ -22,11 +22,11 @@
PASS isReadOnlyField(createTimeInput("00:30", step1hour, "00:35"), pseudoMinute) is false
PASS isReadOnlyField(createTimeInput("00:00", step1hour, "00:35"), pseudoMinute) is false
Hour field:
-PASS isReadOnlyField(createTimeInput("11:00", step1day, ""), pseudoHour) is true
-PASS isReadOnlyField(createTimeInput("11:00", step1day, ""), pseudoAMPM) is true
+PASS isReadOnlyField(createTimeInput("11:00", step1day, ""), pseudoHour) is false
+PASS isReadOnlyField(createTimeInput("11:00", step1day, ""), pseudoAMPM) is false
PASS isReadOnlyField(createTimeInput("11:00", step1day, ""), pseudoMinute) is true
-PASS isReadOnlyField(createTimeInput("11:30", step1day, "11:30"), pseudoHour) is true
-PASS isReadOnlyField(createTimeInput("11:30", step1day, "11:30"), pseudoAMPM) is true
+PASS isReadOnlyField(createTimeInput("11:30", step1day, "11:30"), pseudoHour) is false
+PASS isReadOnlyField(createTimeInput("11:30", step1day, "11:30"), pseudoAMPM) is false
PASS isReadOnlyField(createTimeInput("11:30", step1day, "11:30"), pseudoMinute) is true
PASS isReadOnlyField(createTimeInput("11:30", step1day, "12:30"), pseudoHour) is false
PASS isReadOnlyField(createTimeInput("11:30", step1day, "12:30"), pseudoAMPM) is false
Modified: trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-readonly-subfield.html (139864 => 139865)
--- trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-readonly-subfield.html 2013-01-16 10:59:33 UTC (rev 139864)
+++ trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-readonly-subfield.html 2013-01-16 11:04:36 UTC (rev 139865)
@@ -53,11 +53,11 @@
shouldBeFalse('isReadOnlyField(createTimeInput("00:00", step1hour, "00:35"), pseudoMinute)');
debug('Hour field:');
-shouldBeTrue('isReadOnlyField(createTimeInput("11:00", step1day, ""), pseudoHour)');
-shouldBeTrue('isReadOnlyField(createTimeInput("11:00", step1day, ""), pseudoAMPM)');
+shouldBeFalse('isReadOnlyField(createTimeInput("11:00", step1day, ""), pseudoHour)');
+shouldBeFalse('isReadOnlyField(createTimeInput("11:00", step1day, ""), pseudoAMPM)');
shouldBeTrue('isReadOnlyField(createTimeInput("11:00", step1day, ""), pseudoMinute)');
-shouldBeTrue('isReadOnlyField(createTimeInput("11:30", step1day, "11:30"), pseudoHour)');
-shouldBeTrue('isReadOnlyField(createTimeInput("11:30", step1day, "11:30"), pseudoAMPM)');
+shouldBeFalse('isReadOnlyField(createTimeInput("11:30", step1day, "11:30"), pseudoHour)');
+shouldBeFalse('isReadOnlyField(createTimeInput("11:30", step1day, "11:30"), pseudoAMPM)');
shouldBeTrue('isReadOnlyField(createTimeInput("11:30", step1day, "11:30"), pseudoMinute)');
shouldBeFalse('isReadOnlyField(createTimeInput("11:30", step1day, "12:30"), pseudoHour)');
shouldBeFalse('isReadOnlyField(createTimeInput("11:30", step1day, "12:30"), pseudoAMPM)');
Modified: trunk/LayoutTests/platform/chromium/TestExpectations (139864 => 139865)
--- trunk/LayoutTests/platform/chromium/TestExpectations 2013-01-16 10:59:33 UTC (rev 139864)
+++ trunk/LayoutTests/platform/chromium/TestExpectations 2013-01-16 11:04:36 UTC (rev 139865)
@@ -4091,6 +4091,9 @@
webkit.org/b/104993 [ XP ] fast/forms/time-multiple-fields/time-multiple-fields-stepup-stepdown-from-renderer.html [ Failure ]
+# Need rebaseline
+webkit.org/b/106983 fast/forms/time/time-appearance-basic.html [ Failure ]
+
webkit.org/b/106518 compositing/iframes/iframe-content-flipping.html [ ImageOnlyFailure ]
webkit.org/b/106518 platform/chromium/virtual/softwarecompositing/iframes/iframe-content-flipping.html [ ImageOnlyFailure ]
Modified: trunk/LayoutTests/platform/chromium-mac/fast/forms/time/time-appearance-basic-expected.png
(Binary files differ)
Modified: trunk/Source/WebCore/ChangeLog (139864 => 139865)
--- trunk/Source/WebCore/ChangeLog 2013-01-16 10:59:33 UTC (rev 139864)
+++ trunk/Source/WebCore/ChangeLog 2013-01-16 11:04:36 UTC (rev 139865)
@@ -1,3 +1,41 @@
+2013-01-16 Kent Tamura <[email protected]>
+
+ INPUT_MULTIPLE_FIELDS_UI: Unable to edit a time field with step=86400, and confusing appearance
+ https://bugs.webkit.org/show_bug.cgi?id=106983
+
+ Reviewed by Kentaro Hara.
+
+ For example, we show a read-only hour field and a read-only minutes
+ field for <input type=time min="17:00" step=86400> because the step
+ value is 24 hours and the hour field can be only 17. However, we need to
+ provide a way to clear the value of the time field in such case. We
+ shouldn't make the hour field read-only if no other fields are editable.
+
+ - We don't make hour fields read-only for input[type=time].
+
+ - We make hour fields read-only for input[type=datetime-local] only if
+ year, month, or day field is editable. e.g.
+ <input type=datetime-local min=2013-01-16T17:00 step=86400>:
+ The hour field is read-only, and year/month/day fields are editable.
+ <input type=datetime-local min=2013-01-16T17:00 max=2013-01-16T18:00 step=86400>:
+ The hour field is editable, and year/month/day fields are read-only.
+
+ Test: fast/forms/datetimelocal-multiple-fields/datetimelocal-multiple-fields-readonly-subfield.html
+
+ * html/shadow/DateTimeEditElement.cpp:
+ (DateTimeEditBuilder): Declare new functions.
+ (WebCore::DateTimeEditBuilder::getRangeOfDayOfMonthField):
+ Added a function by extracting some code from visitField.
+ (WebCore::DateTimeEditBuilder::visitField):
+ (WebCore::DateTimeEditBuilder::shouldDayOfMonthFieldReadOnly):
+ Added a function by extracting some code from visitField.
+ (WebCore::DateTimeEditBuilder::shouldHourFieldReadOnly):
+ If the type is "time", we don't make hour fields read-only.
+ Otherwise, we don't make hour fields read-only if year/month/day fields
+ are read-only. Note that we don't need to check read-only status of year
+ and month fields explicitly here because a day field can be read-only
+ only if the year field and the month field are read-only.
+
2013-01-16 Allan Sandfeld Jensen <[email protected]>
[TexMap] Composited CSS shaders crash when using non-GL TextureMapper
Modified: trunk/Source/WebCore/html/shadow/DateTimeEditElement.cpp (139864 => 139865)
--- trunk/Source/WebCore/html/shadow/DateTimeEditElement.cpp 2013-01-16 10:59:33 UTC (rev 139864)
+++ trunk/Source/WebCore/html/shadow/DateTimeEditElement.cpp 2013-01-16 11:04:36 UTC (rev 139865)
@@ -59,7 +59,9 @@
bool build(const String&);
private:
+ void getRangeOfDayOfMonthField(int& minDay, int& maxDay) const;
bool needMillisecondField() const;
+ bool shouldDayOfMonthFieldReadOnly(int minDay, int maxDay) const;
bool shouldHourFieldReadOnly() const;
bool shouldMillisecondFieldReadOnly() const;
bool shouldMinuteFieldReadOnly() const;
@@ -90,6 +92,20 @@
return DateTimeFormat::parse(formatString, *this);
}
+void DateTimeEditBuilder::getRangeOfDayOfMonthField(int& minDay, int& maxDay) const
+{
+ minDay = 1;
+ maxDay = 31;
+ if (m_parameters.minimum.type() != DateComponents::Invalid
+ && m_parameters.maximum.type() != DateComponents::Invalid
+ && m_parameters.minimum.fullYear() == m_parameters.maximum.fullYear()
+ && m_parameters.minimum.month() == m_parameters.maximum.month()
+ && m_parameters.minimum.monthDay() <= m_parameters.maximum.monthDay()) {
+ minDay = m_parameters.minimum.monthDay();
+ maxDay = m_parameters.maximum.monthDay();
+ }
+}
+
bool DateTimeEditBuilder::needMillisecondField() const
{
return m_dateValue.millisecond()
@@ -106,18 +122,11 @@
switch (fieldType) {
case DateTimeFormat::FieldTypeDayOfMonth: {
- int minDay = 1, maxDay = 31;
- if (m_parameters.minimum.type() != DateComponents::Invalid
- && m_parameters.maximum.type() != DateComponents::Invalid
- && m_parameters.minimum.fullYear() == m_parameters.maximum.fullYear()
- && m_parameters.minimum.month() == m_parameters.maximum.month()
- && m_parameters.minimum.monthDay() <= m_parameters.maximum.monthDay()) {
- minDay = m_parameters.minimum.monthDay();
- maxDay = m_parameters.maximum.monthDay();
- }
+ int minDay, maxDay;
+ getRangeOfDayOfMonthField(minDay, maxDay);
RefPtr<DateTimeFieldElement> field = DateTimeDayFieldElement::create(document, m_editElement, m_parameters.placeholderForDay, minDay, maxDay);
m_editElement.addField(field);
- if (minDay == maxDay && minDay == m_dateValue.monthDay() && m_dateValue.type() != DateComponents::Date) {
+ if (shouldDayOfMonthFieldReadOnly(minDay, maxDay)) {
field->setValueAsDate(m_dateValue);
field->setReadOnly();
}
@@ -296,8 +305,24 @@
}
}
+bool DateTimeEditBuilder::shouldDayOfMonthFieldReadOnly(int minDay, int maxDay) const
+{
+ return minDay == maxDay && minDay == m_dateValue.monthDay() && m_dateValue.type() != DateComponents::Date;
+}
+
bool DateTimeEditBuilder::shouldHourFieldReadOnly() const
{
+ if (m_dateValue.type() == DateComponents::Time)
+ return false;
+ ASSERT(m_dateValue.type() == DateComponents::DateTimeLocal || m_dateValue.type() == DateComponents::DateTime);
+ int minDay, maxDay;
+ getRangeOfDayOfMonthField(minDay, maxDay);
+ if (shouldDayOfMonthFieldReadOnly(minDay, maxDay)) {
+ ASSERT(m_parameters.minimum.fullYear() == m_parameters.maximum.fullYear());
+ ASSERT(m_parameters.minimum.month() == m_parameters.maximum.month());
+ return false;
+ }
+
const Decimal decimalMsPerDay(static_cast<int>(msPerDay));
Decimal hourPartOfMinimum = (stepRange().minimum().abs().remainder(decimalMsPerDay) / static_cast<int>(msPerHour)).floor();
return hourPartOfMinimum == m_dateValue.hour() && stepRange().step().remainder(decimalMsPerDay).isZero();