Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(517)

Side by Side Diff: Source/core/css/BasicShapeFunctions.cpp

Issue 1164573002: CSSValue Immediates: Change CSSValue to an object instead of a pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/css/BasicShapeFunctions.h ('k') | Source/core/css/CSSBasicShapes.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 case BasicShapeRadius::ClosestSide: 58 case BasicShapeRadius::ClosestSide:
59 return pool.createIdentifierValue(CSSValueClosestSide); 59 return pool.createIdentifierValue(CSSValueClosestSide);
60 case BasicShapeRadius::FarthestSide: 60 case BasicShapeRadius::FarthestSide:
61 return pool.createIdentifierValue(CSSValueFarthestSide); 61 return pool.createIdentifierValue(CSSValueFarthestSide);
62 } 62 }
63 63
64 ASSERT_NOT_REACHED(); 64 ASSERT_NOT_REACHED();
65 return nullptr; 65 return nullptr;
66 } 66 }
67 67
68 PassRefPtrWillBeRawPtr<CSSValue> valueForBasicShape(const ComputedStyle& style, const BasicShape* basicShape) 68 CSSValue valueForBasicShape(const ComputedStyle& style, const BasicShape* basicS hape)
69 { 69 {
70 CSSValuePool& pool = cssValuePool(); 70 CSSValuePool& pool = cssValuePool();
71 71
72 RefPtrWillBeRawPtr<CSSBasicShape> basicShapeValue = nullptr; 72 RefPtrWillBeRawPtr<CSSBasicShape> basicShapeValue = nullptr;
73 switch (basicShape->type()) { 73 switch (basicShape->type()) {
74 case BasicShape::BasicShapeCircleType: { 74 case BasicShape::BasicShapeCircleType: {
75 const BasicShapeCircle* circle = toBasicShapeCircle(basicShape); 75 const BasicShapeCircle* circle = toBasicShapeCircle(basicShape);
76 RefPtrWillBeRawPtr<CSSBasicShapeCircle> circleValue = CSSBasicShapeCircl e::create(); 76 RefPtrWillBeRawPtr<CSSBasicShapeCircle> circleValue = CSSBasicShapeCircl e::create();
77 77
78 circleValue->setCenterX(valueForCenterCoordinate(pool, style, circle->ce nterX(), HORIZONTAL)); 78 circleValue->setCenterX(valueForCenterCoordinate(pool, style, circle->ce nterX(), HORIZONTAL));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 insetValue->setTopLeftRadius(CSSPrimitiveValue::create(inset->topLeftRad ius(), style)); 116 insetValue->setTopLeftRadius(CSSPrimitiveValue::create(inset->topLeftRad ius(), style));
117 insetValue->setTopRightRadius(CSSPrimitiveValue::create(inset->topRightR adius(), style)); 117 insetValue->setTopRightRadius(CSSPrimitiveValue::create(inset->topRightR adius(), style));
118 insetValue->setBottomRightRadius(CSSPrimitiveValue::create(inset->bottom RightRadius(), style)); 118 insetValue->setBottomRightRadius(CSSPrimitiveValue::create(inset->bottom RightRadius(), style));
119 insetValue->setBottomLeftRadius(CSSPrimitiveValue::create(inset->bottomL eftRadius(), style)); 119 insetValue->setBottomLeftRadius(CSSPrimitiveValue::create(inset->bottomL eftRadius(), style));
120 120
121 basicShapeValue = insetValue.release(); 121 basicShapeValue = insetValue.release();
122 break; 122 break;
123 } 123 }
124 default: 124 default:
125 ASSERT_NOT_REACHED();
125 break; 126 break;
126 } 127 }
127 128
128 return pool.createValue(basicShapeValue.release()); 129 return pool.createValue(basicShapeValue.release());
129 } 130 }
130 131
131 static Length convertToLength(const StyleResolverState& state, CSSPrimitiveValue * value) 132 static Length convertToLength(const StyleResolverState& state, CSSPrimitiveValue * value)
132 { 133 {
133 if (!value) 134 if (!value)
134 return Length(0, Fixed); 135 return Length(0, Fixed);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 } 269 }
269 270
270 FloatPoint floatPointForCenterCoordinate(const BasicShapeCenterCoordinate& cente rX, const BasicShapeCenterCoordinate& centerY, FloatSize boxSize) 271 FloatPoint floatPointForCenterCoordinate(const BasicShapeCenterCoordinate& cente rX, const BasicShapeCenterCoordinate& centerY, FloatSize boxSize)
271 { 272 {
272 float x = floatValueForLength(centerX.computedLength(), boxSize.width()); 273 float x = floatValueForLength(centerX.computedLength(), boxSize.width());
273 float y = floatValueForLength(centerY.computedLength(), boxSize.height()); 274 float y = floatValueForLength(centerY.computedLength(), boxSize.height());
274 return FloatPoint(x, y); 275 return FloatPoint(x, y);
275 } 276 }
276 277
277 } 278 }
OLDNEW
« no previous file with comments | « Source/core/css/BasicShapeFunctions.h ('k') | Source/core/css/CSSBasicShapes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698