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

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

Powered by Google App Engine
This is Rietveld 408576698