OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 bool m_isInteger; | 97 bool m_isInteger; |
98 }; | 98 }; |
99 | 99 |
100 class CORE_EXPORT CSSCalcValue : public GarbageCollected<CSSCalcValue> { | 100 class CORE_EXPORT CSSCalcValue : public GarbageCollected<CSSCalcValue> { |
101 public: | 101 public: |
102 static CSSCalcValue* create(const CSSParserTokenRange&, ValueRange); | 102 static CSSCalcValue* create(const CSSParserTokenRange&, ValueRange); |
103 static CSSCalcValue* create(CSSCalcExpressionNode*, ValueRange = ValueRangeA
ll); | 103 static CSSCalcValue* create(CSSCalcExpressionNode*, ValueRange = ValueRangeA
ll); |
104 | 104 |
105 static CSSCalcExpressionNode* createExpressionNode(CSSPrimitiveValue*, bool
isInteger = false); | 105 static CSSCalcExpressionNode* createExpressionNode(CSSPrimitiveValue*, bool
isInteger = false); |
106 static CSSCalcExpressionNode* createExpressionNode(CSSCalcExpressionNode*, C
SSCalcExpressionNode*, CalcOperator); | 106 static CSSCalcExpressionNode* createExpressionNode(CSSCalcExpressionNode*, C
SSCalcExpressionNode*, CalcOperator); |
107 static CSSCalcExpressionNode* createExpressionNode(double pixels, double per
cent); | 107 static CSSCalcExpressionNode* createExpressionNode(double pixels, double per
cent, bool unitless = false); |
108 | 108 |
109 PassRefPtr<CalculationValue> toCalcValue(const CSSToLengthConversionData& co
nversionData) const | 109 PassRefPtr<CalculationValue> toCalcValue(const CSSToLengthConversionData& co
nversionData) const |
110 { | 110 { |
111 PixelsAndPercent value(0, 0); | 111 PixelsAndPercent value(0, 0); |
112 m_expression->accumulatePixelsAndPercent(conversionData, value); | 112 m_expression->accumulatePixelsAndPercent(conversionData, value); |
113 return CalculationValue::create(value, m_nonNegative ? ValueRangeNonNega
tive : ValueRangeAll); | 113 return CalculationValue::create(value, m_nonNegative ? ValueRangeNonNega
tive : ValueRangeAll); |
114 } | 114 } |
115 CalculationCategory category() const { return m_expression->category(); } | 115 CalculationCategory category() const { return m_expression->category(); } |
116 bool isInt() const { return m_expression->isInteger(); } | 116 bool isInt() const { return m_expression->isInteger(); } |
117 double doubleValue() const; | 117 double doubleValue() const; |
(...skipping 20 matching lines...) Expand all Loading... |
138 | 138 |
139 double clampToPermittedRange(double) const; | 139 double clampToPermittedRange(double) const; |
140 | 140 |
141 const Member<CSSCalcExpressionNode> m_expression; | 141 const Member<CSSCalcExpressionNode> m_expression; |
142 const bool m_nonNegative; | 142 const bool m_nonNegative; |
143 }; | 143 }; |
144 | 144 |
145 } // namespace blink | 145 } // namespace blink |
146 | 146 |
147 #endif // CSSCalculationValue_h | 147 #endif // CSSCalculationValue_h |
OLD | NEW |