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 DateTimeNumericFieldElement_h | 26 #ifndef DateTimeNumericFieldElement_h |
27 #define DateTimeNumericFieldElement_h | 27 #define DateTimeNumericFieldElement_h |
28 | 28 |
29 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) | 29 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) |
30 #include "core/html/shadow/DateTimeFieldElement.h" | 30 #include "core/html/shadow/DateTimeFieldElement.h" |
31 | 31 |
| 32 #include "wtf/Allocator.h" |
32 #include "wtf/text/StringBuilder.h" | 33 #include "wtf/text/StringBuilder.h" |
33 #include "wtf/text/WTFString.h" | 34 #include "wtf/text/WTFString.h" |
34 | 35 |
35 namespace blink { | 36 namespace blink { |
36 | 37 |
37 // DateTimeNumericFieldElement represents numeric field of date time format, | 38 // DateTimeNumericFieldElement represents numeric field of date time format, |
38 // such as: | 39 // such as: |
39 // - hour | 40 // - hour |
40 // - minute | 41 // - minute |
41 // - millisecond | 42 // - millisecond |
42 // - second | 43 // - second |
43 // - year | 44 // - year |
44 class DateTimeNumericFieldElement : public DateTimeFieldElement { | 45 class DateTimeNumericFieldElement : public DateTimeFieldElement { |
45 WTF_MAKE_NONCOPYABLE(DateTimeNumericFieldElement); | 46 WTF_MAKE_NONCOPYABLE(DateTimeNumericFieldElement); |
46 | 47 |
47 public: | 48 public: |
48 struct Step { | 49 struct Step { |
| 50 DISALLOW_ALLOCATION(); |
49 Step(int step = 1, int stepBase = 0) : step(step), stepBase(stepBase) {
} | 51 Step(int step = 1, int stepBase = 0) : step(step), stepBase(stepBase) {
} |
50 int step; | 52 int step; |
51 int stepBase; | 53 int stepBase; |
52 }; | 54 }; |
53 | 55 |
54 struct Range { | 56 struct Range { |
| 57 DISALLOW_ALLOCATION(); |
55 Range(int minimum, int maximum) : minimum(minimum), maximum(maximum) { } | 58 Range(int minimum, int maximum) : minimum(minimum), maximum(maximum) { } |
56 int clampValue(int) const; | 59 int clampValue(int) const; |
57 bool isInRange(int) const; | 60 bool isInRange(int) const; |
58 bool isSingleton() const { return minimum == maximum; } | 61 bool isSingleton() const { return minimum == maximum; } |
59 | 62 |
60 int minimum; | 63 int minimum; |
61 int maximum; | 64 int maximum; |
62 }; | 65 }; |
63 | 66 |
64 protected: | 67 protected: |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 const Step m_step; | 103 const Step m_step; |
101 int m_value; | 104 int m_value; |
102 bool m_hasValue; | 105 bool m_hasValue; |
103 mutable StringBuilder m_typeAheadBuffer; | 106 mutable StringBuilder m_typeAheadBuffer; |
104 }; | 107 }; |
105 | 108 |
106 } // namespace blink | 109 } // namespace blink |
107 | 110 |
108 #endif | 111 #endif |
109 #endif | 112 #endif |
OLD | NEW |