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 #ifndef BasicShapePropertyFunctions_h | 5 #ifndef BasicShapePropertyFunctions_h |
6 #define BasicShapePropertyFunctions_h | 6 #define BasicShapePropertyFunctions_h |
7 | 7 |
8 #include "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
9 #include "core/style/BasicShapes.h" | 9 #include "core/style/BasicShapes.h" |
10 #include "core/style/ComputedStyle.h" | 10 #include "core/style/ComputedStyle.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 { | 26 { |
27 switch (property) { | 27 switch (property) { |
28 case CSSPropertyShapeOutside: | 28 case CSSPropertyShapeOutside: |
29 if (!style.shapeOutside()) | 29 if (!style.shapeOutside()) |
30 return nullptr; | 30 return nullptr; |
31 if (style.shapeOutside()->type() != ShapeValue::Shape) | 31 if (style.shapeOutside()->type() != ShapeValue::Shape) |
32 return nullptr; | 32 return nullptr; |
33 if (style.shapeOutside()->cssBox() != BoxMissing) | 33 if (style.shapeOutside()->cssBox() != BoxMissing) |
34 return nullptr; | 34 return nullptr; |
35 return style.shapeOutside()->shape(); | 35 return style.shapeOutside()->shape(); |
36 case CSSPropertyWebkitClipPath: | 36 case CSSPropertyClipPath: |
37 if (!style.clipPath()) | 37 if (!style.clipPath()) |
38 return nullptr; | 38 return nullptr; |
39 if (style.clipPath()->type() != ClipPathOperation::SHAPE) | 39 if (style.clipPath()->type() != ClipPathOperation::SHAPE) |
40 return nullptr; | 40 return nullptr; |
41 return toShapeClipPathOperation(style.clipPath())->basicShape(); | 41 return toShapeClipPathOperation(style.clipPath())->basicShape(); |
42 default: | 42 default: |
43 NOTREACHED(); | 43 NOTREACHED(); |
44 return nullptr; | 44 return nullptr; |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 static void setBasicShape(CSSPropertyID property, ComputedStyle& style, Pass
RefPtr<BasicShape> shape) | 48 static void setBasicShape(CSSPropertyID property, ComputedStyle& style, Pass
RefPtr<BasicShape> shape) |
49 { | 49 { |
50 switch (property) { | 50 switch (property) { |
51 case CSSPropertyShapeOutside: | 51 case CSSPropertyShapeOutside: |
52 style.setShapeOutside(ShapeValue::createShapeValue(std::move(shape),
BoxMissing)); | 52 style.setShapeOutside(ShapeValue::createShapeValue(std::move(shape),
BoxMissing)); |
53 break; | 53 break; |
54 case CSSPropertyWebkitClipPath: | 54 case CSSPropertyClipPath: |
55 style.setClipPath(ShapeClipPathOperation::create(std::move(shape))); | 55 style.setClipPath(ShapeClipPathOperation::create(std::move(shape))); |
56 break; | 56 break; |
57 default: | 57 default: |
58 NOTREACHED(); | 58 NOTREACHED(); |
59 } | 59 } |
60 } | 60 } |
61 }; | 61 }; |
62 | 62 |
63 } // namespace blink | 63 } // namespace blink |
64 | 64 |
65 #endif // BasicShapePropertyFunctions_h | 65 #endif // BasicShapePropertyFunctions_h |
OLD | NEW |