Chromium Code Reviews| 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 14 matching lines...) Expand all Loading... | |
| 25 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF | 25 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF |
| 26 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 26 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 27 * SUCH DAMAGE. | 27 * SUCH DAMAGE. |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 #include "core/css/BasicShapeFunctions.h" | 30 #include "core/css/BasicShapeFunctions.h" |
| 31 | 31 |
| 32 #include "core/css/CSSBasicShapeValues.h" | 32 #include "core/css/CSSBasicShapeValues.h" |
| 33 #include "core/css/CSSIdentifierValue.h" | 33 #include "core/css/CSSIdentifierValue.h" |
| 34 #include "core/css/CSSPrimitiveValueMappings.h" | 34 #include "core/css/CSSPrimitiveValueMappings.h" |
| 35 #include "core/css/CSSRayValue.h" | |
|
fs
2017/05/15 09:18:14
(Only needed because StyleRay returns CSSRayValue
Eric Willigers
2017/05/15 10:52:23
Done, then undone because ValueForBasicShape now c
| |
| 35 #include "core/css/CSSValuePair.h" | 36 #include "core/css/CSSValuePair.h" |
| 36 #include "core/css/resolver/StyleResolverState.h" | 37 #include "core/css/resolver/StyleResolverState.h" |
| 37 #include "core/style/BasicShapes.h" | 38 #include "core/style/BasicShapes.h" |
| 38 #include "core/style/ComputedStyle.h" | 39 #include "core/style/ComputedStyle.h" |
| 40 #include "core/style/StyleRay.h" | |
| 39 | 41 |
| 40 namespace blink { | 42 namespace blink { |
| 41 | 43 |
| 42 static CSSValue* ValueForCenterCoordinate( | 44 static CSSValue* ValueForCenterCoordinate( |
| 43 const ComputedStyle& style, | 45 const ComputedStyle& style, |
| 44 const BasicShapeCenterCoordinate& center, | 46 const BasicShapeCenterCoordinate& center, |
| 45 EBoxOrient orientation) { | 47 EBoxOrient orientation) { |
| 46 if (center.GetDirection() == BasicShapeCenterCoordinate::kTopLeft) | 48 if (center.GetDirection() == BasicShapeCenterCoordinate::kTopLeft) |
| 47 return CSSValue::Create(center.length(), style.EffectiveZoom()); | 49 return CSSValue::Create(center.length(), style.EffectiveZoom()); |
| 48 | 50 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 74 return CSSIdentifierValue::Create(CSSValueFarthestSide); | 76 return CSSIdentifierValue::Create(CSSValueFarthestSide); |
| 75 } | 77 } |
| 76 | 78 |
| 77 NOTREACHED(); | 79 NOTREACHED(); |
| 78 return nullptr; | 80 return nullptr; |
| 79 } | 81 } |
| 80 | 82 |
| 81 CSSValue* ValueForBasicShape(const ComputedStyle& style, | 83 CSSValue* ValueForBasicShape(const ComputedStyle& style, |
| 82 const BasicShape* basic_shape) { | 84 const BasicShape* basic_shape) { |
| 83 switch (basic_shape->GetType()) { | 85 switch (basic_shape->GetType()) { |
| 86 case BasicShape::kStyleRayType: | |
| 87 return ToStyleRay(basic_shape)->ComputedCSSValue(); | |
| 88 | |
| 89 case BasicShape::kStylePathType: | |
| 90 return ToStylePath(basic_shape)->ComputedCSSValue(); | |
| 91 | |
| 84 case BasicShape::kBasicShapeCircleType: { | 92 case BasicShape::kBasicShapeCircleType: { |
| 85 const BasicShapeCircle* circle = ToBasicShapeCircle(basic_shape); | 93 const BasicShapeCircle* circle = ToBasicShapeCircle(basic_shape); |
| 86 CSSBasicShapeCircleValue* circle_value = | 94 CSSBasicShapeCircleValue* circle_value = |
| 87 CSSBasicShapeCircleValue::Create(); | 95 CSSBasicShapeCircleValue::Create(); |
| 88 | 96 |
| 89 circle_value->SetCenterX( | 97 circle_value->SetCenterX( |
| 90 ValueForCenterCoordinate(style, circle->CenterX(), HORIZONTAL)); | 98 ValueForCenterCoordinate(style, circle->CenterX(), HORIZONTAL)); |
| 91 circle_value->SetCenterY( | 99 circle_value->SetCenterY( |
| 92 ValueForCenterCoordinate(style, circle->CenterY(), VERTICAL)); | 100 ValueForCenterCoordinate(style, circle->CenterY(), VERTICAL)); |
| 93 circle_value->SetRadius( | 101 circle_value->SetRadius( |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 305 FloatPoint FloatPointForCenterCoordinate( | 313 FloatPoint FloatPointForCenterCoordinate( |
| 306 const BasicShapeCenterCoordinate& center_x, | 314 const BasicShapeCenterCoordinate& center_x, |
| 307 const BasicShapeCenterCoordinate& center_y, | 315 const BasicShapeCenterCoordinate& center_y, |
| 308 FloatSize box_size) { | 316 FloatSize box_size) { |
| 309 float x = FloatValueForLength(center_x.ComputedLength(), box_size.Width()); | 317 float x = FloatValueForLength(center_x.ComputedLength(), box_size.Width()); |
| 310 float y = FloatValueForLength(center_y.ComputedLength(), box_size.Height()); | 318 float y = FloatValueForLength(center_y.ComputedLength(), box_size.Height()); |
| 311 return FloatPoint(x, y); | 319 return FloatPoint(x, y); |
| 312 } | 320 } |
| 313 | 321 |
| 314 } // namespace blink | 322 } // namespace blink |
| OLD | NEW |