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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 break; | 126 break; |
127 } | 127 } |
128 | 128 |
129 return pool.createValue(basicShapeValue.release()); | 129 return pool.createValue(basicShapeValue.release()); |
130 } | 130 } |
131 | 131 |
132 static Length convertToLength(const StyleResolverState& state, NullableCSSValue
value) | 132 static Length convertToLength(const StyleResolverState& state, NullableCSSValue
value) |
133 { | 133 { |
134 if (!value) | 134 if (!value) |
135 return Length(0, Fixed); | 135 return Length(0, Fixed); |
136 return toCSSPrimitiveValue(*value).convertToLength(state.cssToLengthConversi
onData()); | 136 return toCSSPrimitiveValue(value).convertToLength(state.cssToLengthConversio
nData()); |
137 } | 137 } |
138 | 138 |
139 static LengthSize convertToLengthSize(const StyleResolverState& state, NullableC
SSValue value) | 139 static LengthSize convertToLengthSize(const StyleResolverState& state, NullableC
SSValue value) |
140 { | 140 { |
141 if (!value) | 141 if (!value) |
142 return LengthSize(Length(0, Fixed), Length(0, Fixed)); | 142 return LengthSize(Length(0, Fixed), Length(0, Fixed)); |
143 | 143 |
144 Pair* pair = toCSSPrimitiveValue(*value).getPairValue(); | 144 Pair* pair = toCSSPrimitiveValue(value).getPairValue(); |
145 return LengthSize(convertToLength(state, pair->first()), convertToLength(sta
te, pair->second())); | 145 return LengthSize(convertToLength(state, pair->first()), convertToLength(sta
te, pair->second())); |
146 } | 146 } |
147 | 147 |
148 static BasicShapeCenterCoordinate convertToCenterCoordinate(const StyleResolverS
tate& state, NullableCSSValue value) | 148 static BasicShapeCenterCoordinate convertToCenterCoordinate(const StyleResolverS
tate& state, NullableCSSValue value) |
149 { | 149 { |
150 BasicShapeCenterCoordinate::Direction direction; | 150 BasicShapeCenterCoordinate::Direction direction; |
151 Length offset = Length(0, Fixed); | 151 Length offset = Length(0, Fixed); |
152 | 152 |
153 CSSValueID keyword = CSSValueTop; | 153 CSSValueID keyword = CSSValueTop; |
154 if (!value) { | 154 if (!value) { |
155 keyword = CSSValueCenter; | 155 keyword = CSSValueCenter; |
156 } else if (toCSSPrimitiveValue(*value).isValueID()) { | 156 } else if (toCSSPrimitiveValue(value).isValueID()) { |
157 keyword = toCSSPrimitiveValue(*value).getValueID(); | 157 keyword = toCSSPrimitiveValue(value).getValueID(); |
158 } else if (Pair* pair = toCSSPrimitiveValue(*value).getPairValue()) { | 158 } else if (Pair* pair = toCSSPrimitiveValue(value).getPairValue()) { |
159 keyword = toCSSPrimitiveValue(*pair->first()).getValueID(); | 159 keyword = pair->first().getValueID(); |
160 offset = convertToLength(state, pair->second()); | 160 offset = convertToLength(state, pair->second()); |
161 } else { | 161 } else { |
162 offset = convertToLength(state, value); | 162 offset = convertToLength(state, value); |
163 } | 163 } |
164 | 164 |
165 switch (keyword) { | 165 switch (keyword) { |
166 case CSSValueTop: | 166 case CSSValueTop: |
167 case CSSValueLeft: | 167 case CSSValueLeft: |
168 direction = BasicShapeCenterCoordinate::TopLeft; | 168 direction = BasicShapeCenterCoordinate::TopLeft; |
169 break; | 169 break; |
(...skipping 12 matching lines...) Expand all Loading... |
182 } | 182 } |
183 | 183 |
184 return BasicShapeCenterCoordinate(direction, offset); | 184 return BasicShapeCenterCoordinate(direction, offset); |
185 } | 185 } |
186 | 186 |
187 static BasicShapeRadius cssValueToBasicShapeRadius(const StyleResolverState& sta
te, NullableCSSValue radius) | 187 static BasicShapeRadius cssValueToBasicShapeRadius(const StyleResolverState& sta
te, NullableCSSValue radius) |
188 { | 188 { |
189 if (!radius) | 189 if (!radius) |
190 return BasicShapeRadius(BasicShapeRadius::ClosestSide); | 190 return BasicShapeRadius(BasicShapeRadius::ClosestSide); |
191 | 191 |
192 if (toCSSPrimitiveValue(*radius).isValueID()) { | 192 if (toCSSPrimitiveValue(radius).isValueID()) { |
193 switch (toCSSPrimitiveValue(*radius).getValueID()) { | 193 switch (toCSSPrimitiveValue(radius).getValueID()) { |
194 case CSSValueClosestSide: | 194 case CSSValueClosestSide: |
195 return BasicShapeRadius(BasicShapeRadius::ClosestSide); | 195 return BasicShapeRadius(BasicShapeRadius::ClosestSide); |
196 case CSSValueFarthestSide: | 196 case CSSValueFarthestSide: |
197 return BasicShapeRadius(BasicShapeRadius::FarthestSide); | 197 return BasicShapeRadius(BasicShapeRadius::FarthestSide); |
198 default: | 198 default: |
199 ASSERT_NOT_REACHED(); | 199 ASSERT_NOT_REACHED(); |
200 break; | 200 break; |
201 } | 201 } |
202 } | 202 } |
203 | 203 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 } | 269 } |
270 | 270 |
271 FloatPoint floatPointForCenterCoordinate(const BasicShapeCenterCoordinate& cente
rX, const BasicShapeCenterCoordinate& centerY, FloatSize boxSize) | 271 FloatPoint floatPointForCenterCoordinate(const BasicShapeCenterCoordinate& cente
rX, const BasicShapeCenterCoordinate& centerY, FloatSize boxSize) |
272 { | 272 { |
273 float x = floatValueForLength(centerX.computedLength(), boxSize.width()); | 273 float x = floatValueForLength(centerX.computedLength(), boxSize.width()); |
274 float y = floatValueForLength(centerY.computedLength(), boxSize.height()); | 274 float y = floatValueForLength(centerY.computedLength(), boxSize.height()); |
275 return FloatPoint(x, y); | 275 return FloatPoint(x, y); |
276 } | 276 } |
277 | 277 |
278 } | 278 } |
OLD | NEW |