Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(562)

Unified Diff: Source/WebCore/html/shadow/DateTimeEditElement.cpp

Issue 11420032: Merge 134239 - Refactoring: set read-only values on layout in DateTimeEditElement (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1312/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/html/shadow/DateTimeEditElement.h ('k') | Source/WebCore/html/shadow/DateTimeFieldElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/html/shadow/DateTimeEditElement.cpp
===================================================================
--- Source/WebCore/html/shadow/DateTimeEditElement.cpp (revision 134890)
+++ Source/WebCore/html/shadow/DateTimeEditElement.cpp (working copy)
@@ -121,8 +121,10 @@
case DateTimeFormat::FieldTypeMinute: {
RefPtr<DateTimeNumericFieldElement> field = DateTimeMinuteFieldElement::create(document, m_editElement);
m_editElement.addField(field);
- if (shouldMinuteFieldReadOnly())
+ if (shouldMinuteFieldReadOnly()) {
+ field->setValueAsDate(m_dateValue);
field->setReadOnly();
+ }
return;
}
@@ -161,10 +163,12 @@
return;
case DateTimeFormat::FieldTypeSecond: {
- RefPtr<DateTimeSecondFieldElement> field = DateTimeSecondFieldElement::create(document, m_editElement);
+ RefPtr<DateTimeNumericFieldElement> field = DateTimeSecondFieldElement::create(document, m_editElement);
m_editElement.addField(field);
- if (shouldSecondFieldReadOnly())
+ if (shouldSecondFieldReadOnly()) {
+ field->setValueAsDate(m_dateValue);
field->setReadOnly();
+ }
if (needMillisecondField()) {
visitLiteral(m_parameters.locale.localizedDecimalSeparator());
@@ -174,10 +178,12 @@
}
case DateTimeFormat::FieldTypeFractionalSecond: {
- RefPtr<DateTimeMillisecondFieldElement> field = DateTimeMillisecondFieldElement::create(document, m_editElement);
+ RefPtr<DateTimeNumericFieldElement> field = DateTimeMillisecondFieldElement::create(document, m_editElement);
m_editElement.addField(field);
- if (shouldMillisecondFieldReadOnly())
+ if (shouldMillisecondFieldReadOnly()) {
+ field->setValueAsDate(m_dateValue);
field->setReadOnly();
+ }
return;
}
@@ -462,17 +468,17 @@
m_fields[fieldIndex]->setValueAsDate(date);
}
-void DateTimeEditElement::setValueAsDateTimeFieldsState(const DateTimeFieldsState& dateTimeFieldsState, const DateComponents& dateForReadOnlyField)
+void DateTimeEditElement::setValueAsDateTimeFieldsState(const DateTimeFieldsState& dateTimeFieldsState)
{
for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex)
- m_fields[fieldIndex]->setValueAsDateTimeFieldsState(dateTimeFieldsState, dateForReadOnlyField);
+ m_fields[fieldIndex]->setValueAsDateTimeFieldsState(dateTimeFieldsState);
}
void DateTimeEditElement::setEmptyValue(const LayoutParameters& layoutParameters, const DateComponents& dateForReadOnlyField)
{
layout(layoutParameters, dateForReadOnlyField);
for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex)
- m_fields[fieldIndex]->setEmptyValue(dateForReadOnlyField, DateTimeFieldElement::DispatchNoEvent);
+ m_fields[fieldIndex]->setEmptyValue(DateTimeFieldElement::DispatchNoEvent);
}
bool DateTimeEditElement::hasFocusedField()
« no previous file with comments | « Source/WebCore/html/shadow/DateTimeEditElement.h ('k') | Source/WebCore/html/shadow/DateTimeFieldElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698