| 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 11 matching lines...) Expand all Loading... |
| 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 23 * SUCH DAMAGE. | 23 * SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef DateTimeEditElement_h | 26 #ifndef DateTimeEditElement_h |
| 27 #define DateTimeEditElement_h | 27 #define DateTimeEditElement_h |
| 28 | 28 |
| 29 #include "core/html/forms/StepRange.h" | 29 #include "core/html/forms/StepRange.h" |
| 30 #include "core/html/shadow/DateTimeFieldElement.h" | 30 #include "core/html/shadow/DateTimeFieldElement.h" |
| 31 #include "platform/DateComponents.h" | 31 #include "platform/DateComponents.h" |
| 32 #include "public/platform/WebFocusType.h" |
| 32 #include "wtf/Allocator.h" | 33 #include "wtf/Allocator.h" |
| 33 | 34 |
| 34 namespace blink { | 35 namespace blink { |
| 35 | 36 |
| 36 class DateTimeFieldsState; | 37 class DateTimeFieldsState; |
| 37 class Locale; | 38 class Locale; |
| 38 class StepRange; | 39 class StepRange; |
| 39 | 40 |
| 40 // DateTimeEditElement class contains numberic field and symbolc field for | 41 // DateTimeEditElement class contains numberic field and symbolc field for |
| 41 // representing date and time, such as | 42 // representing date and time, such as |
| 42 // - Year, Month, Day Of Month | 43 // - Year, Month, Day Of Month |
| 43 // - Hour, Minute, Second, Millisecond, AM/PM | 44 // - Hour, Minute, Second, Millisecond, AM/PM |
| 44 class DateTimeEditElement final : public HTMLDivElement, | 45 class DateTimeEditElement final : public HTMLDivElement, |
| 45 public DateTimeFieldElement::FieldOwner { | 46 public DateTimeFieldElement::FieldOwner { |
| 46 WTF_MAKE_NONCOPYABLE(DateTimeEditElement); | 47 WTF_MAKE_NONCOPYABLE(DateTimeEditElement); |
| 47 USING_GARBAGE_COLLECTED_MIXIN(DateTimeEditElement); | 48 USING_GARBAGE_COLLECTED_MIXIN(DateTimeEditElement); |
| 48 | 49 |
| 49 public: | 50 public: |
| 50 // EditControlOwner implementer must call removeEditControlOwner when | 51 // EditControlOwner implementer must call removeEditControlOwner when |
| 51 // it doesn't handle event, e.g. at destruction. | 52 // it doesn't handle event, e.g. at destruction. |
| 52 class EditControlOwner : public GarbageCollectedMixin { | 53 class EditControlOwner : public GarbageCollectedMixin { |
| 53 public: | 54 public: |
| 54 virtual ~EditControlOwner(); | 55 virtual ~EditControlOwner(); |
| 55 virtual void DidBlurFromControl() = 0; | 56 virtual void DidBlurFromControl(WebFocusType) = 0; |
| 56 virtual void DidFocusOnControl() = 0; | 57 virtual void DidFocusOnControl(WebFocusType) = 0; |
| 57 virtual void EditControlValueChanged() = 0; | 58 virtual void EditControlValueChanged() = 0; |
| 58 virtual String FormatDateTimeFieldsState( | 59 virtual String FormatDateTimeFieldsState( |
| 59 const DateTimeFieldsState&) const = 0; | 60 const DateTimeFieldsState&) const = 0; |
| 60 virtual bool IsEditControlOwnerDisabled() const = 0; | 61 virtual bool IsEditControlOwnerDisabled() const = 0; |
| 61 virtual bool IsEditControlOwnerReadOnly() const = 0; | 62 virtual bool IsEditControlOwnerReadOnly() const = 0; |
| 62 virtual AtomicString LocaleIdentifier() const = 0; | 63 virtual AtomicString LocaleIdentifier() const = 0; |
| 63 virtual void EditControlDidChangeValueByKeyboard() = 0; | 64 virtual void EditControlDidChangeValueByKeyboard() = 0; |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 struct LayoutParameters { | 67 struct LayoutParameters { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 bool IsDisabled() const; | 133 bool IsDisabled() const; |
| 133 bool IsReadOnly() const; | 134 bool IsReadOnly() const; |
| 134 void GetLayout(const LayoutParameters&, const DateComponents&); | 135 void GetLayout(const LayoutParameters&, const DateComponents&); |
| 135 void UpdateUIState(); | 136 void UpdateUIState(); |
| 136 | 137 |
| 137 // Element function. | 138 // Element function. |
| 138 PassRefPtr<ComputedStyle> CustomStyleForLayoutObject() override; | 139 PassRefPtr<ComputedStyle> CustomStyleForLayoutObject() override; |
| 139 bool IsDateTimeEditElement() const override; | 140 bool IsDateTimeEditElement() const override; |
| 140 | 141 |
| 141 // DateTimeFieldElement::FieldOwner functions. | 142 // DateTimeFieldElement::FieldOwner functions. |
| 142 void DidBlurFromField() override; | 143 void DidBlurFromField(WebFocusType) override; |
| 143 void DidFocusOnField() override; | 144 void DidFocusOnField(WebFocusType) override; |
| 144 void FieldValueChanged() override; | 145 void FieldValueChanged() override; |
| 145 bool FocusOnNextField(const DateTimeFieldElement&) override; | 146 bool FocusOnNextField(const DateTimeFieldElement&) override; |
| 146 bool FocusOnPreviousField(const DateTimeFieldElement&) override; | 147 bool FocusOnPreviousField(const DateTimeFieldElement&) override; |
| 147 bool IsFieldOwnerDisabled() const override; | 148 bool IsFieldOwnerDisabled() const override; |
| 148 bool IsFieldOwnerReadOnly() const override; | 149 bool IsFieldOwnerReadOnly() const override; |
| 149 AtomicString LocaleIdentifier() const override; | 150 AtomicString LocaleIdentifier() const override; |
| 150 void FieldDidChangeValueByKeyboard() override; | 151 void FieldDidChangeValueByKeyboard() override; |
| 151 | 152 |
| 152 HeapVector<Member<DateTimeFieldElement>, kMaximumNumberOfFields> fields_; | 153 HeapVector<Member<DateTimeFieldElement>, kMaximumNumberOfFields> fields_; |
| 153 Member<EditControlOwner> edit_control_owner_; | 154 Member<EditControlOwner> edit_control_owner_; |
| 154 }; | 155 }; |
| 155 | 156 |
| 156 DEFINE_TYPE_CASTS(DateTimeEditElement, | 157 DEFINE_TYPE_CASTS(DateTimeEditElement, |
| 157 Element, | 158 Element, |
| 158 element, | 159 element, |
| 159 element->IsDateTimeEditElement(), | 160 element->IsDateTimeEditElement(), |
| 160 element.IsDateTimeEditElement()); | 161 element.IsDateTimeEditElement()); |
| 161 | 162 |
| 162 } // namespace blink | 163 } // namespace blink |
| 163 | 164 |
| 164 #endif | 165 #endif |
| OLD | NEW |