OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/CSSImageSliceInterpolationType.h" | 5 #include "core/animation/CSSImageSliceInterpolationType.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include "core/animation/CSSLengthInterpolationType.h" | 8 #include "core/animation/CSSLengthInterpolationType.h" |
9 #include "core/animation/ImageSlicePropertyFunctions.h" | 9 #include "core/animation/ImageSlicePropertyFunctions.h" |
10 #include "core/css/CSSBorderImageSliceValue.h" | 10 #include "core/css/CSSBorderImageSliceValue.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 std::unique_ptr<InterpolableList> list = | 138 std::unique_ptr<InterpolableList> list = |
139 InterpolableList::create(SideIndexCount); | 139 InterpolableList::create(SideIndexCount); |
140 const Length* sides[SideIndexCount] = {}; | 140 const Length* sides[SideIndexCount] = {}; |
141 sides[SideTop] = &slice.slices.top(); | 141 sides[SideTop] = &slice.slices.top(); |
142 sides[SideRight] = &slice.slices.right(); | 142 sides[SideRight] = &slice.slices.right(); |
143 sides[SideBottom] = &slice.slices.bottom(); | 143 sides[SideBottom] = &slice.slices.bottom(); |
144 sides[SideLeft] = &slice.slices.left(); | 144 sides[SideLeft] = &slice.slices.left(); |
145 | 145 |
146 for (size_t i = 0; i < SideIndexCount; i++) { | 146 for (size_t i = 0; i < SideIndexCount; i++) { |
147 const Length& side = *sides[i]; | 147 const Length& side = *sides[i]; |
148 list->set(i, InterpolableNumber::create( | 148 list->set(i, |
149 side.isFixed() ? side.pixels() / zoom : side.percent())); | 149 InterpolableNumber::create(side.isFixed() ? side.pixels() / zoom |
| 150 : side.percent())); |
150 } | 151 } |
151 | 152 |
152 return InterpolationValue( | 153 return InterpolationValue( |
153 std::move(list), | 154 std::move(list), |
154 CSSImageSliceNonInterpolableValue::create(SliceTypes(slice))); | 155 CSSImageSliceNonInterpolableValue::create(SliceTypes(slice))); |
155 } | 156 } |
156 | 157 |
157 } // namespace | 158 } // namespace |
158 | 159 |
159 InterpolationValue CSSImageSliceInterpolationType::maybeConvertNeutral( | 160 InterpolationValue CSSImageSliceInterpolationType::maybeConvertNeutral( |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 return types.isNumber[index] ? Length(value * style.effectiveZoom(), Fixed) | 275 return types.isNumber[index] ? Length(value * style.effectiveZoom(), Fixed) |
275 : Length(value, Percent); | 276 : Length(value, Percent); |
276 }; | 277 }; |
277 LengthBox box(convertSide(SideTop), convertSide(SideRight), | 278 LengthBox box(convertSide(SideTop), convertSide(SideRight), |
278 convertSide(SideBottom), convertSide(SideLeft)); | 279 convertSide(SideBottom), convertSide(SideLeft)); |
279 ImageSlicePropertyFunctions::setImageSlice(cssProperty(), style, | 280 ImageSlicePropertyFunctions::setImageSlice(cssProperty(), style, |
280 ImageSlice(box, types.fill)); | 281 ImageSlice(box, types.fill)); |
281 } | 282 } |
282 | 283 |
283 } // namespace blink | 284 } // namespace blink |
OLD | NEW |