Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(601)

Side by Side Diff: Source/core/html/forms/RangeInputType.cpp

Issue 301563002: Remove the precision="float" attribute on <input type="range"> (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLInputElement.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } 121 }
122 122
123 StepRange RangeInputType::createStepRange(AnyStepHandling anyStepHandling) const 123 StepRange RangeInputType::createStepRange(AnyStepHandling anyStepHandling) const
124 { 124 {
125 DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (rang eDefaultStep, rangeDefaultStepBase, rangeStepScaleFactor)); 125 DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (rang eDefaultStep, rangeDefaultStepBase, rangeStepScaleFactor));
126 126
127 const Decimal stepBase = findStepBase(rangeDefaultStepBase); 127 const Decimal stepBase = findStepBase(rangeDefaultStepBase);
128 const Decimal minimum = parseToNumber(element().fastGetAttribute(minAttr), r angeDefaultMinimum); 128 const Decimal minimum = parseToNumber(element().fastGetAttribute(minAttr), r angeDefaultMinimum);
129 const Decimal maximum = ensureMaximum(parseToNumber(element().fastGetAttribu te(maxAttr), rangeDefaultMaximum), minimum, rangeDefaultMaximum); 129 const Decimal maximum = ensureMaximum(parseToNumber(element().fastGetAttribu te(maxAttr), rangeDefaultMaximum), minimum, rangeDefaultMaximum);
130 130
131 const AtomicString& precisionValue = element().fastGetAttribute(precisionAtt r);
132 if (!precisionValue.isNull()) {
133 const Decimal step = equalIgnoringCase(precisionValue, "float") ? Decima l::nan() : 1;
134 return StepRange(stepBase, minimum, maximum, step, stepDescription);
135 }
136
137 const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element().fastGetAttribute(stepAttr)); 131 const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element().fastGetAttribute(stepAttr));
138 return StepRange(stepBase, minimum, maximum, step, stepDescription); 132 return StepRange(stepBase, minimum, maximum, step, stepDescription);
139 } 133 }
140 134
141 bool RangeInputType::isSteppable() const 135 bool RangeInputType::isSteppable() const
142 { 136 {
143 return true; 137 return true;
144 } 138 }
145 139
146 void RangeInputType::handleMouseDownEvent(MouseEvent* event) 140 void RangeInputType::handleMouseDownEvent(MouseEvent* event)
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 right = middle; 388 right = middle;
395 } 389 }
396 const Decimal closestLeft = middle ? m_tickMarkValues[middle - 1] : Decimal: :infinity(Decimal::Negative); 390 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); 391 const Decimal closestRight = middle != m_tickMarkValues.size() ? m_tickMarkV alues[middle] : Decimal::infinity(Decimal::Positive);
398 if (closestRight - value < value - closestLeft) 392 if (closestRight - value < value - closestLeft)
399 return closestRight; 393 return closestRight;
400 return closestLeft; 394 return closestLeft;
401 } 395 }
402 396
403 } // namespace WebCore 397 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/HTMLInputElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698