| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 virtual void accumulateLengthArray(CSSLengthArray&, double multiplier) const
= 0; | 82 virtual void accumulateLengthArray(CSSLengthArray&, double multiplier) const
= 0; |
| 83 virtual void accumulatePixelsAndPercent(const CSSToLengthConversionData&, Pi
xelsAndPercent&, float multiplier = 1) const = 0; | 83 virtual void accumulatePixelsAndPercent(const CSSToLengthConversionData&, Pi
xelsAndPercent&, float multiplier = 1) const = 0; |
| 84 virtual String customCSSText() const = 0; | 84 virtual String customCSSText() const = 0; |
| 85 virtual bool equals(const CSSCalcExpressionNode& other) const { return m_cat
egory == other.m_category && m_isInteger == other.m_isInteger; } | 85 virtual bool equals(const CSSCalcExpressionNode& other) const { return m_cat
egory == other.m_category && m_isInteger == other.m_isInteger; } |
| 86 virtual Type type() const = 0; | 86 virtual Type type() const = 0; |
| 87 | 87 |
| 88 CalculationCategory category() const { return m_category; } | 88 CalculationCategory category() const { return m_category; } |
| 89 virtual CSSPrimitiveValue::UnitType primitiveType() const = 0; | 89 virtual CSSPrimitiveValue::UnitType primitiveType() const = 0; |
| 90 bool isInteger() const { return m_isInteger; } | 90 bool isInteger() const { return m_isInteger; } |
| 91 | 91 |
| 92 virtual void trace(Visitor*) { } | |
| 93 | |
| 94 protected: | 92 protected: |
| 95 CSSCalcExpressionNode(CalculationCategory category, bool isInteger) | 93 CSSCalcExpressionNode(CalculationCategory category, bool isInteger) |
| 96 : m_category(category) | 94 : m_category(category) |
| 97 , m_isInteger(isInteger) | 95 , m_isInteger(isInteger) |
| 98 { | 96 { |
| 99 ASSERT(category != CalcOther); | 97 ASSERT(category != CalcOther); |
| 100 } | 98 } |
| 101 | 99 |
| 102 CalculationCategory m_category; | 100 CalculationCategory m_category; |
| 103 bool m_isInteger; | 101 bool m_isInteger; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 123 double doubleValue() const; | 121 double doubleValue() const; |
| 124 bool isNegative() const { return m_expression->doubleValue() < 0; } | 122 bool isNegative() const { return m_expression->doubleValue() < 0; } |
| 125 ValueRange permittedValueRange() { return m_nonNegative ? ValueRangeNonNegat
ive : ValueRangeAll; } | 123 ValueRange permittedValueRange() { return m_nonNegative ? ValueRangeNonNegat
ive : ValueRangeAll; } |
| 126 double computeLengthPx(const CSSToLengthConversionData&) const; | 124 double computeLengthPx(const CSSToLengthConversionData&) const; |
| 127 void accumulateLengthArray(CSSLengthArray& lengthArray, double multiplier) c
onst { m_expression->accumulateLengthArray(lengthArray, multiplier); } | 125 void accumulateLengthArray(CSSLengthArray& lengthArray, double multiplier) c
onst { m_expression->accumulateLengthArray(lengthArray, multiplier); } |
| 128 CSSCalcExpressionNode* expressionNode() const { return m_expression.get(); } | 126 CSSCalcExpressionNode* expressionNode() const { return m_expression.get(); } |
| 129 | 127 |
| 130 String customCSSText() const; | 128 String customCSSText() const; |
| 131 bool equals(const CSSCalcValue&) const; | 129 bool equals(const CSSCalcValue&) const; |
| 132 | 130 |
| 133 void traceAfterDispatch(Visitor*); | |
| 134 | |
| 135 private: | 131 private: |
| 136 CSSCalcValue(PassRefPtr<CSSCalcExpressionNode> expression, ValueRange range) | 132 CSSCalcValue(PassRefPtr<CSSCalcExpressionNode> expression, ValueRange range) |
| 137 : CSSValue(CalculationClass) | 133 : CSSValue(CalculationClass) |
| 138 , m_expression(expression) | 134 , m_expression(expression) |
| 139 , m_nonNegative(range == ValueRangeNonNegative) | 135 , m_nonNegative(range == ValueRangeNonNegative) |
| 140 { | 136 { |
| 141 } | 137 } |
| 142 | 138 |
| 143 double clampToPermittedRange(double) const; | 139 double clampToPermittedRange(double) const; |
| 144 | 140 |
| 145 const RefPtr<CSSCalcExpressionNode> m_expression; | 141 const RefPtr<CSSCalcExpressionNode> m_expression; |
| 146 const bool m_nonNegative; | 142 const bool m_nonNegative; |
| 147 }; | 143 }; |
| 148 | 144 |
| 149 DEFINE_CSS_VALUE_TYPE_CASTS(CSSCalcValue, isCalcValue()); | 145 DEFINE_CSS_VALUE_TYPE_CASTS(CSSCalcValue, isCalcValue()); |
| 150 | 146 |
| 151 } // namespace blink | 147 } // namespace blink |
| 152 | 148 |
| 153 | 149 |
| 154 #endif // CSSCalculationValue_h | 150 #endif // CSSCalculationValue_h |
| OLD | NEW |