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

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

Issue 1421533006: Make SVGLength wrap a CSSPrimitiveValue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments addressed Created 5 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * * Redistributions of source code must retain the above copyright 4 * * Redistributions of source code must retain the above copyright
5 * notice, this list of conditions and the following disclaimer. 5 * notice, this list of conditions and the following disclaimer.
6 * * Redistributions in binary form must reproduce the above 6 * * Redistributions in binary form must reproduce the above
7 * copyright notice, this list of conditions and the following disclaimer 7 * copyright notice, this list of conditions and the following disclaimer
8 * in the documentation and/or other materials provided with the 8 * in the documentation and/or other materials provided with the
9 * distribution. 9 * distribution.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 float em = state.parentStyle()->specifiedFontSize(); 198 float em = state.parentStyle()->specifiedFontSize();
199 float rem = state.rootElementStyle() ? state.rootElementStyle()->specifiedFo ntSize() : 1.0f; 199 float rem = state.rootElementStyle() ? state.rootElementStyle()->specifiedFo ntSize() : 1.0f;
200 CSSToLengthConversionData::FontSizes fontSizes(em, rem, &state.parentStyle() ->font()); 200 CSSToLengthConversionData::FontSizes fontSizes(em, rem, &state.parentStyle() ->font());
201 CSSToLengthConversionData::ViewportSize viewportSize(state.document().layout View()); 201 CSSToLengthConversionData::ViewportSize viewportSize(state.document().layout View());
202 202
203 CSSToLengthConversionData conversionData(state.style(), fontSizes, viewportS ize, 1.0f); 203 CSSToLengthConversionData conversionData(state.style(), fontSizes, viewportS ize, 1.0f);
204 if (primitiveValue.isLength()) 204 if (primitiveValue.isLength())
205 return primitiveValue.computeLength<float>(conversionData); 205 return primitiveValue.computeLength<float>(conversionData);
206 if (primitiveValue.isCalculatedPercentageWithLength()) 206 if (primitiveValue.isCalculatedPercentageWithLength())
207 return primitiveValue.cssCalcValue()->toCalcValue(conversionData)->evalu ate(parentSize.value); 207 return primitiveValue.cssCalcValue()->toCalcValue(conversionData)->evalu ate(parentSize.value);
208 if (primitiveValue.isNumber())
209 return primitiveValue.getFloatValue();
208 210
209 ASSERT_NOT_REACHED(); 211 ASSERT_NOT_REACHED();
210 return 0; 212 return 0;
211 } 213 }
212 214
213 FontDescription::Size StyleBuilderConverter::convertFontSize(StyleResolverState& state, const CSSValue& value) 215 FontDescription::Size StyleBuilderConverter::convertFontSize(StyleResolverState& state, const CSSValue& value)
214 { 216 {
215 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); 217 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
216 218
217 FontDescription::Size parentSize(0, 0.0f, false); 219 FontDescription::Size parentSize(0, 0.0f, false);
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 return ScaleTransformOperation::create(sx, sy, sz, TransformOperation::Scale 3D); 944 return ScaleTransformOperation::create(sx, sy, sz, TransformOperation::Scale 3D);
943 } 945 }
944 946
945 RespectImageOrientationEnum StyleBuilderConverter::convertImageOrientation(Style ResolverState& state, const CSSValue& value) 947 RespectImageOrientationEnum StyleBuilderConverter::convertImageOrientation(Style ResolverState& state, const CSSValue& value)
946 { 948 {
947 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); 949 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
948 return primitiveValue.getValueID() == CSSValueFromImage ? RespectImageOrient ation : DoNotRespectImageOrientation; 950 return primitiveValue.getValueID() == CSSValueFromImage ? RespectImageOrient ation : DoNotRespectImageOrientation;
949 } 951 }
950 952
951 } // namespace blink 953 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698