| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 CalcLength, | 59 CalcLength, |
| 60 CalcPercent, | 60 CalcPercent, |
| 61 CalcPercentNumber, | 61 CalcPercentNumber, |
| 62 CalcPercentLength, | 62 CalcPercentLength, |
| 63 CalcAngle, | 63 CalcAngle, |
| 64 CalcTime, | 64 CalcTime, |
| 65 CalcFrequency, | 65 CalcFrequency, |
| 66 CalcOther | 66 CalcOther |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 class CSSCalcExpressionNode : public RefCountedWillBeGarbageCollected<CSSCalcExp
ressionNode> { | 69 class CSSCalcExpressionNode : public RefCountedWillBeGarbageCollectedFinalized<C
SSCalcExpressionNode> { |
| 70 DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(CSSCalcExpressionNode); | 70 DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(CSSCalcExpressionNode); |
| 71 public: | 71 public: |
| 72 enum Type { | 72 enum Type { |
| 73 CssCalcPrimitiveValue = 1, | 73 CssCalcPrimitiveValue = 1, |
| 74 CssCalcBinaryOperation | 74 CssCalcBinaryOperation |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 virtual bool isZero() const = 0; | 77 virtual bool isZero() const = 0; |
| 78 virtual double doubleValue() const = 0; | 78 virtual double doubleValue() const = 0; |
| 79 virtual double computeLengthPx(const CSSToLengthConversionData&) const = 0; | 79 virtual double computeLengthPx(const CSSToLengthConversionData&) const = 0; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 99 | 99 |
| 100 CalculationCategory m_category; | 100 CalculationCategory m_category; |
| 101 bool m_isInteger; | 101 bool m_isInteger; |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 class CORE_EXPORT CSSCalcValue : public CSSValueObject { | 104 class CORE_EXPORT CSSCalcValue : public CSSValueObject { |
| 105 public: | 105 public: |
| 106 static PassRefPtrWillBeRawPtr<CSSCalcValue> create(CSSParserValueList*, Valu
eRange); | 106 static PassRefPtrWillBeRawPtr<CSSCalcValue> create(CSSParserValueList*, Valu
eRange); |
| 107 static PassRefPtrWillBeRawPtr<CSSCalcValue> create(PassRefPtrWillBeRawPtr<CS
SCalcExpressionNode>, ValueRange = ValueRangeAll); | 107 static PassRefPtrWillBeRawPtr<CSSCalcValue> create(PassRefPtrWillBeRawPtr<CS
SCalcExpressionNode>, ValueRange = ValueRangeAll); |
| 108 | 108 |
| 109 static PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> createExpressionNode(Pa
ssRefPtrWillBeRawPtr<CSSPrimitiveValue>, bool isInteger = false); | 109 static PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> createExpressionNode(CS
SPrimitiveValue, bool isInteger = false); |
| 110 static PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> createExpressionNode(Pa
ssRefPtrWillBeRawPtr<CSSCalcExpressionNode>, PassRefPtrWillBeRawPtr<CSSCalcExpre
ssionNode>, CalcOperator); | 110 static PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> createExpressionNode(Pa
ssRefPtrWillBeRawPtr<CSSCalcExpressionNode>, PassRefPtrWillBeRawPtr<CSSCalcExpre
ssionNode>, CalcOperator); |
| 111 static PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> createExpressionNode(do
uble pixels, double percent); | 111 static PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> createExpressionNode(do
uble pixels, double percent); |
| 112 | 112 |
| 113 PassRefPtr<CalculationValue> toCalcValue(const CSSToLengthConversionData& co
nversionData) const | 113 PassRefPtr<CalculationValue> toCalcValue(const CSSToLengthConversionData& co
nversionData) const |
| 114 { | 114 { |
| 115 PixelsAndPercent value(0, 0); | 115 PixelsAndPercent value(0, 0); |
| 116 m_expression->accumulatePixelsAndPercent(conversionData, value); | 116 m_expression->accumulatePixelsAndPercent(conversionData, value); |
| 117 return CalculationValue::create(value, m_nonNegative ? ValueRangeNonNega
tive : ValueRangeAll); | 117 return CalculationValue::create(value, m_nonNegative ? ValueRangeNonNega
tive : ValueRangeAll); |
| 118 } | 118 } |
| 119 CalculationCategory category() const { return m_expression->category(); } | 119 CalculationCategory category() const { return m_expression->category(); } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 143 const RefPtrWillBeMember<CSSCalcExpressionNode> m_expression; | 143 const RefPtrWillBeMember<CSSCalcExpressionNode> m_expression; |
| 144 const bool m_nonNegative; | 144 const bool m_nonNegative; |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 DEFINE_CSS_VALUE_TYPE_CASTS(CSSCalcValue, isCalcValue()); | 147 DEFINE_CSS_VALUE_TYPE_CASTS(CSSCalcValue, isCalcValue()); |
| 148 | 148 |
| 149 } // namespace blink | 149 } // namespace blink |
| 150 | 150 |
| 151 | 151 |
| 152 #endif // CSSCalculationValue_h | 152 #endif // CSSCalculationValue_h |
| OLD | NEW |