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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 return static_cast<int>(m_symbols.size()); | 100 return static_cast<int>(m_symbols.size()); |
101 } | 101 } |
102 | 102 |
103 int DateTimeSymbolicFieldElement::minimum() const | 103 int DateTimeSymbolicFieldElement::minimum() const |
104 { | 104 { |
105 return 1; | 105 return 1; |
106 } | 106 } |
107 | 107 |
108 void DateTimeSymbolicFieldElement::setEmptyValue(EventBehavior eventBehavior) | 108 void DateTimeSymbolicFieldElement::setEmptyValue(EventBehavior eventBehavior) |
109 { | 109 { |
| 110 if (isReadOnly()) |
| 111 return; |
110 m_selectedIndex = invalidIndex; | 112 m_selectedIndex = invalidIndex; |
111 updateVisibleValue(eventBehavior); | 113 updateVisibleValue(eventBehavior); |
112 } | 114 } |
113 | 115 |
114 void DateTimeSymbolicFieldElement::setValueAsInteger(int newSelectedIndex, Event
Behavior eventBehavior) | 116 void DateTimeSymbolicFieldElement::setValueAsInteger(int newSelectedIndex, Event
Behavior eventBehavior) |
115 { | 117 { |
116 m_selectedIndex = std::max(0, std::min(newSelectedIndex, static_cast<int>(m_
symbols.size() - 1))); | 118 m_selectedIndex = std::max(0, std::min(newSelectedIndex, static_cast<int>(m_
symbols.size() - 1))); |
117 updateVisibleValue(eventBehavior); | 119 updateVisibleValue(eventBehavior); |
118 } | 120 } |
119 | 121 |
(...skipping 26 matching lines...) Expand all Loading... |
146 } | 148 } |
147 | 149 |
148 String DateTimeSymbolicFieldElement::visibleValue() const | 150 String DateTimeSymbolicFieldElement::visibleValue() const |
149 { | 151 { |
150 return hasValue() ? m_symbols[m_selectedIndex] : visibleEmptyValue(); | 152 return hasValue() ? m_symbols[m_selectedIndex] : visibleEmptyValue(); |
151 } | 153 } |
152 | 154 |
153 } // namespace WebCore | 155 } // namespace WebCore |
154 | 156 |
155 #endif | 157 #endif |
OLD | NEW |