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

Side by Side Diff: third_party/WebKit/Source/core/animation/CSSVisibilityInterpolationType.cpp

Issue 1885353004: Add ComputedStyle constructor and getter to InterpolationEnvironment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_transformInterpolationType
Patch Set: Rebased Created 4 years, 4 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
OLDNEW
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/CSSVisibilityInterpolationType.h" 5 #include "core/animation/CSSVisibilityInterpolationType.h"
6 6
7 #include "core/css/CSSPrimitiveValueMappings.h" 7 #include "core/css/CSSPrimitiveValueMappings.h"
8 #include "core/css/resolver/StyleResolverState.h" 8 #include "core/css/resolver/StyleResolverState.h"
9 #include "wtf/PtrUtil.h" 9 #include "wtf/PtrUtil.h"
10 #include <memory> 10 #include <memory>
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 case CSSValueVisible: 138 case CSSValueVisible:
139 case CSSValueCollapse: 139 case CSSValueCollapse:
140 return createVisibilityValue(primitiveValue.convertTo<EVisibility>()); 140 return createVisibilityValue(primitiveValue.convertTo<EVisibility>());
141 default: 141 default:
142 return nullptr; 142 return nullptr;
143 } 143 }
144 } 144 }
145 145
146 InterpolationValue CSSVisibilityInterpolationType::maybeConvertUnderlyingValue(c onst InterpolationEnvironment& environment) const 146 InterpolationValue CSSVisibilityInterpolationType::maybeConvertUnderlyingValue(c onst InterpolationEnvironment& environment) const
147 { 147 {
148 return createVisibilityValue(environment.state().style()->visibility()); 148 return createVisibilityValue(environment.style().visibility());
149 } 149 }
150 150
151 PairwiseInterpolationValue CSSVisibilityInterpolationType::maybeMergeSingles(Int erpolationValue&& start, InterpolationValue&& end) const 151 PairwiseInterpolationValue CSSVisibilityInterpolationType::maybeMergeSingles(Int erpolationValue&& start, InterpolationValue&& end) const
152 { 152 {
153 return PairwiseInterpolationValue( 153 return PairwiseInterpolationValue(
154 InterpolableNumber::create(0), 154 InterpolableNumber::create(0),
155 InterpolableNumber::create(1), 155 InterpolableNumber::create(1),
156 CSSVisibilityNonInterpolableValue::create( 156 CSSVisibilityNonInterpolableValue::create(
157 toCSSVisibilityNonInterpolableValue(*start.nonInterpolableValue).vis ibility(), 157 toCSSVisibilityNonInterpolableValue(*start.nonInterpolableValue).vis ibility(),
158 toCSSVisibilityNonInterpolableValue(*end.nonInterpolableValue).visib ility())); 158 toCSSVisibilityNonInterpolableValue(*end.nonInterpolableValue).visib ility()));
159 } 159 }
160 160
161 void CSSVisibilityInterpolationType::composite(UnderlyingValueOwner& underlyingV alueOwner, double underlyingFraction, const InterpolationValue& value, double in terpolationFraction) const 161 void CSSVisibilityInterpolationType::composite(UnderlyingValueOwner& underlyingV alueOwner, double underlyingFraction, const InterpolationValue& value, double in terpolationFraction) const
162 { 162 {
163 underlyingValueOwner.set(*this, value); 163 underlyingValueOwner.set(*this, value);
164 } 164 }
165 165
166 void CSSVisibilityInterpolationType::apply(const InterpolableValue& interpolable Value, const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironmen t& environment) const 166 void CSSVisibilityInterpolationType::apply(const InterpolableValue& interpolable Value, const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironmen t& environment) const
167 { 167 {
168 // Visibility interpolation has been deferred to application time here due t o its non-linear behaviour. 168 // Visibility interpolation has been deferred to application time here due t o its non-linear behaviour.
169 double fraction = toInterpolableNumber(interpolableValue).value(); 169 double fraction = toInterpolableNumber(interpolableValue).value();
170 EVisibility visibility = toCSSVisibilityNonInterpolableValue(nonInterpolable Value)->visibility(fraction); 170 EVisibility visibility = toCSSVisibilityNonInterpolableValue(nonInterpolable Value)->visibility(fraction);
171 environment.state().style()->setVisibility(visibility); 171 environment.style().setVisibility(visibility);
172 } 172 }
173 173
174 } // namespace blink 174 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698