Chromium Code Reviews| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 PassRefPtr<CalculationValue> toCalcValue(const CSSToLengthConversionData& co nversionData) const | 112 PassRefPtr<CalculationValue> toCalcValue(const CSSToLengthConversionData& co nversionData) const |
| 113 { | 113 { |
| 114 PixelsAndPercent value(0, 0); | 114 PixelsAndPercent value(0, 0); |
| 115 m_expression->accumulatePixelsAndPercent(conversionData, value); | 115 m_expression->accumulatePixelsAndPercent(conversionData, value); |
| 116 return CalculationValue::create(value, m_nonNegative ? ValueRangeNonNega tive : ValueRangeAll); | 116 return CalculationValue::create(value, m_nonNegative ? ValueRangeNonNega tive : ValueRangeAll); |
| 117 } | 117 } |
| 118 CalculationCategory category() const { return m_expression->category(); } | 118 CalculationCategory category() const { return m_expression->category(); } |
| 119 bool isInt() const { return m_expression->isInteger(); } | 119 bool isInt() const { return m_expression->isInteger(); } |
| 120 double doubleValue() const; | 120 double doubleValue() const; |
| 121 bool isNegative() const { return m_expression->doubleValue() < 0; } | 121 bool isNegative() const { return m_expression->doubleValue() < 0; } |
| 122 bool isPositive() const { return m_expression->doubleValue() > 0; } | |
|
alancutter (OOO until 2018)
2015/03/12 03:43:08
The doubleValue() function is broken for lengths a
| |
| 122 ValueRange permittedValueRange() { return m_nonNegative ? ValueRangeNonNegat ive : ValueRangeAll; } | 123 ValueRange permittedValueRange() { return m_nonNegative ? ValueRangeNonNegat ive : ValueRangeAll; } |
| 123 double computeLengthPx(const CSSToLengthConversionData&) const; | 124 double computeLengthPx(const CSSToLengthConversionData&) const; |
| 124 void accumulateLengthArray(CSSLengthArray& lengthArray, CSSLengthTypeArray& lengthTypeArray, double multiplier) const { m_expression->accumulateLengthArray( lengthArray, lengthTypeArray, multiplier); } | 125 void accumulateLengthArray(CSSLengthArray& lengthArray, CSSLengthTypeArray& lengthTypeArray, double multiplier) const { m_expression->accumulateLengthArray( lengthArray, lengthTypeArray, multiplier); } |
| 125 CSSCalcExpressionNode* expressionNode() const { return m_expression.get(); } | 126 CSSCalcExpressionNode* expressionNode() const { return m_expression.get(); } |
| 126 | 127 |
| 127 String customCSSText() const; | 128 String customCSSText() const; |
| 128 bool equals(const CSSCalcValue&) const; | 129 bool equals(const CSSCalcValue&) const; |
| 129 | 130 |
| 130 DECLARE_TRACE_AFTER_DISPATCH(); | 131 DECLARE_TRACE_AFTER_DISPATCH(); |
| 131 | 132 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 142 const RefPtrWillBeMember<CSSCalcExpressionNode> m_expression; | 143 const RefPtrWillBeMember<CSSCalcExpressionNode> m_expression; |
| 143 const bool m_nonNegative; | 144 const bool m_nonNegative; |
| 144 }; | 145 }; |
| 145 | 146 |
| 146 DEFINE_CSS_VALUE_TYPE_CASTS(CSSCalcValue, isCalcValue()); | 147 DEFINE_CSS_VALUE_TYPE_CASTS(CSSCalcValue, isCalcValue()); |
| 147 | 148 |
| 148 } // namespace blink | 149 } // namespace blink |
| 149 | 150 |
| 150 | 151 |
| 151 #endif // CSSCalculationValue_h | 152 #endif // CSSCalculationValue_h |
| OLD | NEW |