OLD | NEW |
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // ---------------------------- | 72 // ---------------------------- |
73 | 73 |
74 DateTimeDayFieldElement::DateTimeDayFieldElement(Document* document, FieldOwner&
fieldOwner, const String& placeholder, const Range& range) | 74 DateTimeDayFieldElement::DateTimeDayFieldElement(Document* document, FieldOwner&
fieldOwner, const String& placeholder, const Range& range) |
75 : DateTimeNumericFieldElement(document, fieldOwner, range, Range(1, 31), pla
ceholder) | 75 : DateTimeNumericFieldElement(document, fieldOwner, range, Range(1, 31), pla
ceholder) |
76 { | 76 { |
77 } | 77 } |
78 | 78 |
79 PassRefPtr<DateTimeDayFieldElement> DateTimeDayFieldElement::create(Document* do
cument, FieldOwner& fieldOwner, const String& placeholder, const Range& range) | 79 PassRefPtr<DateTimeDayFieldElement> DateTimeDayFieldElement::create(Document* do
cument, FieldOwner& fieldOwner, const String& placeholder, const Range& range) |
80 { | 80 { |
81 DEFINE_STATIC_LOCAL(AtomicString, dayPsuedoId, ("-webkit-datetime-edit-day-f
ield", AtomicString::ConstructFromLiteral)); | 81 DEFINE_STATIC_LOCAL(AtomicString, dayPsuedoId, ("-webkit-datetime-edit-day-f
ield", AtomicString::ConstructFromLiteral)); |
82 RefPtr<DateTimeDayFieldElement> field = adoptRef(new DateTimeDayFieldElement
(document, fieldOwner, placeholder.isEmpty() ? ASCIILiteral("--") : placeholder,
range)); | 82 RefPtr<DateTimeDayFieldElement> field = adoptRef(new DateTimeDayFieldElement
(document, fieldOwner, placeholder.isEmpty() ? "--" : placeholder, range)); |
83 field->initialize(dayPsuedoId, AXDayOfMonthFieldText()); | 83 field->initialize(dayPsuedoId, AXDayOfMonthFieldText()); |
84 return field.release(); | 84 return field.release(); |
85 } | 85 } |
86 | 86 |
87 void DateTimeDayFieldElement::populateDateTimeFieldsState(DateTimeFieldsState& d
ateTimeFieldsState) | 87 void DateTimeDayFieldElement::populateDateTimeFieldsState(DateTimeFieldsState& d
ateTimeFieldsState) |
88 { | 88 { |
89 dateTimeFieldsState.setDayOfMonth(hasValue() ? valueAsInteger() : DateTimeFi
eldsState::emptyValue); | 89 dateTimeFieldsState.setDayOfMonth(hasValue() ? valueAsInteger() : DateTimeFi
eldsState::emptyValue); |
90 } | 90 } |
91 | 91 |
92 void DateTimeDayFieldElement::setValueAsDate(const DateComponents& date) | 92 void DateTimeDayFieldElement::setValueAsDate(const DateComponents& date) |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 // ---------------------------- | 398 // ---------------------------- |
399 | 399 |
400 DateTimeMonthFieldElement::DateTimeMonthFieldElement(Document* document, FieldOw
ner& fieldOwner, const String& placeholder, const Range& range) | 400 DateTimeMonthFieldElement::DateTimeMonthFieldElement(Document* document, FieldOw
ner& fieldOwner, const String& placeholder, const Range& range) |
401 : DateTimeNumericFieldElement(document, fieldOwner, range, Range(1, 12), pla
ceholder) | 401 : DateTimeNumericFieldElement(document, fieldOwner, range, Range(1, 12), pla
ceholder) |
402 { | 402 { |
403 } | 403 } |
404 | 404 |
405 PassRefPtr<DateTimeMonthFieldElement> DateTimeMonthFieldElement::create(Document
* document, FieldOwner& fieldOwner, const String& placeholder, const Range& rang
e) | 405 PassRefPtr<DateTimeMonthFieldElement> DateTimeMonthFieldElement::create(Document
* document, FieldOwner& fieldOwner, const String& placeholder, const Range& rang
e) |
406 { | 406 { |
407 DEFINE_STATIC_LOCAL(AtomicString, monthPsuedoId, ("-webkit-datetime-edit-mon
th-field", AtomicString::ConstructFromLiteral)); | 407 DEFINE_STATIC_LOCAL(AtomicString, monthPsuedoId, ("-webkit-datetime-edit-mon
th-field", AtomicString::ConstructFromLiteral)); |
408 RefPtr<DateTimeMonthFieldElement> field = adoptRef(new DateTimeMonthFieldEle
ment(document, fieldOwner, placeholder.isEmpty() ? ASCIILiteral("--") : placehol
der, range)); | 408 RefPtr<DateTimeMonthFieldElement> field = adoptRef(new DateTimeMonthFieldEle
ment(document, fieldOwner, placeholder.isEmpty() ? "--" : placeholder, range)); |
409 field->initialize(monthPsuedoId, AXMonthFieldText()); | 409 field->initialize(monthPsuedoId, AXMonthFieldText()); |
410 return field.release(); | 410 return field.release(); |
411 } | 411 } |
412 | 412 |
413 void DateTimeMonthFieldElement::populateDateTimeFieldsState(DateTimeFieldsState&
dateTimeFieldsState) | 413 void DateTimeMonthFieldElement::populateDateTimeFieldsState(DateTimeFieldsState&
dateTimeFieldsState) |
414 { | 414 { |
415 dateTimeFieldsState.setMonth(hasValue() ? valueAsInteger() : DateTimeFieldsS
tate::emptyValue); | 415 dateTimeFieldsState.setMonth(hasValue() ? valueAsInteger() : DateTimeFieldsS
tate::emptyValue); |
416 } | 416 } |
417 | 417 |
418 void DateTimeMonthFieldElement::setValueAsDate(const DateComponents& date) | 418 void DateTimeMonthFieldElement::setValueAsDate(const DateComponents& date) |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 setValueAsInteger(value); | 558 setValueAsInteger(value); |
559 return; | 559 return; |
560 } | 560 } |
561 | 561 |
562 setEmptyValue(); | 562 setEmptyValue(); |
563 } | 563 } |
564 | 564 |
565 // ---------------------------- | 565 // ---------------------------- |
566 | 566 |
567 DateTimeYearFieldElement::DateTimeYearFieldElement(Document* document, FieldOwne
r& fieldOwner, const DateTimeYearFieldElement::Parameters& parameters) | 567 DateTimeYearFieldElement::DateTimeYearFieldElement(Document* document, FieldOwne
r& fieldOwner, const DateTimeYearFieldElement::Parameters& parameters) |
568 : DateTimeNumericFieldElement(document, fieldOwner, Range(parameters.minimum
Year, parameters.maximumYear), Range(DateComponents::minimumYear(), DateComponen
ts::maximumYear()), parameters.placeholder.isEmpty() ? ASCIILiteral("----") : pa
rameters.placeholder) | 568 : DateTimeNumericFieldElement(document, fieldOwner, Range(parameters.minimum
Year, parameters.maximumYear), Range(DateComponents::minimumYear(), DateComponen
ts::maximumYear()), parameters.placeholder.isEmpty() ? "----" : parameters.place
holder) |
569 , m_minIsSpecified(parameters.minIsSpecified) | 569 , m_minIsSpecified(parameters.minIsSpecified) |
570 , m_maxIsSpecified(parameters.maxIsSpecified) | 570 , m_maxIsSpecified(parameters.maxIsSpecified) |
571 { | 571 { |
572 ASSERT(parameters.minimumYear >= DateComponents::minimumYear()); | 572 ASSERT(parameters.minimumYear >= DateComponents::minimumYear()); |
573 ASSERT(parameters.maximumYear <= DateComponents::maximumYear()); | 573 ASSERT(parameters.maximumYear <= DateComponents::maximumYear()); |
574 } | 574 } |
575 | 575 |
576 PassRefPtr<DateTimeYearFieldElement> DateTimeYearFieldElement::create(Document*
document, FieldOwner& fieldOwner, const DateTimeYearFieldElement::Parameters& pa
rameters) | 576 PassRefPtr<DateTimeYearFieldElement> DateTimeYearFieldElement::create(Document*
document, FieldOwner& fieldOwner, const DateTimeYearFieldElement::Parameters& pa
rameters) |
577 { | 577 { |
578 DEFINE_STATIC_LOCAL(AtomicString, yearPsuedoId, ("-webkit-datetime-edit-year
-field", AtomicString::ConstructFromLiteral)); | 578 DEFINE_STATIC_LOCAL(AtomicString, yearPsuedoId, ("-webkit-datetime-edit-year
-field", AtomicString::ConstructFromLiteral)); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 setValueAsInteger(value); | 626 setValueAsInteger(value); |
627 return; | 627 return; |
628 } | 628 } |
629 | 629 |
630 setEmptyValue(); | 630 setEmptyValue(); |
631 } | 631 } |
632 | 632 |
633 } // namespace WebCore | 633 } // namespace WebCore |
634 | 634 |
635 #endif | 635 #endif |
OLD | NEW |