| 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 10 matching lines...) Expand all Loading... |
| 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 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 DateTimeFieldElement_h | 26 #ifndef DateTimeFieldElement_h |
| 27 #define DateTimeFieldElement_h | 27 #define DateTimeFieldElement_h |
| 28 | 28 |
| 29 #include "core/html/HTMLDivElement.h" | 29 #include "core/html/HTMLDivElement.h" |
| 30 #include "core/html/HTMLSpanElement.h" | 30 #include "core/html/HTMLSpanElement.h" |
| 31 #include "public/platform/WebFocusType.h" |
| 31 | 32 |
| 32 namespace blink { | 33 namespace blink { |
| 33 | 34 |
| 34 class DateComponents; | 35 class DateComponents; |
| 35 class DateTimeFieldsState; | 36 class DateTimeFieldsState; |
| 36 | 37 |
| 37 // DateTimeFieldElement is base class of date time field element. | 38 // DateTimeFieldElement is base class of date time field element. |
| 38 class DateTimeFieldElement : public HTMLSpanElement { | 39 class DateTimeFieldElement : public HTMLSpanElement { |
| 39 WTF_MAKE_NONCOPYABLE(DateTimeFieldElement); | 40 WTF_MAKE_NONCOPYABLE(DateTimeFieldElement); |
| 40 | 41 |
| 41 public: | 42 public: |
| 42 enum EventBehavior { | 43 enum EventBehavior { |
| 43 kDispatchNoEvent, | 44 kDispatchNoEvent, |
| 44 kDispatchEvent, | 45 kDispatchEvent, |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 // FieldOwner implementer must call removeEventHandler when | 48 // FieldOwner implementer must call removeEventHandler when |
| 48 // it doesn't handle event, e.g. at destruction. | 49 // it doesn't handle event, e.g. at destruction. |
| 49 class FieldOwner : public GarbageCollectedMixin { | 50 class FieldOwner : public GarbageCollectedMixin { |
| 50 public: | 51 public: |
| 51 virtual ~FieldOwner(); | 52 virtual ~FieldOwner(); |
| 52 virtual void DidBlurFromField() = 0; | 53 virtual void DidBlurFromField(WebFocusType) = 0; |
| 53 virtual void DidFocusOnField() = 0; | 54 virtual void DidFocusOnField(WebFocusType) = 0; |
| 54 virtual void FieldValueChanged() = 0; | 55 virtual void FieldValueChanged() = 0; |
| 55 virtual bool FocusOnNextField(const DateTimeFieldElement&) = 0; | 56 virtual bool FocusOnNextField(const DateTimeFieldElement&) = 0; |
| 56 virtual bool FocusOnPreviousField(const DateTimeFieldElement&) = 0; | 57 virtual bool FocusOnPreviousField(const DateTimeFieldElement&) = 0; |
| 57 virtual bool IsFieldOwnerDisabled() const = 0; | 58 virtual bool IsFieldOwnerDisabled() const = 0; |
| 58 virtual bool IsFieldOwnerReadOnly() const = 0; | 59 virtual bool IsFieldOwnerReadOnly() const = 0; |
| 59 virtual AtomicString LocaleIdentifier() const = 0; | 60 virtual AtomicString LocaleIdentifier() const = 0; |
| 60 virtual void FieldDidChangeValueByKeyboard() = 0; | 61 virtual void FieldDidChangeValueByKeyboard() = 0; |
| 61 }; | 62 }; |
| 62 | 63 |
| 63 void DefaultEventHandler(Event*) override; | 64 void DefaultEventHandler(Event*) override; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 87 const String& ax_help_text, | 88 const String& ax_help_text, |
| 88 int ax_minimum, | 89 int ax_minimum, |
| 89 int ax_maximum); | 90 int ax_maximum); |
| 90 Locale& LocaleForOwner() const; | 91 Locale& LocaleForOwner() const; |
| 91 AtomicString LocaleIdentifier() const; | 92 AtomicString LocaleIdentifier() const; |
| 92 void UpdateVisibleValue(EventBehavior); | 93 void UpdateVisibleValue(EventBehavior); |
| 93 virtual int ValueAsInteger() const = 0; | 94 virtual int ValueAsInteger() const = 0; |
| 94 virtual int ValueForARIAValueNow() const; | 95 virtual int ValueForARIAValueNow() const; |
| 95 | 96 |
| 96 // Node functions. | 97 // Node functions. |
| 97 void SetFocused(bool) override; | 98 void SetFocused(bool, WebFocusType) override; |
| 98 | 99 |
| 99 private: | 100 private: |
| 100 void DefaultKeyboardEventHandler(KeyboardEvent*); | 101 void DefaultKeyboardEventHandler(KeyboardEvent*); |
| 101 bool IsDateTimeFieldElement() const final; | 102 bool IsDateTimeFieldElement() const final; |
| 102 bool IsFieldOwnerDisabled() const; | 103 bool IsFieldOwnerDisabled() const; |
| 103 bool IsFieldOwnerReadOnly() const; | 104 bool IsFieldOwnerReadOnly() const; |
| 104 bool SupportsFocus() const final; | 105 bool SupportsFocus() const final; |
| 105 | 106 |
| 106 Member<FieldOwner> field_owner_; | 107 Member<FieldOwner> field_owner_; |
| 107 }; | 108 }; |
| 108 | 109 |
| 109 } // namespace blink | 110 } // namespace blink |
| 110 | 111 |
| 111 #endif | 112 #endif |
| OLD | NEW |