| 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 BorderImageLengthBoxPropertyFunctions_h | 5 #ifndef BorderImageLengthBoxPropertyFunctions_h |
| 6 #define BorderImageLengthBoxPropertyFunctions_h | 6 #define BorderImageLengthBoxPropertyFunctions_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 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class BorderImageLengthBoxPropertyFunctions { | 13 class BorderImageLengthBoxPropertyFunctions { |
| 14 public: | 14 public: |
| 15 static const BorderImageLengthBox& getInitialBorderImageLengthBox(CSSPropert
yID property) { return getBorderImageLengthBox(property, ComputedStyle::initialS
tyle()); } | 15 static const BorderImageLengthBox& getInitialBorderImageLengthBox(CSSPropert
yID property) { return getBorderImageLengthBox(property, ComputedStyle::initialS
tyle()); } |
| 16 | 16 |
| 17 static const BorderImageLengthBox& getBorderImageLengthBox(CSSPropertyID pro
perty, const ComputedStyle& style) | 17 static const BorderImageLengthBox& getBorderImageLengthBox(CSSPropertyID pro
perty, const ComputedStyle& style) |
| 18 { | 18 { |
| 19 switch (property) { | 19 switch (property) { |
| 20 case CSSPropertyBorderImageOutset: | 20 case CSSPropertyBorderImageOutset: |
| 21 return style.borderImageOutset(); | 21 return style.borderImageOutset(); |
| 22 case CSSPropertyBorderImageWidth: | 22 case CSSPropertyBorderImageWidth: |
| 23 return style.borderImageWidth(); | 23 return style.borderImageWidth(); |
| 24 case CSSPropertyWebkitMaskBoxImageOutset: | 24 case CSSPropertyWebkitMaskBoxImageOutset: |
| 25 return style.maskBoxImageOutset(); | 25 return style.maskBoxImageOutset(); |
| 26 case CSSPropertyWebkitMaskBoxImageWidth: | 26 case CSSPropertyWebkitMaskBoxImageWidth: |
| 27 return style.maskBoxImageWidth(); | 27 return style.maskBoxImageWidth(); |
| 28 default: | 28 default: |
| 29 ASSERT_NOT_REACHED(); | 29 NOTREACHED(); |
| 30 return getInitialBorderImageLengthBox(CSSPropertyBorderImageOutset); | 30 return getInitialBorderImageLengthBox(CSSPropertyBorderImageOutset); |
| 31 } | 31 } |
| 32 } | 32 } |
| 33 | 33 |
| 34 static void setBorderImageLengthBox(CSSPropertyID property, ComputedStyle& s
tyle, const BorderImageLengthBox& box) | 34 static void setBorderImageLengthBox(CSSPropertyID property, ComputedStyle& s
tyle, const BorderImageLengthBox& box) |
| 35 { | 35 { |
| 36 switch (property) { | 36 switch (property) { |
| 37 case CSSPropertyBorderImageOutset: | 37 case CSSPropertyBorderImageOutset: |
| 38 style.setBorderImageOutset(box); | 38 style.setBorderImageOutset(box); |
| 39 break; | 39 break; |
| 40 case CSSPropertyWebkitMaskBoxImageOutset: | 40 case CSSPropertyWebkitMaskBoxImageOutset: |
| 41 style.setMaskBoxImageOutset(box); | 41 style.setMaskBoxImageOutset(box); |
| 42 break; | 42 break; |
| 43 case CSSPropertyBorderImageWidth: | 43 case CSSPropertyBorderImageWidth: |
| 44 style.setBorderImageWidth(box); | 44 style.setBorderImageWidth(box); |
| 45 break; | 45 break; |
| 46 case CSSPropertyWebkitMaskBoxImageWidth: | 46 case CSSPropertyWebkitMaskBoxImageWidth: |
| 47 style.setMaskBoxImageWidth(box); | 47 style.setMaskBoxImageWidth(box); |
| 48 break; | 48 break; |
| 49 default: | 49 default: |
| 50 ASSERT_NOT_REACHED(); | 50 NOTREACHED(); |
| 51 break; | 51 break; |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 } // namespace blink | 56 } // namespace blink |
| 57 | 57 |
| 58 #endif // BorderImageLengthBoxPropertyFunctions_h | 58 #endif // BorderImageLengthBoxPropertyFunctions_h |
| OLD | NEW |