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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 | 247 |
248 Document* document = element()->document(); | 248 Document* document = element()->document(); |
249 RefPtr<HTMLDivElement> track = HTMLDivElement::create(document); | 249 RefPtr<HTMLDivElement> track = HTMLDivElement::create(document); |
250 track->setPseudo(AtomicString("-webkit-slider-runnable-track", AtomicString:
:ConstructFromLiteral)); | 250 track->setPseudo(AtomicString("-webkit-slider-runnable-track", AtomicString:
:ConstructFromLiteral)); |
251 track->appendChild(SliderThumbElement::create(document), IGNORE_EXCEPTION); | 251 track->appendChild(SliderThumbElement::create(document), IGNORE_EXCEPTION); |
252 RefPtr<HTMLElement> container = SliderContainerElement::create(document); | 252 RefPtr<HTMLElement> container = SliderContainerElement::create(document); |
253 container->appendChild(track.release(), IGNORE_EXCEPTION); | 253 container->appendChild(track.release(), IGNORE_EXCEPTION); |
254 element()->userAgentShadowRoot()->appendChild(container.release(), IGNORE_EX
CEPTION); | 254 element()->userAgentShadowRoot()->appendChild(container.release(), IGNORE_EX
CEPTION); |
255 } | 255 } |
256 | 256 |
257 RenderObject* RangeInputType::createRenderer(RenderArena* arena, RenderStyle*) c
onst | 257 RenderObject* RangeInputType::createRenderer(RenderStyle*) const |
258 { | 258 { |
259 return new (arena) RenderSlider(element()); | 259 return new RenderSlider(element()); |
260 } | 260 } |
261 | 261 |
262 Decimal RangeInputType::parseToNumber(const String& src, const Decimal& defaultV
alue) const | 262 Decimal RangeInputType::parseToNumber(const String& src, const Decimal& defaultV
alue) const |
263 { | 263 { |
264 return parseToDecimalForNumberType(src, defaultValue); | 264 return parseToDecimalForNumberType(src, defaultValue); |
265 } | 265 } |
266 | 266 |
267 String RangeInputType::serialize(const Decimal& value) const | 267 String RangeInputType::serialize(const Decimal& value) const |
268 { | 268 { |
269 if (!value.isFinite()) | 269 if (!value.isFinite()) |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 right = middle; | 390 right = middle; |
391 } | 391 } |
392 const Decimal closestLeft = middle ? m_tickMarkValues[middle - 1] : Decimal:
:infinity(Decimal::Negative); | 392 const Decimal closestLeft = middle ? m_tickMarkValues[middle - 1] : Decimal:
:infinity(Decimal::Negative); |
393 const Decimal closestRight = middle != m_tickMarkValues.size() ? m_tickMarkV
alues[middle] : Decimal::infinity(Decimal::Positive); | 393 const Decimal closestRight = middle != m_tickMarkValues.size() ? m_tickMarkV
alues[middle] : Decimal::infinity(Decimal::Positive); |
394 if (closestRight - value < value - closestLeft) | 394 if (closestRight - value < value - closestLeft) |
395 return closestRight; | 395 return closestRight; |
396 return closestLeft; | 396 return closestLeft; |
397 } | 397 } |
398 | 398 |
399 } // namespace WebCore | 399 } // namespace WebCore |
OLD | NEW |