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

Side by Side Diff: Source/core/css/CSSPrimitiveValueMappings.h

Issue 68203023: Merge FixedIntegerConversion and FixedFloatConversion for CSSPrimitiveValue::convertToLength (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Created 7 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) 2007 Alexey Proskuryakov <ap@nypop.com>. 2 * Copyright (C) 2007 Alexey Proskuryakov <ap@nypop.com>.
3 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
4 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 4 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
5 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com> 5 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com>
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
(...skipping 4412 matching lines...) Expand 10 before | Expand all | Expand 10 after
4423 m_value.valueID = CSSValueColumn; 4423 m_value.valueID = CSSValueColumn;
4424 break; 4424 break;
4425 case AutoFlowRow: 4425 case AutoFlowRow:
4426 m_value.valueID = CSSValueRow; 4426 m_value.valueID = CSSValueRow;
4427 break; 4427 break;
4428 } 4428 }
4429 } 4429 }
4430 4430
4431 enum LengthConversion { 4431 enum LengthConversion {
4432 AnyConversion = ~0, 4432 AnyConversion = ~0,
4433 FixedIntegerConversion = 1 << 0, 4433 FixedConversion = 1 << 0,
4434 FixedFloatConversion = 1 << 1, 4434 AutoConversion = 1 << 1,
4435 AutoConversion = 1 << 2, 4435 PercentConversion = 1 << 2,
4436 PercentConversion = 1 << 3,
4437 }; 4436 };
4438 4437
4439 template<int supported> Length CSSPrimitiveValue::convertToLength(const RenderSt yle* style, const RenderStyle* rootStyle, double multiplier, bool computingFontS ize) 4438 template<int supported> Length CSSPrimitiveValue::convertToLength(const RenderSt yle* style, const RenderStyle* rootStyle, double multiplier, bool computingFontS ize)
4440 { 4439 {
4441 ASSERT(!hasVariableReference()); 4440 ASSERT(!hasVariableReference());
4442 if ((supported & (FixedIntegerConversion | FixedFloatConversion)) && isFontR elativeLength() && (!style || !rootStyle)) 4441 if ((supported & FixedConversion) && isFontRelativeLength() && (!style || !r ootStyle))
4443 return Length(Undefined); 4442 return Length(Undefined);
4444 if ((supported & FixedIntegerConversion) && isLength()) 4443 if ((supported & FixedConversion) && isLength())
4445 return computeLength<Length>(style, rootStyle, multiplier, computingFont Size); 4444 return computeLength<Length>(style, rootStyle, multiplier, computingFont Size);
4446 if ((supported & FixedFloatConversion) && isLength())
4447 return Length(computeLength<double>(style, rootStyle, multiplier), Fixed );
4448 if ((supported & PercentConversion) && isPercentage()) 4445 if ((supported & PercentConversion) && isPercentage())
4449 return Length(getDoubleValue(), Percent); 4446 return Length(getDoubleValue(), Percent);
4450 if ((supported & AutoConversion) && getValueID() == CSSValueAuto) 4447 if ((supported & AutoConversion) && getValueID() == CSSValueAuto)
4451 return Length(Auto); 4448 return Length(Auto);
4452 if ((supported & (FixedIntegerConversion | FixedFloatConversion)) && (suppor ted & PercentConversion) && isCalculated()) 4449 if ((supported & FixedConversion) && (supported & PercentConversion) && isCa lculated())
4453 return Length(cssCalcValue()->toCalcValue(style, rootStyle, multiplier)) ; 4450 return Length(cssCalcValue()->toCalcValue(style, rootStyle, multiplier)) ;
4454 if ((supported & (FixedIntegerConversion | FixedFloatConversion)) && isViewp ortPercentageLength()) 4451 if ((supported & FixedConversion) && isViewportPercentageLength())
4455 return viewportPercentageLength(); 4452 return viewportPercentageLength();
4456 return Length(Undefined); 4453 return Length(Undefined);
4457 } 4454 }
4458 4455
4459 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBufferedRendering e) 4456 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBufferedRendering e)
4460 : CSSValue(PrimitiveClass) 4457 : CSSValue(PrimitiveClass)
4461 { 4458 {
4462 m_primitiveUnitType = CSS_VALUE_ID; 4459 m_primitiveUnitType = CSS_VALUE_ID;
4463 switch (e) { 4460 switch (e) {
4464 case BR_AUTO: 4461 case BR_AUTO:
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
4950 break; 4947 break;
4951 } 4948 }
4952 4949
4953 ASSERT_NOT_REACHED(); 4950 ASSERT_NOT_REACHED();
4954 return TouchActionDelayNone; 4951 return TouchActionDelayNone;
4955 } 4952 }
4956 4953
4957 } 4954 }
4958 4955
4959 #endif 4956 #endif
OLDNEW
« no previous file with comments | « Source/core/css/CSSCalculationValue.cpp ('k') | Source/core/css/resolver/FilterOperationResolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698