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 23 matching lines...) Expand all Loading... |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 class DateTimeFieldsState; | 36 class DateTimeFieldsState; |
37 class Locale; | 37 class Locale; |
38 class StepRange; | 38 class StepRange; |
39 | 39 |
40 // DateTimeEditElement class contains numberic field and symbolc field for | 40 // DateTimeEditElement class contains numberic field and symbolc field for |
41 // representing date and time, such as | 41 // representing date and time, such as |
42 // - Year, Month, Day Of Month | 42 // - Year, Month, Day Of Month |
43 // - Hour, Minute, Second, Millisecond, AM/PM | 43 // - Hour, Minute, Second, Millisecond, AM/PM |
44 class DateTimeEditElement FINAL : public HTMLDivElement, public DateTimeFieldEle
ment::FieldOwner { | 44 class DateTimeEditElement final : public HTMLDivElement, public DateTimeFieldEle
ment::FieldOwner { |
45 WTF_MAKE_NONCOPYABLE(DateTimeEditElement); | 45 WTF_MAKE_NONCOPYABLE(DateTimeEditElement); |
46 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(DateTimeEditElement); | 46 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(DateTimeEditElement); |
47 | 47 |
48 public: | 48 public: |
49 // EditControlOwner implementer must call removeEditControlOwner when | 49 // EditControlOwner implementer must call removeEditControlOwner when |
50 // it doesn't handle event, e.g. at destruction. | 50 // it doesn't handle event, e.g. at destruction. |
51 class EditControlOwner : public WillBeGarbageCollectedMixin { | 51 class EditControlOwner : public WillBeGarbageCollectedMixin { |
52 public: | 52 public: |
53 virtual ~EditControlOwner(); | 53 virtual ~EditControlOwner(); |
54 virtual void didBlurFromControl() = 0; | 54 virtual void didBlurFromControl() = 0; |
(...skipping 20 matching lines...) Expand all Loading... |
75 LayoutParameters(Locale& locale, const StepRange& stepRange) | 75 LayoutParameters(Locale& locale, const StepRange& stepRange) |
76 : locale(locale) | 76 : locale(locale) |
77 , stepRange(stepRange) | 77 , stepRange(stepRange) |
78 { | 78 { |
79 } | 79 } |
80 }; | 80 }; |
81 | 81 |
82 static PassRefPtrWillBeRawPtr<DateTimeEditElement> create(Document&, EditCon
trolOwner&); | 82 static PassRefPtrWillBeRawPtr<DateTimeEditElement> create(Document&, EditCon
trolOwner&); |
83 | 83 |
84 virtual ~DateTimeEditElement(); | 84 virtual ~DateTimeEditElement(); |
85 virtual void trace(Visitor*) OVERRIDE; | 85 virtual void trace(Visitor*) override; |
86 | 86 |
87 void addField(PassRefPtrWillBeRawPtr<DateTimeFieldElement>); | 87 void addField(PassRefPtrWillBeRawPtr<DateTimeFieldElement>); |
88 bool anyEditableFieldsHaveValues() const; | 88 bool anyEditableFieldsHaveValues() const; |
89 void blurByOwner(); | 89 void blurByOwner(); |
90 virtual void defaultEventHandler(Event*) OVERRIDE; | 90 virtual void defaultEventHandler(Event*) override; |
91 void disabledStateChanged(); | 91 void disabledStateChanged(); |
92 Element* fieldsWrapperElement() const; | 92 Element* fieldsWrapperElement() const; |
93 void focusIfNoFocus(); | 93 void focusIfNoFocus(); |
94 // If oldFocusedNode is one of sub-fields, focus on it. Otherwise focus on | 94 // If oldFocusedNode is one of sub-fields, focus on it. Otherwise focus on |
95 // the first sub-field. | 95 // the first sub-field. |
96 void focusByOwner(Element* oldFocusedElement = 0); | 96 void focusByOwner(Element* oldFocusedElement = 0); |
97 bool hasFocusedField(); | 97 bool hasFocusedField(); |
98 void readOnlyStateChanged(); | 98 void readOnlyStateChanged(); |
99 void removeEditControlOwner() { m_editControlOwner = nullptr; } | 99 void removeEditControlOwner() { m_editControlOwner = nullptr; } |
100 void resetFields(); | 100 void resetFields(); |
(...skipping 26 matching lines...) Expand all Loading... |
127 size_t fieldIndexOf(const DateTimeFieldElement&) const; | 127 size_t fieldIndexOf(const DateTimeFieldElement&) const; |
128 DateTimeFieldElement* focusedField() const; | 128 DateTimeFieldElement* focusedField() const; |
129 size_t focusedFieldIndex() const; | 129 size_t focusedFieldIndex() const; |
130 bool focusOnNextFocusableField(size_t startIndex); | 130 bool focusOnNextFocusableField(size_t startIndex); |
131 bool isDisabled() const; | 131 bool isDisabled() const; |
132 bool isReadOnly() const; | 132 bool isReadOnly() const; |
133 void layout(const LayoutParameters&, const DateComponents&); | 133 void layout(const LayoutParameters&, const DateComponents&); |
134 void updateUIState(); | 134 void updateUIState(); |
135 | 135 |
136 // Element function. | 136 // Element function. |
137 virtual PassRefPtr<RenderStyle> customStyleForRenderer() OVERRIDE; | 137 virtual PassRefPtr<RenderStyle> customStyleForRenderer() override; |
138 virtual bool isDateTimeEditElement() const OVERRIDE; | 138 virtual bool isDateTimeEditElement() const override; |
139 | 139 |
140 // DateTimeFieldElement::FieldOwner functions. | 140 // DateTimeFieldElement::FieldOwner functions. |
141 virtual void didBlurFromField() OVERRIDE; | 141 virtual void didBlurFromField() override; |
142 virtual void didFocusOnField() OVERRIDE; | 142 virtual void didFocusOnField() override; |
143 virtual void fieldValueChanged() OVERRIDE; | 143 virtual void fieldValueChanged() override; |
144 virtual bool focusOnNextField(const DateTimeFieldElement&) OVERRIDE; | 144 virtual bool focusOnNextField(const DateTimeFieldElement&) override; |
145 virtual bool focusOnPreviousField(const DateTimeFieldElement&) OVERRIDE; | 145 virtual bool focusOnPreviousField(const DateTimeFieldElement&) override; |
146 virtual bool isFieldOwnerDisabled() const OVERRIDE; | 146 virtual bool isFieldOwnerDisabled() const override; |
147 virtual bool isFieldOwnerReadOnly() const OVERRIDE; | 147 virtual bool isFieldOwnerReadOnly() const override; |
148 virtual AtomicString localeIdentifier() const OVERRIDE; | 148 virtual AtomicString localeIdentifier() const override; |
149 virtual void fieldDidChangeValueByKeyboard() OVERRIDE; | 149 virtual void fieldDidChangeValueByKeyboard() override; |
150 | 150 |
151 WillBeHeapVector<RawPtrWillBeMember<DateTimeFieldElement>, maximumNumberOfFi
elds> m_fields; | 151 WillBeHeapVector<RawPtrWillBeMember<DateTimeFieldElement>, maximumNumberOfFi
elds> m_fields; |
152 RawPtrWillBeMember<EditControlOwner> m_editControlOwner; | 152 RawPtrWillBeMember<EditControlOwner> m_editControlOwner; |
153 }; | 153 }; |
154 | 154 |
155 DEFINE_TYPE_CASTS(DateTimeEditElement, Element, element, element->isDateTimeEdit
Element(), element.isDateTimeEditElement()); | 155 DEFINE_TYPE_CASTS(DateTimeEditElement, Element, element, element->isDateTimeEdit
Element(), element.isDateTimeEditElement()); |
156 | 156 |
157 } // namespace blink | 157 } // namespace blink |
158 | 158 |
159 #endif | 159 #endif |
160 #endif | 160 #endif |
OLD | NEW |