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

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

Issue 2158723002: Make CSSValuePair store const CSSValues (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_make_cssparsersinglevalue_return_const
Patch Set: Review feedback Created 4 years, 5 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 | « no previous file | third_party/WebKit/Source/core/css/CSSBasicShapeValues.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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 insetValue->setBottomRightRadius(CSSValuePair::create(inset->bottomRight Radius(), style)); 110 insetValue->setBottomRightRadius(CSSValuePair::create(inset->bottomRight Radius(), style));
111 insetValue->setBottomLeftRadius(CSSValuePair::create(inset->bottomLeftRa dius(), style)); 111 insetValue->setBottomLeftRadius(CSSValuePair::create(inset->bottomLeftRa dius(), style));
112 112
113 return insetValue; 113 return insetValue;
114 } 114 }
115 default: 115 default:
116 return nullptr; 116 return nullptr;
117 } 117 }
118 } 118 }
119 119
120 static Length convertToLength(const StyleResolverState& state, CSSPrimitiveValue * value) 120 static Length convertToLength(const StyleResolverState& state, const CSSPrimitiv eValue* value)
121 { 121 {
122 if (!value) 122 if (!value)
123 return Length(0, Fixed); 123 return Length(0, Fixed);
124 return value->convertToLength(state.cssToLengthConversionData()); 124 return value->convertToLength(state.cssToLengthConversionData());
125 } 125 }
126 126
127 static LengthSize convertToLengthSize(const StyleResolverState& state, CSSValueP air* value) 127 static LengthSize convertToLengthSize(const StyleResolverState& state, const CSS ValuePair* value)
128 { 128 {
129 if (!value) 129 if (!value)
130 return LengthSize(Length(0, Fixed), Length(0, Fixed)); 130 return LengthSize(Length(0, Fixed), Length(0, Fixed));
131 131
132 return LengthSize(convertToLength(state, &toCSSPrimitiveValue(value->first() )), convertToLength(state, &toCSSPrimitiveValue(value->second()))); 132 return LengthSize(convertToLength(state, &toCSSPrimitiveValue(value->first() )), convertToLength(state, &toCSSPrimitiveValue(value->second())));
133 } 133 }
134 134
135 static BasicShapeCenterCoordinate convertToCenterCoordinate(const StyleResolverS tate& state, CSSValue* value) 135 static BasicShapeCenterCoordinate convertToCenterCoordinate(const StyleResolverS tate& state, CSSValue* value)
136 { 136 {
137 BasicShapeCenterCoordinate::Direction direction; 137 BasicShapeCenterCoordinate::Direction direction;
(...skipping 26 matching lines...) Expand all
164 break; 164 break;
165 default: 165 default:
166 ASSERT_NOT_REACHED(); 166 ASSERT_NOT_REACHED();
167 direction = BasicShapeCenterCoordinate::TopLeft; 167 direction = BasicShapeCenterCoordinate::TopLeft;
168 break; 168 break;
169 } 169 }
170 170
171 return BasicShapeCenterCoordinate(direction, offset); 171 return BasicShapeCenterCoordinate(direction, offset);
172 } 172 }
173 173
174 static BasicShapeRadius cssValueToBasicShapeRadius(const StyleResolverState& sta te, CSSPrimitiveValue* radius) 174 static BasicShapeRadius cssValueToBasicShapeRadius(const StyleResolverState& sta te, const CSSPrimitiveValue* radius)
175 { 175 {
176 if (!radius) 176 if (!radius)
177 return BasicShapeRadius(BasicShapeRadius::ClosestSide); 177 return BasicShapeRadius(BasicShapeRadius::ClosestSide);
178 178
179 if (radius->isValueID()) { 179 if (radius->isValueID()) {
180 switch (radius->getValueID()) { 180 switch (radius->getValueID()) {
181 case CSSValueClosestSide: 181 case CSSValueClosestSide:
182 return BasicShapeRadius(BasicShapeRadius::ClosestSide); 182 return BasicShapeRadius(BasicShapeRadius::ClosestSide);
183 case CSSValueFarthestSide: 183 case CSSValueFarthestSide:
184 return BasicShapeRadius(BasicShapeRadius::FarthestSide); 184 return BasicShapeRadius(BasicShapeRadius::FarthestSide);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 } 247 }
248 248
249 FloatPoint floatPointForCenterCoordinate(const BasicShapeCenterCoordinate& cente rX, const BasicShapeCenterCoordinate& centerY, FloatSize boxSize) 249 FloatPoint floatPointForCenterCoordinate(const BasicShapeCenterCoordinate& cente rX, const BasicShapeCenterCoordinate& centerY, FloatSize boxSize)
250 { 250 {
251 float x = floatValueForLength(centerX.computedLength(), boxSize.width()); 251 float x = floatValueForLength(centerX.computedLength(), boxSize.width());
252 float y = floatValueForLength(centerY.computedLength(), boxSize.height()); 252 float y = floatValueForLength(centerY.computedLength(), boxSize.height());
253 return FloatPoint(x, y); 253 return FloatPoint(x, y);
254 } 254 }
255 255
256 } // namespace blink 256 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/CSSBasicShapeValues.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698