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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 struct Range { | 51 struct Range { |
52 Range(int minimum, int maximum) : minimum(minimum), maximum(maximum) { } | 52 Range(int minimum, int maximum) : minimum(minimum), maximum(maximum) { } |
53 int clampValue(int) const; | 53 int clampValue(int) const; |
54 bool isInRange(int) const; | 54 bool isInRange(int) const; |
55 bool isSingleton() const { return minimum == maximum; } | 55 bool isSingleton() const { return minimum == maximum; } |
56 | 56 |
57 int minimum; | 57 int minimum; |
58 int maximum; | 58 int maximum; |
59 }; | 59 }; |
60 | 60 |
61 virtual void acceptHeapVisitor(Visitor*) const OVERRIDE; | |
62 | |
63 protected: | 61 protected: |
64 DateTimeNumericFieldElement(Handle<Document>, FieldOwner&, const Range&, con
st Range& hardLimits, const String& placeholder, const Step& = Step()); | 62 DateTimeNumericFieldElement(Handle<Document>, FieldOwner&, const Range&, con
st Range& hardLimits, const String& placeholder, const Step& = Step()); |
65 | 63 |
66 int clampValue(int value) const { return m_range.clampValue(value); } | 64 int clampValue(int value) const { return m_range.clampValue(value); } |
67 virtual int defaultValueForStepDown() const; | 65 virtual int defaultValueForStepDown() const; |
68 virtual int defaultValueForStepUp() const; | 66 virtual int defaultValueForStepUp() const; |
69 const Range& range() const { return m_range; } | 67 const Range& range() const { return m_range; } |
70 | 68 |
71 // DateTimeFieldElement functions. | 69 // DateTimeFieldElement functions. |
72 virtual bool hasValue() const OVERRIDE FINAL; | 70 virtual bool hasValue() const OVERRIDE FINAL; |
73 void initialize(const AtomicString& pseudo, const String& axHelpText); | 71 void initialize(const AtomicString& pseudo, const String& axHelpText); |
74 int maximum() const; | 72 int maximum() const; |
75 virtual void setEmptyValue(EventBehavior = DispatchNoEvent) OVERRIDE FINAL; | 73 virtual void setEmptyValue(EventBehavior = DispatchNoEvent) OVERRIDE FINAL; |
76 virtual void setValueAsInteger(int, EventBehavior = DispatchNoEvent) OVERRID
E; | 74 virtual void setValueAsInteger(int, EventBehavior = DispatchNoEvent) OVERRID
E; |
77 virtual int valueAsInteger() const OVERRIDE FINAL; | 75 virtual int valueAsInteger() const OVERRIDE FINAL; |
78 virtual String visibleValue() const OVERRIDE FINAL; | 76 virtual String visibleValue() const OVERRIDE FINAL; |
79 | 77 |
| 78 virtual void acceptHeapVisitor(Visitor*) const OVERRIDE; |
| 79 |
80 private: | 80 private: |
81 // DateTimeFieldElement functions. | 81 // DateTimeFieldElement functions. |
82 virtual void didBlur() OVERRIDE FINAL; | 82 virtual void didBlur() OVERRIDE FINAL; |
83 virtual void handleKeyboardEvent(KeyboardEvent*) OVERRIDE FINAL; | 83 virtual void handleKeyboardEvent(KeyboardEvent*) OVERRIDE FINAL; |
84 virtual float maximumWidth(const Font&) OVERRIDE; | 84 virtual float maximumWidth(const Font&) OVERRIDE; |
85 virtual void stepDown() OVERRIDE FINAL; | 85 virtual void stepDown() OVERRIDE FINAL; |
86 virtual void stepUp() OVERRIDE FINAL; | 86 virtual void stepUp() OVERRIDE FINAL; |
87 virtual String value() const OVERRIDE FINAL; | 87 virtual String value() const OVERRIDE FINAL; |
88 | 88 |
89 String formatValue(int) const; | 89 String formatValue(int) const; |
90 int roundUp(int) const; | 90 int roundUp(int) const; |
91 int roundDown(int) const; | 91 int roundDown(int) const; |
92 int typeAheadValue() const; | 92 int typeAheadValue() const; |
93 | 93 |
94 DOMTimeStamp m_lastDigitCharTime; | 94 DOMTimeStamp m_lastDigitCharTime; |
95 const String m_placeholder; | 95 const String m_placeholder; |
96 const Range m_range; | 96 const Range m_range; |
97 const Range m_hardLimits; | 97 const Range m_hardLimits; |
98 const Step m_step; | 98 const Step m_step; |
99 int m_value; | 99 int m_value; |
100 bool m_hasValue; | 100 bool m_hasValue; |
101 mutable StringBuilder m_typeAheadBuffer; | 101 mutable StringBuilder m_typeAheadBuffer; |
102 }; | 102 }; |
103 | 103 |
104 } // namespace WebCore | 104 } // namespace WebCore |
105 | 105 |
106 #endif | 106 #endif |
107 #endif | 107 #endif |
OLD | NEW |