| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/animation/CSSLengthInterpolationType.h" | 5 #include "core/animation/CSSLengthInterpolationType.h" |
| 6 | 6 |
| 7 #include "core/animation/LengthInterpolationFunctions.h" | 7 #include "core/animation/LengthInterpolationFunctions.h" |
| 8 #include "core/animation/LengthPropertyFunctions.h" | 8 #include "core/animation/LengthPropertyFunctions.h" |
| 9 #include "core/animation/css/CSSAnimatableValueFactory.h" | 9 #include "core/animation/css/CSSAnimatableValueFactory.h" |
| 10 #include "core/css/CSSCalculationValue.h" | 10 #include "core/css/CSSCalculationValue.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 #if DCHECK_IS_ON() | 151 #if DCHECK_IS_ON() |
| 152 // Assert that setting the length on ComputedStyle directly is identical to | 152 // Assert that setting the length on ComputedStyle directly is identical to |
| 153 // the StyleBuilder code path. This check is useful for catching differences | 153 // the StyleBuilder code path. This check is useful for catching differences |
| 154 // in clamping behaviour. | 154 // in clamping behaviour. |
| 155 Length before; | 155 Length before; |
| 156 Length after; | 156 Length after; |
| 157 DCHECK(LengthPropertyFunctions::getLength(cssProperty(), style, before)); | 157 DCHECK(LengthPropertyFunctions::getLength(cssProperty(), style, before)); |
| 158 StyleBuilder::applyProperty(cssProperty(), state, | 158 StyleBuilder::applyProperty(cssProperty(), state, |
| 159 *CSSValue::create(length, zoom)); | 159 *CSSValue::create(length, zoom)); |
| 160 DCHECK(LengthPropertyFunctions::getLength(cssProperty(), style, after)); | 160 DCHECK(LengthPropertyFunctions::getLength(cssProperty(), style, after)); |
| 161 DCHECK_EQ(before.type(), after.type()); | 161 DCHECK(before.isSpecified()); |
| 162 if (before.isSpecified()) { | 162 DCHECK(after.isSpecified()); |
| 163 const float kSlack = 0.1; | 163 const float kSlack = 0.1; |
| 164 float delta = | 164 float delta = |
| 165 floatValueForLength(after, 100) - floatValueForLength(before, 100); | 165 floatValueForLength(after, 100) - floatValueForLength(before, 100); |
| 166 DCHECK_LT(std::abs(delta), kSlack); | 166 DCHECK_LT(std::abs(delta), kSlack); |
| 167 } | |
| 168 #endif | 167 #endif |
| 169 return; | 168 return; |
| 170 } | 169 } |
| 171 StyleBuilder::applyProperty(cssProperty(), state, | 170 StyleBuilder::applyProperty(cssProperty(), state, |
| 172 *CSSValue::create(length, zoom)); | 171 *CSSValue::create(length, zoom)); |
| 173 } | 172 } |
| 174 | 173 |
| 175 } // namespace blink | 174 } // namespace blink |
| OLD | NEW |