| 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 #ifndef ImageSlicePropertyFunctions_h | 5 #ifndef ImageSlicePropertyFunctions_h |
| 6 #define ImageSlicePropertyFunctions_h | 6 #define ImageSlicePropertyFunctions_h |
| 7 | 7 |
| 8 #include "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
| 9 #include "core/style/ComputedStyle.h" | 9 #include "core/style/ComputedStyle.h" |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 class ImageSlicePropertyFunctions { | 24 class ImageSlicePropertyFunctions { |
| 25 public: | 25 public: |
| 26 static ImageSlice getInitialImageSlice(CSSPropertyID property) { return getI
mageSlice(property, ComputedStyle::initialStyle()); } | 26 static ImageSlice getInitialImageSlice(CSSPropertyID property) { return getI
mageSlice(property, ComputedStyle::initialStyle()); } |
| 27 | 27 |
| 28 static ImageSlice getImageSlice(CSSPropertyID property, const ComputedStyle&
style) | 28 static ImageSlice getImageSlice(CSSPropertyID property, const ComputedStyle&
style) |
| 29 { | 29 { |
| 30 switch (property) { | 30 switch (property) { |
| 31 default: | 31 default: |
| 32 ASSERT_NOT_REACHED(); | 32 NOTREACHED(); |
| 33 // Fall through. | 33 // Fall through. |
| 34 case CSSPropertyBorderImageSlice: | 34 case CSSPropertyBorderImageSlice: |
| 35 return ImageSlice(style.borderImageSlices(), style.borderImageSlices
Fill()); | 35 return ImageSlice(style.borderImageSlices(), style.borderImageSlices
Fill()); |
| 36 case CSSPropertyWebkitMaskBoxImageSlice: | 36 case CSSPropertyWebkitMaskBoxImageSlice: |
| 37 return ImageSlice(style.maskBoxImageSlices(), style.maskBoxImageSlic
esFill()); | 37 return ImageSlice(style.maskBoxImageSlices(), style.maskBoxImageSlic
esFill()); |
| 38 } | 38 } |
| 39 } | 39 } |
| 40 | 40 |
| 41 static void setImageSlice(CSSPropertyID property, ComputedStyle& style, cons
t ImageSlice& slice) | 41 static void setImageSlice(CSSPropertyID property, ComputedStyle& style, cons
t ImageSlice& slice) |
| 42 { | 42 { |
| 43 switch (property) { | 43 switch (property) { |
| 44 case CSSPropertyBorderImageSlice: | 44 case CSSPropertyBorderImageSlice: |
| 45 style.setBorderImageSlices(slice.slices); | 45 style.setBorderImageSlices(slice.slices); |
| 46 style.setBorderImageSlicesFill(slice.fill); | 46 style.setBorderImageSlicesFill(slice.fill); |
| 47 break; | 47 break; |
| 48 case CSSPropertyWebkitMaskBoxImageSlice: | 48 case CSSPropertyWebkitMaskBoxImageSlice: |
| 49 style.setMaskBoxImageSlices(slice.slices); | 49 style.setMaskBoxImageSlices(slice.slices); |
| 50 style.setMaskBoxImageSlicesFill(slice.fill); | 50 style.setMaskBoxImageSlicesFill(slice.fill); |
| 51 break; | 51 break; |
| 52 default: | 52 default: |
| 53 ASSERT_NOT_REACHED(); | 53 NOTREACHED(); |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 } // namespace blink | 58 } // namespace blink |
| 59 | 59 |
| 60 #endif // ImageSlicePropertyFunctions_h | 60 #endif // ImageSlicePropertyFunctions_h |
| OLD | NEW |