| 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 17 matching lines...) Expand all Loading... |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 #ifndef SKY_ENGINE_CORE_CSS_CSSPRIMITIVEVALUEMAPPINGS_H_ | 30 #ifndef SKY_ENGINE_CORE_CSS_CSSPRIMITIVEVALUEMAPPINGS_H_ |
| 31 #define SKY_ENGINE_CORE_CSS_CSSPRIMITIVEVALUEMAPPINGS_H_ | 31 #define SKY_ENGINE_CORE_CSS_CSSPRIMITIVEVALUEMAPPINGS_H_ |
| 32 | 32 |
| 33 #include "gen/sky/core/CSSValueKeywords.h" | 33 #include "gen/sky/core/CSSValueKeywords.h" |
| 34 #include "sky/engine/core/css/CSSCalculationValue.h" | 34 #include "sky/engine/core/css/CSSCalculationValue.h" |
| 35 #include "sky/engine/core/css/CSSPrimitiveValue.h" | 35 #include "sky/engine/core/css/CSSPrimitiveValue.h" |
| 36 #include "sky/engine/core/css/CSSPrimitiveValueMappings.h" | 36 #include "sky/engine/core/css/CSSPrimitiveValueMappings.h" |
| 37 #include "sky/engine/core/css/CSSToLengthConversionData.h" | 37 #include "sky/engine/core/css/CSSToLengthConversionData.h" |
| 38 #include "sky/engine/core/rendering/style/LineClampValue.h" | |
| 39 #include "sky/engine/core/rendering/style/RenderStyleConstants.h" | 38 #include "sky/engine/core/rendering/style/RenderStyleConstants.h" |
| 40 #include "sky/engine/platform/Length.h" | 39 #include "sky/engine/platform/Length.h" |
| 41 #include "sky/engine/platform/fonts/FontDescription.h" | 40 #include "sky/engine/platform/fonts/FontDescription.h" |
| 42 #include "sky/engine/platform/fonts/FontSmoothingMode.h" | 41 #include "sky/engine/platform/fonts/FontSmoothingMode.h" |
| 43 #include "sky/engine/platform/fonts/TextRenderingMode.h" | 42 #include "sky/engine/platform/fonts/TextRenderingMode.h" |
| 44 #include "sky/engine/platform/graphics/GraphicsTypes.h" | 43 #include "sky/engine/platform/graphics/GraphicsTypes.h" |
| 45 #include "sky/engine/platform/graphics/Path.h" | 44 #include "sky/engine/platform/graphics/Path.h" |
| 46 #include "sky/engine/platform/scroll/ScrollableArea.h" | 45 #include "sky/engine/platform/scroll/ScrollableArea.h" |
| 47 #include "sky/engine/platform/text/TextDirection.h" | 46 #include "sky/engine/platform/text/TextDirection.h" |
| 48 #include "sky/engine/platform/text/UnicodeBidi.h" | 47 #include "sky/engine/platform/text/UnicodeBidi.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 m_primitiveUnitType = CSS_NUMBER; | 94 m_primitiveUnitType = CSS_NUMBER; |
| 96 m_value.num = static_cast<double>(i); | 95 m_value.num = static_cast<double>(i); |
| 97 } | 96 } |
| 98 | 97 |
| 99 template<> inline CSSPrimitiveValue::operator float() const | 98 template<> inline CSSPrimitiveValue::operator float() const |
| 100 { | 99 { |
| 101 ASSERT(isNumber()); | 100 ASSERT(isNumber()); |
| 102 return clampTo<float>(getDoubleValue()); | 101 return clampTo<float>(getDoubleValue()); |
| 103 } | 102 } |
| 104 | 103 |
| 105 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineClampValue i) | |
| 106 : CSSValue(PrimitiveClass) | |
| 107 { | |
| 108 m_primitiveUnitType = i.isPercentage() ? CSS_PERCENTAGE : CSS_NUMBER; | |
| 109 m_value.num = static_cast<double>(i.value()); | |
| 110 } | |
| 111 | |
| 112 template<> inline CSSPrimitiveValue::operator LineClampValue() const | |
| 113 { | |
| 114 if (m_primitiveUnitType == CSS_NUMBER) | |
| 115 return LineClampValue(clampTo<int>(m_value.num), LineClampLineCount); | |
| 116 | |
| 117 if (m_primitiveUnitType == CSS_PERCENTAGE) | |
| 118 return LineClampValue(clampTo<int>(m_value.num), LineClampPercentage); | |
| 119 | |
| 120 ASSERT_NOT_REACHED(); | |
| 121 return LineClampValue(); | |
| 122 } | |
| 123 | |
| 124 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColumnFill columnFill) | 104 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColumnFill columnFill) |
| 125 : CSSValue(PrimitiveClass) | 105 : CSSValue(PrimitiveClass) |
| 126 { | 106 { |
| 127 m_primitiveUnitType = CSS_VALUE_ID; | 107 m_primitiveUnitType = CSS_VALUE_ID; |
| 128 switch (columnFill) { | 108 switch (columnFill) { |
| 129 case ColumnFillAuto: | 109 case ColumnFillAuto: |
| 130 m_value.valueID = CSSValueAuto; | 110 m_value.valueID = CSSValueAuto; |
| 131 break; | 111 break; |
| 132 case ColumnFillBalance: | 112 case ColumnFillBalance: |
| 133 m_value.valueID = CSSValueBalance; | 113 m_value.valueID = CSSValueBalance; |
| (...skipping 3458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3592 default: | 3572 default: |
| 3593 break; | 3573 break; |
| 3594 } | 3574 } |
| 3595 ASSERT_NOT_REACHED(); | 3575 ASSERT_NOT_REACHED(); |
| 3596 return ScrollBehaviorInstant; | 3576 return ScrollBehaviorInstant; |
| 3597 } | 3577 } |
| 3598 | 3578 |
| 3599 } | 3579 } |
| 3600 | 3580 |
| 3601 #endif // SKY_ENGINE_CORE_CSS_CSSPRIMITIVEVALUEMAPPINGS_H_ | 3581 #endif // SKY_ENGINE_CORE_CSS_CSSPRIMITIVEVALUEMAPPINGS_H_ |
| OLD | NEW |