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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 return std::min(std::max(value, minimum), maximum); | 45 return std::min(std::max(value, minimum), maximum); |
46 } | 46 } |
47 | 47 |
48 bool DateTimeNumericFieldElement::Range::isInRange(int value) const | 48 bool DateTimeNumericFieldElement::Range::isInRange(int value) const |
49 { | 49 { |
50 return value >= minimum && value <= maximum; | 50 return value >= minimum && value <= maximum; |
51 } | 51 } |
52 | 52 |
53 // ---------------------------- | 53 // ---------------------------- |
54 | 54 |
55 DateTimeNumericFieldElement::DateTimeNumericFieldElement(Document* document, Fie
ldOwner& fieldOwner, const Range& range, const Range& hardLimits, const String&
placeholder, const DateTimeNumericFieldElement::Step& step) | 55 DateTimeNumericFieldElement::DateTimeNumericFieldElement(Document& document, Fie
ldOwner& fieldOwner, const Range& range, const Range& hardLimits, const String&
placeholder, const DateTimeNumericFieldElement::Step& step) |
56 : DateTimeFieldElement(document, fieldOwner) | 56 : DateTimeFieldElement(document, fieldOwner) |
57 , m_lastDigitCharTime(0) | 57 , m_lastDigitCharTime(0) |
58 , m_placeholder(placeholder) | 58 , m_placeholder(placeholder) |
59 , m_range(range) | 59 , m_range(range) |
60 , m_hardLimits(hardLimits) | 60 , m_hardLimits(hardLimits) |
61 , m_step(step) | 61 , m_step(step) |
62 , m_value(0) | 62 , m_value(0) |
63 , m_hasValue(false) | 63 , m_hasValue(false) |
64 { | 64 { |
65 ASSERT(m_step.step); | 65 ASSERT(m_step.step); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 if (n >= 0) | 238 if (n >= 0) |
239 n = (n + m_step.step - 1) / m_step.step * m_step.step; | 239 n = (n + m_step.step - 1) / m_step.step * m_step.step; |
240 else | 240 else |
241 n = -(-n / m_step.step * m_step.step); | 241 n = -(-n / m_step.step * m_step.step); |
242 return n + m_step.stepBase; | 242 return n + m_step.stepBase; |
243 } | 243 } |
244 | 244 |
245 } // namespace WebCore | 245 } // namespace WebCore |
246 | 246 |
247 #endif | 247 #endif |
OLD | NEW |