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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 return false; | 248 return false; |
249 | 249 |
250 return compareCSSValuePtr( | 250 return compareCSSValuePtr( |
251 m_value, static_cast<const CSSCalcPrimitiveValue&>(other).m_value); | 251 m_value, static_cast<const CSSCalcPrimitiveValue&>(other).m_value); |
252 } | 252 } |
253 | 253 |
254 Type getType() const override { return CssCalcPrimitiveValue; } | 254 Type getType() const override { return CssCalcPrimitiveValue; } |
255 CSSPrimitiveValue::UnitType typeWithCalcResolved() const override { | 255 CSSPrimitiveValue::UnitType typeWithCalcResolved() const override { |
256 return m_value->typeWithCalcResolved(); | 256 return m_value->typeWithCalcResolved(); |
257 } | 257 } |
| 258 const CSSCalcExpressionNode* leftExpressionNode() const { |
| 259 NOTREACHED(); |
| 260 return nullptr; |
| 261 } |
| 262 |
| 263 const CSSCalcExpressionNode* rightExpressionNode() const { |
| 264 NOTREACHED(); |
| 265 return nullptr; |
| 266 } |
| 267 |
| 268 CalcOperator operatorType() const { |
| 269 NOTREACHED(); |
| 270 return CalcAdd; |
| 271 } |
258 | 272 |
259 DEFINE_INLINE_VIRTUAL_TRACE() { | 273 DEFINE_INLINE_VIRTUAL_TRACE() { |
260 visitor->trace(m_value); | 274 visitor->trace(m_value); |
261 CSSCalcExpressionNode::trace(visitor); | 275 CSSCalcExpressionNode::trace(visitor); |
262 } | 276 } |
263 | 277 |
264 private: | 278 private: |
265 CSSCalcPrimitiveValue(CSSPrimitiveValue* value, bool isInteger) | 279 CSSCalcPrimitiveValue(CSSPrimitiveValue* value, bool isInteger) |
266 : CSSCalcExpressionNode(unitCategory(value->typeWithCalcResolved()), | 280 : CSSCalcExpressionNode(unitCategory(value->typeWithCalcResolved()), |
267 isInteger), | 281 isInteger), |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 return false; | 561 return false; |
548 | 562 |
549 const CSSCalcBinaryOperation& other = | 563 const CSSCalcBinaryOperation& other = |
550 static_cast<const CSSCalcBinaryOperation&>(exp); | 564 static_cast<const CSSCalcBinaryOperation&>(exp); |
551 return compareCSSValuePtr(m_leftSide, other.m_leftSide) && | 565 return compareCSSValuePtr(m_leftSide, other.m_leftSide) && |
552 compareCSSValuePtr(m_rightSide, other.m_rightSide) && | 566 compareCSSValuePtr(m_rightSide, other.m_rightSide) && |
553 m_operator == other.m_operator; | 567 m_operator == other.m_operator; |
554 } | 568 } |
555 | 569 |
556 Type getType() const override { return CssCalcBinaryOperation; } | 570 Type getType() const override { return CssCalcBinaryOperation; } |
| 571 const CSSCalcExpressionNode* leftExpressionNode() const { return m_leftSide; } |
| 572 |
| 573 const CSSCalcExpressionNode* rightExpressionNode() const { |
| 574 return m_rightSide; |
| 575 } |
| 576 |
| 577 CalcOperator operatorType() const { return m_operator; } |
557 | 578 |
558 CSSPrimitiveValue::UnitType typeWithCalcResolved() const override { | 579 CSSPrimitiveValue::UnitType typeWithCalcResolved() const override { |
559 switch (m_category) { | 580 switch (m_category) { |
560 case CalcNumber: | 581 case CalcNumber: |
561 ASSERT(m_leftSide->category() == CalcNumber && | 582 ASSERT(m_leftSide->category() == CalcNumber && |
562 m_rightSide->category() == CalcNumber); | 583 m_rightSide->category() == CalcNumber); |
563 return CSSPrimitiveValue::UnitType::Number; | 584 return CSSPrimitiveValue::UnitType::Number; |
564 case CalcLength: | 585 case CalcLength: |
565 case CalcPercent: { | 586 case CalcPercent: { |
566 if (m_leftSide->category() == CalcNumber) | 587 if (m_leftSide->category() == CalcNumber) |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 | 836 |
816 return expression ? new CSSCalcValue(expression, range) : nullptr; | 837 return expression ? new CSSCalcValue(expression, range) : nullptr; |
817 } | 838 } |
818 | 839 |
819 CSSCalcValue* CSSCalcValue::create(CSSCalcExpressionNode* expression, | 840 CSSCalcValue* CSSCalcValue::create(CSSCalcExpressionNode* expression, |
820 ValueRange range) { | 841 ValueRange range) { |
821 return new CSSCalcValue(expression, range); | 842 return new CSSCalcValue(expression, range); |
822 } | 843 } |
823 | 844 |
824 } // namespace blink | 845 } // namespace blink |
OLD | NEW |