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

Unified Diff: Source/WebCore/css/CSSPrimitiveValue.h

Issue 10349004: Revert 115573 - Move Length and CSS length computation to float (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1123/
Patch Set: Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/css/CSSComputedStyleDeclaration.cpp ('k') | Source/WebCore/css/CSSPrimitiveValue.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/css/CSSPrimitiveValue.h
===================================================================
--- Source/WebCore/css/CSSPrimitiveValue.h (revision 115918)
+++ Source/WebCore/css/CSSPrimitiveValue.h (working copy)
@@ -42,26 +42,15 @@
struct Length;
-// Dimension calculations are imprecise, often resulting in values of e.g.
-// 44.99998. We need to go ahead and round if we're really close to the next
-// integer value.
template<typename T> inline T roundForImpreciseConversion(double value)
{
+ // Dimension calculations are imprecise, often resulting in values of e.g.
+ // 44.99998. We need to go ahead and round if we're really close to the
+ // next integer value.
value += (value < 0) ? -0.01 : +0.01;
return ((value > std::numeric_limits<T>::max()) || (value < std::numeric_limits<T>::min())) ? 0 : static_cast<T>(value);
}
-template<> inline float roundForImpreciseConversion(double value)
-{
- double ceiledValue = ceil(value);
- double proximityToNextInt = ceiledValue - value;
- if (proximityToNextInt <= 0.01 && value > 0)
- return static_cast<float>(ceiledValue);
- if (proximityToNextInt >= 0.99 && value < 0)
- return static_cast<float>(floor(value));
- return static_cast<float>(value);
-}
-
class CSSPrimitiveValue : public CSSValue {
public:
enum UnitTypes {
« no previous file with comments | « Source/WebCore/css/CSSComputedStyleDeclaration.cpp ('k') | Source/WebCore/css/CSSPrimitiveValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698