| 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 "core/animation/CSSLengthInterpolationType.h" | 8 #include "core/animation/CSSLengthInterpolationType.h" |
| 8 #include "core/animation/ImageSlicePropertyFunctions.h" | 9 #include "core/animation/ImageSlicePropertyFunctions.h" |
| 10 #include "core/animation/SideIndex.h" |
| 9 #include "core/css/CSSBorderImageSliceValue.h" | 11 #include "core/css/CSSBorderImageSliceValue.h" |
| 10 #include "core/css/resolver/StyleResolverState.h" | 12 #include "core/css/resolver/StyleResolverState.h" |
| 11 #include "wtf/PtrUtil.h" | 13 #include "wtf/PtrUtil.h" |
| 12 #include <memory> | |
| 13 | 14 |
| 14 namespace blink { | 15 namespace blink { |
| 15 | 16 |
| 16 namespace { | 17 namespace { |
| 17 | 18 |
| 18 enum SideIndex : unsigned { | |
| 19 SideTop, | |
| 20 SideRight, | |
| 21 SideBottom, | |
| 22 SideLeft, | |
| 23 SideIndexCount, | |
| 24 }; | |
| 25 | |
| 26 struct SliceTypes { | 19 struct SliceTypes { |
| 27 explicit SliceTypes(const ImageSlice& slice) { | 20 explicit SliceTypes(const ImageSlice& slice) { |
| 28 isNumber[SideTop] = slice.slices.top().isFixed(); | 21 isNumber[SideTop] = slice.slices.top().isFixed(); |
| 29 isNumber[SideRight] = slice.slices.right().isFixed(); | 22 isNumber[SideRight] = slice.slices.right().isFixed(); |
| 30 isNumber[SideBottom] = slice.slices.bottom().isFixed(); | 23 isNumber[SideBottom] = slice.slices.bottom().isFixed(); |
| 31 isNumber[SideLeft] = slice.slices.left().isFixed(); | 24 isNumber[SideLeft] = slice.slices.left().isFixed(); |
| 32 fill = slice.fill; | 25 fill = slice.fill; |
| 33 } | 26 } |
| 34 explicit SliceTypes(const CSSBorderImageSliceValue& slice) { | 27 explicit SliceTypes(const CSSBorderImageSliceValue& slice) { |
| 35 isNumber[SideTop] = slice.slices().top()->isPrimitiveValue() && | 28 isNumber[SideTop] = slice.slices().top()->isPrimitiveValue() && |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 return types.isNumber[index] ? Length(value * style.effectiveZoom(), Fixed) | 267 return types.isNumber[index] ? Length(value * style.effectiveZoom(), Fixed) |
| 275 : Length(value, Percent); | 268 : Length(value, Percent); |
| 276 }; | 269 }; |
| 277 LengthBox box(convertSide(SideTop), convertSide(SideRight), | 270 LengthBox box(convertSide(SideTop), convertSide(SideRight), |
| 278 convertSide(SideBottom), convertSide(SideLeft)); | 271 convertSide(SideBottom), convertSide(SideLeft)); |
| 279 ImageSlicePropertyFunctions::setImageSlice(cssProperty(), style, | 272 ImageSlicePropertyFunctions::setImageSlice(cssProperty(), style, |
| 280 ImageSlice(box, types.fill)); | 273 ImageSlice(box, types.fill)); |
| 281 } | 274 } |
| 282 | 275 |
| 283 } // namespace blink | 276 } // namespace blink |
| OLD | NEW |