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

Side by Side Diff: third_party/WebKit/Source/core/html/shadow/DateTimeEditElement.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 bool shouldYearFieldDisabled() const; 65 bool shouldYearFieldDisabled() const;
66 inline const StepRange& stepRange() const { return m_parameters.stepRange; } 66 inline const StepRange& stepRange() const { return m_parameters.stepRange; }
67 DateTimeNumericFieldElement::Step createStep(double msPerFieldUnit, double m sPerFieldSize) const; 67 DateTimeNumericFieldElement::Step createStep(double msPerFieldUnit, double m sPerFieldSize) const;
68 68
69 // DateTimeFormat::TokenHandler functions. 69 // DateTimeFormat::TokenHandler functions.
70 void visitField(DateTimeFormat::FieldType, int) final; 70 void visitField(DateTimeFormat::FieldType, int) final;
71 void visitLiteral(const String&) final; 71 void visitLiteral(const String&) final;
72 72
73 DateTimeEditElement& editElement() const; 73 DateTimeEditElement& editElement() const;
74 74
75 RawPtrWillBeMember<DateTimeEditElement> m_editElement; 75 Member<DateTimeEditElement> m_editElement;
76 const DateComponents m_dateValue; 76 const DateComponents m_dateValue;
77 const DateTimeEditElement::LayoutParameters& m_parameters; 77 const DateTimeEditElement::LayoutParameters& m_parameters;
78 DateTimeNumericFieldElement::Range m_dayRange; 78 DateTimeNumericFieldElement::Range m_dayRange;
79 DateTimeNumericFieldElement::Range m_hour23Range; 79 DateTimeNumericFieldElement::Range m_hour23Range;
80 DateTimeNumericFieldElement::Range m_minuteRange; 80 DateTimeNumericFieldElement::Range m_minuteRange;
81 DateTimeNumericFieldElement::Range m_secondRange; 81 DateTimeNumericFieldElement::Range m_secondRange;
82 DateTimeNumericFieldElement::Range m_millisecondRange; 82 DateTimeNumericFieldElement::Range m_millisecondRange;
83 }; 83 };
84 84
85 DateTimeEditBuilder::DateTimeEditBuilder(DateTimeEditElement& element, const Dat eTimeEditElement::LayoutParameters& layoutParameters, const DateComponents& date Value) 85 DateTimeEditBuilder::DateTimeEditBuilder(DateTimeEditElement& element, const Dat eTimeEditElement::LayoutParameters& layoutParameters, const DateComponents& date Value)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 141
142 void DateTimeEditBuilder::visitField(DateTimeFormat::FieldType fieldType, int co unt) 142 void DateTimeEditBuilder::visitField(DateTimeFormat::FieldType fieldType, int co unt)
143 { 143 {
144 const int countForAbbreviatedMonth = 3; 144 const int countForAbbreviatedMonth = 3;
145 const int countForFullMonth = 4; 145 const int countForFullMonth = 4;
146 const int countForNarrowMonth = 5; 146 const int countForNarrowMonth = 5;
147 Document& document = editElement().document(); 147 Document& document = editElement().document();
148 148
149 switch (fieldType) { 149 switch (fieldType) {
150 case DateTimeFormat::FieldTypeDayOfMonth: { 150 case DateTimeFormat::FieldTypeDayOfMonth: {
151 RefPtrWillBeRawPtr<DateTimeFieldElement> field = DateTimeDayFieldElement ::create(document, editElement(), m_parameters.placeholderForDay, m_dayRange); 151 RawPtr<DateTimeFieldElement> field = DateTimeDayFieldElement::create(doc ument, editElement(), m_parameters.placeholderForDay, m_dayRange);
152 editElement().addField(field); 152 editElement().addField(field);
153 if (shouldDayOfMonthFieldDisabled()) { 153 if (shouldDayOfMonthFieldDisabled()) {
154 field->setValueAsDate(m_dateValue); 154 field->setValueAsDate(m_dateValue);
155 field->setDisabled(); 155 field->setDisabled();
156 } 156 }
157 return; 157 return;
158 } 158 }
159 159
160 case DateTimeFormat::FieldTypeHour11: { 160 case DateTimeFormat::FieldTypeHour11: {
161 DateTimeNumericFieldElement::Step step = createStep(msPerHour, msPerHour * 12); 161 DateTimeNumericFieldElement::Step step = createStep(msPerHour, msPerHour * 12);
162 RefPtrWillBeRawPtr<DateTimeFieldElement> field = DateTimeHour11FieldElem ent::create(document, editElement(), m_hour23Range, step); 162 RawPtr<DateTimeFieldElement> field = DateTimeHour11FieldElement::create( document, editElement(), m_hour23Range, step);
163 editElement().addField(field); 163 editElement().addField(field);
164 if (shouldHourFieldDisabled()) { 164 if (shouldHourFieldDisabled()) {
165 field->setValueAsDate(m_dateValue); 165 field->setValueAsDate(m_dateValue);
166 field->setDisabled(); 166 field->setDisabled();
167 } 167 }
168 return; 168 return;
169 } 169 }
170 170
171 case DateTimeFormat::FieldTypeHour12: { 171 case DateTimeFormat::FieldTypeHour12: {
172 DateTimeNumericFieldElement::Step step = createStep(msPerHour, msPerHour * 12); 172 DateTimeNumericFieldElement::Step step = createStep(msPerHour, msPerHour * 12);
173 RefPtrWillBeRawPtr<DateTimeFieldElement> field = DateTimeHour12FieldElem ent::create(document, editElement(), m_hour23Range, step); 173 RawPtr<DateTimeFieldElement> field = DateTimeHour12FieldElement::create( document, editElement(), m_hour23Range, step);
174 editElement().addField(field); 174 editElement().addField(field);
175 if (shouldHourFieldDisabled()) { 175 if (shouldHourFieldDisabled()) {
176 field->setValueAsDate(m_dateValue); 176 field->setValueAsDate(m_dateValue);
177 field->setDisabled(); 177 field->setDisabled();
178 } 178 }
179 return; 179 return;
180 } 180 }
181 181
182 case DateTimeFormat::FieldTypeHour23: { 182 case DateTimeFormat::FieldTypeHour23: {
183 DateTimeNumericFieldElement::Step step = createStep(msPerHour, msPerDay) ; 183 DateTimeNumericFieldElement::Step step = createStep(msPerHour, msPerDay) ;
184 RefPtrWillBeRawPtr<DateTimeFieldElement> field = DateTimeHour23FieldElem ent::create(document, editElement(), m_hour23Range, step); 184 RawPtr<DateTimeFieldElement> field = DateTimeHour23FieldElement::create( document, editElement(), m_hour23Range, step);
185 editElement().addField(field); 185 editElement().addField(field);
186 if (shouldHourFieldDisabled()) { 186 if (shouldHourFieldDisabled()) {
187 field->setValueAsDate(m_dateValue); 187 field->setValueAsDate(m_dateValue);
188 field->setDisabled(); 188 field->setDisabled();
189 } 189 }
190 return; 190 return;
191 } 191 }
192 192
193 case DateTimeFormat::FieldTypeHour24: { 193 case DateTimeFormat::FieldTypeHour24: {
194 DateTimeNumericFieldElement::Step step = createStep(msPerHour, msPerDay) ; 194 DateTimeNumericFieldElement::Step step = createStep(msPerHour, msPerDay) ;
195 RefPtrWillBeRawPtr<DateTimeFieldElement> field = DateTimeHour24FieldElem ent::create(document, editElement(), m_hour23Range, step); 195 RawPtr<DateTimeFieldElement> field = DateTimeHour24FieldElement::create( document, editElement(), m_hour23Range, step);
196 editElement().addField(field); 196 editElement().addField(field);
197 if (shouldHourFieldDisabled()) { 197 if (shouldHourFieldDisabled()) {
198 field->setValueAsDate(m_dateValue); 198 field->setValueAsDate(m_dateValue);
199 field->setDisabled(); 199 field->setDisabled();
200 } 200 }
201 return; 201 return;
202 } 202 }
203 203
204 case DateTimeFormat::FieldTypeMinute: { 204 case DateTimeFormat::FieldTypeMinute: {
205 DateTimeNumericFieldElement::Step step = createStep(msPerMinute, msPerHo ur); 205 DateTimeNumericFieldElement::Step step = createStep(msPerMinute, msPerHo ur);
206 RefPtrWillBeRawPtr<DateTimeNumericFieldElement> field = DateTimeMinuteFi eldElement::create(document, editElement(), m_minuteRange, step); 206 RawPtr<DateTimeNumericFieldElement> field = DateTimeMinuteFieldElement:: create(document, editElement(), m_minuteRange, step);
207 editElement().addField(field); 207 editElement().addField(field);
208 if (shouldMinuteFieldDisabled()) { 208 if (shouldMinuteFieldDisabled()) {
209 field->setValueAsDate(m_dateValue); 209 field->setValueAsDate(m_dateValue);
210 field->setDisabled(); 210 field->setDisabled();
211 } 211 }
212 return; 212 return;
213 } 213 }
214 214
215 case DateTimeFormat::FieldTypeMonth: // Fallthrough. 215 case DateTimeFormat::FieldTypeMonth: // Fallthrough.
216 case DateTimeFormat::FieldTypeMonthStandAlone: { 216 case DateTimeFormat::FieldTypeMonthStandAlone: {
217 int minMonth = 0, maxMonth = 11; 217 int minMonth = 0, maxMonth = 11;
218 if (m_parameters.minimum.getType() != DateComponents::Invalid 218 if (m_parameters.minimum.getType() != DateComponents::Invalid
219 && m_parameters.maximum.getType() != DateComponents::Invalid 219 && m_parameters.maximum.getType() != DateComponents::Invalid
220 && m_parameters.minimum.fullYear() == m_parameters.maximum.fullYear( ) 220 && m_parameters.minimum.fullYear() == m_parameters.maximum.fullYear( )
221 && m_parameters.minimum.month() <= m_parameters.maximum.month()) { 221 && m_parameters.minimum.month() <= m_parameters.maximum.month()) {
222 minMonth = m_parameters.minimum.month(); 222 minMonth = m_parameters.minimum.month();
223 maxMonth = m_parameters.maximum.month(); 223 maxMonth = m_parameters.maximum.month();
224 } 224 }
225 RefPtrWillBeRawPtr<DateTimeFieldElement> field; 225 RawPtr<DateTimeFieldElement> field;
226 switch (count) { 226 switch (count) {
227 case countForNarrowMonth: // Fallthrough. 227 case countForNarrowMonth: // Fallthrough.
228 case countForAbbreviatedMonth: 228 case countForAbbreviatedMonth:
229 field = DateTimeSymbolicMonthFieldElement::create(document, editElem ent(), fieldType == DateTimeFormat::FieldTypeMonth ? m_parameters.locale.shortMo nthLabels() : m_parameters.locale.shortStandAloneMonthLabels(), minMonth, maxMon th); 229 field = DateTimeSymbolicMonthFieldElement::create(document, editElem ent(), fieldType == DateTimeFormat::FieldTypeMonth ? m_parameters.locale.shortMo nthLabels() : m_parameters.locale.shortStandAloneMonthLabels(), minMonth, maxMon th);
230 break; 230 break;
231 case countForFullMonth: 231 case countForFullMonth:
232 field = DateTimeSymbolicMonthFieldElement::create(document, editElem ent(), fieldType == DateTimeFormat::FieldTypeMonth ? m_parameters.locale.monthLa bels() : m_parameters.locale.standAloneMonthLabels(), minMonth, maxMonth); 232 field = DateTimeSymbolicMonthFieldElement::create(document, editElem ent(), fieldType == DateTimeFormat::FieldTypeMonth ? m_parameters.locale.monthLa bels() : m_parameters.locale.standAloneMonthLabels(), minMonth, maxMonth);
233 break; 233 break;
234 default: 234 default:
235 field = DateTimeMonthFieldElement::create(document, editElement(), m _parameters.placeholderForMonth, DateTimeNumericFieldElement::Range(minMonth + 1 , maxMonth + 1)); 235 field = DateTimeMonthFieldElement::create(document, editElement(), m _parameters.placeholderForMonth, DateTimeNumericFieldElement::Range(minMonth + 1 , maxMonth + 1));
236 break; 236 break;
237 } 237 }
238 editElement().addField(field); 238 editElement().addField(field);
239 if (minMonth == maxMonth && minMonth == m_dateValue.month() && m_dateVal ue.getType() != DateComponents::Month) { 239 if (minMonth == maxMonth && minMonth == m_dateValue.month() && m_dateVal ue.getType() != DateComponents::Month) {
240 field->setValueAsDate(m_dateValue); 240 field->setValueAsDate(m_dateValue);
241 field->setDisabled(); 241 field->setDisabled();
242 } 242 }
243 return; 243 return;
244 } 244 }
245 245
246 case DateTimeFormat::FieldTypePeriod: { 246 case DateTimeFormat::FieldTypePeriod: {
247 RefPtrWillBeRawPtr<DateTimeFieldElement> field = DateTimeAMPMFieldElemen t::create(document, editElement(), m_parameters.locale.timeAMPMLabels()); 247 RawPtr<DateTimeFieldElement> field = DateTimeAMPMFieldElement::create(do cument, editElement(), m_parameters.locale.timeAMPMLabels());
248 editElement().addField(field); 248 editElement().addField(field);
249 if (shouldAMPMFieldDisabled()) { 249 if (shouldAMPMFieldDisabled()) {
250 field->setValueAsDate(m_dateValue); 250 field->setValueAsDate(m_dateValue);
251 field->setDisabled(); 251 field->setDisabled();
252 } 252 }
253 return; 253 return;
254 } 254 }
255 255
256 case DateTimeFormat::FieldTypeSecond: { 256 case DateTimeFormat::FieldTypeSecond: {
257 DateTimeNumericFieldElement::Step step = createStep(msPerSecond, msPerMi nute); 257 DateTimeNumericFieldElement::Step step = createStep(msPerSecond, msPerMi nute);
258 RefPtrWillBeRawPtr<DateTimeNumericFieldElement> field = DateTimeSecondFi eldElement::create(document, editElement(), m_secondRange, step); 258 RawPtr<DateTimeNumericFieldElement> field = DateTimeSecondFieldElement:: create(document, editElement(), m_secondRange, step);
259 editElement().addField(field); 259 editElement().addField(field);
260 if (shouldSecondFieldDisabled()) { 260 if (shouldSecondFieldDisabled()) {
261 field->setValueAsDate(m_dateValue); 261 field->setValueAsDate(m_dateValue);
262 field->setDisabled(); 262 field->setDisabled();
263 } 263 }
264 264
265 if (needMillisecondField()) { 265 if (needMillisecondField()) {
266 visitLiteral(m_parameters.locale.localizedDecimalSeparator()); 266 visitLiteral(m_parameters.locale.localizedDecimalSeparator());
267 visitField(DateTimeFormat::FieldTypeFractionalSecond, 3); 267 visitField(DateTimeFormat::FieldTypeFractionalSecond, 3);
268 } 268 }
269 return; 269 return;
270 } 270 }
271 271
272 case DateTimeFormat::FieldTypeFractionalSecond: { 272 case DateTimeFormat::FieldTypeFractionalSecond: {
273 DateTimeNumericFieldElement::Step step = createStep(1, msPerSecond); 273 DateTimeNumericFieldElement::Step step = createStep(1, msPerSecond);
274 RefPtrWillBeRawPtr<DateTimeNumericFieldElement> field = DateTimeMillisec ondFieldElement::create(document, editElement(), m_millisecondRange, step); 274 RawPtr<DateTimeNumericFieldElement> field = DateTimeMillisecondFieldElem ent::create(document, editElement(), m_millisecondRange, step);
275 editElement().addField(field); 275 editElement().addField(field);
276 if (shouldMillisecondFieldDisabled()) { 276 if (shouldMillisecondFieldDisabled()) {
277 field->setValueAsDate(m_dateValue); 277 field->setValueAsDate(m_dateValue);
278 field->setDisabled(); 278 field->setDisabled();
279 } 279 }
280 return; 280 return;
281 } 281 }
282 282
283 case DateTimeFormat::FieldTypeWeekOfYear: { 283 case DateTimeFormat::FieldTypeWeekOfYear: {
284 DateTimeNumericFieldElement::Range range(DateComponents::minimumWeekNumb er, DateComponents::maximumWeekNumber); 284 DateTimeNumericFieldElement::Range range(DateComponents::minimumWeekNumb er, DateComponents::maximumWeekNumber);
(...skipping 22 matching lines...) Expand all
307 yearParams.maxIsSpecified = false; 307 yearParams.maxIsSpecified = false;
308 } else { 308 } else {
309 yearParams.maximumYear = m_parameters.maximum.fullYear(); 309 yearParams.maximumYear = m_parameters.maximum.fullYear();
310 yearParams.maxIsSpecified = true; 310 yearParams.maxIsSpecified = true;
311 } 311 }
312 if (yearParams.minimumYear > yearParams.maximumYear) { 312 if (yearParams.minimumYear > yearParams.maximumYear) {
313 std::swap(yearParams.minimumYear, yearParams.maximumYear); 313 std::swap(yearParams.minimumYear, yearParams.maximumYear);
314 std::swap(yearParams.minIsSpecified, yearParams.maxIsSpecified); 314 std::swap(yearParams.minIsSpecified, yearParams.maxIsSpecified);
315 } 315 }
316 yearParams.placeholder = m_parameters.placeholderForYear; 316 yearParams.placeholder = m_parameters.placeholderForYear;
317 RefPtrWillBeRawPtr<DateTimeFieldElement> field = DateTimeYearFieldElemen t::create(document, editElement(), yearParams); 317 RawPtr<DateTimeFieldElement> field = DateTimeYearFieldElement::create(do cument, editElement(), yearParams);
318 editElement().addField(field); 318 editElement().addField(field);
319 if (shouldYearFieldDisabled()) { 319 if (shouldYearFieldDisabled()) {
320 field->setValueAsDate(m_dateValue); 320 field->setValueAsDate(m_dateValue);
321 field->setDisabled(); 321 field->setDisabled();
322 } 322 }
323 return; 323 return;
324 } 324 }
325 325
326 default: 326 default:
327 return; 327 return;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 return m_parameters.minimum.getType() != DateComponents::Invalid 395 return m_parameters.minimum.getType() != DateComponents::Invalid
396 && m_parameters.maximum.getType() != DateComponents::Invalid 396 && m_parameters.maximum.getType() != DateComponents::Invalid
397 && m_parameters.minimum.fullYear() == m_parameters.maximum.fullYear() 397 && m_parameters.minimum.fullYear() == m_parameters.maximum.fullYear()
398 && m_parameters.minimum.fullYear() == m_dateValue.fullYear(); 398 && m_parameters.minimum.fullYear() == m_dateValue.fullYear();
399 } 399 }
400 400
401 void DateTimeEditBuilder::visitLiteral(const String& text) 401 void DateTimeEditBuilder::visitLiteral(const String& text)
402 { 402 {
403 DEFINE_STATIC_LOCAL(AtomicString, textPseudoId, ("-webkit-datetime-edit-text ", AtomicString::ConstructFromLiteral)); 403 DEFINE_STATIC_LOCAL(AtomicString, textPseudoId, ("-webkit-datetime-edit-text ", AtomicString::ConstructFromLiteral));
404 ASSERT(text.length()); 404 ASSERT(text.length());
405 RefPtrWillBeRawPtr<HTMLDivElement> element = HTMLDivElement::create(editElem ent().document()); 405 RawPtr<HTMLDivElement> element = HTMLDivElement::create(editElement().docume nt());
406 element->setShadowPseudoId(textPseudoId); 406 element->setShadowPseudoId(textPseudoId);
407 if (m_parameters.locale.isRTL() && text.length()) { 407 if (m_parameters.locale.isRTL() && text.length()) {
408 CharDirection dir = direction(text[0]); 408 CharDirection dir = direction(text[0]);
409 if (dir == SegmentSeparator || dir == WhiteSpaceNeutral || dir == OtherN eutral) 409 if (dir == SegmentSeparator || dir == WhiteSpaceNeutral || dir == OtherN eutral)
410 element->appendChild(Text::create(editElement().document(), String(& rightToLeftMarkCharacter, 1))); 410 element->appendChild(Text::create(editElement().document(), String(& rightToLeftMarkCharacter, 1)));
411 } 411 }
412 element->appendChild(Text::create(editElement().document(), text)); 412 element->appendChild(Text::create(editElement().document(), text));
413 editElement().fieldsWrapperElement()->appendChild(element); 413 editElement().fieldsWrapperElement()->appendChild(element);
414 } 414 }
415 415
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 visitor->trace(m_editControlOwner); 468 visitor->trace(m_editControlOwner);
469 HTMLDivElement::trace(visitor); 469 HTMLDivElement::trace(visitor);
470 } 470 }
471 471
472 inline Element* DateTimeEditElement::fieldsWrapperElement() const 472 inline Element* DateTimeEditElement::fieldsWrapperElement() const
473 { 473 {
474 ASSERT(firstChild()); 474 ASSERT(firstChild());
475 return toElement(firstChild()); 475 return toElement(firstChild());
476 } 476 }
477 477
478 void DateTimeEditElement::addField(PassRefPtrWillBeRawPtr<DateTimeFieldElement> field) 478 void DateTimeEditElement::addField(RawPtr<DateTimeFieldElement> field)
479 { 479 {
480 if (m_fields.size() >= maximumNumberOfFields) 480 if (m_fields.size() >= maximumNumberOfFields)
481 return; 481 return;
482 m_fields.append(field.get()); 482 m_fields.append(field.get());
483 fieldsWrapperElement()->appendChild(field); 483 fieldsWrapperElement()->appendChild(field);
484 } 484 }
485 485
486 bool DateTimeEditElement::anyEditableFieldsHaveValues() const 486 bool DateTimeEditElement::anyEditableFieldsHaveValues() const
487 { 487 {
488 for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex) { 488 for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex) {
489 if (!m_fields[fieldIndex]->isDisabled() && m_fields[fieldIndex]->hasValu e()) 489 if (!m_fields[fieldIndex]->isDisabled() && m_fields[fieldIndex]->hasValu e())
490 return true; 490 return true;
491 } 491 }
492 return false; 492 return false;
493 } 493 }
494 494
495 void DateTimeEditElement::blurByOwner() 495 void DateTimeEditElement::blurByOwner()
496 { 496 {
497 if (DateTimeFieldElement* field = focusedField()) 497 if (DateTimeFieldElement* field = focusedField())
498 field->blur(); 498 field->blur();
499 } 499 }
500 500
501 PassRefPtrWillBeRawPtr<DateTimeEditElement> DateTimeEditElement::create(Document & document, EditControlOwner& editControlOwner) 501 RawPtr<DateTimeEditElement> DateTimeEditElement::create(Document& document, Edit ControlOwner& editControlOwner)
502 { 502 {
503 RefPtrWillBeRawPtr<DateTimeEditElement> container = adoptRefWillBeNoop(new D ateTimeEditElement(document, editControlOwner)); 503 RawPtr<DateTimeEditElement> container = new DateTimeEditElement(document, ed itControlOwner);
504 container->setShadowPseudoId(AtomicString("-webkit-datetime-edit", AtomicStr ing::ConstructFromLiteral)); 504 container->setShadowPseudoId(AtomicString("-webkit-datetime-edit", AtomicStr ing::ConstructFromLiteral));
505 container->setAttribute(idAttr, ShadowElementNames::dateTimeEdit()); 505 container->setAttribute(idAttr, ShadowElementNames::dateTimeEdit());
506 return container.release(); 506 return container.release();
507 } 507 }
508 508
509 PassRefPtr<ComputedStyle> DateTimeEditElement::customStyleForLayoutObject() 509 PassRefPtr<ComputedStyle> DateTimeEditElement::customStyleForLayoutObject()
510 { 510 {
511 // FIXME: This is a kind of layout. We might want to introduce new layoutObj ect. 511 // FIXME: This is a kind of layout. We might want to introduce new layoutObj ect.
512 RefPtr<ComputedStyle> originalStyle = originalStyleForLayoutObject(); 512 RefPtr<ComputedStyle> originalStyle = originalStyleForLayoutObject();
513 RefPtr<ComputedStyle> style = ComputedStyle::clone(*originalStyle); 513 RefPtr<ComputedStyle> style = ComputedStyle::clone(*originalStyle);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 663
664 bool DateTimeEditElement::isReadOnly() const 664 bool DateTimeEditElement::isReadOnly() const
665 { 665 {
666 return m_editControlOwner && m_editControlOwner->isEditControlOwnerReadOnly( ); 666 return m_editControlOwner && m_editControlOwner->isEditControlOwnerReadOnly( );
667 } 667 }
668 668
669 void DateTimeEditElement::layout(const LayoutParameters& layoutParameters, const DateComponents& dateValue) 669 void DateTimeEditElement::layout(const LayoutParameters& layoutParameters, const DateComponents& dateValue)
670 { 670 {
671 DEFINE_STATIC_LOCAL(AtomicString, fieldsWrapperPseudoId, ("-webkit-datetime- edit-fields-wrapper", AtomicString::ConstructFromLiteral)); 671 DEFINE_STATIC_LOCAL(AtomicString, fieldsWrapperPseudoId, ("-webkit-datetime- edit-fields-wrapper", AtomicString::ConstructFromLiteral));
672 if (!hasChildren()) { 672 if (!hasChildren()) {
673 RefPtrWillBeRawPtr<HTMLDivElement> element = HTMLDivElement::create(docu ment()); 673 RawPtr<HTMLDivElement> element = HTMLDivElement::create(document());
674 element->setShadowPseudoId(fieldsWrapperPseudoId); 674 element->setShadowPseudoId(fieldsWrapperPseudoId);
675 appendChild(element.get()); 675 appendChild(element.get());
676 } 676 }
677 Element* fieldsWrapper = fieldsWrapperElement(); 677 Element* fieldsWrapper = fieldsWrapperElement();
678 678
679 size_t focusedFieldIndex = this->focusedFieldIndex(); 679 size_t focusedFieldIndex = this->focusedFieldIndex();
680 DateTimeFieldElement* const focusedField = fieldAt(focusedFieldIndex); 680 DateTimeFieldElement* const focusedField = fieldAt(focusedFieldIndex);
681 const AtomicString focusedFieldId = focusedField ? focusedField->shadowPseud oId() : nullAtom; 681 const AtomicString focusedFieldId = focusedField ? focusedField->shadowPseud oId() : nullAtom;
682 682
683 DateTimeEditBuilder builder(*this, layoutParameters, dateValue); 683 DateTimeEditBuilder builder(*this, layoutParameters, dateValue);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 { 815 {
816 DateTimeFieldsState dateTimeFieldsState; 816 DateTimeFieldsState dateTimeFieldsState;
817 for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex) 817 for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex)
818 m_fields[fieldIndex]->populateDateTimeFieldsState(dateTimeFieldsState); 818 m_fields[fieldIndex]->populateDateTimeFieldsState(dateTimeFieldsState);
819 return dateTimeFieldsState; 819 return dateTimeFieldsState;
820 } 820 }
821 821
822 } // namespace blink 822 } // namespace blink
823 823
824 #endif 824 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698