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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 197 |
198 | 198 |
199 // FIXME: We can't use stepUp() for the step value "any". So, we increase | 199 // FIXME: We can't use stepUp() for the step value "any". So, we increase |
200 // or decrease the value by 1/100 of the value range. Is it reasonable? | 200 // or decrease the value by 1/100 of the value range. Is it reasonable? |
201 const Decimal step = equalIgnoringCase(element().fastGetAttribute(stepAttr),
"any") ? (stepRange.maximum() - stepRange.minimum()) / 100 : stepRange.step(); | 201 const Decimal step = equalIgnoringCase(element().fastGetAttribute(stepAttr),
"any") ? (stepRange.maximum() - stepRange.minimum()) / 100 : stepRange.step(); |
202 const Decimal bigStep = max((stepRange.maximum() - stepRange.minimum()) / 10
, step); | 202 const Decimal bigStep = max((stepRange.maximum() - stepRange.minimum()) / 10
, step); |
203 | 203 |
204 bool isVertical = false; | 204 bool isVertical = false; |
205 if (element().renderer()) { | 205 if (element().renderer()) { |
206 ControlPart part = element().renderer()->style()->appearance(); | 206 ControlPart part = element().renderer()->style()->appearance(); |
207 isVertical = part == SliderVerticalPart || part == MediaVolumeSliderPart
; | 207 isVertical = part == SliderVerticalPart; |
208 } | 208 } |
209 | 209 |
210 Decimal newValue; | 210 Decimal newValue; |
211 if (key == "Up") | 211 if (key == "Up") |
212 newValue = current + step; | 212 newValue = current + step; |
213 else if (key == "Down") | 213 else if (key == "Down") |
214 newValue = current - step; | 214 newValue = current - step; |
215 else if (key == "Left") | 215 else if (key == "Left") |
216 newValue = isVertical ? current + step : current - step; | 216 newValue = isVertical ? current + step : current - step; |
217 else if (key == "Right") | 217 else if (key == "Right") |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 right = middle; | 394 right = middle; |
395 } | 395 } |
396 const Decimal closestLeft = middle ? m_tickMarkValues[middle - 1] : Decimal:
:infinity(Decimal::Negative); | 396 const Decimal closestLeft = middle ? m_tickMarkValues[middle - 1] : Decimal:
:infinity(Decimal::Negative); |
397 const Decimal closestRight = middle != m_tickMarkValues.size() ? m_tickMarkV
alues[middle] : Decimal::infinity(Decimal::Positive); | 397 const Decimal closestRight = middle != m_tickMarkValues.size() ? m_tickMarkV
alues[middle] : Decimal::infinity(Decimal::Positive); |
398 if (closestRight - value < value - closestLeft) | 398 if (closestRight - value < value - closestLeft) |
399 return closestRight; | 399 return closestRight; |
400 return closestLeft; | 400 return closestLeft; |
401 } | 401 } |
402 | 402 |
403 } // namespace WebCore | 403 } // namespace WebCore |
OLD | NEW |