OLD | NEW |
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 16 matching lines...) Expand all Loading... |
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 */ | 28 */ |
29 | 29 |
30 #ifndef CSSPrimitiveValueMappings_h | 30 #ifndef CSSPrimitiveValueMappings_h |
31 #define CSSPrimitiveValueMappings_h | 31 #define CSSPrimitiveValueMappings_h |
32 | 32 |
33 #include "CSSValueKeywords.h" | 33 #include "CSSValueKeywords.h" |
34 #include "core/css/CSSCalculationValue.h" | 34 #include "core/css/CSSCalculationValue.h" |
35 #include "core/css/CSSPrimitiveValue.h" | 35 #include "core/css/CSSPrimitiveValue.h" |
36 #include "core/css/CSSReflectionDirection.h" | 36 #include "core/css/CSSReflectionDirection.h" |
| 37 #include "core/css/CSSToLengthConversionData.h" |
37 #include "core/platform/graphics/Path.h" | 38 #include "core/platform/graphics/Path.h" |
38 #include "core/rendering/style/LineClampValue.h" | 39 #include "core/rendering/style/LineClampValue.h" |
39 #include "core/rendering/style/RenderStyleConstants.h" | 40 #include "core/rendering/style/RenderStyleConstants.h" |
40 #include "core/rendering/style/SVGRenderStyleDefs.h" | 41 #include "core/rendering/style/SVGRenderStyleDefs.h" |
41 #include "platform/Length.h" | 42 #include "platform/Length.h" |
42 #include "platform/ThemeTypes.h" | 43 #include "platform/ThemeTypes.h" |
43 #include "platform/fonts/FontDescription.h" | 44 #include "platform/fonts/FontDescription.h" |
44 #include "platform/fonts/FontSmoothingMode.h" | 45 #include "platform/fonts/FontSmoothingMode.h" |
45 #include "platform/fonts/TextRenderingMode.h" | 46 #include "platform/fonts/TextRenderingMode.h" |
46 #include "platform/graphics/GraphicsTypes.h" | 47 #include "platform/graphics/GraphicsTypes.h" |
(...skipping 4381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4428 } | 4429 } |
4429 } | 4430 } |
4430 | 4431 |
4431 enum LengthConversion { | 4432 enum LengthConversion { |
4432 AnyConversion = ~0, | 4433 AnyConversion = ~0, |
4433 FixedConversion = 1 << 0, | 4434 FixedConversion = 1 << 0, |
4434 AutoConversion = 1 << 1, | 4435 AutoConversion = 1 << 1, |
4435 PercentConversion = 1 << 2, | 4436 PercentConversion = 1 << 2, |
4436 }; | 4437 }; |
4437 | 4438 |
4438 template<int supported> Length CSSPrimitiveValue::convertToLength(const RenderSt
yle* style, const RenderStyle* rootStyle, double multiplier, bool computingFontS
ize) | 4439 template<int supported> Length CSSPrimitiveValue::convertToLength(const CSSToLen
gthConversionData& conversionData) |
4439 { | 4440 { |
4440 ASSERT(!hasVariableReference()); | 4441 ASSERT(!hasVariableReference()); |
4441 if ((supported & FixedConversion) && isFontRelativeLength() && (!style || !r
ootStyle)) | |
4442 return Length(Undefined); | |
4443 if ((supported & FixedConversion) && isLength()) | 4442 if ((supported & FixedConversion) && isLength()) |
4444 return computeLength<Length>(style, rootStyle, multiplier, computingFont
Size); | 4443 return computeLength<Length>(conversionData); |
4445 if ((supported & PercentConversion) && isPercentage()) | 4444 if ((supported & PercentConversion) && isPercentage()) |
4446 return Length(getDoubleValue(), Percent); | 4445 return Length(getDoubleValue(), Percent); |
4447 if ((supported & AutoConversion) && getValueID() == CSSValueAuto) | 4446 if ((supported & AutoConversion) && getValueID() == CSSValueAuto) |
4448 return Length(Auto); | 4447 return Length(Auto); |
4449 if ((supported & FixedConversion) && (supported & PercentConversion) && isCa
lculated()) | 4448 if ((supported & FixedConversion) && (supported & PercentConversion) && isCa
lculated()) |
4450 return Length(cssCalcValue()->toCalcValue(style, rootStyle, multiplier))
; | 4449 return Length(cssCalcValue()->toCalcValue(conversionData)); |
4451 if ((supported & FixedConversion) && isViewportPercentageLength()) | 4450 if ((supported & FixedConversion) && isViewportPercentageLength()) |
4452 return viewportPercentageLength(); | 4451 return viewportPercentageLength(); |
4453 return Length(Undefined); | 4452 return Length(Undefined); |
4454 } | 4453 } |
4455 | 4454 |
4456 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBufferedRendering e) | 4455 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBufferedRendering e) |
4457 : CSSValue(PrimitiveClass) | 4456 : CSSValue(PrimitiveClass) |
4458 { | 4457 { |
4459 m_primitiveUnitType = CSS_VALUE_ID; | 4458 m_primitiveUnitType = CSS_VALUE_ID; |
4460 switch (e) { | 4459 switch (e) { |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4947 break; | 4946 break; |
4948 } | 4947 } |
4949 | 4948 |
4950 ASSERT_NOT_REACHED(); | 4949 ASSERT_NOT_REACHED(); |
4951 return TouchActionDelayNone; | 4950 return TouchActionDelayNone; |
4952 } | 4951 } |
4953 | 4952 |
4954 } | 4953 } |
4955 | 4954 |
4956 #endif | 4955 #endif |
OLD | NEW |