| 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 28 matching lines...) Expand all Loading... |
| 39 class DateTimeFieldsState; | 39 class DateTimeFieldsState; |
| 40 class Locale; | 40 class Locale; |
| 41 class StepRange; | 41 class StepRange; |
| 42 | 42 |
| 43 // DateTimeEditElement class contains numberic field and symbolc field for | 43 // DateTimeEditElement class contains numberic field and symbolc field for |
| 44 // representing date and time, such as | 44 // representing date and time, such as |
| 45 // - Year, Month, Day Of Month | 45 // - Year, Month, Day Of Month |
| 46 // - Hour, Minute, Second, Millisecond, AM/PM | 46 // - Hour, Minute, Second, Millisecond, AM/PM |
| 47 class DateTimeEditElement final : public HTMLDivElement, public DateTimeFieldEle
ment::FieldOwner { | 47 class DateTimeEditElement final : public HTMLDivElement, public DateTimeFieldEle
ment::FieldOwner { |
| 48 WTF_MAKE_NONCOPYABLE(DateTimeEditElement); | 48 WTF_MAKE_NONCOPYABLE(DateTimeEditElement); |
| 49 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(DateTimeEditElement); | 49 USING_GARBAGE_COLLECTED_MIXIN(DateTimeEditElement); |
| 50 | 50 |
| 51 public: | 51 public: |
| 52 // EditControlOwner implementer must call removeEditControlOwner when | 52 // EditControlOwner implementer must call removeEditControlOwner when |
| 53 // it doesn't handle event, e.g. at destruction. | 53 // it doesn't handle event, e.g. at destruction. |
| 54 class EditControlOwner : public WillBeGarbageCollectedMixin { | 54 class EditControlOwner : public GarbageCollectedMixin { |
| 55 public: | 55 public: |
| 56 virtual ~EditControlOwner(); | 56 virtual ~EditControlOwner(); |
| 57 virtual void didBlurFromControl() = 0; | 57 virtual void didBlurFromControl() = 0; |
| 58 virtual void didFocusOnControl() = 0; | 58 virtual void didFocusOnControl() = 0; |
| 59 virtual void editControlValueChanged() = 0; | 59 virtual void editControlValueChanged() = 0; |
| 60 virtual String formatDateTimeFieldsState(const DateTimeFieldsState&) con
st = 0; | 60 virtual String formatDateTimeFieldsState(const DateTimeFieldsState&) con
st = 0; |
| 61 virtual bool isEditControlOwnerDisabled() const = 0; | 61 virtual bool isEditControlOwnerDisabled() const = 0; |
| 62 virtual bool isEditControlOwnerReadOnly() const = 0; | 62 virtual bool isEditControlOwnerReadOnly() const = 0; |
| 63 virtual AtomicString localeIdentifier() const = 0; | 63 virtual AtomicString localeIdentifier() const = 0; |
| 64 virtual void editControlDidChangeValueByKeyboard() = 0; | 64 virtual void editControlDidChangeValueByKeyboard() = 0; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 76 String placeholderForMonth; | 76 String placeholderForMonth; |
| 77 String placeholderForYear; | 77 String placeholderForYear; |
| 78 | 78 |
| 79 LayoutParameters(Locale& locale, const StepRange& stepRange) | 79 LayoutParameters(Locale& locale, const StepRange& stepRange) |
| 80 : locale(locale) | 80 : locale(locale) |
| 81 , stepRange(stepRange) | 81 , stepRange(stepRange) |
| 82 { | 82 { |
| 83 } | 83 } |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 static PassRefPtrWillBeRawPtr<DateTimeEditElement> create(Document&, EditCon
trolOwner&); | 86 static RawPtr<DateTimeEditElement> create(Document&, EditControlOwner&); |
| 87 | 87 |
| 88 ~DateTimeEditElement() override; | 88 ~DateTimeEditElement() override; |
| 89 DECLARE_VIRTUAL_TRACE(); | 89 DECLARE_VIRTUAL_TRACE(); |
| 90 | 90 |
| 91 void addField(PassRefPtrWillBeRawPtr<DateTimeFieldElement>); | 91 void addField(RawPtr<DateTimeFieldElement>); |
| 92 bool anyEditableFieldsHaveValues() const; | 92 bool anyEditableFieldsHaveValues() const; |
| 93 void blurByOwner(); | 93 void blurByOwner(); |
| 94 void defaultEventHandler(Event*) override; | 94 void defaultEventHandler(Event*) override; |
| 95 void disabledStateChanged(); | 95 void disabledStateChanged(); |
| 96 Element* fieldsWrapperElement() const; | 96 Element* fieldsWrapperElement() const; |
| 97 void focusIfNoFocus(); | 97 void focusIfNoFocus(); |
| 98 // If oldFocusedNode is one of sub-fields, focus on it. Otherwise focus on | 98 // If oldFocusedNode is one of sub-fields, focus on it. Otherwise focus on |
| 99 // the first sub-field. | 99 // the first sub-field. |
| 100 void focusByOwner(Element* oldFocusedElement = 0); | 100 void focusByOwner(Element* oldFocusedElement = 0); |
| 101 bool hasFocusedField(); | 101 bool hasFocusedField(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 void didBlurFromField() override; | 145 void didBlurFromField() override; |
| 146 void didFocusOnField() override; | 146 void didFocusOnField() override; |
| 147 void fieldValueChanged() override; | 147 void fieldValueChanged() override; |
| 148 bool focusOnNextField(const DateTimeFieldElement&) override; | 148 bool focusOnNextField(const DateTimeFieldElement&) override; |
| 149 bool focusOnPreviousField(const DateTimeFieldElement&) override; | 149 bool focusOnPreviousField(const DateTimeFieldElement&) override; |
| 150 bool isFieldOwnerDisabled() const override; | 150 bool isFieldOwnerDisabled() const override; |
| 151 bool isFieldOwnerReadOnly() const override; | 151 bool isFieldOwnerReadOnly() const override; |
| 152 AtomicString localeIdentifier() const override; | 152 AtomicString localeIdentifier() const override; |
| 153 void fieldDidChangeValueByKeyboard() override; | 153 void fieldDidChangeValueByKeyboard() override; |
| 154 | 154 |
| 155 WillBeHeapVector<RawPtrWillBeMember<DateTimeFieldElement>, maximumNumberOfFi
elds> m_fields; | 155 HeapVector<Member<DateTimeFieldElement>, maximumNumberOfFields> m_fields; |
| 156 RawPtrWillBeMember<EditControlOwner> m_editControlOwner; | 156 Member<EditControlOwner> m_editControlOwner; |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 DEFINE_TYPE_CASTS(DateTimeEditElement, Element, element, element->isDateTimeEdit
Element(), element.isDateTimeEditElement()); | 159 DEFINE_TYPE_CASTS(DateTimeEditElement, Element, element, element->isDateTimeEdit
Element(), element.isDateTimeEditElement()); |
| 160 | 160 |
| 161 } // namespace blink | 161 } // namespace blink |
| 162 | 162 |
| 163 #endif | 163 #endif |
| 164 #endif | 164 #endif |
| OLD | NEW |