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

Side by Side Diff: Source/core/html/forms/StepRange.h

Issue 136783006: Upgrade stepUp()/stepDown() implementation to match spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: applyStep(): add missing EventQueueScope Created 6 years, 10 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
« no previous file with comments | « Source/core/html/forms/InputType.cpp ('k') | Source/core/html/forms/StepRange.cpp » ('j') | 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) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 Decimal defaultValue() const 65 Decimal defaultValue() const
66 { 66 {
67 return defaultStep * stepScaleFactor; 67 return defaultStep * stepScaleFactor;
68 } 68 }
69 }; 69 };
70 70
71 StepRange(); 71 StepRange();
72 StepRange(const StepRange&); 72 StepRange(const StepRange&);
73 StepRange(const Decimal& stepBase, const Decimal& minimum, const Decimal& ma ximum, const Decimal& step, const StepDescription&); 73 StepRange(const Decimal& stepBase, const Decimal& minimum, const Decimal& ma ximum, const Decimal& step, const StepDescription&);
74 Decimal acceptableError() const;
75 Decimal alignValueForStep(const Decimal& currentValue, const Decimal& newVal ue) const; 74 Decimal alignValueForStep(const Decimal& currentValue, const Decimal& newVal ue) const;
76 Decimal clampValue(const Decimal& value) const; 75 Decimal clampValue(const Decimal& value) const;
77 bool hasStep() const { return m_hasStep; } 76 bool hasStep() const { return m_hasStep; }
78 Decimal maximum() const { return m_maximum; } 77 Decimal maximum() const { return m_maximum; }
79 Decimal minimum() const { return m_minimum; } 78 Decimal minimum() const { return m_minimum; }
80 static Decimal parseStep(AnyStepHandling, const StepDescription&, const Stri ng&); 79 static Decimal parseStep(AnyStepHandling, const StepDescription&, const Stri ng&);
81 Decimal step() const { return m_step; } 80 Decimal step() const { return m_step; }
82 Decimal stepBase() const { return m_stepBase; } 81 Decimal stepBase() const { return m_stepBase; }
83 bool stepMismatch(const Decimal&) const; 82 bool stepMismatch(const Decimal&) const;
84 83
(...skipping 13 matching lines...) Expand all
98 } 97 }
99 98
100 // Map from 0-1 range to value 99 // Map from 0-1 range to value
101 Decimal valueFromProportion(const Decimal& proportion) const 100 Decimal valueFromProportion(const Decimal& proportion) const
102 { 101 {
103 return m_minimum + proportion * (m_maximum - m_minimum); 102 return m_minimum + proportion * (m_maximum - m_minimum);
104 } 103 }
105 104
106 private: 105 private:
107 StepRange& operator =(const StepRange&); 106 StepRange& operator =(const StepRange&);
107 Decimal acceptableError() const;
108 Decimal roundByStep(const Decimal& value, const Decimal& base) const; 108 Decimal roundByStep(const Decimal& value, const Decimal& base) const;
109 109
110 const Decimal m_maximum; // maximum must be >= minimum. 110 const Decimal m_maximum; // maximum must be >= minimum.
111 const Decimal m_minimum; 111 const Decimal m_minimum;
112 const Decimal m_step; 112 const Decimal m_step;
113 const Decimal m_stepBase; 113 const Decimal m_stepBase;
114 const StepDescription m_stepDescription; 114 const StepDescription m_stepDescription;
115 const bool m_hasStep; 115 const bool m_hasStep;
116 }; 116 };
117 117
118 } 118 }
119 119
120 #endif // StepRange_h 120 #endif // StepRange_h
OLDNEW
« no previous file with comments | « Source/core/html/forms/InputType.cpp ('k') | Source/core/html/forms/StepRange.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698