| 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/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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 { | 120 { |
| 121 if (!state.parentStyle()) | 121 if (!state.parentStyle()) |
| 122 return nullptr; | 122 return nullptr; |
| 123 EVisibility inheritedVisibility = state.parentStyle()->visibility(); | 123 EVisibility inheritedVisibility = state.parentStyle()->visibility(); |
| 124 conversionCheckers.append(ParentVisibilityChecker::create(inheritedVisibilit
y)); | 124 conversionCheckers.append(ParentVisibilityChecker::create(inheritedVisibilit
y)); |
| 125 return createVisibilityValue(inheritedVisibility); | 125 return createVisibilityValue(inheritedVisibility); |
| 126 } | 126 } |
| 127 | 127 |
| 128 InterpolationValue CSSVisibilityInterpolationType::maybeConvertValue(const CSSVa
lue& value, const StyleResolverState& state, ConversionCheckers& conversionCheck
ers) const | 128 InterpolationValue CSSVisibilityInterpolationType::maybeConvertValue(const CSSVa
lue& value, const StyleResolverState& state, ConversionCheckers& conversionCheck
ers) const |
| 129 { | 129 { |
| 130 if (!value.isPrimitiveValue()) | 130 if (!value.isIdentifierValue()) |
| 131 return nullptr; | 131 return nullptr; |
| 132 | 132 |
| 133 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 133 const CSSIdentifierValue& identifierValue = toCSSIdentifierValue(value); |
| 134 CSSValueID keyword = primitiveValue.getValueID(); | 134 CSSValueID keyword = identifierValue.getValueID(); |
| 135 | 135 |
| 136 switch (keyword) { | 136 switch (keyword) { |
| 137 case CSSValueHidden: | 137 case CSSValueHidden: |
| 138 case CSSValueVisible: | 138 case CSSValueVisible: |
| 139 case CSSValueCollapse: | 139 case CSSValueCollapse: |
| 140 return createVisibilityValue(primitiveValue.convertTo<EVisibility>()); | 140 return createVisibilityValue(identifierValue.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.state().style()->visibility()); |
| 149 } | 149 } |
| 150 | 150 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 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.state().style()->setVisibility(visibility); |
| 172 } | 172 } |
| 173 | 173 |
| 174 } // namespace blink | 174 } // namespace blink |
| OLD | NEW |