| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 const BasicShapeRadius& radius) { | 67 const BasicShapeRadius& radius) { |
| 68 switch (radius.type()) { | 68 switch (radius.type()) { |
| 69 case BasicShapeRadius::Value: | 69 case BasicShapeRadius::Value: |
| 70 return CSSValue::create(radius.value(), style.effectiveZoom()); | 70 return CSSValue::create(radius.value(), style.effectiveZoom()); |
| 71 case BasicShapeRadius::ClosestSide: | 71 case BasicShapeRadius::ClosestSide: |
| 72 return CSSIdentifierValue::create(CSSValueClosestSide); | 72 return CSSIdentifierValue::create(CSSValueClosestSide); |
| 73 case BasicShapeRadius::FarthestSide: | 73 case BasicShapeRadius::FarthestSide: |
| 74 return CSSIdentifierValue::create(CSSValueFarthestSide); | 74 return CSSIdentifierValue::create(CSSValueFarthestSide); |
| 75 } | 75 } |
| 76 | 76 |
| 77 ASSERT_NOT_REACHED(); | 77 NOTREACHED(); |
| 78 return nullptr; | 78 return nullptr; |
| 79 } | 79 } |
| 80 | 80 |
| 81 CSSValue* valueForBasicShape(const ComputedStyle& style, | 81 CSSValue* valueForBasicShape(const ComputedStyle& style, |
| 82 const BasicShape* basicShape) { | 82 const BasicShape* basicShape) { |
| 83 switch (basicShape->type()) { | 83 switch (basicShape->type()) { |
| 84 case BasicShape::BasicShapeCircleType: { | 84 case BasicShape::BasicShapeCircleType: { |
| 85 const BasicShapeCircle* circle = toBasicShapeCircle(basicShape); | 85 const BasicShapeCircle* circle = toBasicShapeCircle(basicShape); |
| 86 CSSBasicShapeCircleValue* circleValue = | 86 CSSBasicShapeCircleValue* circleValue = |
| 87 CSSBasicShapeCircleValue::create(); | 87 CSSBasicShapeCircleValue::create(); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 break; | 195 break; |
| 196 case CSSValueRight: | 196 case CSSValueRight: |
| 197 case CSSValueBottom: | 197 case CSSValueBottom: |
| 198 direction = BasicShapeCenterCoordinate::BottomRight; | 198 direction = BasicShapeCenterCoordinate::BottomRight; |
| 199 break; | 199 break; |
| 200 case CSSValueCenter: | 200 case CSSValueCenter: |
| 201 direction = BasicShapeCenterCoordinate::TopLeft; | 201 direction = BasicShapeCenterCoordinate::TopLeft; |
| 202 offset = Length(50, Percent); | 202 offset = Length(50, Percent); |
| 203 break; | 203 break; |
| 204 default: | 204 default: |
| 205 ASSERT_NOT_REACHED(); | 205 NOTREACHED(); |
| 206 direction = BasicShapeCenterCoordinate::TopLeft; | 206 direction = BasicShapeCenterCoordinate::TopLeft; |
| 207 break; | 207 break; |
| 208 } | 208 } |
| 209 | 209 |
| 210 return BasicShapeCenterCoordinate(direction, offset); | 210 return BasicShapeCenterCoordinate(direction, offset); |
| 211 } | 211 } |
| 212 | 212 |
| 213 static BasicShapeRadius cssValueToBasicShapeRadius( | 213 static BasicShapeRadius cssValueToBasicShapeRadius( |
| 214 const StyleResolverState& state, | 214 const StyleResolverState& state, |
| 215 const CSSValue* radius) { | 215 const CSSValue* radius) { |
| 216 if (!radius) | 216 if (!radius) |
| 217 return BasicShapeRadius(BasicShapeRadius::ClosestSide); | 217 return BasicShapeRadius(BasicShapeRadius::ClosestSide); |
| 218 | 218 |
| 219 if (radius->isIdentifierValue()) { | 219 if (radius->isIdentifierValue()) { |
| 220 switch (toCSSIdentifierValue(radius)->getValueID()) { | 220 switch (toCSSIdentifierValue(radius)->getValueID()) { |
| 221 case CSSValueClosestSide: | 221 case CSSValueClosestSide: |
| 222 return BasicShapeRadius(BasicShapeRadius::ClosestSide); | 222 return BasicShapeRadius(BasicShapeRadius::ClosestSide); |
| 223 case CSSValueFarthestSide: | 223 case CSSValueFarthestSide: |
| 224 return BasicShapeRadius(BasicShapeRadius::FarthestSide); | 224 return BasicShapeRadius(BasicShapeRadius::FarthestSide); |
| 225 default: | 225 default: |
| 226 ASSERT_NOT_REACHED(); | 226 NOTREACHED(); |
| 227 break; | 227 break; |
| 228 } | 228 } |
| 229 } | 229 } |
| 230 | 230 |
| 231 return BasicShapeRadius(convertToLength(state, toCSSPrimitiveValue(radius))); | 231 return BasicShapeRadius(convertToLength(state, toCSSPrimitiveValue(radius))); |
| 232 } | 232 } |
| 233 | 233 |
| 234 PassRefPtr<BasicShape> basicShapeForValue(const StyleResolverState& state, | 234 PassRefPtr<BasicShape> basicShapeForValue(const StyleResolverState& state, |
| 235 const CSSValue& basicShapeValue) { | 235 const CSSValue& basicShapeValue) { |
| 236 RefPtr<BasicShape> basicShape; | 236 RefPtr<BasicShape> basicShape; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 convertToLengthSize(state, rectValue.topLeftRadius())); | 286 convertToLengthSize(state, rectValue.topLeftRadius())); |
| 287 rect->setTopRightRadius( | 287 rect->setTopRightRadius( |
| 288 convertToLengthSize(state, rectValue.topRightRadius())); | 288 convertToLengthSize(state, rectValue.topRightRadius())); |
| 289 rect->setBottomRightRadius( | 289 rect->setBottomRightRadius( |
| 290 convertToLengthSize(state, rectValue.bottomRightRadius())); | 290 convertToLengthSize(state, rectValue.bottomRightRadius())); |
| 291 rect->setBottomLeftRadius( | 291 rect->setBottomLeftRadius( |
| 292 convertToLengthSize(state, rectValue.bottomLeftRadius())); | 292 convertToLengthSize(state, rectValue.bottomLeftRadius())); |
| 293 | 293 |
| 294 basicShape = std::move(rect); | 294 basicShape = std::move(rect); |
| 295 } else { | 295 } else { |
| 296 ASSERT_NOT_REACHED(); | 296 NOTREACHED(); |
| 297 } | 297 } |
| 298 | 298 |
| 299 return basicShape.release(); | 299 return basicShape.release(); |
| 300 } | 300 } |
| 301 | 301 |
| 302 FloatPoint floatPointForCenterCoordinate( | 302 FloatPoint floatPointForCenterCoordinate( |
| 303 const BasicShapeCenterCoordinate& centerX, | 303 const BasicShapeCenterCoordinate& centerX, |
| 304 const BasicShapeCenterCoordinate& centerY, | 304 const BasicShapeCenterCoordinate& centerY, |
| 305 FloatSize boxSize) { | 305 FloatSize boxSize) { |
| 306 float x = floatValueForLength(centerX.computedLength(), boxSize.width()); | 306 float x = floatValueForLength(centerX.computedLength(), boxSize.width()); |
| 307 float y = floatValueForLength(centerY.computedLength(), boxSize.height()); | 307 float y = floatValueForLength(centerY.computedLength(), boxSize.height()); |
| 308 return FloatPoint(x, y); | 308 return FloatPoint(x, y); |
| 309 } | 309 } |
| 310 | 310 |
| 311 } // namespace blink | 311 } // namespace blink |
| OLD | NEW |