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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 const NonInterpolableValue* nonInterpolableValue, | 134 const NonInterpolableValue* nonInterpolableValue, |
135 InterpolationEnvironment& environment) const { | 135 InterpolationEnvironment& environment) const { |
136 StyleResolverState& state = environment.state(); | 136 StyleResolverState& state = environment.state(); |
137 ComputedStyle& style = *state.style(); | 137 ComputedStyle& style = *state.style(); |
138 float zoom = effectiveZoom(style); | 138 float zoom = effectiveZoom(style); |
139 Length length = LengthInterpolationFunctions::createLength( | 139 Length length = LengthInterpolationFunctions::createLength( |
140 interpolableValue, nonInterpolableValue, | 140 interpolableValue, nonInterpolableValue, |
141 state.cssToLengthConversionData(), m_valueRange); | 141 state.cssToLengthConversionData(), m_valueRange); |
142 if (LengthPropertyFunctions::setLength(cssProperty(), style, length)) { | 142 if (LengthPropertyFunctions::setLength(cssProperty(), style, length)) { |
143 #if DCHECK_IS_ON() | 143 #if DCHECK_IS_ON() |
144 // Assert that setting the length on ComputedStyle directly is identical to
the StyleBuilder code path. | 144 // Assert that setting the length on ComputedStyle directly is identical to |
145 // This check is useful for catching differences in clamping behaviour. | 145 // the StyleBuilder code path. This check is useful for catching differences |
| 146 // in clamping behaviour. |
146 Length before; | 147 Length before; |
147 Length after; | 148 Length after; |
148 DCHECK(LengthPropertyFunctions::getLength(cssProperty(), style, before)); | 149 DCHECK(LengthPropertyFunctions::getLength(cssProperty(), style, before)); |
149 StyleBuilder::applyProperty(cssProperty(), state, | 150 StyleBuilder::applyProperty(cssProperty(), state, |
150 *CSSValue::create(length, zoom)); | 151 *CSSValue::create(length, zoom)); |
151 DCHECK(LengthPropertyFunctions::getLength(cssProperty(), style, after)); | 152 DCHECK(LengthPropertyFunctions::getLength(cssProperty(), style, after)); |
152 DCHECK_EQ(before.type(), after.type()); | 153 DCHECK_EQ(before.type(), after.type()); |
153 if (before.isSpecified()) { | 154 if (before.isSpecified()) { |
154 const float kSlack = 0.1; | 155 const float kSlack = 0.1; |
155 float delta = | 156 float delta = |
156 floatValueForLength(after, 100) - floatValueForLength(before, 100); | 157 floatValueForLength(after, 100) - floatValueForLength(before, 100); |
157 DCHECK_LT(std::abs(delta), kSlack); | 158 DCHECK_LT(std::abs(delta), kSlack); |
158 } | 159 } |
159 #endif | 160 #endif |
160 return; | 161 return; |
161 } | 162 } |
162 StyleBuilder::applyProperty(cssProperty(), state, | 163 StyleBuilder::applyProperty(cssProperty(), state, |
163 *CSSValue::create(length, zoom)); | 164 *CSSValue::create(length, zoom)); |
164 } | 165 } |
165 | 166 |
166 } // namespace blink | 167 } // namespace blink |
OLD | NEW |