OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * Copyright (C) 2011 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 element().setValue(element().value()); | 275 element().setValue(element().value()); |
276 element().updateView(); | 276 element().updateView(); |
277 } | 277 } |
278 | 278 |
279 void RangeInputType::stepAttributeChanged() { | 279 void RangeInputType::stepAttributeChanged() { |
280 if (element().hasDirtyValue()) | 280 if (element().hasDirtyValue()) |
281 element().setValue(element().value()); | 281 element().setValue(element().value()); |
282 element().updateView(); | 282 element().updateView(); |
283 } | 283 } |
284 | 284 |
285 void RangeInputType::setValue(const String& value, | 285 void RangeInputType::didSetValue(const String&, bool valueChanged) { |
286 bool valueChanged, | |
287 TextFieldEventBehavior eventBehavior) { | |
288 InputType::setValue(value, valueChanged, eventBehavior); | |
289 | |
290 if (valueChanged) | 286 if (valueChanged) |
291 element().updateView(); | 287 element().updateView(); |
292 } | 288 } |
293 | 289 |
294 void RangeInputType::updateView() { | 290 void RangeInputType::updateView() { |
295 sliderThumbElement()->setPositionFromValue(); | 291 sliderThumbElement()->setPositionFromValue(); |
296 } | 292 } |
297 | 293 |
298 String RangeInputType::fallbackValue() const { | 294 String RangeInputType::fallbackValue() const { |
299 return serializeForNumberType(createStepRange(RejectAny).defaultValue()); | 295 return serializeForNumberType(createStepRange(RejectAny).defaultValue()); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 : Decimal::infinity(Decimal::Negative); | 400 : Decimal::infinity(Decimal::Negative); |
405 const Decimal closestRight = middle != m_tickMarkValues.size() | 401 const Decimal closestRight = middle != m_tickMarkValues.size() |
406 ? m_tickMarkValues[middle] | 402 ? m_tickMarkValues[middle] |
407 : Decimal::infinity(Decimal::Positive); | 403 : Decimal::infinity(Decimal::Positive); |
408 if (closestRight - value < value - closestLeft) | 404 if (closestRight - value < value - closestLeft) |
409 return closestRight; | 405 return closestRight; |
410 return closestLeft; | 406 return closestLeft; |
411 } | 407 } |
412 | 408 |
413 } // namespace blink | 409 } // namespace blink |
OLD | NEW |