OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
10 * disclaimer. | 10 * disclaimer. |
(...skipping 17 matching lines...) Expand all Loading... |
28 */ | 28 */ |
29 | 29 |
30 #ifndef BasicShapes_h | 30 #ifndef BasicShapes_h |
31 #define BasicShapes_h | 31 #define BasicShapes_h |
32 | 32 |
33 #include "core/CoreExport.h" | 33 #include "core/CoreExport.h" |
34 #include "core/style/ComputedStyleConstants.h" | 34 #include "core/style/ComputedStyleConstants.h" |
35 #include "platform/Length.h" | 35 #include "platform/Length.h" |
36 #include "platform/LengthSize.h" | 36 #include "platform/LengthSize.h" |
37 #include "platform/graphics/GraphicsTypes.h" | 37 #include "platform/graphics/GraphicsTypes.h" |
| 38 #include "wtf/Allocator.h" |
38 #include "wtf/RefCounted.h" | 39 #include "wtf/RefCounted.h" |
39 #include "wtf/RefPtr.h" | 40 #include "wtf/RefPtr.h" |
40 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
41 | 42 |
42 namespace blink { | 43 namespace blink { |
43 | 44 |
44 class FloatRect; | 45 class FloatRect; |
45 class FloatSize; | 46 class FloatSize; |
46 class Path; | 47 class Path; |
47 | 48 |
(...skipping 22 matching lines...) Expand all Loading... |
70 BasicShape() | 71 BasicShape() |
71 { | 72 { |
72 } | 73 } |
73 | 74 |
74 }; | 75 }; |
75 | 76 |
76 #define DEFINE_BASICSHAPE_TYPE_CASTS(thisType) \ | 77 #define DEFINE_BASICSHAPE_TYPE_CASTS(thisType) \ |
77 DEFINE_TYPE_CASTS(thisType, BasicShape, value, value->type() == BasicShape::
thisType##Type, value.type() == BasicShape::thisType##Type) | 78 DEFINE_TYPE_CASTS(thisType, BasicShape, value, value->type() == BasicShape::
thisType##Type, value.type() == BasicShape::thisType##Type) |
78 | 79 |
79 class BasicShapeCenterCoordinate { | 80 class BasicShapeCenterCoordinate { |
| 81 DISALLOW_ALLOCATION(); |
80 public: | 82 public: |
81 enum Direction { | 83 enum Direction { |
82 TopLeft, | 84 TopLeft, |
83 BottomRight | 85 BottomRight |
84 }; | 86 }; |
85 | 87 |
86 BasicShapeCenterCoordinate(Direction direction = TopLeft, const Length& leng
th = Length(0, Fixed)) | 88 BasicShapeCenterCoordinate(Direction direction = TopLeft, const Length& leng
th = Length(0, Fixed)) |
87 : m_direction(direction) | 89 : m_direction(direction) |
88 , m_length(length) | 90 , m_length(length) |
89 , m_computedLength(direction == TopLeft ? length : length.subtractFromOn
eHundredPercent()) | 91 , m_computedLength(direction == TopLeft ? length : length.subtractFromOn
eHundredPercent()) |
(...skipping 18 matching lines...) Expand all Loading... |
108 return BasicShapeCenterCoordinate(TopLeft, m_computedLength.blend(other.
m_computedLength, progress, ValueRangeAll)); | 110 return BasicShapeCenterCoordinate(TopLeft, m_computedLength.blend(other.
m_computedLength, progress, ValueRangeAll)); |
109 } | 111 } |
110 | 112 |
111 private: | 113 private: |
112 Direction m_direction; | 114 Direction m_direction; |
113 Length m_length; | 115 Length m_length; |
114 Length m_computedLength; | 116 Length m_computedLength; |
115 }; | 117 }; |
116 | 118 |
117 class BasicShapeRadius { | 119 class BasicShapeRadius { |
| 120 DISALLOW_ALLOCATION(); |
118 public: | 121 public: |
119 enum Type { | 122 enum Type { |
120 Value, | 123 Value, |
121 ClosestSide, | 124 ClosestSide, |
122 FarthestSide | 125 FarthestSide |
123 }; | 126 }; |
124 BasicShapeRadius() : m_type(ClosestSide) { } | 127 BasicShapeRadius() : m_type(ClosestSide) { } |
125 explicit BasicShapeRadius(const Length& v) : m_value(v), m_type(Value) { } | 128 explicit BasicShapeRadius(const Length& v) : m_value(v), m_type(Value) { } |
126 explicit BasicShapeRadius(Type t) : m_type(t) { } | 129 explicit BasicShapeRadius(Type t) : m_type(t) { } |
127 BasicShapeRadius(const BasicShapeRadius& other) : m_value(other.value()), m_
type(other.type()) { } | 130 BasicShapeRadius(const BasicShapeRadius& other) : m_value(other.value()), m_
type(other.type()) { } |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 LengthSize m_topLeftRadius; | 281 LengthSize m_topLeftRadius; |
279 LengthSize m_topRightRadius; | 282 LengthSize m_topRightRadius; |
280 LengthSize m_bottomRightRadius; | 283 LengthSize m_bottomRightRadius; |
281 LengthSize m_bottomLeftRadius; | 284 LengthSize m_bottomLeftRadius; |
282 }; | 285 }; |
283 | 286 |
284 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeInset); | 287 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeInset); |
285 | 288 |
286 } | 289 } |
287 #endif | 290 #endif |
OLD | NEW |