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 22 matching lines...) Expand all Loading... |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
35 // DateTimeSymbolicFieldElement represents non-numeric field of data time | 35 // DateTimeSymbolicFieldElement represents non-numeric field of data time |
36 // format, such as: AM/PM, and month. | 36 // format, such as: AM/PM, and month. |
37 class DateTimeSymbolicFieldElement : public DateTimeFieldElement, public TypeAhe
adDataSource { | 37 class DateTimeSymbolicFieldElement : public DateTimeFieldElement, public TypeAhe
adDataSource { |
38 WTF_MAKE_NONCOPYABLE(DateTimeSymbolicFieldElement); | 38 WTF_MAKE_NONCOPYABLE(DateTimeSymbolicFieldElement); |
39 | 39 |
40 protected: | 40 protected: |
41 DateTimeSymbolicFieldElement(Document&, FieldOwner&, const Vector<String>&,
int minimum, int maximum); | 41 DateTimeSymbolicFieldElement(Document&, FieldOwner&, const Vector<String>&,
int minimum, int maximum); |
42 size_t symbolsSize() const { return m_symbols.size(); } | 42 size_t symbolsSize() const { return m_symbols.size(); } |
43 virtual bool hasValue() const override final; | 43 bool hasValue() const final; |
44 void initialize(const AtomicString& pseudo, const String& axHelpText); | 44 void initialize(const AtomicString& pseudo, const String& axHelpText); |
45 virtual void setEmptyValue(EventBehavior = DispatchNoEvent) override final; | 45 void setEmptyValue(EventBehavior = DispatchNoEvent) final; |
46 virtual void setValueAsInteger(int, EventBehavior = DispatchNoEvent) overrid
e final; | 46 void setValueAsInteger(int, EventBehavior = DispatchNoEvent) final; |
47 virtual int valueAsInteger() const override final; | 47 int valueAsInteger() const final; |
48 | 48 |
49 private: | 49 private: |
50 static const int invalidIndex = -1; | 50 static const int invalidIndex = -1; |
51 | 51 |
52 String visibleEmptyValue() const; | 52 String visibleEmptyValue() const; |
53 bool indexIsInRange(int index) const { return index >= m_minimumIndex && ind
ex <= m_maximumIndex; } | 53 bool indexIsInRange(int index) const { return index >= m_minimumIndex && ind
ex <= m_maximumIndex; } |
54 | 54 |
55 // DateTimeFieldElement functions. | 55 // DateTimeFieldElement functions. |
56 virtual void handleKeyboardEvent(KeyboardEvent*) override final; | 56 void handleKeyboardEvent(KeyboardEvent*) final; |
57 virtual float maximumWidth(const Font&) override; | 57 float maximumWidth(const Font&) override; |
58 virtual void stepDown() override final; | 58 void stepDown() final; |
59 virtual void stepUp() override final; | 59 void stepUp() final; |
60 virtual String value() const override final; | 60 String value() const final; |
61 virtual int valueForARIAValueNow() const override final; | 61 int valueForARIAValueNow() const final; |
62 virtual String visibleValue() const override final; | 62 String visibleValue() const final; |
63 | 63 |
64 // TypeAheadDataSource functions. | 64 // TypeAheadDataSource functions. |
65 virtual int indexOfSelectedOption() const override; | 65 int indexOfSelectedOption() const override; |
66 virtual int optionCount() const override; | 66 int optionCount() const override; |
67 virtual String optionAtIndex(int index) const override; | 67 String optionAtIndex(int index) const override; |
68 | 68 |
69 const Vector<String> m_symbols; | 69 const Vector<String> m_symbols; |
70 | 70 |
71 // We use AtomicString to share visible empty value among multiple | 71 // We use AtomicString to share visible empty value among multiple |
72 // DateTimeEditElements in the page. | 72 // DateTimeEditElements in the page. |
73 const AtomicString m_visibleEmptyValue; | 73 const AtomicString m_visibleEmptyValue; |
74 int m_selectedIndex; | 74 int m_selectedIndex; |
75 TypeAhead m_typeAhead; | 75 TypeAhead m_typeAhead; |
76 const int m_minimumIndex; | 76 const int m_minimumIndex; |
77 const int m_maximumIndex; | 77 const int m_maximumIndex; |
78 }; | 78 }; |
79 | 79 |
80 } // namespace blink | 80 } // namespace blink |
81 | 81 |
82 #endif | 82 #endif |
83 #endif | 83 #endif |
OLD | NEW |