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

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

Issue 1318543010: Change first() and second() in CSSPairValue to return const references (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Review feedback Created 5 years, 3 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 | Annotate | Revision Log
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 if (!value) 133 if (!value)
134 return Length(0, Fixed); 134 return Length(0, Fixed);
135 return value->convertToLength(state.cssToLengthConversionData()); 135 return value->convertToLength(state.cssToLengthConversionData());
136 } 136 }
137 137
138 static LengthSize convertToLengthSize(const StyleResolverState& state, CSSValueP air* value) 138 static LengthSize convertToLengthSize(const StyleResolverState& state, CSSValueP air* value)
139 { 139 {
140 if (!value) 140 if (!value)
141 return LengthSize(Length(0, Fixed), Length(0, Fixed)); 141 return LengthSize(Length(0, Fixed), Length(0, Fixed));
142 142
143 return LengthSize(convertToLength(state, toCSSPrimitiveValue(value->first()) ), convertToLength(state, toCSSPrimitiveValue(value->second()))); 143 return LengthSize(convertToLength(state, &toCSSPrimitiveValue(value->first() )), convertToLength(state, &toCSSPrimitiveValue(value->second())));
144 } 144 }
145 145
146 static BasicShapeCenterCoordinate convertToCenterCoordinate(const StyleResolverS tate& state, CSSValue* value) 146 static BasicShapeCenterCoordinate convertToCenterCoordinate(const StyleResolverS tate& state, CSSValue* value)
147 { 147 {
148 BasicShapeCenterCoordinate::Direction direction; 148 BasicShapeCenterCoordinate::Direction direction;
149 Length offset = Length(0, Fixed); 149 Length offset = Length(0, Fixed);
150 150
151 CSSValueID keyword = CSSValueTop; 151 CSSValueID keyword = CSSValueTop;
152 if (!value) { 152 if (!value) {
153 keyword = CSSValueCenter; 153 keyword = CSSValueCenter;
154 } else if (value->isPrimitiveValue() && toCSSPrimitiveValue(value)->isValueI D()) { 154 } else if (value->isPrimitiveValue() && toCSSPrimitiveValue(value)->isValueI D()) {
155 keyword = toCSSPrimitiveValue(value)->getValueID(); 155 keyword = toCSSPrimitiveValue(value)->getValueID();
156 } else if (value->isValuePair()) { 156 } else if (value->isValuePair()) {
157 keyword = toCSSPrimitiveValue(toCSSValuePair(value)->first())->getValueI D(); 157 keyword = toCSSPrimitiveValue(toCSSValuePair(value)->first()).getValueID ();
158 offset = convertToLength(state, toCSSPrimitiveValue(toCSSValuePair(value )->second())); 158 offset = convertToLength(state, &toCSSPrimitiveValue(toCSSValuePair(valu e)->second()));
159 } else { 159 } else {
160 offset = convertToLength(state, toCSSPrimitiveValue(value)); 160 offset = convertToLength(state, toCSSPrimitiveValue(value));
161 } 161 }
162 162
163 switch (keyword) { 163 switch (keyword) {
164 case CSSValueTop: 164 case CSSValueTop:
165 case CSSValueLeft: 165 case CSSValueLeft:
166 direction = BasicShapeCenterCoordinate::TopLeft; 166 direction = BasicShapeCenterCoordinate::TopLeft;
167 break; 167 break;
168 case CSSValueRight: 168 case CSSValueRight:
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 } 267 }
268 268
269 FloatPoint floatPointForCenterCoordinate(const BasicShapeCenterCoordinate& cente rX, const BasicShapeCenterCoordinate& centerY, FloatSize boxSize) 269 FloatPoint floatPointForCenterCoordinate(const BasicShapeCenterCoordinate& cente rX, const BasicShapeCenterCoordinate& centerY, FloatSize boxSize)
270 { 270 {
271 float x = floatValueForLength(centerX.computedLength(), boxSize.width()); 271 float x = floatValueForLength(centerX.computedLength(), boxSize.width());
272 float y = floatValueForLength(centerY.computedLength(), boxSize.height()); 272 float y = floatValueForLength(centerY.computedLength(), boxSize.height());
273 return FloatPoint(x, y); 273 return FloatPoint(x, y);
274 } 274 }
275 275
276 } 276 }
OLDNEW
« no previous file with comments | « Source/core/animation/LengthPairStyleInterpolationTest.cpp ('k') | Source/core/css/CSSBasicShapes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698