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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 else | 225 else |
226 return; // Did not match any key binding. | 226 return; // Did not match any key binding. |
227 | 227 |
228 newValue = stepRange.clampValue(newValue); | 228 newValue = stepRange.clampValue(newValue); |
229 | 229 |
230 if (newValue != current) { | 230 if (newValue != current) { |
231 EventQueueScope scope; | 231 EventQueueScope scope; |
232 TextFieldEventBehavior eventBehavior = DispatchChangeEvent; | 232 TextFieldEventBehavior eventBehavior = DispatchChangeEvent; |
233 setValueAsDecimal(newValue, eventBehavior, IGNORE_EXCEPTION); | 233 setValueAsDecimal(newValue, eventBehavior, IGNORE_EXCEPTION); |
234 | 234 |
235 if (AXObjectCache* cache = element()->document()->existingAXObjectCache(
)) | 235 if (AXObjectCache* cache = element()->document().existingAXObjectCache()
) |
236 cache->postNotification(element(), AXObjectCache::AXValueChanged, tr
ue); | 236 cache->postNotification(element(), AXObjectCache::AXValueChanged, tr
ue); |
237 element()->dispatchFormControlChangeEvent(); | 237 element()->dispatchFormControlChangeEvent(); |
238 } | 238 } |
239 | 239 |
240 event->setDefaultHandled(); | 240 event->setDefaultHandled(); |
241 } | 241 } |
242 | 242 |
243 void RangeInputType::createShadowSubtree() | 243 void RangeInputType::createShadowSubtree() |
244 { | 244 { |
245 ASSERT(element()->shadow()); | 245 ASSERT(element()->shadow()); |
246 | 246 |
247 Document* document = element()->document(); | 247 Document* document = &element()->document(); |
248 RefPtr<HTMLDivElement> track = HTMLDivElement::create(document); | 248 RefPtr<HTMLDivElement> track = HTMLDivElement::create(document); |
249 track->setPart(AtomicString("-webkit-slider-runnable-track", AtomicString::C
onstructFromLiteral)); | 249 track->setPart(AtomicString("-webkit-slider-runnable-track", AtomicString::C
onstructFromLiteral)); |
250 track->setAttribute(idAttr, ShadowElementNames::sliderTrack()); | 250 track->setAttribute(idAttr, ShadowElementNames::sliderTrack()); |
251 track->appendChild(SliderThumbElement::create(document)); | 251 track->appendChild(SliderThumbElement::create(document)); |
252 RefPtr<HTMLElement> container = SliderContainerElement::create(document); | 252 RefPtr<HTMLElement> container = SliderContainerElement::create(document); |
253 container->appendChild(track.release()); | 253 container->appendChild(track.release()); |
254 element()->userAgentShadowRoot()->appendChild(container.release()); | 254 element()->userAgentShadowRoot()->appendChild(container.release()); |
255 } | 255 } |
256 | 256 |
257 RenderObject* RangeInputType::createRenderer(RenderStyle*) const | 257 RenderObject* RangeInputType::createRenderer(RenderStyle*) const |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 right = middle; | 387 right = middle; |
388 } | 388 } |
389 const Decimal closestLeft = middle ? m_tickMarkValues[middle - 1] : Decimal:
:infinity(Decimal::Negative); | 389 const Decimal closestLeft = middle ? m_tickMarkValues[middle - 1] : Decimal:
:infinity(Decimal::Negative); |
390 const Decimal closestRight = middle != m_tickMarkValues.size() ? m_tickMarkV
alues[middle] : Decimal::infinity(Decimal::Positive); | 390 const Decimal closestRight = middle != m_tickMarkValues.size() ? m_tickMarkV
alues[middle] : Decimal::infinity(Decimal::Positive); |
391 if (closestRight - value < value - closestLeft) | 391 if (closestRight - value < value - closestLeft) |
392 return closestRight; | 392 return closestRight; |
393 return closestLeft; | 393 return closestLeft; |
394 } | 394 } |
395 | 395 |
396 } // namespace WebCore | 396 } // namespace WebCore |
OLD | NEW |