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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 RefPtr<HTMLDivElement> element = HTMLDivElement::create(m_editElement.docume
nt()); | 404 RefPtrWillBeRawPtr<HTMLDivElement> element = HTMLDivElement::create(m_editEl
ement.document()); |
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 Direction dir = direction(text[0]); | 407 Direction 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(m_editElement.document(), String(&
rightToLeftMark, 1))); | 409 element->appendChild(Text::create(m_editElement.document(), String(&
rightToLeftMark, 1))); |
410 } | 410 } |
411 element->appendChild(Text::create(m_editElement.document(), text)); | 411 element->appendChild(Text::create(m_editElement.document(), text)); |
412 m_editElement.fieldsWrapperElement()->appendChild(element); | 412 m_editElement.fieldsWrapperElement()->appendChild(element); |
413 } | 413 } |
414 | 414 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 | 655 |
656 bool DateTimeEditElement::isReadOnly() const | 656 bool DateTimeEditElement::isReadOnly() const |
657 { | 657 { |
658 return m_editControlOwner && m_editControlOwner->isEditControlOwnerReadOnly(
); | 658 return m_editControlOwner && m_editControlOwner->isEditControlOwnerReadOnly(
); |
659 } | 659 } |
660 | 660 |
661 void DateTimeEditElement::layout(const LayoutParameters& layoutParameters, const
DateComponents& dateValue) | 661 void DateTimeEditElement::layout(const LayoutParameters& layoutParameters, const
DateComponents& dateValue) |
662 { | 662 { |
663 DEFINE_STATIC_LOCAL(AtomicString, fieldsWrapperPseudoId, ("-webkit-datetime-
edit-fields-wrapper", AtomicString::ConstructFromLiteral)); | 663 DEFINE_STATIC_LOCAL(AtomicString, fieldsWrapperPseudoId, ("-webkit-datetime-
edit-fields-wrapper", AtomicString::ConstructFromLiteral)); |
664 if (!firstChild()) { | 664 if (!firstChild()) { |
665 RefPtr<HTMLDivElement> element = HTMLDivElement::create(document()); | 665 RefPtrWillBeRawPtr<HTMLDivElement> element = HTMLDivElement::create(docu
ment()); |
666 element->setShadowPseudoId(fieldsWrapperPseudoId); | 666 element->setShadowPseudoId(fieldsWrapperPseudoId); |
667 appendChild(element.get()); | 667 appendChild(element.get()); |
668 } | 668 } |
669 Element* fieldsWrapper = fieldsWrapperElement(); | 669 Element* fieldsWrapper = fieldsWrapperElement(); |
670 | 670 |
671 size_t focusedFieldIndex = this->focusedFieldIndex(); | 671 size_t focusedFieldIndex = this->focusedFieldIndex(); |
672 DateTimeFieldElement* const focusedField = fieldAt(focusedFieldIndex); | 672 DateTimeFieldElement* const focusedField = fieldAt(focusedFieldIndex); |
673 const AtomicString focusedFieldId = focusedField ? focusedField->shadowPseud
oId() : nullAtom; | 673 const AtomicString focusedFieldId = focusedField ? focusedField->shadowPseud
oId() : nullAtom; |
674 | 674 |
675 DateTimeEditBuilder builder(*this, layoutParameters, dateValue); | 675 DateTimeEditBuilder builder(*this, layoutParameters, dateValue); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 { | 807 { |
808 DateTimeFieldsState dateTimeFieldsState; | 808 DateTimeFieldsState dateTimeFieldsState; |
809 for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex) | 809 for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex) |
810 m_fields[fieldIndex]->populateDateTimeFieldsState(dateTimeFieldsState); | 810 m_fields[fieldIndex]->populateDateTimeFieldsState(dateTimeFieldsState); |
811 return dateTimeFieldsState; | 811 return dateTimeFieldsState; |
812 } | 812 } |
813 | 813 |
814 } // namespace WebCore | 814 } // namespace WebCore |
815 | 815 |
816 #endif | 816 #endif |
OLD | NEW |