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

Unified Diff: third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.cpp

Issue 2366823003: Use approximation when comparing Length floats in DCHECK (Closed)
Patch Set: Compile and ordering Created 4 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.cpp
diff --git a/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.cpp
index d149f5e843bd9279ccf4f28b06e260f3dbd39750..0100e1b6074d934fb89052ee9f70598ac6fad49b 100644
--- a/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.cpp
+++ b/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.cpp
@@ -10,6 +10,7 @@
#include "core/css/CSSCalculationValue.h"
#include "core/css/resolver/StyleBuilder.h"
#include "core/css/resolver/StyleResolverState.h"
+#include "platform/LengthFunctions.h"
#include "wtf/PtrUtil.h"
#include <memory>
@@ -122,7 +123,12 @@ void CSSLengthInterpolationType::apply(const InterpolableValue& interpolableValu
DCHECK(LengthPropertyFunctions::getLength(cssProperty(), style, before));
StyleBuilder::applyProperty(cssProperty(), state, *CSSPrimitiveValue::create(length, zoom));
DCHECK(LengthPropertyFunctions::getLength(cssProperty(), style, after));
- DCHECK(before == after);
+ DCHECK_EQ(before.type(), after.type());
+ if (before.isSpecified()) {
+ const float kSlack = 0.1;
+ float delta = floatValueForLength(after, 100) - floatValueForLength(before, 100);
+ DCHECK_LT(std::abs(delta), kSlack);
+ }
#endif
return;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698