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

Side by Side Diff: Source/core/css/resolver/CSSToStyleMap.cpp

Issue 98193002: Call convertToLength in CSSToStyleMap instead of having it inlined (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years 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 | no next file » | 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r ights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r ights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 if (!value->isPrimitiveValue()) 224 if (!value->isPrimitiveValue())
225 return; 225 return;
226 226
227 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 227 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
228 Pair* pair = primitiveValue->getPairValue(); 228 Pair* pair = primitiveValue->getPairValue();
229 if (pair) { 229 if (pair) {
230 ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPositionX | | propertyID == CSSPropertyWebkitMaskPositionX); 230 ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPositionX | | propertyID == CSSPropertyWebkitMaskPositionX);
231 primitiveValue = pair->second(); 231 primitiveValue = pair->second();
232 } 232 }
233 233
234 Length length; 234 Length length = primitiveValue->convertToLength<FixedConversion | PercentCon version>(cssToLengthConversionData());
235 if (primitiveValue->isLength()) 235 ASSERT(!length.isUndefined());
236 length = primitiveValue->computeLength<Length>(cssToLengthConversionData ());
237 else if (primitiveValue->isPercentage())
238 length = Length(primitiveValue->getDoubleValue(), Percent);
239 else if (primitiveValue->isCalculatedPercentageWithLength())
240 length = Length(primitiveValue->cssCalcValue()->toCalcValue(cssToLengthC onversionData()));
241 else if (primitiveValue->isViewportPercentageLength())
242 length = primitiveValue->viewportPercentageLength();
243 else
244 return;
245 236
246 layer->setXPosition(length); 237 layer->setXPosition(length);
247 if (pair) 238 if (pair)
248 layer->setBackgroundXOrigin(*(pair->first())); 239 layer->setBackgroundXOrigin(*(pair->first()));
249 } 240 }
250 241
251 void CSSToStyleMap::mapFillYPosition(CSSPropertyID propertyID, FillLayer* layer, CSSValue* value) const 242 void CSSToStyleMap::mapFillYPosition(CSSPropertyID propertyID, FillLayer* layer, CSSValue* value) const
252 { 243 {
253 if (!value->isPrimitiveValue()) 244 if (!value->isPrimitiveValue())
254 return; 245 return;
255 246
256 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 247 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
257 Pair* pair = primitiveValue->getPairValue(); 248 Pair* pair = primitiveValue->getPairValue();
258 if (pair) { 249 if (pair) {
259 ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPositionY | | propertyID == CSSPropertyWebkitMaskPositionY); 250 ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPositionY | | propertyID == CSSPropertyWebkitMaskPositionY);
260 primitiveValue = pair->second(); 251 primitiveValue = pair->second();
261 } 252 }
262 253
263 Length length; 254 Length length = primitiveValue->convertToLength<FixedConversion | PercentCon version>(cssToLengthConversionData());
264 if (primitiveValue->isLength()) 255 ASSERT(!length.isUndefined());
265 length = primitiveValue->computeLength<Length>(cssToLengthConversionData ());
266 else if (primitiveValue->isPercentage())
267 length = Length(primitiveValue->getDoubleValue(), Percent);
268 else if (primitiveValue->isCalculatedPercentageWithLength())
269 length = Length(primitiveValue->cssCalcValue()->toCalcValue(cssToLengthC onversionData()));
270 else if (primitiveValue->isViewportPercentageLength())
271 length = primitiveValue->viewportPercentageLength();
272 else
273 return;
274 256
275 layer->setYPosition(length); 257 layer->setYPosition(length);
276 if (pair) 258 if (pair)
277 layer->setBackgroundYOrigin(*(pair->first())); 259 layer->setBackgroundYOrigin(*(pair->first()));
278 } 260 }
279 261
280 void CSSToStyleMap::mapFillMaskSourceType(CSSPropertyID, FillLayer* layer, CSSVa lue* value) 262 void CSSToStyleMap::mapFillMaskSourceType(CSSPropertyID, FillLayer* layer, CSSVa lue* value)
281 { 263 {
282 EMaskSourceType type = FillLayer::initialFillMaskSourceType(layer->type()); 264 EMaskSourceType type = FillLayer::initialFillMaskSourceType(layer->type());
283 if (value->isInitialValue()) { 265 if (value->isInitialValue()) {
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 verticalRule = SpaceImageRule; 651 verticalRule = SpaceImageRule;
670 break; 652 break;
671 default: // CSSValueRepeat 653 default: // CSSValueRepeat
672 verticalRule = RepeatImageRule; 654 verticalRule = RepeatImageRule;
673 break; 655 break;
674 } 656 }
675 image.setVerticalRule(verticalRule); 657 image.setVerticalRule(verticalRule);
676 } 658 }
677 659
678 }; 660 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698